diff --git a/CMakeLists.txt b/CMakeLists.txt index 13ffd60..fa01c46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option(GCTL_NETCDF "Use the NetCDF library" ON) option(GCTL_FFTW3 "Use the FFTW3 library" ON) option(GCTL_EEMD "Use the EEMD library" ON) option(GCTL_OPENBLAS "Use the Openblas library" OFF) +option(GCTL_EXPRTK "Use the ExprTK library" ON) option(GCTL_CHECK_BOUNDER "Check array's index" OFF) option(GCTL_CHECK_SIZE "Check array's size" OFF) # 传递安装地址给编译期宏变量 @@ -24,6 +25,7 @@ message(STATUS "[GCTL] Use the NetCDF library: " ${GCTL_NETCDF}) message(STATUS "[GCTL] Use the FFTW3 library: " ${GCTL_FFTW3}) message(STATUS "[GCTL] Use the EEMD library: " ${GCTL_EEMD}) message(STATUS "[GCTL] Use the Openblas library: " ${GCTL_OPENBLAS}) +message(STATUS "[GCTL] Use the ExprTK library: " ${GCTL_EXPRTK}) message(STATUS "[GCTL] Check Bounder: " ${GCTL_CHECK_BOUNDER}) message(STATUS "[GCTL] Check Size: " ${GCTL_CHECK_SIZE}) diff --git a/GCTLConfig.cmake.in b/GCTLConfig.cmake.in index bc9dc79..8713ff0 100644 --- a/GCTLConfig.cmake.in +++ b/GCTLConfig.cmake.in @@ -15,6 +15,7 @@ set(@PROJECT_NAME@_FFTW3 @GCTL_FFTW3@) set(@PROJECT_NAME@_EEMD @GCTL_EEMD@) set(@PROJECT_NAME@_OPENMP @GCTL_OPENMP@) set(@PROJECT_NAME@_OPENBLAS @GCTL_OPENBLAS@) +set(@PROJECT_NAME@_EXPRTK @GCTL_EXPRTK@) set(@PROJECT_NAME@_CHECK_BOUNDER @GCTL_CHECK_BOUNDER@) set(@PROJECT_NAME@_CHECK_SIZE @GCTL_CHECK_SIZE@) @@ -23,6 +24,7 @@ message(STATUS "[GCTL] Use the FFTW3 library: " @GCTL_FFTW3@) message(STATUS "[GCTL] Use the EEMD library: " @GCTL_EEMD@) message(STATUS "[GCTL] Use the OpenMP library: " @GCTL_OPENMP@) message(STATUS "[GCTL] Use the Openblas library: " @GCTL_OPENBLAS@) +message(STATUS "[GCTL] Use the ExprTK library: " @GCTL_EXPRTK@) message(STATUS "[GCTL] Check Bounder: " @GCTL_CHECK_BOUNDER@) message(STATUS "[GCTL] Check Size: " @GCTL_CHECK_SIZE@) diff --git a/config.h.in b/config.h.in index 8ff890e..676698d 100644 --- a/config.h.in +++ b/config.h.in @@ -4,5 +4,6 @@ #cmakedefine GCTL_FFTW3 #cmakedefine GCTL_EEMD #cmakedefine GCTL_OPENBLAS +#cmakedefine GCTL_EXPRTK #cmakedefine GCTL_CHECK_BOUNDER #cmakedefine GCTL_CHECK_SIZE \ No newline at end of file diff --git a/example/text_io_ex.cpp b/example/text_io_ex.cpp index b2fbbb5..f864ca0 100644 --- a/example/text_io_ex.cpp +++ b/example/text_io_ex.cpp @@ -32,33 +32,31 @@ using namespace gctl; int main(int argc, char const *argv[]) try { -/* - dsv_io tc; + + dsv_io tc, tout; tc.set_delimeter('|'); tc.load_text("tmp/world_data", ".txt", BothHead); - tc.info(); + //tc.info(); - //_1s_vector name = tc.get_row_names(); - //display_vector(name); + //tc.set_column_type(Int, "IndepYear_n"); + //tc.filt_column("IndepYear_n < 0", {"IndepYear_n"}, {"Name_s", "Population_n", "GNP_n"}, tout); - _1s_array name; - tc.get_column("Name_s", name); - name.show(std::cout, ','); + tc.filt_column("America", "Continent_s", {"Name_s", "Population_n", "GNP_n"}, tout); + //tc.match_column("America", "Continent_s", {}, tout); - tc.get_row("AUS", name); - name.show(std::cout, ','); - - tc.save_csv("out"); -*/ + tout.set_delimeter('|'); + tout.save_text("out"); +/* geodsv_io tc; tc.load_text("tmp/topo", ".txt", ColumnHead); - tc.cell(0, 0, std::string("x (m)")); - tc.cell(0, 1, std::string("y (m)")); - tc.cell(0, 2, std::string("elevation (m)")); + tc.set_column_names({"x (m)", "y (m)", "elev (m)"}); + tc.set_column_type(Float, "x (m)"); + tc.set_column_type(Float, "y (m)"); + tc.set_column_type(Float, "elev (m)"); array topo; - tc.get_column_point3dc(0, 1, 2, topo); + tc.get_column_point3dc(topo, 1, 2, 3); std::clog << std::setprecision(11) << topo.front().z << "\n"; std::clog << topo.back().x << "," << topo.back().y << "," << topo.back().z << "\n"; @@ -66,17 +64,36 @@ int main(int argc, char const *argv[]) try display_vector(tc.get_annotoations(), std::clog, '\n'); display_vector(tc.get_head_records(), std::clog, '\n'); + //tc.column_output("C3", Disable); + + array elev; + tc.get_column(elev, "elev (m)"); + elev.for_each([](double &d, size_t i){d += 100.0;}); + + tc.add_column(2, "elev_plus"); + tc.fill_column(elev, "elev_plus"); + + tc.add_column(-1, "dist"); + tc.cal_column("dist := sqrt(C1*C1 + C3*C3)", {"dist", "C1", "C3"}); + + tc.add_row(3); + tc.fill_row(array{5.5, 4.4, 3.3, 2.2, 1.1}, 3); + + geodsv_io out_table; + tc.filt_column("dist > 1000", {"dist"}, {"x (m)", "y (m)", "elev (m)"}, out_table); + out_table.save_text("out2"); + _1s_vector s = tc.get_tags(); s.push_back("Elev = 1000"); tc.set_tags(s); tc.save_csv("out"); double c = 4.25242153654; - tc.cell(1, 0, c, 12); - std::clog << std::setprecision(12) << tc.cell(1, 0) << "\n"; + tc.cell(c, 2, 1, 12); + std::clog << std::setprecision(12) << tc.cell(2, 1) << "\n"; tc.info(); - +*/ return 0; } catch(std::exception &e) diff --git a/installer b/installer deleted file mode 100755 index fd9d6e5..0000000 --- a/installer +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -if [[ $# == 0 || ${1} == "help" ]]; then - echo "Compiles executables/libraries and maintains installed files. Two tools 'Cmake' and 'stow' are empolyed here. For more information, see https://cmake.org and https://www.gnu.org/software/stow/." - echo "" - echo "School of Earth Sciences, Zhejiang University" - echo "Yi Zhang (yizhang-geo@zju.edu.cn)" - echo "" - echo "Usage: ./config.sh [option] [Cmake options]" - echo "" - echo "Options:" - echo "(1) configure: Configure Cmake project(s). This option could take extra Cmake options as in