This commit is contained in:
张壹 2025-02-06 21:17:24 +08:00
parent 51bca90178
commit c413814a8b
94 changed files with 282 additions and 283 deletions

View File

@ -4,6 +4,9 @@ project(GCTL VERSION 1.0)
#
include(CMakePackageConfigHelpers)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
option(GCTL_OPENMP "Use the OpenMP library" ON)
option(GCTL_NETCDF "Use the NetCDF library" ON)

View File

@ -6,7 +6,7 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
#
aux_source_directory(geometry/ GCTL_GEOMETRY_SRC)
aux_source_directory(algorithm/ GCTL_ALGORITHM_SRC)
aux_source_directory(algorithms/ GCTL_ALGORITHMS_SRC)
aux_source_directory(io/ GCTL_IO_SRC)
aux_source_directory(utility/ GCTL_UTILITY_SRC)
aux_source_directory(maths/ GCTL_MATHS_SRC)
@ -24,10 +24,10 @@ endif()
#
#
# libcmake
add_library(gctl SHARED ${GCTL_UTILITY_SRC} ${GCTL_ALGORITHM_SRC} ${GCTL_GEODESY_SRC}
add_library(gctl SHARED ${GCTL_UTILITY_SRC} ${GCTL_ALGORITHMS_SRC} ${GCTL_GEODESY_SRC}
${GCTL_GEOMETRY_SRC} ${GCTL_IO_SRC} ${GCTL_MATHS_SRC})
#
add_library(gctl_static STATIC ${GCTL_UTILITY_SRC} ${GCTL_ALGORITHM_SRC} ${GCTL_GEODESY_SRC}
add_library(gctl_static STATIC ${GCTL_UTILITY_SRC} ${GCTL_ALGORITHMS_SRC} ${GCTL_GEODESY_SRC}
${GCTL_GEOMETRY_SRC} ${GCTL_IO_SRC} ${GCTL_MATHS_SRC})
#
set_target_properties(gctl_static PROPERTIES OUTPUT_NAME "gctl")
@ -101,7 +101,7 @@ endif()
file(GLOB GCTL_HEAD *.h)
file(GLOB GCTL_CORE_HEAD core/*.h)
file(GLOB GCTL_IO_HEAD io/*.h)
file(GLOB GCTL_ALGORITHM_HEAD algorithm/*.h)
file(GLOB GCTL_ALGORITHMS_HEAD algorithms/*.h)
file(GLOB GCTL_MATHS_HEAD maths/*.h)
file(GLOB GCTL_GEOMETRY_HEAD geometry/*.h)
file(GLOB GCTL_UTILITY_HEAD utility/*.h)
@ -113,7 +113,7 @@ if(NOT WIN32)
endif()
if(NOT GCTL_FFTW3)
list(REMOVE_ITEM GCTL_ALGORITHM_HEAD "${PROJECT_SOURCE_DIR}/lib/algorithm/fft.h")
list(REMOVE_ITEM GCTL_ALGORITHMS_HEAD "${PROJECT_SOURCE_DIR}/lib/algorithms/fft.h")
endif()
if(NOT GCTL_NETCDF)
@ -124,7 +124,7 @@ install(FILES ${GCTL_HEAD} DESTINATION include/gctl)
install(FILES ${GCTL_CORE_HEAD} DESTINATION include/gctl/core)
install(FILES ${GCTL_IO_HEAD} DESTINATION include/gctl/io)
install(FILES ${GCTL_MATHS_HEAD} DESTINATION include/gctl/maths)
install(FILES ${GCTL_ALGORITHM_HEAD} DESTINATION include/gctl/algorithm)
install(FILES ${GCTL_ALGORITHMS_HEAD} DESTINATION include/gctl/algorithms)
install(FILES ${GCTL_GEOMETRY_HEAD} DESTINATION include/gctl/geometry)
install(FILES ${GCTL_UTILITY_HEAD} DESTINATION include/gctl/utility)
install(FILES ${GCTL_MESH_HEAD} DESTINATION include/gctl/mesh)

View File

@ -28,21 +28,21 @@
#ifndef _GCTL_ALGORITHM_H
#define _GCTL_ALGORITHM_H
#include "algorithm/algorithm_func.h"
#include "algorithm/glni.h"
#include "algorithm/interpolate.h"
#include "algorithm/extrapolate.h"
#include "algorithm/heap_sort.h"
#include "algorithm/boxsort2d.h"
#include "algorithm/boxsort_sph.h"
#include "algorithm/variogram.h"
#include "algorithm/fir_filter.h"
#include "algorithm/space_filter.h"
#include "algorithm/sinkhorn.h"
#include "algorithm/kde.h"
#include "algorithm/autodiff.h"
#include "algorithm/multinary.h"
#include "algorithm/emd.h"
#include "algorithm/fft_filter.h"
#include "algorithms/algorithm_func.h"
#include "algorithms/glni.h"
#include "algorithms/interpolate.h"
#include "algorithms/extrapolate.h"
#include "algorithms/heap_sort.h"
#include "algorithms/boxsort2d.h"
#include "algorithms/boxsort_sph.h"
#include "algorithms/variogram.h"
#include "algorithms/fir_filter.h"
#include "algorithms/space_filter.h"
#include "algorithms/sinkhorn.h"
#include "algorithms/kde.h"
#include "algorithms/autodiff.h"
#include "algorithms/multinary.h"
#include "algorithms/emd.h"
#include "algorithms/fft_filter.h"
#endif // _GCTL_ALGORITHM_H

View File

@ -134,6 +134,6 @@ namespace gctl
*/
void difference_2d(const array<double> &in, array<double> &diff, int row_size, int col_size,
double spacing, gradient_type_e d_type, int order = 1);
}
};
#endif // _GCTL_ALGORITHM_FUNC_H

View File

@ -56,6 +56,6 @@ namespace gctl
private:
double val_, der_;
};
}
};
#endif // _GCTL_AUTODIFF_H

