This commit is contained in:
张壹 2025-02-09 20:59:18 +08:00
parent c2db915fb1
commit b68d27f726
29 changed files with 44 additions and 55 deletions

View File

@ -28,9 +28,6 @@ message(STATUS "[GCTL_POTENTIAL] Use the exprtk library: " ${GCTL_POTENTIAL_EXPR
find_package(GCTL REQUIRED) find_package(GCTL REQUIRED)
include_directories(${GCTL_INC_DIR}) include_directories(${GCTL_INC_DIR})
find_package(GCTL_GRAPHIC REQUIRED)
include_directories(${GCTL_GRAPHIC_INC_DIR})
find_package(GCTL_MESH REQUIRED) find_package(GCTL_MESH REQUIRED)
include_directories(${GCTL_MESH_INC_DIR}) include_directories(${GCTL_MESH_INC_DIR})
@ -41,7 +38,7 @@ if(GCTL_POTENTIAL_FFTW3)
if(NOT FFTW3_FOUND) if(NOT FFTW3_FOUND)
find_package(FFTW3 REQUIRED) find_package(FFTW3 REQUIRED)
message(STATUS "Found FFTW3") message(STATUS "Found FFTW3")
include_directories(${FFTW3_INC_DIR}) include_directories(${FFTW3_INCLUDE_DIRS})
endif() endif()
endif() endif()
@ -72,6 +69,7 @@ if(GCTL_POTENTIAL_AUTODIFF)
find_package(autodiff REQUIRED) find_package(autodiff REQUIRED)
if(autodiff_FOUND) if(autodiff_FOUND)
message(STATUS "autodiff Found.") message(STATUS "autodiff Found.")
include_directories(${autodiff_INCLUDE_DIR})
endif() endif()
endif() endif()
endif() endif()

View File

@ -40,7 +40,7 @@ endif()
if(@PROJECT_NAME@_FFTW3) if(@PROJECT_NAME@_FFTW3)
if(NOT FFTW3_FOUND) if(NOT FFTW3_FOUND)
find_package(FFTW3 REQUIRED) find_package(FFTW3 REQUIRED)
include_directories(${FFTW3_INC_DIR}) include_directories(${FFTW3_INCLUDE_DIRS})
endif() endif()
endif() endif()

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
geodsv_io tio; geodsv_io tio;
tio.init_table(obsp.size(), 8); tio.init_table(obsp.size(), 8);
tio.set_column_names({"X", "Y", "Vx", "Vz", "Vxx", "Vxz", "Vzx", "Vzz"}); tio.column_names({"X", "Y", "Vx", "Vz", "Vxx", "Vxz", "Vzx", "Vzz"});
tio.fill_column_point2dc(obsp, "X", "Y"); tio.fill_column_point2dc(obsp, "X", "Y");
tio.fill_column(vx, "Vx", 12); tio.fill_column(vx, "Vx", 12);
tio.fill_column(vz, "Vz", 12); tio.fill_column(vz, "Vz", 12);

View File

@ -25,12 +25,11 @@
* Also add information on how to contact you by electronic and paper mail. * Also add information on how to contact you by electronic and paper mail.
******************************************************/ ******************************************************/
#include "toml.hpp"
#include "../lib/potential.h"
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/geometry.h" #include "gctl/geometry.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "../lib/potential.h"
#include "toml.hpp"
using namespace gctl; using namespace gctl;
int main(int argc, char *argv[]) try int main(int argc, char *argv[]) try
@ -94,7 +93,7 @@ int main(int argc, char *argv[]) try
geodsv_io gio; geodsv_io gio;
gio.init_table(obsp.size(), 8); gio.init_table(obsp.size(), 8);
gio.set_column_names({"rad", "deg", "gx", "gz", "gxx", "gxz", "gzx", "gzz"}); gio.column_names({"rad", "deg", "gx", "gz", "gxx", "gxz", "gzx", "gzz"});
gio.fill_column(r, "rad"); gio.fill_column(r, "rad");
gio.fill_column(d, "deg"); gio.fill_column(d, "deg");
gio.fill_column(gx, "gx"); gio.fill_column(gx, "gx");

View File

@ -41,20 +41,13 @@ target_link_libraries(gctl_potential_static ${GCTL_LIB})
target_link_libraries(gctl_potential PUBLIC ${GCTL_MESH_LIB}) target_link_libraries(gctl_potential PUBLIC ${GCTL_MESH_LIB})
target_link_libraries(gctl_potential_static ${GCTL_MESH_LIB}) target_link_libraries(gctl_potential_static ${GCTL_MESH_LIB})
target_link_libraries(gctl_potential PUBLIC ${GCTL_GRAPHIC_LIB})
target_link_libraries(gctl_potential_static ${GCTL_GRAPHIC_LIB})
target_link_libraries(gctl_potential PUBLIC ${GCTL_OPTIMIZATION_LIB}) target_link_libraries(gctl_potential PUBLIC ${GCTL_OPTIMIZATION_LIB})
target_link_libraries(gctl_potential_static ${GCTL_OPTIMIZATION_LIB}) target_link_libraries(gctl_potential_static ${GCTL_OPTIMIZATION_LIB})
#if(GCTL_GRAPHIC_MATHGL)
# target_link_libraries(gctl_potential PUBLIC ${MathGL2_LIBRARIES} ${MathGL2_FLTK_LIBRARIES})
# target_link_libraries(gctl_potential_static ${MathGL2_LIBRARIES} ${MathGL2_FLTK_LIBRARIES})
#endif()
if(GCTL_POTENTIAL_FFTW3) if(GCTL_POTENTIAL_FFTW3)
target_link_libraries(gctl_potential PUBLIC ${FFTW3_LIBRARIES}) find_library(FFTW_LIB ${FFTW3_LIBRARIES} HINTS ${FFTW3_LIBRARY_DIRS})
target_link_libraries(gctl_potential_static ${FFTW3_LIBRARIES}) target_link_libraries(gctl_potential PUBLIC ${FFTW_LIB})
target_link_libraries(gctl_potential_static ${FFTW_LIB})
endif() endif()
if(GCTL_POTENTIAL_TESS) if(GCTL_POTENTIAL_TESS)

View File

@ -56,6 +56,6 @@ namespace gctl
*/ */
void gobser(array<double> &out_obs, const array<block> &ele, const array<point3dc> &obsp, void gobser(array<double> &out_obs, const array<block> &ele, const array<point3dc> &obsp,
const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg); const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_GRAV_KERNEL_BLOCK_H #endif // _GCTL_GRAV_KERNEL_BLOCK_H

View File

@ -43,6 +43,6 @@ namespace gctl
*/ */
void gobser(array<double> &out_obs, const array<vertex2dc> &cor_vert, const array<point2dc> &obsp, void gobser(array<double> &out_obs, const array<vertex2dc> &cor_vert, const array<point2dc> &obsp,
const double &rho, gravitational_field_type_e comp_id = Vz); const double &rho, gravitational_field_type_e comp_id = Vz);
} };
#endif // _GCTL_GRAV_KERNEL_POLYGON_H #endif // _GCTL_GRAV_KERNEL_POLYGON_H

View File

@ -56,6 +56,6 @@ namespace gctl
*/ */
void gobser(array<double> &out_obs, const array<rectangle2d> &ele, const array<point2dc> &obsp, void gobser(array<double> &out_obs, const array<rectangle2d> &ele, const array<point2dc> &obsp,
const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg); const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_GRAV_KERNEL_RECTANGLE2D_H #endif // _GCTL_GRAV_KERNEL_RECTANGLE2D_H

View File

@ -28,12 +28,8 @@
#ifndef _GCTL_GRAV_KERNEL_SPHERE_H #ifndef _GCTL_GRAV_KERNEL_SPHERE_H
#define _GCTL_GRAV_KERNEL_SPHERE_H #define _GCTL_GRAV_KERNEL_SPHERE_H
#include "gctl/core/array.h"
#include "gctl/geometry/point3c.h"
#include "gctl/geometry/sphere.h"
#include "gctl/optimization/loss_func.h"
#include "gm_data.h" #include "gm_data.h"
#include "gctl/optimization/loss_func.h"
#ifdef GCTL_POTENTIAL_AUTODIFF #ifdef GCTL_POTENTIAL_AUTODIFF
#include "autodiff/reverse/var.hpp" #include "autodiff/reverse/var.hpp"
@ -84,6 +80,6 @@ namespace gctl
#endif // GCTL_POTENTIAL_AUTODIFF #endif // GCTL_POTENTIAL_AUTODIFF
} };
#endif // _GCTL_GRAV_KERNEL_SPHERE_H #endif // _GCTL_GRAV_KERNEL_SPHERE_H

