update cmakelist

This commit is contained in:
2025-02-11 10:43:28 +08:00
parent 2901590f00
commit 613c73c812
36 changed files with 92 additions and 75 deletions

View File

@@ -35,7 +35,7 @@ if (mesh_dimen == gctl::MESH_2D && mesh_tp == gctl::REGULAR_MESH) \
else if (mesh_dimen == gctl::MESH_2D && mesh_tp == gctl::LINEAR_MESH) \
mesh_ptr = new gctl::linear_mesh_2d; \
else if (mesh_dimen == gctl::MESH_2D && mesh_tp == gctl::TRI_TET_MESH) \
mesh_ptr = new gctl::triangle_mesh; \
mesh_ptr = new gctl::triangle2d_mesh; \
else if (mesh_dimen == gctl::MESH_3D && mesh_tp == gctl::REGULAR_MESH) \
mesh_ptr = new gctl::regular_mesh_3d; \
else if (mesh_dimen == gctl::MESH_3D && mesh_tp == gctl::LINEAR_MESH) \

View File

@@ -5,18 +5,10 @@ set(INSTALL_DIR sbin)
find_package(GCTL REQUIRED)
include_directories(${GCTL_INC_DIR})
find_package(GCTL_GRAPHIC REQUIRED)
include_directories(${GCTL_GRAPHIC_INC_DIR})
find_package(GCTL_MESH REQUIRED)
include_directories(${GCTL_MESH_INC_DIR})
if(GCTL_GRAPHIC_MATHGL)
find_package(MathGL2 REQUIRED FLTK)
message(STATUS "mathGL Version: " ${MathGL2_VERSION})
include_directories(${MathGL2_INCLUDE_DIRS})
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
@@ -32,12 +24,6 @@ set_target_properties(${TOOL_NAME} PROPERTIES INSTALL_RPATH /usr/local/lib)
set_target_properties(${TOOL_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
target_link_libraries(${TOOL_NAME} PUBLIC ${GCTL_LIB})
target_link_libraries(${TOOL_NAME} PUBLIC ${GCTL_GRAPHIC_LIB})
target_link_libraries(${TOOL_NAME} PUBLIC ${GCTL_MESH_LIB})
if(GCTL_GRAPHIC_MATHGL)
target_link_libraries(${TOOL_NAME} PUBLIC ${MathGL2_LIBRARIES} ${MathGL2_FLTK_LIBRARIES})
endif()
install(TARGETS ${TOOL_NAME} RUNTIME DESTINATION ${INSTALL_DIR})

View File

@@ -2,28 +2,69 @@ cmake_minimum_required(VERSION 3.15.2)
project(GCTL_TOOLKITS VERSION 1.0)
# add directories to compile the tool
add_subdirectory(2minfo)
add_subdirectory(addnoise)
add_subdirectory(cutprofile)
add_subdirectory(fractopo)
add_subdirectory(gmshinfo)
add_subdirectory(gmsh2vtk)
add_subdirectory(lbsi)
add_subdirectory(slbsi)
add_subdirectory(lki)
add_subdirectory(nc2other)
add_subdirectory(ncget)
add_subdirectory(ncinfo)
add_subdirectory(shc2xyz)
add_subdirectory(sph2plane)
add_subdirectory(tetgen2gmsh)
add_subdirectory(tetgm)
add_subdirectory(trackline)
add_subdirectory(triangle2gmsh)
add_subdirectory(txtinfo)
add_subdirectory(xyz2nc)
add_subdirectory(xyz2sph)
add_subdirectory(handyman)
add_subdirectory(grd2xyz)
#add_subdirectory(gm3d)
find_package(GCTL REQUIRED)
find_package(GCTL_MESH REQUIRED)
find_package(GCTL_OPTIMIZATION REQUIRED)
find_package(GCTL_POTENTIAL REQUIRED)
include_directories(${GCTL_INC_DIR})
include_directories(${GCTL_MESH_INC_DIR})
include_directories(${GCTL_OPTIMIZATION_INC_DIR})
include_directories(${GCTL_POTENTIAL_INC_DIR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${BIN_DIR})
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "Processor: " ${CMAKE_HOST_SYSTEM_PROCESSOR})
macro(add_toolkit name lib1 lib2 lib3 lib4)
aux_source_directory(${name} ${name}_src)
add_executable(${name} ${${name}_src})
set_target_properties(${name} PROPERTIES INSTALL_RPATH /usr/local/lib)
set_target_properties(${name} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
if(${lib1})
target_link_libraries(${name} PUBLIC ${GCTL_LIB})
endif()
if(${lib2})
target_link_libraries(${name} PUBLIC ${GCTL_MESH_LIB})
endif()
if(${lib3})
target_link_libraries(${name} PUBLIC ${GCTL_OPTIMIZATION_LIB})
endif()
if(${lib4})
target_link_libraries(${name} PUBLIC ${GCTL_POTENTIAL_LIB})
endif()
install(TARGETS ${name} RUNTIME DESTINATION sbin)
endmacro()
add_toolkit(2minfo ON ON OFF OFF)
add_toolkit(addnoise ON OFF OFF OFF)
add_toolkit(cutprofile ON OFF OFF OFF)
add_toolkit(fractopo ON OFF OFF OFF)
add_toolkit(gm3d ON OFF OFF OFF)
add_toolkit(gmsh2vtk ON OFF OFF OFF)
add_toolkit(gmshinfo ON OFF OFF OFF)
add_toolkit(grd2xyz ON OFF OFF OFF)
add_toolkit(handyman ON OFF OFF OFF)
add_toolkit(lbsi ON OFF ON OFF)
add_toolkit(lki ON OFF ON OFF)
add_toolkit(nc2other ON OFF OFF OFF)
add_toolkit(ncget ON OFF OFF OFF)
add_toolkit(ncinfo ON OFF OFF OFF)
add_toolkit(shc2xyz ON OFF OFF OFF)
add_toolkit(slbsi ON OFF ON OFF)
add_toolkit(sph2plane ON OFF OFF OFF)
add_toolkit(tetgen2gmsh ON OFF OFF OFF)
add_toolkit(tetgm ON OFF ON ON)
add_toolkit(trackline ON OFF OFF OFF)
add_toolkit(triangle2gmsh ON OFF OFF OFF)
add_toolkit(txtinfo ON OFF OFF OFF)
add_toolkit(xyz2nc ON OFF OFF OFF)
add_toolkit(xyz2sph ON OFF OFF OFF)

View File

@@ -29,8 +29,8 @@
#define _CUTPROFILE_H
#include "gctl/core.h"
#include "gctl/algorithm.h"
#include "gctl/utility.h"
#include "gctl/algorithms.h"
struct node
{

View File

@@ -46,7 +46,7 @@
#include "gctl/core.h"
#include "gctl/utility.h"
#include "gctl/geometry.h"
#include "gctl/algorithm.h"
#include "gctl/algorithms.h"
using namespace std;

View File

@@ -140,7 +140,7 @@ void HandyMan::SR_CalPlaneCoeff()
void HandyMan::SR_RGB2CPT()
{
gctl::text_content tc;
gctl::dsv_io tc;
std::string rgb_file, cpt_file;
std::cout << "Name of the RGB series file (Each line of file contains a R G B group).\n>> ";
std::cin >> rgb_file;
@@ -149,12 +149,12 @@ void HandyMan::SR_RGB2CPT()
std::cin >> cpt_file;
tc.load_text(rgb_file);
std::vector<double> R(tc.contents_.size()), G(tc.contents_.size()), B(tc.contents_.size());
for (size_t i = 0; i < tc.contents_.size(); i++)
{
gctl::parse_string_to_value(tc.contents_[i], ' ', true, R[i], G[i], B[i]);
}
int c_size = R.size();
int c_size = tc.row_number();
gctl::array<double> R, G, B;
tc.get_column(R, 0);
tc.get_column(G, 1);
tc.get_column(B, 2);
int i_type;
std::cout << "Interpolation type of the interval values.\n(1) linear\n(2) data\n>> ";
@@ -209,9 +209,11 @@ void HandyMan::SR_RGB2CPT()
tc.clear();
tc.load_text(f_name);
std::vector<double> D, D_ori;
gctl::str2type_vector(tc.contents_, D_ori);
gctl::array<double> D_ori;
tc.get_column(D_ori, 0);
std::vector<double> D;
D.reserve(D_ori.size());
for (size_t i = 0; i < D_ori.size(); i++)
{

View File

@@ -142,7 +142,7 @@ void LBSI::Routine(std::string in_name, std::string tar_name,
{
UpdateTarVec(s, true);
Wgts.assign_all(0.0);
Wgts.assign(0.0);
// run the inversion process in factory mode
//lcg(_AxProduct, nullptr, Wgts.get(), B.get(), MatSize, &my_para, this, GK.get(), DK.get(), ADK.get());
lcg(Wgts, B);
@@ -207,7 +207,7 @@ void LBSI::Routine(std::string in_name, std::string tar_name,
{
UpdateTarVec(s, false);
Wgts.assign_all(0.0);
Wgts.assign(0.0);
// run the inversion process in factory mode
//lcg(_AxProduct, nullptr, Wgts.get(), B.get(), MatSize, &my_para, this, GK.get(), DK.get(), ADK.get());
lcg(Wgts, B);

View File

@@ -29,7 +29,7 @@
//#include "lcg/solver.h"
// GCTL library
#include "gctl/core.h"
#include "gctl/algorithm.h"
#include "gctl/algorithms.h"
#include "gctl/geometry.h"
#include "gctl/io.h"
#include "gctl/utility.h"
@@ -186,7 +186,7 @@ void LKI::Routine(std::string inname, std::string tarname, std::string outname,
bar.progressed(i);
Kernel.assign_all(0.0);
Wgts.assign_all(0.0);
Wgts.assign(0.0);
CalKernel(TargNodes[i]);
@@ -261,7 +261,7 @@ void LKI::InitTargetNodes(std::string para, gctl::text_descriptor &desc)
double dx, dy, xmin, xmax, ymin, ymax, ele = 0.0;
gctl::parse_string_to_value(para, '/', true, xmin, dx, xmax, ymin, dy, ymax);
gctl::get_grid_point3c(TargNodes, xmin, xmax, ymin, ymax, dx, dy, ele);
gctl::grid_points_2d(TargNodes, xmin, xmax, ymin, ymax, dx, dy, ele);
return;
}

View File

@@ -31,7 +31,7 @@
// add gctl head files
#include "gctl/core.h"
#include "gctl/utility.h"
#include "gctl/algorithm.h"
#include "gctl/algorithms.h"
#include "gctl/io.h"
#define NORMAL_GRAVITY 9.80665 // m/s^2

View File

@@ -135,7 +135,7 @@ void LBSI::Routine(std::string in_name, std::string tar_name,
{
UpdateTarVec(s, true);
Wgts.assign_all(0.0);
Wgts.assign(0.0);
lcg(Wgts, B);
double deg, sum;
@@ -193,7 +193,7 @@ void LBSI::Routine(std::string in_name, std::string tar_name,
{
UpdateTarVec(s, false);
Wgts.assign_all(0.0);
Wgts.assign(0.0);
lcg(Wgts, B);
sum = 0.0;

View File

@@ -3,20 +3,12 @@ set(BIN_DIR bin)
set(INSTALL_DIR sbin)
find_package(GCTL REQUIRED)
find_package(GCTL_GRAPHIC REQUIRED)
find_package(GCTL_MESH REQUIRED)
find_package(GCTL_POTENTIAL REQUIRED)
include_directories(${GCTL_INC_DIR})
include_directories(${GCTL_GRAPHIC_INC_DIR})
include_directories(${GCTL_MESH_INC_DIR})
include_directories(${GCTL_POTENTIAL_INC_DIR})
if(GCTL_GRAPHIC_MATHGL)
find_package(MathGL2 REQUIRED FLTK)
message(STATUS "mathGL Version: " ${MathGL2_VERSION})
include_directories(${MathGL2_INCLUDE_DIRS})
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
@@ -36,8 +28,4 @@ target_link_libraries(${TOOL_NAME} PUBLIC ${GCTL_LIB})
target_link_libraries(${TOOL_NAME} PUBLIC ${GCTL_MESH_LIB})
target_link_libraries(${TOOL_NAME} PUBLIC ${GCTL_POTENTIAL_LIB})
if(GCTL_GRAPHIC_MATHGL)
target_link_libraries(${TOOL_NAME} PUBLIC ${MathGL2_LIBRARIES} ${MathGL2_FLTK_LIBRARIES})
endif()
install(TARGETS ${TOOL_NAME} RUNTIME DESTINATION ${INSTALL_DIR})

View File

@@ -155,7 +155,7 @@ int main(int argc, char *argv[]) try
if (7 == sscanf(obser_para.c_str(), "%lf/%lf/%lf/%lf/%lf/%lf/%lf",
&xmin, &dx, &xmax, &ymin, &dy, &ymax, &ele))
{
gctl::get_grid_point3c(obs_points, xmin, xmax, ymin, ymax, dx, dy, ele);
gctl::grid_points_2d(obs_points, xmin, xmax, ymin, ymax, dx, dy, ele);
}
else
{

View File

@@ -47,7 +47,7 @@
#include "gctl/core.h"
#include "gctl/utility.h"
#include "gctl/algorithm.h"
#include "gctl/algorithms.h"
#include "gctl/io.h"
using namespace std;

View File

@@ -273,7 +273,7 @@ Please see instructions or contact the author for more information.");
{
for (int c = 1; c < col_index.size(); c++)
{
out_data.assign_all(GCTL_BDL_MAX);
out_data.assign(GCTL_BDL_MAX);
for (int i = 0; i < table_data.size(); i++)
{
@@ -309,7 +309,7 @@ Please see instructions or contact the author for more information.");
{
for (int c = 3; c < col_index.size(); c++)
{
out_data.assign_all(GCTL_BDL_MAX);
out_data.assign(GCTL_BDL_MAX);
for (int i = 0; i < table_data.size(); i++)
{