From 0212883ec799b697e0fb83fbe939bb6abdd5caff Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Fri, 7 Feb 2025 11:56:53 +0800 Subject: [PATCH] tmp --- CMakeLists.txt | 2 ++ GCTLConfig.cmake.in | 2 ++ lib/CMakeLists.txt | 2 ++ lib/geometry/geometry2d.cpp | 4 ++-- lib/io/mesh_io.cpp | 4 ++-- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79693d7..7c9f7bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ if(GCTL_OPENBLAS) endif() if(GCTL_NETCDF) + find_package(HDF5) + if(NOT netCDF_FOUND) find_package(netCDF REQUIRED) include_directories(${netCDF_INCLUDE_DIR}) diff --git a/GCTLConfig.cmake.in b/GCTLConfig.cmake.in index 7097cc1..a151443 100644 --- a/GCTLConfig.cmake.in +++ b/GCTLConfig.cmake.in @@ -31,6 +31,8 @@ message(STATUS "[GCTL] Check Size: " @GCTL_CHECK_SIZE@) set(CMAKE_CXX_STANDARD 11) if(@PROJECT_NAME@_NETCDF) + find_package(HDF5) + if(NOT netCDF_FOUND) find_package(netCDF REQUIRED) include_directories(${netCDF_INCLUDE_DIR}) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3e79deb..ec2b6f3 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -47,6 +47,8 @@ if(GCTL_NETCDF) target_link_libraries(gctl_static ${netCDF_CXX_LEGACY_LIB}) target_link_libraries(gctl PUBLIC ${netCDF_LIBRARIES}) target_link_libraries(gctl_static ${netCDF_LIBRARIES}) + target_link_libraries(gctl PUBLIC ${HDF5_LIBRARIES}) + target_link_libraries(gctl_static ${HDF5_LIBRARIES}) endif() # 连接动态库与静态库 diff --git a/lib/geometry/geometry2d.cpp b/lib/geometry/geometry2d.cpp index 5aa901e..717b6cc 100644 --- a/lib/geometry/geometry2d.cpp +++ b/lib/geometry/geometry2d.cpp @@ -25,10 +25,10 @@ * Also add information on how to contact you by electronic and paper mail. ******************************************************/ +#include #include #include #include -#include #include #include @@ -40,7 +40,7 @@ bool gctl::geometry2d::collinear(const point2dc &a, const point2dc &b, { point2dc at = t - a; point2dc ab = b - a; - double cos_arc = dot(at, ab)/(at.module()*ab.module()); + long double cos_arc = dot(at, ab)/(at.module()*ab.module()); if (sqrt(1.0 - cos_arc*cos_arc)*at.module() <= cut_off) return true; else return false; diff --git a/lib/io/mesh_io.cpp b/lib/io/mesh_io.cpp index a810d8d..74fbd35 100644 --- a/lib/io/mesh_io.cpp +++ b/lib/io/mesh_io.cpp @@ -2003,7 +2003,7 @@ void gctl::mesh_io::save_data_to_xyz(std::string filename, std::string dataname, if (out_coor == Spherical) { ps = vptr->c2s(); - ps.rad -= ellipse_radius_2d(refR, refr, ps.lat*M_PI/180.0); + ps.rad -= ellipse_radius_2d(refR, refr, ps.lat*GCTL_Pi/180.0); ofile << ps.lon << " " << ps.lat << " " << ps.rad << " " << datas_[i].val[n] << "\n"; } @@ -2034,7 +2034,7 @@ void gctl::mesh_io::save_data_to_xyz(std::string filename, std::string dataname, if (out_coor == Spherical) { ps = pc.c2s(); - ps.rad -= ellipse_radius_2d(refR, refr, ps.lat*M_PI/180.0); + ps.rad -= ellipse_radius_2d(refR, refr, ps.lat*GCTL_Pi/180.0); ofile << ps.lon << " " << ps.lat << " " << ps.rad << " " << datas_[i].val[e] << "\n"; }