65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
#ifndef _MAGTET_H
|
|
#define _MAGTET_H
|
|
|
|
#include "gctl/core.h"
|
|
#include "gctl/geometry.h"
|
|
#include "gctl/io.h"
|
|
#include "gctl/utility.h"
|
|
|
|
#include "omp.h"
|
|
|
|
#define Cm 1e-7
|
|
#define TOL 1e-10
|
|
|
|
#define TETFILE "tet-file"
|
|
#define MAGFILE "mag-file"
|
|
#define SITEFILE "site-file"
|
|
#define OBSFILE "obs-file"
|
|
#define CALTYPE "cal-type" // potential, gradient or tensor
|
|
|
|
#define RUN_ECHO(action, msg) do {std::clog << msg << " ... \n"; action;} while(0);
|
|
|
|
class magtet
|
|
{
|
|
public:
|
|
magtet();
|
|
virtual ~magtet();
|
|
|
|
void read_tet(std::string tet_name);
|
|
void read_magz(std::string mag_name);
|
|
void init_site(std::string para);
|
|
void write_text(std::string out_name);
|
|
|
|
void cal_tensors();
|
|
double mag_potential(const gctl::tetrahedron &tet, const gctl::point3d_c &site, const gctl::point3d_c &mz,
|
|
gctl::point3d_c *fn, gctl::point3d_c *en, gctl::point3d_c *et);
|
|
gctl::point3d_c mag_gradient(const gctl::tetrahedron &tet, const gctl::point3d_c &site, const gctl::point3d_c &mz,
|
|
gctl::point3d_c *fn, gctl::point3d_c *en, gctl::point3d_c *et);
|
|
gctl::tensor mag_tensor(const gctl::tetrahedron &tet, const gctl::point3d_c &site, const gctl::point3d_c &mz,
|
|
gctl::point3d_c *fn, gctl::point3d_c *en, gctl::point3d_c *et);
|
|
void total_potential();
|
|
void total_gradient();
|
|
void total_tensor();
|
|
|
|
double sign(double s);
|
|
|
|
void routine(const char *para_file);
|
|
|
|
protected:
|
|
int node_num_, ele_num_, site_num_;
|
|
gctl::array<gctl::vertex3d_c> node_; // 四面体元素的顶点集
|
|
gctl::array<gctl::tetrahedron> ele_; // 四面体的元素集
|
|
gctl::array<gctl::point3d_c> magz_; // 磁化矢量
|
|
gctl::array2d<gctl::point3d_c> fnorm_; // 面的外法线矢量
|
|
gctl::array2d<gctl::point3d_c> enorm_; // 边的外法线矢量
|
|
gctl::array2d<gctl::point3d_c> etang_;
|
|
gctl::array<gctl::point3d_c> site_; // 观测点位置集
|
|
|
|
gctl::array<double> mag_pot_; // 正演磁位
|
|
gctl::array<gctl::point3d_c> mag_grad_; // 正演磁场分量
|
|
gctl::array<gctl::tensor> mag_tensor_; // 正演磁场张量
|
|
|
|
gctl::utility::getoption gopt_; // 参数文件解释对象
|
|
};
|
|
|
|
#endif // _MAGTET_H
|