View File

@ -61,7 +61,7 @@ namespace gctl
*/ */
void gobser(array<double> &out_obs, const array<tesseroid> &ele, const array<point3ds> &obsp, void gobser(array<double> &out_obs, const array<tesseroid> &ele, const array<point3ds> &obsp,
const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg); const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg);
} };
#endif // GCTL_POTENTIAL_TESS #endif // GCTL_POTENTIAL_TESS

View File

@ -152,6 +152,6 @@ namespace gctl
*/ */
void gobser(array<tensor> &out_obs, const array<grav_tetrahedron> &ele, const array<point3ds> &obsp, void gobser(array<tensor> &out_obs, const array<grav_tetrahedron> &ele, const array<point3ds> &obsp,
const array<double> &rho, verbose_type_e verbose = FullMsg); const array<double> &rho, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_GRAV_KERNEL_TETRAHEDRON_H #endif // _GCTL_GRAV_KERNEL_TETRAHEDRON_H

View File

@ -123,6 +123,6 @@ namespace gctl
*/ */
void gobser(array<tensor> &out_obs, const array<grav_triangle> &ele, const array<point3ds> &obsp, void gobser(array<tensor> &out_obs, const array<grav_triangle> &ele, const array<point3ds> &obsp,
double rho, verbose_type_e verbose = FullMsg); double rho, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_GRAV_KERNEL_TRIANGLE_H #endif // _GCTL_GRAV_KERNEL_TRIANGLE_H

View File

@ -81,6 +81,6 @@ namespace gctl
*/ */
void gobser(array<double> &out_obs, const array<triangle2d> &ele, const array<point2dp> &obsp, void gobser(array<double> &out_obs, const array<triangle2d> &ele, const array<point2dp> &obsp,
const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg); const array<double> &rho, gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_GRAV_KERNEL_TRIANGLE2D_H #endif // _GCTL_GRAV_KERNEL_TRIANGLE2D_H

View File

@ -148,6 +148,6 @@ namespace gctl
const array<double> &obs_diff, const array<point3ds> &obsp, const array<double> &rho, const array<double> &obs_diff, const array<point3ds> &obsp, const array<double> &rho,
const array<vertex3dc> *verts_ptr = nullptr, double ang_limit = -1.0, const array<vertex3dc> *verts_ptr = nullptr, double ang_limit = -1.0,
gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg); gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_GRAV_KERNEL_TRICONE_H #endif // _GCTL_GRAV_KERNEL_TRICONE_H

View File

@ -28,17 +28,17 @@
#ifndef _GCTL_GM_DATA_H #ifndef _GCTL_GM_DATA_H
#define _GCTL_GM_DATA_H #define _GCTL_GM_DATA_H
#include "gctl_potential_config.h"
#ifdef GCTL_POTENTIAL_OPENMP
#include "omp.h"
#include <thread>
#endif
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/geometry.h" #include "gctl/geometry.h"
#include "gctl/maths.h" #include "gctl/maths.h"
#include "gctl/algorithm.h" #include "gctl/algorithms.h"
#include "gctl_potential_config.h"
#ifdef GCTL_POTENTIAL_OPENMP
#include "omp.h"
#include "thread"
#endif
namespace gctl namespace gctl
{ {

View File

@ -120,6 +120,6 @@ namespace gctl
*/ */
void trend(std::string datname, std::string regname, std::string resname, int wx_size, int wy_size, int x_order, int y_order); void trend(std::string datname, std::string regname, std::string resname, int wx_size, int wy_size, int x_order, int y_order);
}; };
} };
#endif //_GM_REGULAR_GRID_H #endif //_GM_REGULAR_GRID_H