View File

@ -486,6 +486,6 @@ namespace gctl
}
return;
}
}
};
#endif // _BOXSORT2D_H

View File

@ -46,7 +46,7 @@ namespace gctl
void ceemdan1d(const array<double> &in, matrix<double> &out, size_t M,
unsigned int ensemble_size, double noise_strength, unsigned int S_number,
unsigned int num_siftings, unsigned long int rng_seed);
}
};
#endif // GCTL_EEMD

View File

@ -105,6 +105,6 @@ namespace gctl
*/
void zeros_extrapolate_2d(const array<double> &in_arr, array<double> &out_arr, int in_row, int in_col,
int &out_row, int &out_col, int &ori_row, int &ori_col);
}
};
#endif // _GCTL_EXTRAPOLATE_H

View File

@ -94,7 +94,7 @@ namespace gctl
array<double> fid_;
array<std::complex<double> > freqs_;
};
}
};
#endif // GCTL_FFTW3

View File

@ -98,6 +98,6 @@ namespace gctl
int taps_; ///< Number of taps of the filter
};
}
};
#endif // _RIF_FILTER_H

View File

@ -374,6 +374,6 @@ namespace gctl
size_t size_;
};
}
}
};
#endif // _GCTL_GLNI_H

View File

@ -246,6 +246,6 @@ namespace gctl
return;
}
};
}
};
#endif //_GCTL_HEAPSORT_H

View File

@ -316,6 +316,6 @@ namespace gctl
*/
array<double> *p2p_dist_sph(point3ds * out_posi, int out_num, point3ds *in_posi, double *in_val,
int in_num, double search_rlen, double search_deg);
}
};
#endif // _GCTL_INTERPOLATE_H

View File

@ -171,6 +171,6 @@ namespace gctl
double gaussian_kernel(double x, double y);
};
}
};
#endif // _GCTL_KERNEL_DENSITY_ESTIMATION_H

View File

@ -56,6 +56,6 @@ namespace gctl
array<double> std_;
array<double> ys_;
};
}
};
#endif // _GCTL_MULTINARY_H

View File

@ -114,6 +114,6 @@ namespace gctl
matrix<double> RP_; // 整理后的转换矩阵
matrix<double> rp_maxi_; // RP_中每一快的最大值
};
}
};
#endif // _GCTL_SINKHORN_H

View File

@ -161,6 +161,6 @@ namespace gctl
* @param m_OrderNumClm
*/
void trend_2d(matrix<double> &data, int m_RowNum, int m_ClmNum, int m_OrderNumRow, int m_OrderNumClm);
}
};
#endif // _GCTL_SPACE_FILTER_H

View File

@ -137,6 +137,6 @@ namespace gctl
* @return Semi-variogram value
*/
double variogram(const double &d, const variogram_model &vm, variogram_type_e type);
}
};
#endif // _VARIOGRAM_H

View File

@ -63,6 +63,6 @@ namespace gctl
* @param coeff Window coefficients
*/
void window_blackman(int taps, array<double> &coeff);
}
};
#endif // _WINDOWFUNC_H

View File