View File

@ -46,6 +46,6 @@ namespace gctl
void gobser(array<double> &out_data, std::string data_name, const array<point2dc> &obs, void gobser(array<double> &out_data, std::string data_name, const array<point2dc> &obs,
gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg); gravitational_field_type_e comp_id = Vz, verbose_type_e verbose = FullMsg);
}; };
} };
#endif //_GRAV_REGULAR_MESH_2D_H #endif //_GRAV_REGULAR_MESH_2D_H

View File

@ -64,6 +64,6 @@ namespace gctl
const array<double> &inc_deg, const array<double> &dec_deg, const array<double> &inc_deg, const array<double> &dec_deg,
magnetic_field_type_e comp_id = Za, verbose_type_e verbose = FullMsg); magnetic_field_type_e comp_id = Za, verbose_type_e verbose = FullMsg);
}; };
} };
#endif //_GM_REGULAR_MESH_3D_H #endif //_GM_REGULAR_MESH_3D_H

View File

@ -63,6 +63,6 @@ namespace gctl
magnetic_field_type_e comp_id = Za, verbose_type_e verbose = FullMsg); magnetic_field_type_e comp_id = Za, verbose_type_e verbose = FullMsg);
#endif // GCTL_POTENTIAL_MAGTESS #endif // GCTL_POTENTIAL_MAGTESS
}; };
} };
#endif //_GM_REGULAR_MESH_SPH_3D_H #endif //_GM_REGULAR_MESH_SPH_3D_H

View File

@ -87,6 +87,6 @@ namespace gctl
void magobser(array<tensor> &out_obs, std::string magz_name, const array<point3dc> &obsp, void magobser(array<tensor> &out_obs, std::string magz_name, const array<point3dc> &obsp,
verbose_type_e verbose = FullMsg); verbose_type_e verbose = FullMsg);
}; };
} };
#endif // _GM_TET_MESH_H #endif // _GM_TET_MESH_H

View File