@ -107,7 +107,7 @@ namespace gctl
*
* @param[in] len Length of the array. Must be equal to or bigger than zero.
*/
array(size_t len);
explicit array(size_t len);
/**
* @brief Construct an array with the given length and initial values.
@ -145,7 +145,7 @@ namespace gctl
*
* @param init_val Initial values
*/
array(std::initializer_list<ArrValType> init_val);
explicit array(std::initializer_list<ArrValType> init_val);
/**
* @brief Construct a new array object as a sequence
@ -1509,18 +1509,6 @@ namespace gctl
}
#endif // GCTL_EIGEN
/*
template <typename ArrValType>
void array<ArrValType>::for_each(foreach_a_ptr func)
{
for (size_t i = 0; i < length_; i++)
{
func(val_[i], i);
}
return;
}
*/
template <typename ArrValType>
void array<ArrValType>::show(std::ostream &os, char sep)
{
@ -1709,7 +1697,7 @@ namespace gctl
throw std::runtime_error("Incompatible array sizes. gctl::array<T>::dot(...)");
}
ArrValType s = 0;
ArrValType s = (ArrValType) 0;
for (size_t i = 0; i < length_; i++)
{
s += val_[i]*a[i];
@ -1744,15 +1732,32 @@ namespace gctl
return sum()/static_cast<ArrValType>(length_);
}
template <typename ArrValType>
ArrValType array<ArrValType>::variance() const
{
static_assert(std::is_arithmetic<ArrValType>::value,
"gctl::array<T>::variance(...) could only be used with an arithmetic type.");
if (length_ == 0 || val_ == nullptr) return ArrValType{};
ArrValType m = mean();
ArrValType d = ArrValType(0);
for (size_t i = 0; i < length_; i++)
{
d += (val_[i] - m)*(val_[i] - m);
}
return d/static_cast<ArrValType>(length_);
}
template <typename ArrValType>
ArrValType array<ArrValType>::std() const
{
static_assert(std::is_arithmetic<ArrValType>::value,
"gctl::array<T>::std(...) could only be used with an arithmetic type.");
if (length_ == 0 || length_ == 1) return ArrValType{};
if (length_ == 0 || val_ == nullptr) return ArrValType{};
ArrValType m = mean(), s = 0;
ArrValType m = mean(), s = ArrValType(0);
for (size_t i = 0; i < length_; i++)
{
s += (val_[i] - m)*(val_[i] - m);
@ -1913,28 +1918,13 @@ namespace gctl
static_assert(std::is_arithmetic<ArrValType>::value,
"gctl::array<T>::linear2log(...) could only be used with an arithmetic type.");
for (size_t i = 0; i < length_; ++i)
{
val_[i] = log(val_[i])/log(base);
}
return;
}
if (length_ == 0 || val_ == nullptr) return;
template <typename ArrValType>
ArrValType array<ArrValType>::variance() const
{
static_assert(std::is_arithmetic<ArrValType>::value,
"gctl::array<T>::variance(...) could only be used with an arithmetic type.");
if (length_ == 0) return ArrValType{};
ArrValType mn = mean();
ArrValType d = 0;
for (size_t i = 0; i < length_; i++)
{
d = d + (val_[i] - mn)*(val_[i] - mn);
if (val_[i] <= ArrValType(0)) continue; // 跳过非正值
val_[i] = std::log(val_[i])/std::log(base);
}
return d/static_cast<ArrValType>(length_);
}
template <typename ArrValType>
@ -1946,7 +1936,7 @@ namespace gctl
if (length_ < 2) return 0;
ArrValType mn = mean();
ArrValType d = 0;
ArrValType d = (ArrValType) 0;
for (size_t i = 0; i < length_; i++)
{
d = d + (val_[i] - mn)*(val_[i] - mn);
@ -2044,6 +2034,6 @@ namespace gctl
else os << byte << " B\n";
return;
}
}
};
#endif // _GCTL_ARRAY_H

View File

@ -257,6 +257,6 @@ namespace gctl
SoftScale, // 所有数据按比例映射至max(min, min(arr))和min(max, max(arr))范围内
CutOff, // 超过min和max范围数据直接设置为边界值
};
}
};
#endif // _GCTL_ENUM_H

View File

@ -113,28 +113,28 @@ namespace gctl
{
public:
runtime_error() : std::runtime_error("GCTL: Unexpected runtime error."){}
runtime_error(std::string estr) : std::runtime_error(("GCTL: Unexpected runtime error. "+estr).c_str()){}
explicit runtime_error(std::string estr) : std::runtime_error(("GCTL: Unexpected runtime error. "+estr).c_str()){}
};
class range_error : public std::range_error
{
public:
range_error() : std::range_error("GCTL: Invalid range detected."){}
range_error(std::string estr) : std::range_error(("GCTL: Invalid range detected. "+estr).c_str()){}
explicit range_error(std::string estr) : std::range_error(("GCTL: Invalid range detected. "+estr).c_str()){}
};
class overflow_error : public std::overflow_error
{
public:
overflow_error() : std::overflow_error("GCTL: Overflow error."){}
overflow_error(std::string estr) : std::overflow_error(("GCTL: Overflow error. "+estr).c_str()){}
explicit overflow_error(std::string estr) : std::overflow_error(("GCTL: Overflow error. "+estr).c_str()){}
};
class underflow_error : public std::underflow_error
{
public:
underflow_error() : std::underflow_error("GCTL: Underflow error."){}
underflow_error(std::string estr) : std::underflow_error(("GCTL: Underflow error. "+estr).c_str()){}
explicit underflow_error(std::string estr) : std::underflow_error(("GCTL: Underflow error. "+estr).c_str()){}
};
@ -142,36 +142,36 @@ namespace gctl
{
public:
logic_error() : std::logic_error("GCTL: Logic error."){}
logic_error(std::string estr) : std::logic_error(("GCTL: Logic error. "+estr).c_str()){}
explicit logic_error(std::string estr) : std::logic_error(("GCTL: Logic error. "+estr).c_str()){}
};
class domain_error : public std::domain_error
{
public:
domain_error() : std::domain_error("GCTL: Domain error."){}
domain_error(std::string estr) : std::domain_error(("GCTL: Domain error. "+estr).c_str()){}
explicit domain_error(std::string estr) : std::domain_error(("GCTL: Domain error. "+estr).c_str()){}
};
class invalid_argument : public std::invalid_argument
{
public:
invalid_argument() : std::invalid_argument("GCTL: Invalid argument."){}
invalid_argument(std::string estr) : std::invalid_argument(("GCTL: Invalid argument. "+estr).c_str()){}
explicit invalid_argument(std::string estr) : std::invalid_argument(("GCTL: Invalid argument. "+estr).c_str()){}
};
class length_error : public std::length_error
{
public:
length_error() : std::length_error("GCTL: Length error."){}
length_error(std::string estr) : std::length_error(("GCTL: Length error. "+estr).c_str()){}
explicit length_error(std::string estr) : std::length_error(("GCTL: Length error. "+estr).c_str()){}
};
class out_of_range : public std::out_of_range
{
public:
out_of_range() : std::out_of_range("GCTL: Out of range."){}
out_of_range(std::string estr) : std::out_of_range(("GCTL: Out of range. "+estr).c_str()){}
explicit out_of_range(std::string estr) : std::out_of_range(("GCTL: Out of range. "+estr).c_str()){}
};
}
};
#endif // _GCTL_EXCEPTIONS_H

View File

@ -114,7 +114,7 @@ namespace gctl
*
* @param[in] b
*/
matrix(const std::vector<std::vector<MatValType> > &b);
explicit matrix(const std::vector<std::vector<MatValType> > &b);
/**
* @brief
@ -1093,6 +1093,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_MATRIX_H

View File

@ -653,6 +653,6 @@ namespace gctl
{
return arr2d.size();
}
}
};
#endif // _GCTL_SPARRAY_H

View File

@ -61,6 +61,7 @@ namespace gctl
*/
mat_node()
{
val = (NodeValueType) 0;
r_id = c_id = -1;
next_right = next_down = nullptr;
}
@ -626,6 +627,7 @@ namespace gctl
r_end = c_end = nullptr;
d_link = nullptr;
r_count = c_count = nullptr;
zero_val = (MatrixValueType) 0;
}
template <typename MatrixValueType>
@ -2939,6 +2941,7 @@ namespace gctl
{
if (!empty()) clear();
zero_val = b.zero_val;
r_num = b.row_size();
c_num = b.col_size();
r_head = new mat_node<MatrixValueType>* [r_num];
@ -3302,6 +3305,6 @@ namespace gctl
#endif // GCTL_EIGEN
}
};
#endif //_GCTL_SPMAT_H

View File

@ -41,7 +41,7 @@ namespace gctl
//该类成员访问权限全部为private因为不想让用户直接使用该类
//定义智能指针类为友元,因为智能指针类需要直接操纵辅助类
friend class smart_ptr<T>;
ref_ptr() : p(nullptr) {}
ref_ptr() : p(nullptr), count(0) {}
//构造函数的参数为基础对象的指针
ref_ptr(T *ptr) : p(ptr), count(1) {}
//析构函数
@ -94,6 +94,6 @@ namespace gctl
private:
ref_ptr<T> *rp; //辅助类对象指针
};
}
};
#endif //_GCTL_SPTR_H

View File

@ -129,6 +129,6 @@ namespace gctl
while (os >> t){a.push_back(t);}
return os;
}
}
};
#endif // _GCTL_VECTOR_TYPE_H

View File

@ -274,6 +274,6 @@ namespace gctl
tar->ur = src->ur;
return;
}
}
};
#endif // _GCTL_BLOCK_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_EDGE_H
#define _GCTL_EDGE_H
#include "point3c.h"
#include "vertex.h"
#include "entity.h"
@ -148,6 +149,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_EDGE_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_EDGE2D_H
#define _GCTL_EDGE2D_H
#include "point2c.h"
#include "vertex.h"
#include "entity.h"
#include "triangle2d.h"
@ -181,6 +182,6 @@ namespace gctl
neigh[1] = &nei1;
return;
}
}
};
#endif // _GCTL_EDGE2D_H

View File

@ -251,6 +251,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_ENTITY_H

View File