@ -77,5 +77,7 @@ namespace gctl
magnetic_field_type_e comp_id = Za, verbose_type_e verbose = FullMsg); magnetic_field_type_e comp_id = Za, verbose_type_e verbose = FullMsg);
#endif // GCTL_POTENTIAL_AUTODIFF #endif // GCTL_POTENTIAL_AUTODIFF
}
};
#endif // _GCTL_MAG_KERNEL_BLOCK_H #endif // _GCTL_MAG_KERNEL_BLOCK_H

View File

@ -97,6 +97,6 @@ namespace gctl
*/ */
void magobser(array<point3dc> &out_obs, const array<mag_dipole> &dipoles, void magobser(array<point3dc> &out_obs, const array<mag_dipole> &dipoles,
const array<point3ds> &obsp, verbose_type_e verbose = FullMsg); const array<point3ds> &obsp, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_MAG_KERNEL_DIPOLE_H #endif // _GCTL_MAG_KERNEL_DIPOLE_H

View File

@ -125,7 +125,7 @@ namespace gctl
void magobser(array<double> &out_obs, const array<mag_tesseroid> &ele, const array<point3ds> &obsp, void magobser(array<double> &out_obs, const array<mag_tesseroid> &ele, const array<point3ds> &obsp,
const array<double> &sus, magnetic_field_type_e comp_id = Za, int gauss_order = 4, const array<double> &sus, magnetic_field_type_e comp_id = Za, int gauss_order = 4,
verbose_type_e verbose = FullMsg); verbose_type_e verbose = FullMsg);
} };
#endif // GCTL_POTENTIAL_MAGTESS #endif // GCTL_POTENTIAL_MAGTESS

View File

@ -129,6 +129,6 @@ namespace gctl
*/ */
void magobser(array<point3dc> &out_obs, const array<mag_tetrahedron> &ele, const array<point3ds> &obsp, void magobser(array<point3dc> &out_obs, const array<mag_tetrahedron> &ele, const array<point3ds> &obsp,
const array<double> &sus, verbose_type_e verbose = FullMsg); const array<double> &sus, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_MAG_KERNEL_TETRAHEDRON_H #endif // _GCTL_MAG_KERNEL_TETRAHEDRON_H

View File

@ -295,5 +295,6 @@ namespace gctl
*/ */
void magobser(array<tensor> &out_obs, const array<magtet_ren17> &ele, const array<point3ds> &obsp, void magobser(array<tensor> &out_obs, const array<magtet_ren17> &ele, const array<point3ds> &obsp,
const array<double> &sus, verbose_type_e verbose = FullMsg); const array<double> &sus, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_MAG_KERNEL_TETRAHEDRON_REN2017_H #endif // _GCTL_MAG_KERNEL_TETRAHEDRON_REN2017_H

View File

@ -129,6 +129,6 @@ namespace gctl
*/ */
void magobser(array<point3dc> &out_obs, const array<mag_triangle> &ele, const array<point3ds> &obsp, void magobser(array<point3dc> &out_obs, const array<mag_triangle> &ele, const array<point3ds> &obsp,
const array<double> &sus, verbose_type_e verbose = FullMsg); const array<double> &sus, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_MAG_KERNEL_TRIANGLE_H #endif // _GCTL_MAG_KERNEL_TRIANGLE_H

View File

@ -77,6 +77,6 @@ namespace gctl
void magobser(array<point3dc> &out_obs, const array<magcone> &top_ele, const array<magcone> &btm_ele, void magobser(array<point3dc> &out_obs, const array<magcone> &top_ele, const array<magcone> &btm_ele,
const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg); const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_MAG_KERNEL_TRICONE_H #endif // _GCTL_MAG_KERNEL_TRICONE_H

View File

@ -137,6 +137,6 @@ namespace gctl
*/ */
void magobser(array<tensor> &out_obs, const array<magcone_ren17> &top_ele, const array<magcone_ren17> &btm_ele, void magobser(array<tensor> &out_obs, const array<magcone_ren17> &top_ele, const array<magcone_ren17> &btm_ele,
const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg); const array<point3ds> &obsp, const array<double> &sus, verbose_type_e verbose = FullMsg);
} };
#endif // _GCTL_MAG_KERNEL_TRICONE_REN2017_H #endif // _GCTL_MAG_KERNEL_TRICONE_REN2017_H

View File

@ -372,7 +372,7 @@ void save_gmsh(const std::vector<std::string> &cmd_units)
// save gmsh <file> // save gmsh <file>
if (cmd_units.size() < 3) throw std::runtime_error("save: insufficient parameters."); if (cmd_units.size() < 3) throw std::runtime_error("save: insufficient parameters.");
rg.save_gmsh(cmd_units[2], OverWrite, NotPacked); rg.save_gmsh(cmd_units[2], NotPacked);
return; return;
} }