@ -25,12 +25,14 @@
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#include "geometry2d.h"
#include <algorithm>
#include <string>
#include <iostream>
#include <cmath>
#include <map>
#include <vector>
#include "string"
#include "cmath"
#include "map"
#include "algorithm"
#include "geometry2d.h"
// 计算点t是否在直线ab上。
bool gctl::geometry2d::collinear(const point2dc &a, const point2dc &b,
@ -39,7 +41,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());
if (sqrt(1 - cos_arc*cos_arc)*at.module() <= cut_off)
if (sqrt(1.0 - cos_arc*cos_arc)*at.module() <= cut_off)
return true;
else return false;
}

View File

@ -239,5 +239,6 @@ namespace gctl
void extract_triangular_mesh_2d(const array<triangle2d> &in_eles, const array<bool> &out_list,
array<vertex2dc> &out_nodes, array<triangle2d> &out_eles);
}
}
};
#endif // _GCTL_GEOMETRY2D_H

View File

@ -25,15 +25,16 @@
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <sstream>
#include <iomanip>
#include "geometry3d.h"
#include "string"
#include "cmath"
#include "vector"
#include "map"
#include "algorithm"
double gctl::geometry3d::angle(const point3dc &a, const point3dc &b) //向量夹角
{
double d = GCTL_SetToBox(-1.0, 1.0, dot(a, b)/(a.module() * b.module()));

View File

@ -361,5 +361,6 @@ namespace gctl
void cut_triangular_mesh(const array<triangle> &in_eles, const point3dc &nor, const point3dc &surf,
array<vertex3dc> &out_nodes, array<triangle> &out_eles);
}
}
};
#endif // _GCTL_GEOMETRY3D_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_NODE_H
#define _GCTL_NODE_H
#include "point3c.h"
#include "vertex.h"
#include "entity.h"
@ -147,6 +148,6 @@ namespace gctl
copy_entity(tar, src);
return;
}
}
};
#endif // _GCTL_NODE_H

55
lib/geometry/point.h Normal file
View File

@ -0,0 +1,55 @@
/********************************************************
*
*
*
*
*
*
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2023 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* GCTL is distributed under a dual licensing scheme. You can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 2
* of the License, or (at your option) any later version. You should have
* received a copy of the GNU Lesser General Public License along with this
* program. If not, see <http://www.gnu.org/licenses/>.
*
* If the terms and conditions of the LGPL v.2. would prevent you from using
* the GCTL, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the GCTL's original author. As a rule,
* licenses are provided "as-is", unlimited in time for a one time fee. Please
* send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget
* to include some description of your company and the realm of its activities.
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#ifndef _GCTL_POINT_H
#define _GCTL_POINT_H
#include "iostream"
#include "string"
#include "cmath"
#include "iomanip"
#include "regex"
#include "../core/macro.h"
#include "../core/exceptions.h"
namespace gctl
{
template <typename T> struct point2c;
template <typename T> struct point2p;
template <typename T> struct point3c;
template <typename T> struct point3s;
#ifndef IO_PSN
#define IO_PSN
// static variable for controlling the IO process
static int io_psn = 6;
#endif // IO_PSN
};
#endif // _GCTL_POINT_H

View File

@ -28,30 +28,13 @@
#ifndef _GCTL_POINT2C_H
#define _GCTL_POINT2C_H
#include "../core/macro.h"
#include "../core/exceptions.h"
#include "point2p.h"
#include "iostream"
#include "string"
#include "cmath"
#include "iomanip"
#include "regex"
#include "point.h"
namespace gctl
{
template <typename T> struct point2c;
template <typename T> struct point2p;
typedef point2c<double> point2dc;
typedef point2c<float> point2fc;
#ifndef IO_PSN
#define IO_PSN
// static variable for controlling the IO process
static int io_psn = 6;
#endif // IO_PSN
/**
* @brief A point under the 2D Cartesian coordinates (aka. 2D vector).
*/
@ -549,6 +532,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_POINT2C_H

View File

@ -28,30 +28,13 @@
#ifndef _GCTL_POINT2P_H
#define _GCTL_POINT2P_H
#include "../core/macro.h"
#include "../core/exceptions.h"
#include "point2c.h"
#include "iostream"
#include "string"
#include "cmath"
#include "iomanip"
#include "regex"
#include "point.h"
namespace gctl
{
template <typename T> struct point2c;
template <typename T> struct point2p;
typedef point2p<double> point2dp;
typedef point2p<float> point2fp;
#ifndef IO_PSN
#define IO_PSN
// static variable for controlling the IO process
static int io_psn = 6;
#endif // IO_PSN
/**
* @brief A point under the 2-D Polar coordinates.
*/
@ -389,6 +372,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_POINT2P_H

View File

@ -28,31 +28,14 @@
#ifndef _GCTL_POINT3C_H
#define _GCTL_POINT3C_H
#include "../core/macro.h"
#include "../core/exceptions.h"
#include "point.h"
#include "../core/array.h"
#include "point3s.h"
#include "iostream"
#include "string"
#include "cmath"
#include "iomanip"
#include "regex"
namespace gctl
{
template <typename T> struct point3c;
template <typename T> struct point3s;
typedef point3c<double> point3dc;
typedef point3c<float> point3fc;
#ifndef IO_PSN
#define IO_PSN
// static variable for controlling the IO process
static int io_psn = 6;
#endif // IO_PSN
/**
* @brief
*/
@ -714,6 +697,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_POINT3C_H

View File

@ -28,30 +28,13 @@
#ifndef _GCTL_POINT3S_H
#define _GCTL_POINT3S_H
#include "../core/macro.h"
#include "../core/exceptions.h"
#include "point3c.h"
#include "iostream"
#include "string"
#include "cmath"
#include "iomanip"
#include "regex"
#include "point.h"
namespace gctl
{
template <typename T> struct point3c;
template <typename T> struct point3s;
typedef point3s<double> point3ds;
typedef point3s<float> point3fs;
#ifndef IO_PSN
#define IO_PSN
// static variable for controlling the IO process
static int io_psn = 6;
#endif // IO_PSN
/**
* @brief
*/
@ -514,6 +497,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_POINT3S_H

View File

@ -178,6 +178,6 @@ namespace gctl
copy_entity(tar, src);
return;
}
}
};
#endif // _GCTL_PRISM_H

View File

@ -204,6 +204,6 @@ namespace gctl
}
return;
}
}
};
#endif // _GCTL_RECTANGLE2D_H

View File

@ -86,6 +86,6 @@ namespace gctl
double r_, R_;
};
}
};
#endif // _GCTL_REFELLIPSOID_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_SPHERE_H
#define _GCTL_SPHERE_H
#include "point3c.h"
#include "vertex.h"
#include "entity.h"
@ -171,6 +172,6 @@ namespace gctl
tar->rad = src->rad;
return;
}
}
};
#endif // _GCTL_SPHERE_H

View File

@ -397,6 +397,6 @@ namespace gctl
t.val[2][0]=a.z*b.x; t.val[2][1]=a.z*b.y; t.val[2][2]=a.z*b.z;
return t;
}
}
};
#endif // _GCTL_TENSOR_H

View File

@ -273,6 +273,6 @@ namespace gctl
tar->ur = src->ur;
return;
}
}
};
#endif // _GCTL_TESSEROID_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_TETRAHEDRON_H
#define _GCTL_TETRAHEDRON_H
#include "point3c.h"
#include "vertex.h"
#include "entity.h"
@ -577,6 +578,6 @@ namespace gctl
tar->vec_order = src->vec_order;
return;
}
}
};
#endif // _GCTL_TETRAHEDRON_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_TRI_CONE_H
#define _GCTL_TRI_CONE_H
#include "point3c.h"
#include "vertex.h"
#include "entity.h"

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_TRIANGLE_H
#define _GCTL_TRIANGLE_H
#include "point3c.h"
#include "vertex.h"
#include "entity.h"
@ -221,6 +222,6 @@ namespace gctl
hgt_x = sqrt(edge_len[(c_id+2)%3]*edge_len[(c_id+2)%3] - hgt_y*hgt_y);
return;
}
}
};
#endif // _GCTL_TRIANGLE_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_TRIANGLE2D_H
#define _GCTL_TRIANGLE2D_H
#include "point2c.h"
#include "vertex.h"
#include "entity.h"
@ -214,6 +215,6 @@ namespace gctl
copy_entity(tar, src);
return;
}
}
};
#endif // _GCTL_TRIANGLE2D_H

View File

@ -28,6 +28,7 @@
#ifndef _GCTL_TRIANGLE2D2O_H
#define _GCTL_TRIANGLE2D2O_H
#include "point2c.h"
#include "vertex.h"
#include "entity.h"
@ -296,6 +297,6 @@ namespace gctl
copy_entity(tar, src);
return;
}
}
};
#endif // _GCTL_TRIANGLE2D2O_H

View File

@ -168,6 +168,6 @@ namespace gctl
os >> a.id; a.in_loc(os);
return os;
}
}
};
#endif // _GCTL_VERTEX_H

View File

@ -1023,6 +1023,6 @@ namespace gctl
*/
void get_column_point3ds(array<point3ds> &data, std::string rname, std::string pname, std::string tname);
};
}
};
#endif //_GCTL_DSV_IO_H

View File

@ -3837,5 +3837,6 @@ namespace gctl
#endif // GCTL_EIGEN
}
};
#endif //_GCTL_GMSH_IO_H

View File

@ -319,8 +319,8 @@ void gctl::mesh_io::info(std::ostream &ss)
{
if (reinterpret_cast<vertex3dc*>(datas_[d].tar_ptrs[l])->id != DEFAULT_INVALID_TAG)
{
min = std::min(min, datas_[d].val[l]);
max = std::max(max, datas_[d].val[l]);
min = GCTL_MIN(min, datas_[d].val[l]);
max = GCTL_MAX(max, datas_[d].val[l]);
d_size++;
}
}
@ -332,8 +332,8 @@ void gctl::mesh_io::info(std::ostream &ss)
{
if (reinterpret_cast<meshio_element*>(datas_[d].tar_ptrs[l])->enabled)
{
min = std::min(min, datas_[d].val[l]);
max = std::max(max, datas_[d].val[l]);
min = GCTL_MIN(min, datas_[d].val[l]);
max = GCTL_MAX(max, datas_[d].val[l]);
d_size++;
}
}

View File

@ -38,7 +38,6 @@
#include "gmsh_io.h"
#include "map"
namespace gctl
{
/**
@ -521,6 +520,6 @@ namespace gctl
void update_indexing(); // 更新索引(对网格的元素进行操作后需调用)
void sort_groups(); // 对单元体组进行梳理(对网格的元素进行操作后需调用)
};
}
};
#endif // _GCTL_MESH_IO_H

View File

@ -428,6 +428,6 @@ namespace gctl
outfile.close();
return;
}
}
};
#endif // _GCTL_NATIVE_IO_H

View File

@ -775,7 +775,7 @@ namespace gctl
return;
}
}
};
#endif // GCTL_NETCDF

View File

@ -141,6 +141,6 @@ namespace gctl
outfile.close();
return;
}
}
};
#endif // _GCTL_OFF_IO_H

View File

@ -187,6 +187,6 @@ namespace gctl
void save_surfer7_grid(std::string filename, const array<double> &out_data,
int xnum, int ynum, double xmin, double ymin, double dx, double dy,
double zmin = NAN, double zmax = NAN, double blank_val = 1.70141e38);
}
};
#endif // _GCTL_SURFER_IO_H

View File

@ -1192,5 +1192,6 @@ namespace gctl
tetout.close();
return;
}
}
};
#endif //_GCTL_TETGEN_IO_H

View File

@ -1322,6 +1322,7 @@ namespace gctl
*/
void save_data_column(std::ofstream &outfile, std::initializer_list<std::vector<double>*> dat_val,
std::initializer_list<std::string> dat_name, char delimiter = ' ', int precision = GCTL_PRECISION);
}
};
#endif //_GCTL_TEXT_IO_H

View File

@ -1270,5 +1270,7 @@ namespace gctl
triout.close();
return;
}
}
};
#endif //_GCTL_TRIANGLE_H

View File

@ -90,6 +90,6 @@ namespace gctl
* @param out_arr Output real array
*/
void idct1d(const _1d_array &in_arr, _1d_array &out_arr);
}
};
#endif // _GCTL_FFT_H

View File

@ -77,6 +77,6 @@ namespace gctl
*/
double gaussian_dist2d(double x, double y, const gaussian_para2d &p,
gradient_type_e mode = Value);
}
};
#endif // _GAUSSFUNC_H

View File

@ -98,6 +98,6 @@ namespace gctl
void nalf_sfcm(array<array<double>> &nalf, const array<array<double>> &a_nm,
const array<array<double>> &b_nm, int max_order, double theta,
legendre_norm_e norm, bool derivative = false);
}
};
#endif //_GCTL_LEGENDRE_H

View File

@ -350,6 +350,6 @@ namespace gctl
* @return New standard deviation value.
*/
double dynamic_stddev(double old_stddev, size_t old_count, double old_mean, double new_input, double &new_mean);
}
};
#endif // _GCTL_LINEAR_ALGEBRA_H

View File

@ -28,16 +28,16 @@
#ifndef _GCTL_MATHFUNC_H
#define _GCTL_MATHFUNC_H
// system's head files
#include <cmath>
#include <random>
#include <vector>
// library's head files
#include "../core/macro.h"
#include "../core/spmat.h"
#include "mathfunc_t.h"
// system's head files
#include "cmath"
#include "random"
#include "vector"
namespace gctl
{
/**
@ -212,6 +212,6 @@ namespace gctl
* @param[in] a_s
*/
void schmidt_orthogonal(const array<double> &a, array<double> &e, int a_s);
}
};
#endif // _GCTL_MATHFUNC_H

View File

@ -51,6 +51,6 @@ namespace gctl
void tran(double **a,int n);
void metrimult(double **a,double **b,int m,int n,int l,double **c);
void svd_standalone(double **a,int m,int n,double **u,double **v,double *q,int Index);
}
};
#endif // _GCTL_MATHFUNC_EXT_H

View File

@ -28,11 +28,8 @@
#ifndef _GCTL_MATHFUNC_TEMPLATE_H
#define _GCTL_MATHFUNC_TEMPLATE_H
#include "../core/enum.h"
#include "../core/array.h"
#include <cmath>
#include "../core/matrix.h"
#include "../core/exceptions.h"
#include "cmath"
namespace gctl
{
@ -142,7 +139,7 @@ namespace gctl
{
T ang;
if(v>=0) ang=atan(v);
else if(v<0) ang=atan(v)+GCTL_Pi;
else ang=atan(v)+GCTL_Pi;
return ang;
}
@ -162,7 +159,7 @@ namespace gctl
}
return ang;
}
}
};
#endif //_GCTL_MATHFUNC_TEMPLATE_H

View File

@ -535,6 +535,6 @@ namespace gctl
size_t idx, eshape_value_e vt, edge_orient_e ot, double &xval, double &yval, double &zval,
double &xval2, double &yval2, double &zval2);
};
}
};
#endif // _GCTL_SHAPEFUNC_H

View File

@ -28,11 +28,11 @@
#ifndef _GCTL_ASSESS_H
#define _GCTL_ASSESS_H
#include "iostream"
#include "string"
#include "cmath"
#include "ctime"
#include "chrono"
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <chrono>
/* Basic assess. If fails, returns msg. If passes, returns 0 */
#define GCTL_Assess(test, msg) \
@ -96,6 +96,6 @@ namespace gctl
int tests_run, tests_passed, tests_failed;
std::chrono::system_clock::time_point start_t;
};
}
};
#endif // _GCTL_ASSESS_H

View File

@ -28,16 +28,16 @@
#ifndef _GCTL_GETOPTION_H
#define _GCTL_GETOPTION_H
// system's head file
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
// library's head file
#include "../core/array.h"
#include "stream.h"
// system's head file
#include "vector"
#include "string"
#include "iostream"
#include "fstream"
namespace gctl
{
/**
@ -263,5 +263,6 @@ namespace gctl
std::vector<int> group_idx_;
};
}
};
#endif //_GCTL_GETOPTION_H

View File

@ -28,16 +28,16 @@
#ifndef _GCTL_GETOPT_HELP_H
#define _GCTL_GETOPT_HELP_H
#include "stream.h"
#ifdef _WINDOWS
#include "windows.h"
#include <windows.h>
#include "getopt_win.h"
#else
#include "sys/ioctl.h"
#include <sys/ioctl.h>
#include "getopt.h"
#endif
#include "stream.h"
namespace gctl
{
struct option_info

View File

@ -28,11 +28,11 @@
#ifndef _GCTL_PROCESS_MONITOR_H
#define _GCTL_PROCESS_MONITOR_H
#include "thread"
#include "mutex"
#include "condition_variable"
#include "termios.h"
#include "iostream"
#include <thread>
#include <mutex>
#include <condition_variable>
#include <termios.h>
#include <iostream>
namespace gctl
{
@ -107,6 +107,6 @@ namespace gctl
std::mutex mtx_;
std::condition_variable cv_;
};
}
};
#endif // _GCTL_PROCESS_MONITOR_H

View File

@ -28,19 +28,19 @@
#ifndef _GCTL_PROGRESS_BAR_H
#define _GCTL_PROGRESS_BAR_H
#include "../core/exceptions.h"
#ifdef _WINDOWS
#include "windows.h"
#include <windows.h>
#else
#include "sys/ioctl.h"
#include <sys/ioctl.h>
#endif
#include "cstring"
#include "iostream"
#include "iomanip"
#include "thread"
#include "chrono"
#include <cstring>
#include <iostream>
#include <iomanip>
#include <thread>
#include <chrono>
#include "../core/exceptions.h"
//进度条宏定义
#define TOTAL_PERCENTAGE 100.0 ///< 设置总的百分比为100%。

View File

@ -27,23 +27,23 @@
#ifndef _GCTL_STREAM_H
#define _GCTL_STREAM_H
// library's head files
#include "stream_t.h"
// system's head files
#include "cstring"
#include "iostream"
#include "fstream"
#include "iomanip"
#include "ctime"
#include <cstring>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <ctime>
#include "stdio.h"
#ifdef _WINDOWS
#include "windows.h"
#include <windows.h>
#else
#include "sys/ioctl.h"
#include <sys/ioctl.h>
#endif
// library's head files
#include "stream_t.h"
namespace gctl
{
/**
@ -197,6 +197,6 @@ namespace gctl
* @param exten_name
*/
void parse_filename(std::string filename, std::string &naked_name, std::string &exten_name);
}
};
#endif // _GCTL_STREAM_H

View File

@ -28,12 +28,12 @@
#ifndef _GCTL_UTC_TIME_H
#define _GCTL_UTC_TIME_H
#include "iostream"
#include "sstream"
#include "iomanip"
#include "cmath"
#include "sys/time.h"
#include "unistd.h"
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <sys/time.h>
#include <unistd.h>
namespace gctl
{
@ -95,6 +95,6 @@ namespace gctl
bool operator!=(const UTC_TIME &ta, const UTC_TIME &tb);
bool operator<(const UTC_TIME &ta, const UTC_TIME &tb);
bool operator<=(const UTC_TIME &ta, const UTC_TIME &tb);
}
};
#endif // _GCTL_UTC_TIME_H