This commit is contained in:
张壹 2025-04-25 18:09:51 +08:00
parent 226e23fad7
commit 3a10544632
32 changed files with 117 additions and 117 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15.2) cmake_minimum_required(VERSION 3.15.2)
# #
project(GCTL_POTENTIAL VERSION 1.0) project(GCTL_POTENTIAL VERSION 2.0)
# #
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)

View File

@ -29,6 +29,9 @@
#define _GCTL_GRAV_KERNEL_BLOCK_H #define _GCTL_GRAV_KERNEL_BLOCK_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/block.h"
#include "gctl/utility/progress_bar.h"
#include "gctl/math/gmath.h"
namespace gctl namespace gctl
{ {

View File

@ -29,6 +29,7 @@
#define _GCTL_GRAV_KERNEL_POLYGON_H #define _GCTL_GRAV_KERNEL_POLYGON_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/vertex.h"
namespace gctl namespace gctl
{ {

View File

@ -29,6 +29,9 @@
#define _GCTL_GRAV_KERNEL_RECTANGLE2D_H #define _GCTL_GRAV_KERNEL_RECTANGLE2D_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/point2c.h"
#include "gctl/poly/rectangle2d.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -29,6 +29,7 @@
#define _GCTL_GRAV_KERNEL_SPHERE_H #define _GCTL_GRAV_KERNEL_SPHERE_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/sphere.h"
#include "gctl/optimization/loss_func.h" #include "gctl/optimization/loss_func.h"
#ifdef GCTL_POTENTIAL_AUTODIFF #ifdef GCTL_POTENTIAL_AUTODIFF

View File

@ -29,6 +29,8 @@
#define _GCTL_GRAV_KERNEL_TESSEROID_H #define _GCTL_GRAV_KERNEL_TESSEROID_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tesseroid.h"
#include "gctl/utility/progress_bar.h"
#ifdef GCTL_POTENTIAL_TESS #ifdef GCTL_POTENTIAL_TESS

View File

@ -1039,7 +1039,7 @@ double gkernel_tetra_potential_sig_sph(const gctl::grav_tetrahedron &a_ele, cons
gctl::gravtet_para* gp = a_ele.att; gctl::gravtet_para* gp = a_ele.att;
op_c = a_op.s2c(); op_c = s2c(a_op);
int *v_order = a_ele.vec_order; int *v_order = a_ele.vec_order;
@ -1108,7 +1108,7 @@ gctl::point3dc gkernel_tetra_gradient_sig_sph(const gctl::grav_tetrahedron &a_el
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
int *v_order = a_ele.vec_order; int *v_order = a_ele.vec_order;
@ -1178,7 +1178,7 @@ gctl::tensor gkernel_tetra_tensor_sig_sph(const gctl::grav_tetrahedron &a_ele, c
R_T = R.transpose(); R_T = R.transpose();
op_c = a_op.s2c(); op_c = s2c(a_op);
int *v_order = a_ele.vec_order; int *v_order = a_ele.vec_order;

View File

@ -29,6 +29,9 @@
#define _GCTL_GRAV_KERNEL_TETRAHEDRON_H #define _GCTL_GRAV_KERNEL_TETRAHEDRON_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tetrahedron.h"
#include "gctl/math/geometry3d.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -360,7 +360,7 @@ double gkernel_triangle_potential_sig_sph(const gctl::grav_triangle &a_ele, cons
gctl::gravtri_para *gp = a_ele.att; gctl::gravtri_para *gp = a_ele.att;
op_c = a_op.s2c(); op_c = s2c(a_op);
r_ijk[0] = *a_ele.vert[0] - op_c; r_ijk[0] = *a_ele.vert[0] - op_c;
r_ijk[1] = *a_ele.vert[1] - op_c; r_ijk[1] = *a_ele.vert[1] - op_c;
@ -423,7 +423,7 @@ gctl::point3dc gkernel_triangle_gradient_sig_sph(const gctl::grav_triangle &a_el
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
r_ijk[0] = *a_ele.vert[0] - op_c; r_ijk[0] = *a_ele.vert[0] - op_c;
r_ijk[1] = *a_ele.vert[1] - op_c; r_ijk[1] = *a_ele.vert[1] - op_c;
@ -487,7 +487,7 @@ gctl::tensor gkernel_triangle_tensor_sig_sph(const gctl::grav_triangle &a_ele, c
R_T = R.transpose(); R_T = R.transpose();
op_c = a_op.s2c(); op_c = s2c(a_op);
r_ijk[0] = *a_ele.vert[0] - op_c; r_ijk[0] = *a_ele.vert[0] - op_c;
r_ijk[1] = *a_ele.vert[1] - op_c; r_ijk[1] = *a_ele.vert[1] - op_c;

View File

@ -29,6 +29,8 @@
#define _GCTL_GRAV_KERNEL_TRIANGLE_H #define _GCTL_GRAV_KERNEL_TRIANGLE_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/triangle.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -443,7 +443,7 @@ void gkernel_triangle2d_vz2(gctl::matrix<double> &out_kernel, const gctl::array<
if (verbose == gctl::FullMsg) bar.progressed(i); if (verbose == gctl::FullMsg) bar.progressed(i);
else if (verbose == gctl::ShortMsg) bar.progressed_simple(i); else if (verbose == gctl::ShortMsg) bar.progressed_simple(i);
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
#pragma omp parallel for private (j, obsg) schedule(guided) #pragma omp parallel for private (j, obsg) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
@ -471,7 +471,7 @@ void gkernel_triangle2d_vx2(gctl::matrix<double> &out_kernel, const gctl::array<
if (verbose == gctl::FullMsg) bar.progressed(i); if (verbose == gctl::FullMsg) bar.progressed(i);
else if (verbose == gctl::ShortMsg) bar.progressed_simple(i); else if (verbose == gctl::ShortMsg) bar.progressed_simple(i);
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
#pragma omp parallel for private (j, obsg) schedule(guided) #pragma omp parallel for private (j, obsg) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
@ -500,7 +500,7 @@ void gkernel_triangle2d_vxx2(gctl::matrix<double> &out_kernel, const gctl::array
if (verbose == gctl::FullMsg) bar.progressed(i); if (verbose == gctl::FullMsg) bar.progressed(i);
else if (verbose == gctl::ShortMsg) bar.progressed_simple(i); else if (verbose == gctl::ShortMsg) bar.progressed_simple(i);
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
#pragma omp parallel for private (j, t) schedule(guided) #pragma omp parallel for private (j, t) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
@ -532,7 +532,7 @@ void gkernel_triangle2d_vxz2(gctl::matrix<double> &out_kernel, const gctl::array
if (verbose == gctl::FullMsg) bar.progressed(i); if (verbose == gctl::FullMsg) bar.progressed(i);
else if (verbose == gctl::ShortMsg) bar.progressed_simple(i); else if (verbose == gctl::ShortMsg) bar.progressed_simple(i);
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
#pragma omp parallel for private (j, t) schedule(guided) #pragma omp parallel for private (j, t) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
@ -564,7 +564,7 @@ void gkernel_triangle2d_vzx2(gctl::matrix<double> &out_kernel, const gctl::array
if (verbose == gctl::FullMsg) bar.progressed(i); if (verbose == gctl::FullMsg) bar.progressed(i);
else if (verbose == gctl::ShortMsg) bar.progressed_simple(i); else if (verbose == gctl::ShortMsg) bar.progressed_simple(i);
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
#pragma omp parallel for private (j, t) schedule(guided) #pragma omp parallel for private (j, t) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
@ -596,7 +596,7 @@ void gkernel_triangle2d_vzz2(gctl::matrix<double> &out_kernel, const gctl::array
if (verbose == gctl::FullMsg) bar.progressed(i); if (verbose == gctl::FullMsg) bar.progressed(i);
else if (verbose == gctl::ShortMsg) bar.progressed_simple(i); else if (verbose == gctl::ShortMsg) bar.progressed_simple(i);
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
#pragma omp parallel for private (j, t) schedule(guided) #pragma omp parallel for private (j, t) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
@ -774,7 +774,7 @@ void gobser_triangle2d_vz2(gctl::array<double> &out_obs, const gctl::array<gctl:
#pragma omp parallel for private (i, obsg, obsc) schedule(guided) #pragma omp parallel for private (i, obsg, obsc) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
obsg.x = gkernel_triangle2d_vx_sig(ele.get(j), &obsc); // 沿x轴正方向的重力值 obsg.x = gkernel_triangle2d_vx_sig(ele.get(j), &obsc); // 沿x轴正方向的重力值
obsg.y = gkernel_triangle2d_vz_sig(ele.get(j), &obsc); // 沿z轴负方向的重力值 obsg.y = gkernel_triangle2d_vz_sig(ele.get(j), &obsc); // 沿z轴负方向的重力值
out_obs[i] += (obsg.y*sin(obsp[i].arc) - obsg.x*cos(obsp[i].arc))*rho[j]; // 沿半径负方向的重力值 out_obs[i] += (obsg.y*sin(obsp[i].arc) - obsg.x*cos(obsp[i].arc))*rho[j]; // 沿半径负方向的重力值
@ -802,7 +802,7 @@ void gobser_triangle2d_vx2(gctl::array<double> &out_obs, const gctl::array<gctl:
#pragma omp parallel for private (i, obsg, obsc) schedule(guided) #pragma omp parallel for private (i, obsg, obsc) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
obsg.x = gkernel_triangle2d_vx_sig(ele.get(j), &obsc); // 沿x轴正方向的重力值 obsg.x = gkernel_triangle2d_vx_sig(ele.get(j), &obsc); // 沿x轴正方向的重力值
obsg.y = gkernel_triangle2d_vz_sig(ele.get(j), &obsc); // 沿z轴负方向的重力值 obsg.y = gkernel_triangle2d_vz_sig(ele.get(j), &obsc); // 沿z轴负方向的重力值
out_obs[i] += (-1.0*obsg.y*cos(obsp[i].arc) + obsg.x*sin(obsp[i].arc))*rho[j]; // 沿弧度负方向的重力值 out_obs[i] += (-1.0*obsg.y*cos(obsp[i].arc) + obsg.x*sin(obsp[i].arc))*rho[j]; // 沿弧度负方向的重力值
@ -831,7 +831,7 @@ void gobser_triangle2d_vxx2(gctl::array<double> &out_obs, const gctl::array<gctl
#pragma omp parallel for private (i, t, obsc) schedule(guided) #pragma omp parallel for private (i, t, obsc) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc); t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc);
t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc); t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc);
t[0][0] = -1.0*t[1][1]; t[0][0] = -1.0*t[1][1];
@ -862,7 +862,7 @@ void gobser_triangle2d_vxz2(gctl::array<double> &out_obs, const gctl::array<gctl
#pragma omp parallel for private (i, t, obsc) schedule(guided) #pragma omp parallel for private (i, t, obsc) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc); t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc);
t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc); t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc);
t[0][0] = -1.0*t[1][1]; t[0][0] = -1.0*t[1][1];
@ -893,7 +893,7 @@ void gobser_triangle2d_vzx2(gctl::array<double> &out_obs, const gctl::array<gctl
#pragma omp parallel for private (i, t, obsc) schedule(guided) #pragma omp parallel for private (i, t, obsc) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc); t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc);
t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc); t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc);
t[0][0] = -1.0*t[1][1]; t[0][0] = -1.0*t[1][1];
@ -924,7 +924,7 @@ void gobser_triangle2d_vzz2(gctl::array<double> &out_obs, const gctl::array<gctl
#pragma omp parallel for private (i, t, obsc) schedule(guided) #pragma omp parallel for private (i, t, obsc) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsc = obsp[i].p2c(); obsc = p2c(obsp[i]);
t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc); t[1][0] = gkernel_triangle2d_vzx_sig(ele.get(j), &obsc);
t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc); t[1][1] = gkernel_triangle2d_vzz_sig(ele.get(j), &obsc);
t[0][0] = -1.0*t[1][1]; t[0][0] = -1.0*t[1][1];

View File

@ -29,6 +29,8 @@
#define _GCTL_GRAV_KERNEL_TRIANGLE2D_H #define _GCTL_GRAV_KERNEL_TRIANGLE2D_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/triangle2d.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -432,7 +432,7 @@ double gkernel_tricone_pot_sig(const gctl::gravcone &a_ele, const gctl::point3ds
gctl::gravcone_para* gp = a_ele.att; gctl::gravcone_para* gp = a_ele.att;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -533,7 +533,7 @@ double gkernel_tricone_vr_sig(const gctl::gravcone &a_ele, const gctl::point3ds
R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi); R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi);
R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi); R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi);
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -597,7 +597,7 @@ double gkernel_tricone_vrp_sig(const gctl::gravcone &a_ele, const gctl::point3ds
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -666,7 +666,7 @@ double gkernel_tricone_vrt_sig(const gctl::gravcone &a_ele, const gctl::point3ds
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -735,7 +735,7 @@ double gkernel_tricone_vrr_sig(const gctl::gravcone &a_ele, const gctl::point3ds
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)

View File

@ -29,6 +29,9 @@
#define _GCTL_GRAV_KERNEL_TRICONE_H #define _GCTL_GRAV_KERNEL_TRICONE_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tri_cone.h"
#include "gctl/math/geometry3d.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -334,7 +334,7 @@ void gobser_mGrad_tricone_vr(gctl::array<double> &out_mGrad,
#pragma omp parallel for private (j) shared(i) schedule(guided) #pragma omp parallel for private (j) shared(i) schedule(guided)
for (j = 0; j < v_size; j++) for (j = 0; j < v_size; j++)
{ {
if (angle(ops[i].s2c(), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0) if (angle(s2c(ops[i]), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0)
out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vr_sig(vert_neighList[j], j, ops[i], rho); out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vr_sig(vert_neighList[j], j, ops[i], rho);
} }
} }
@ -379,7 +379,7 @@ void gobser_mGrad_tricone_vrp(gctl::array<double> &out_mGrad,
#pragma omp parallel for private (j) shared(i) schedule(guided) #pragma omp parallel for private (j) shared(i) schedule(guided)
for (j = 0; j < v_size; j++) for (j = 0; j < v_size; j++)
{ {
if (angle(ops[i].s2c(), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0) if (angle(s2c(ops[i]), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0)
out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vrp_sig(vert_neighList[j], j, ops[i], rho); out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vrp_sig(vert_neighList[j], j, ops[i], rho);
} }
} }
@ -424,7 +424,7 @@ void gobser_mGrad_tricone_vrt(gctl::array<double> &out_mGrad,
#pragma omp parallel for private (j) shared(i) schedule(guided) #pragma omp parallel for private (j) shared(i) schedule(guided)
for (j = 0; j < v_size; j++) for (j = 0; j < v_size; j++)
{ {
if (angle(ops[i].s2c(), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0) if (angle(s2c(ops[i]), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0)
out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vrt_sig(vert_neighList[j], j, ops[i], rho); out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vrt_sig(vert_neighList[j], j, ops[i], rho);
} }
} }
@ -469,7 +469,7 @@ void gobser_mGrad_tricone_vrr(gctl::array<double> &out_mGrad,
#pragma omp parallel for private (j) shared(i) schedule(guided) #pragma omp parallel for private (j) shared(i) schedule(guided)
for (j = 0; j < v_size; j++) for (j = 0; j < v_size; j++)
{ {
if (angle(ops[i].s2c(), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0) if (angle(s2c(ops[i]), verts_ptr->at(j)) <= ang_limit*GCTL_Pi/180.0)
out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vrr_sig(vert_neighList[j], j, ops[i], rho); out_mGrad.at(j) += obs_diff[i] * gobser_mGrad_tricone_vrr_sig(vert_neighList[j], j, ops[i], rho);
} }
} }
@ -631,7 +631,7 @@ double gobser_mGrad_tricone_vr_sig(const std::vector<gctl::gravcone_gji*> &a_lis
R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi); R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi);
R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi); R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi);
op_c = a_op.s2c(); op_c = s2c(a_op);
double point_sum = 0.0; double point_sum = 0.0;
for (int j = 0; j < a_list.size(); j++) for (int j = 0; j < a_list.size(); j++)
@ -842,7 +842,7 @@ double gobser_mGrad_tricone_vrp_sig(const std::vector<gctl::gravcone_gji*> &a_li
R.y = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R.y = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R.z = 0.0; R.z = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
double point_sum = 0.0; double point_sum = 0.0;
for (int j = 0; j < a_list.size(); j++) for (int j = 0; j < a_list.size(); j++)
@ -1033,7 +1033,7 @@ double gobser_mGrad_tricone_vrt_sig(const std::vector<gctl::gravcone_gji*> &a_li
R.y = cos((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi); R.y = cos((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi);
R.z = -1.0*sin((0.5-a_op.lat/180.0)*GCTL_Pi); R.z = -1.0*sin((0.5-a_op.lat/180.0)*GCTL_Pi);
op_c = a_op.s2c(); op_c = s2c(a_op);
double point_sum = 0.0; double point_sum = 0.0;
for (int j = 0; j < a_list.size(); j++) for (int j = 0; j < a_list.size(); j++)
@ -1220,7 +1220,7 @@ double gobser_mGrad_tricone_vrr_sig(const std::vector<gctl::gravcone_gji*> &a_li
R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi); R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi);
R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi); R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi);
op_c = a_op.s2c(); op_c = s2c(a_op);
double point_sum = 0.0; double point_sum = 0.0;
for (int j = 0; j < a_list.size(); j++) for (int j = 0; j < a_list.size(); j++)
@ -1404,7 +1404,7 @@ double gkernel_tricone_gji_pot_sig(const gctl::gravcone_gji &a_ele, const gctl::
gctl::gravcone_para_gji* gp = a_ele.att; gctl::gravcone_para_gji* gp = a_ele.att;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -1461,7 +1461,7 @@ double gkernel_tricone_gji_vr_sig(const gctl::gravcone_gji &a_ele, const gctl::p
R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi); R.y = sin((0.5-a_op.lat/180.0)*GCTL_Pi)*sin((2.0+a_op.lon/180.0)*GCTL_Pi);
R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi); R.z = cos((0.5-a_op.lat/180.0)*GCTL_Pi);
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -1525,7 +1525,7 @@ double gkernel_tricone_gji_vrp_sig(const gctl::gravcone_gji &a_ele, const gctl::
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -1594,7 +1594,7 @@ double gkernel_tricone_gji_vrt_sig(const gctl::gravcone_gji &a_ele, const gctl::
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
@ -1663,7 +1663,7 @@ double gkernel_tricone_gji_vrr_sig(const gctl::gravcone_gji &a_ele, const gctl::
R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi); R[2][1] = cos((2.0+a_op.lon/180.0)*GCTL_Pi);
R[2][2] = 0.0; R[2][2] = 0.0;
op_c = a_op.s2c(); op_c = s2c(a_op);
face_sum = edge_sum = 0.0; face_sum = edge_sum = 0.0;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)

View File

@ -34,12 +34,12 @@
#include <thread> #include <thread>
#endif #endif
#include "gctl/core.h" #include "gctl/core/array.h"
#include "gctl/utility.h" #include "gctl/poly/point3s.h"
#include "gctl/geometry.h" #include "gctl/poly/tensor.h"
#include "gctl/maths.h" #include "gctl/math/gmath.h"
#include "gctl/algorithms.h" #include "gctl/io/dsv_io.h"
#include "gctl/io.h" #include "gctl/utility/utc_time.h"
namespace gctl namespace gctl
{ {

View File

@ -30,6 +30,8 @@
#include "gctl/mesh/regular_grid.h" #include "gctl/mesh/regular_grid.h"
#include "gm_data.h" #include "gm_data.h"
#include "gctl/math/extrapolate.h"
#include "gctl/math/space_filter.h"
namespace gctl namespace gctl
{ {

View File

@ -48,7 +48,7 @@ gctl::point3dc gctl::magkernel_single(const mag_dipole &a_dipole, const point3ds
else R = transform_matrix(a_op); else R = transform_matrix(a_op);
double r = a_op.rad; double r = a_op.rad;
point3dc pc = a_op.s2c(); point3dc pc = s2c(a_op);
// T -> nT 1e+9 * 1e-7 -> 1e+2 // T -> nT 1e+9 * 1e-7 -> 1e+2
point3dc b = 1e+2*a_dipole.M*(3.0*dot(a_dipole.n, pc)/power5(r)*pc - 1.0/power3(r)*a_dipole.n); point3dc b = 1e+2*a_dipole.M*(3.0*dot(a_dipole.n, pc)/power5(r)*pc - 1.0/power3(r)*a_dipole.n);

View File

@ -29,6 +29,8 @@
#define _GCTL_MAG_KERNEL_DIPOLE_H #define _GCTL_MAG_KERNEL_DIPOLE_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/vertex.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -29,6 +29,8 @@
#define _GCTL_MAG_KERNEL_TESSEROID_H #define _GCTL_MAG_KERNEL_TESSEROID_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tesseroid.h"
#include "gctl/utility/progress_bar.h"
#ifdef GCTL_POTENTIAL_MAGTESS #ifdef GCTL_POTENTIAL_MAGTESS

View File

@ -142,7 +142,7 @@ void gctl::callink_magnetic_para_earth_sph(array<mag_tetrahedron> &in_tet, array
mag_z.y = cos(I)*cos(A); mag_z.y = cos(I)*cos(A);
mag_z.z = -1.0*sin(I); mag_z.z = -1.0*sin(I);
s = in_tet[i].center().c2s(); s = c2s(in_tet[i].center());
// magnetic susceptibility is taken as one here // magnetic susceptibility is taken as one here
// rotate the local coordinate system to the regular status // rotate the local coordinate system to the regular status
out_para[i].B = field_tense * mag_z.rotate((90.0 - s.lat)*GCTL_Pi/180.0, 0.0, (90.0 + s.lon)*GCTL_Pi/180.0).normal(); out_para[i].B = field_tense * mag_z.rotate((90.0 - s.lat)*GCTL_Pi/180.0, 0.0, (90.0 + s.lon)*GCTL_Pi/180.0).normal();
@ -231,7 +231,7 @@ gctl::point3dc gctl::magkernel_single(const gctl::mag_tetrahedron &a_ele, const
else R = transform_matrix(a_op); else R = transform_matrix(a_op);
gctl::magtet_para* gp = a_ele.att; gctl::magtet_para* gp = a_ele.att;
gctl::point3dc pc = a_op.s2c(); gctl::point3dc pc = s2c(a_op);
int *v_order = a_ele.vec_order; int *v_order = a_ele.vec_order;
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)

View File

@ -29,6 +29,8 @@
#define _GCTL_MAG_KERNEL_TETRAHEDRON_H #define _GCTL_MAG_KERNEL_TETRAHEDRON_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tetrahedron.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -148,7 +148,7 @@ void gctl::callink_magnetic_para_earth_sph(array<magtet_ren17> &in_tet, array<ma
mag_z.y = cos(I)*cos(A); mag_z.y = cos(I)*cos(A);
mag_z.z = -1.0*sin(I); mag_z.z = -1.0*sin(I);
s = in_tet[i].center().c2s(); s = c2s(in_tet[i].center());
// magnetic susceptibility is taken as one here // magnetic susceptibility is taken as one here
// rotate the local coordinate system to the regular status // rotate the local coordinate system to the regular status
mag_z = field_tense * mag_z.rotate((90.0 - s.lat)*M_PI/180.0, 0.0, (90.0 + s.lon)*M_PI/180.0).normal(); mag_z = field_tense * mag_z.rotate((90.0 - s.lat)*M_PI/180.0, 0.0, (90.0 + s.lon)*M_PI/180.0).normal();
@ -203,7 +203,7 @@ void gctl::callink_magnetic_para_earth_sph(magtet_ren17 &in_tet, magtet_para_ren
mag_z.y = cos(I)*cos(A); mag_z.y = cos(I)*cos(A);
mag_z.z = -1.0*sin(I); mag_z.z = -1.0*sin(I);
s = in_tet.center().c2s(); s = c2s(in_tet.center());
// magnetic susceptibility is taken as one here // magnetic susceptibility is taken as one here
// rotate the local coordinate system to the regular status // rotate the local coordinate system to the regular status
mag_z = field_tense * mag_z.rotate((90.0 - s.lat)*M_PI/180.0, 0.0, (90.0 + s.lon)*M_PI/180.0).normal(); mag_z = field_tense * mag_z.rotate((90.0 - s.lat)*M_PI/180.0, 0.0, (90.0 + s.lon)*M_PI/180.0).normal();
@ -362,7 +362,7 @@ void gctl::magkernel(matrix<point3dc> &out_kernel, const array<magtet_ren17> &el
#pragma omp parallel for private (j, obsp_c) schedule(guided) #pragma omp parallel for private (j, obsp_c) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
obsp_c = obsp[i].s2c(); obsp_c = s2c(obsp[i]);
out_kernel[i][j] = magkernel_tetrahedron_gradient_sig(ele[j], obsp_c); out_kernel[i][j] = magkernel_tetrahedron_gradient_sig(ele[j], obsp_c);
} }
} }
@ -411,7 +411,7 @@ void gctl::magkernel(matrix<tensor> &out_kernel, const array<magtet_ren17> &ele,
#pragma omp parallel for private (j, obsp_c) schedule(guided) #pragma omp parallel for private (j, obsp_c) schedule(guided)
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
obsp_c = obsp[i].s2c(); obsp_c = s2c(obsp[i]);
out_kernel[i][j] = magkernel_tetrahedron_tensor_sig(ele[j], obsp_c); out_kernel[i][j] = magkernel_tetrahedron_tensor_sig(ele[j], obsp_c);
} }
} }
@ -461,7 +461,7 @@ gctl::point3dc gctl::magkernel_single(const magtet_ren17 &ele, const point3ds &o
R[2][1] = cos((2.0+obsp.lon/180.0)*M_PI); R[2][1] = cos((2.0+obsp.lon/180.0)*M_PI);
R[2][2] = 0.0; R[2][2] = 0.0;
point3dc obsp_c = obsp.s2c(); point3dc obsp_c = s2c(obsp);
point3dc out_k = magkernel_tetrahedron_gradient_sig(ele, obsp_c); point3dc out_k = magkernel_tetrahedron_gradient_sig(ele, obsp_c);
out_k = R * out_k; out_k = R * out_k;
@ -634,7 +634,7 @@ void gctl::magobser(array<point3dc> &out_obs, const array<magtet_ren17> &ele, co
#pragma omp parallel for private (i, obsp_c) schedule(guided) #pragma omp parallel for private (i, obsp_c) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsp_c = obsp[i].s2c(); obsp_c = s2c(obsp[i]);
out_obs[i] = out_obs[i] + sus[j] * magkernel_tetrahedron_gradient_sig(ele[j], obsp_c); out_obs[i] = out_obs[i] + sus[j] * magkernel_tetrahedron_gradient_sig(ele[j], obsp_c);
} }
} }
@ -680,7 +680,7 @@ void gctl::magobser(array<tensor> &out_obs, const array<magtet_ren17> &ele, cons
#pragma omp parallel for private (i, obsp_c) schedule(guided) #pragma omp parallel for private (i, obsp_c) schedule(guided)
for (i = 0; i < o_size; i++) for (i = 0; i < o_size; i++)
{ {
obsp_c = obsp[i].s2c(); obsp_c = s2c(obsp[i]);
out_obs[i] = out_obs[i] + sus[j] * magkernel_tetrahedron_tensor_sig(ele[j], obsp_c); out_obs[i] = out_obs[i] + sus[j] * magkernel_tetrahedron_tensor_sig(ele[j], obsp_c);
} }
} }

View File

@ -29,6 +29,8 @@
#define _GCTL_MAG_KERNEL_TETRAHEDRON_REN2017_H #define _GCTL_MAG_KERNEL_TETRAHEDRON_REN2017_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tetrahedron.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -137,7 +137,7 @@ void gctl::callink_magnetic_para_earth_sph(array<mag_triangle> &in_tri, array<ma
mag_z.y = cos(I)*cos(A); mag_z.y = cos(I)*cos(A);
mag_z.z = -1.0*sin(I); mag_z.z = -1.0*sin(I);
s = in_tri[i].center().c2s(); s = c2s(in_tri[i].center());
// magnetic susceptibility is taken as one here // magnetic susceptibility is taken as one here
// rotate the local coordinate system to the regular status // rotate the local coordinate system to the regular status
out_para[i].B = field_tense * mag_z.rotate((90.0 - s.lat)*GCTL_Pi/180.0, 0.0, (90.0 + s.lon)*GCTL_Pi/180.0).normal(); out_para[i].B = field_tense * mag_z.rotate((90.0 - s.lat)*GCTL_Pi/180.0, 0.0, (90.0 + s.lon)*GCTL_Pi/180.0).normal();
@ -218,7 +218,7 @@ gctl::point3dc gctl::magkernel_single(const mag_triangle &a_ele, const point3ds
else R = transform_matrix(a_op); else R = transform_matrix(a_op);
gctl::magtri_para *gp = a_ele.att; gctl::magtri_para *gp = a_ele.att;
gctl::point3dc pc = a_op.s2c(); gctl::point3dc pc = s2c(a_op);
r_ijk[0] = *a_ele.vert[0] - pc; r_ijk[0] = *a_ele.vert[0] - pc;
r_ijk[1] = *a_ele.vert[1] - pc; r_ijk[1] = *a_ele.vert[1] - pc;

View File

@ -29,6 +29,8 @@
#define _GCTL_MAG_KERNEL_TRIANGLE_H #define _GCTL_MAG_KERNEL_TRIANGLE_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/triangle.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -97,7 +97,7 @@ void gctl::callink_magnetic_para_earth_sph(array<magcone> &in_tet, array<magcone
mag_z.z = -1.0*sin(I); mag_z.z = -1.0*sin(I);
c = 1.0/3.0*(*in_tet[i].vert[0] + *in_tet[i].vert[1] + *in_tet[i].vert[2]); c = 1.0/3.0*(*in_tet[i].vert[0] + *in_tet[i].vert[1] + *in_tet[i].vert[2]);
s = c.c2s(); s = c2s(c);
// magnetic susceptibility is taken as one here // magnetic susceptibility is taken as one here
// rotate the local coordinate system to the regular status // rotate the local coordinate system to the regular status
out_para[i].B = field_tense * mag_z.rotate((90.0 - s.lat)*GCTL_Pi/180.0, 0.0, (90.0 + s.lon)*GCTL_Pi/180.0).normal(); out_para[i].B = field_tense * mag_z.rotate((90.0 - s.lat)*GCTL_Pi/180.0, 0.0, (90.0 + s.lon)*GCTL_Pi/180.0).normal();
@ -138,7 +138,7 @@ gctl::point3dc gctl::magkernel_single(const magcone &a_ele, const point3ds &a_op
else R = transform_matrix(a_op); else R = transform_matrix(a_op);
gctl::magcone_para* gp = a_ele.att; gctl::magcone_para* gp = a_ele.att;
gctl::point3dc pc = a_op.s2c(); gctl::point3dc pc = s2c(a_op);
for (f = 0; f < 4; f++) for (f = 0; f < 4; f++)
{ {
@ -278,7 +278,7 @@ void gctl::magkernel(spmat<double> &kernel, const array<magcone> &top_ele, const
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]); cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]);
if (geometry3d::angle(obsp[i].s2c(), cen) < cut_angle*GCTL_Pi/180.0) if (geometry3d::angle(s2c(obsp[i]), cen) < cut_angle*GCTL_Pi/180.0)
{ {
tmp_plt.r_id = i; tmp_plt.r_id = i;
tmp_plt.c_id = j; tmp_plt.c_id = j;
@ -300,7 +300,7 @@ void gctl::magkernel(spmat<double> &kernel, const array<magcone> &top_ele, const
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]); cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]);
if (geometry3d::angle(obsp[i].s2c(), cen) < cut_angle*GCTL_Pi/180.0) if (geometry3d::angle(s2c(obsp[i]), cen) < cut_angle*GCTL_Pi/180.0)
{ {
mag_b = magkernel_single(top_ele[j], obsp[i], Rs.get(i)); mag_b = magkernel_single(top_ele[j], obsp[i], Rs.get(i));
if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val = mag_b.y; if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val = mag_b.y;
@ -319,7 +319,7 @@ void gctl::magkernel(spmat<double> &kernel, const array<magcone> &top_ele, const
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
cen = 1.0/3.0*(*btm_ele[j].vert[0] + *btm_ele[j].vert[1] + *btm_ele[j].vert[2]); cen = 1.0/3.0*(*btm_ele[j].vert[0] + *btm_ele[j].vert[1] + *btm_ele[j].vert[2]);
if (geometry3d::angle(obsp[i].s2c(), cen) < cut_angle*GCTL_Pi/180.0) if (geometry3d::angle(s2c(obsp[i]), cen) < cut_angle*GCTL_Pi/180.0)
{ {
mag_b = magkernel_single(btm_ele[j], obsp[i], Rs.get(i)); mag_b = magkernel_single(btm_ele[j], obsp[i], Rs.get(i));
if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val -= mag_b.y; if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val -= mag_b.y;

View File

@ -29,6 +29,9 @@
#define _GCTL_MAG_KERNEL_TRICONE_H #define _GCTL_MAG_KERNEL_TRICONE_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tri_cone.h"
#include "gctl/utility/progress_bar.h"
#include "gctl/math/geometry3d.h"
namespace gctl namespace gctl
{ {

View File

@ -107,7 +107,7 @@ void gctl::callink_magnetic_para_earth_sph(array<magcone_ren17> &in_cone, array<
mag_z.z = -1.0*sin(I); mag_z.z = -1.0*sin(I);
c = 1.0/3.0*(*in_cone[i].vert[0] + *in_cone[i].vert[1] + *in_cone[i].vert[2]); c = 1.0/3.0*(*in_cone[i].vert[0] + *in_cone[i].vert[1] + *in_cone[i].vert[2]);
s = c.c2s(); s = c2s(c);
// magnetic susceptibility is taken as one here // magnetic susceptibility is taken as one here
// rotate the local coordinate system to the regular status // rotate the local coordinate system to the regular status
mag_z = field_tense * mag_z.rotate((90.0 - s.lat)*M_PI/180.0, 0.0, (90.0 + s.lon)*M_PI/180.0).normal(); mag_z = field_tense * mag_z.rotate((90.0 - s.lat)*M_PI/180.0, 0.0, (90.0 + s.lon)*M_PI/180.0).normal();
@ -151,7 +151,7 @@ gctl::point3dc gctl::magkernel_single(const magcone_ren17 &a_ele, const point3ds
else R = transform_matrix(a_op); else R = transform_matrix(a_op);
// get the observation site in the local coordinates // get the observation site in the local coordinates
gctl::point3dc site = a_op.s2c(); gctl::point3dc site = s2c(a_op);
gctl::point3dc out_grad(0.0, 0.0, 0.0); gctl::point3dc out_grad(0.0, 0.0, 0.0);
for (int f = 0; f < 4; ++f) for (int f = 0; f < 4; ++f)
{ {
@ -238,7 +238,7 @@ gctl::tensor gctl::magkernel_single_tensor(const magcone_ren17 &a_ele, const poi
R_T = R.transpose(); R_T = R.transpose();
// get the observation site in the local coordinates // get the observation site in the local coordinates
gctl::point3dc site = a_op.s2c(); gctl::point3dc site = s2c(a_op);
gctl::tensor out_tensor(0.0); gctl::tensor out_tensor(0.0);
for (int f = 0; f < 4; ++f) for (int f = 0; f < 4; ++f)
{ {
@ -435,7 +435,7 @@ void gctl::magkernel(spmat<double> &kernel, const array<magcone_ren17> &top_ele,
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]); cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]);
if (geometry3d::angle(obsp[i].s2c(), cen) < cut_angle*GCTL_Pi/180.0) if (geometry3d::angle(s2c(obsp[i]), cen) < cut_angle*GCTL_Pi/180.0)
{ {
tmp_plt.r_id = i; tmp_plt.r_id = i;
tmp_plt.c_id = j; tmp_plt.c_id = j;
@ -457,7 +457,7 @@ void gctl::magkernel(spmat<double> &kernel, const array<magcone_ren17> &top_ele,
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]); cen = 1.0/3.0*(*top_ele[j].vert[0] + *top_ele[j].vert[1] + *top_ele[j].vert[2]);
if (geometry3d::angle(obsp[i].s2c(), cen) < cut_angle*GCTL_Pi/180.0) if (geometry3d::angle(s2c(obsp[i]), cen) < cut_angle*GCTL_Pi/180.0)
{ {
mag_b = magkernel_single(top_ele[j], obsp[i], Rs.get(i)); mag_b = magkernel_single(top_ele[j], obsp[i], Rs.get(i));
if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val = mag_b.y; if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val = mag_b.y;
@ -476,7 +476,7 @@ void gctl::magkernel(spmat<double> &kernel, const array<magcone_ren17> &top_ele,
for (j = 0; j < e_size; j++) for (j = 0; j < e_size; j++)
{ {
cen = 1.0/3.0*(*btm_ele[j].vert[0] + *btm_ele[j].vert[1] + *btm_ele[j].vert[2]); cen = 1.0/3.0*(*btm_ele[j].vert[0] + *btm_ele[j].vert[1] + *btm_ele[j].vert[2]);
if (geometry3d::angle(obsp[i].s2c(), cen) < cut_angle*GCTL_Pi/180.0) if (geometry3d::angle(s2c(obsp[i]), cen) < cut_angle*GCTL_Pi/180.0)
{ {
mag_b = magkernel_single(btm_ele[j], obsp[i], Rs.get(i)); mag_b = magkernel_single(btm_ele[j], obsp[i], Rs.get(i));
if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val -= mag_b.y; if (comp_type == Bx) triplts[tri_idx[j + i*e_size]].val -= mag_b.y;

View File

@ -29,6 +29,9 @@
#define _GCTL_MAG_KERNEL_TRICONE_REN2017_H #define _GCTL_MAG_KERNEL_TRICONE_REN2017_H
#include "gm_data.h" #include "gm_data.h"
#include "gctl/poly/tri_cone.h"
#include "gctl/math/geometry3d.h"
#include "gctl/utility/progress_bar.h"
namespace gctl namespace gctl
{ {

View File

@ -438,7 +438,7 @@ void save_text(const std::vector<std::string> &cmd_units)
void data_cloud(const std::vector<std::string> &cmd_units) void data_cloud(const std::vector<std::string> &cmd_units)
{ {
// data-cloud \<new-data-name\> node|cell \<data-could-file\> \<search-x\> \<search-y\> \<search-deg\> [\<text_descriptor\>] // data-cloud \<new-data-name\> node|cell \<data-could-file\> \<search-x\> \<search-y\> \<search-deg\>
if (cmd_units.size() < 7) throw std::runtime_error("data-cloud: insufficient parameters."); if (cmd_units.size() < 7) throw std::runtime_error("data-cloud: insufficient parameters.");
gctl::array<std::string> copy_str(7, "null"); gctl::array<std::string> copy_str(7, "null");
@ -452,33 +452,15 @@ void data_cloud(const std::vector<std::string> &cmd_units)
else if (copy_str[1] == "cell") d_type = ElemData; else if (copy_str[1] == "cell") d_type = ElemData;
else throw std::runtime_error("open-surfer: invalid grid data type."); else throw std::runtime_error("open-surfer: invalid grid data type.");
text_descriptor desc; geodsv_io text_in;
desc.file_name_ = copy_str[2]; text_in.load_text(copy_str[2]);
desc.file_ext_ = ".txt";
desc.col_str_ = "0,1,2";
desc.delimiter_ = ' ';
desc.att_sym_ = '#';
desc.head_num_ = 0;
if (copy_str[6] != "null")
{
parse_string_to_value(copy_str[6], '/', true, desc.col_str_,
desc.delimiter_, desc.att_sym_, desc.head_num_);
}
std::vector<double> posix_vec, posiy_vec, data_vec; array<point2dc> posi_arr;
read_text2vectors(desc, posix_vec, posiy_vec, data_vec); _1d_array data_vec;
text_in.get_column_point2dc(posi_arr, 0, 1);
text_in.get_column(data_vec, 2);
array<point2dc> posi_arr(posix_vec.size()); rg.load_data_cloud(posi_arr, data_vec, atof(copy_str[3].c_str()), atof(copy_str[4].c_str()), atof(copy_str[5].c_str()), copy_str[0], d_type);
array<double> posi_val;
posi_val.input(data_vec);
for (size_t i = 0; i < posi_arr.size(); i++)
{
posi_arr[i].x = posix_vec[i];
posi_arr[i].y = posiy_vec[i];
}
rg.load_data_cloud(posi_arr, posi_val, atof(copy_str[3].c_str()), atof(copy_str[4].c_str()), atof(copy_str[5].c_str()), copy_str[0], d_type);
return; return;
} }
@ -721,29 +703,9 @@ void get_profile(const std::vector<std::string> &cmd_units)
} }
else // File exist else // File exist
{ {
text_descriptor desc; geodsv_io fio;
desc.file_name_ = copy_str[2]; fio.load_text(copy_str[2]);
desc.file_ext_ = ".txt"; fio.get_column_point2dc(xys, 0, 1);
desc.att_sym_ = '#';
desc.col_str_ = "0,1";
desc.delimiter_ = ' ';
desc.head_num_ = 0;
if (copy_str[3] != "null")
{
gctl::parse_string_to_value(copy_str[3], '/', true, desc.col_str_, desc.delimiter_,
desc.att_sym_, desc.head_num_);
}
std::vector<double> xs, ys;
gctl::read_text2vectors(desc, xs, ys);
xys.resize(xs.size());
for (size_t i = 0; i < xys.size(); i++)
{
xys[i].x = xs[i];
xys[i].y = ys[i];
}
rg.extract_points(copy_str[0], xys, p_data); rg.extract_points(copy_str[0], xys, p_data);
} }

View File

@ -22,8 +22,8 @@ Mathematic expresstions could be used to specify the grid ranges.
4. `save gmsh <file>` Save the grid using the Gmsh legacy format. This command will write all data that are allowed for outputing. 4. `save gmsh <file>` Save the grid using the Gmsh legacy format. This command will write all data that are allowed for outputing.
5. `save text <file>` Save the grid data to text file. 5. `save text <file>` Save the grid data to text file.
#### cloud \<new-data-name\> node|cell \<data-could-file\> \<search-x\> \<search-y\> \<search-deg\> [\<text_descriptor\>] #### cloud \<new-data-name\> node|cell \<data-could-file\> \<search-x\> \<search-y\> \<search-deg\>
Import a randomly distributed data could (namely a xyz data). Note that a grid must exist before the use this command. 'node' or 'cell' indicates whether the input could data should be node or cell registed. \<data-could-file\> is the input data file. \<search-x\>,\<search-y\> and \<search-deg\> defines an oval of which the command is used to interpolate the could data to grid points. Additional options for reading the \<data-could-file\> could be given by the [\<text_descriptor\>] argument which has a format of \<order_str\>/\<delimiter\>/\<annotate\>/\<head_record\>. For example 0,1,2/,/#/0 means that the intput data could is stored int the first three columns separated by commas. The file has no head records and any line starts with '#' is an annotation. Import a randomly distributed data could (namely a xyz data). Note that a grid must exist before the use this command. 'node' or 'cell' indicates whether the input could data should be node or cell registed. \<data-could-file\> is the input data file. \<search-x\>,\<search-y\> and \<search-deg\> defines an oval of which the command is used to interpolate the could data to grid points.
#### gradient \<data-name\> \<new-data-name\> dx|dy \<order\> #### gradient \<data-name\> \<new-data-name\> dx|dy \<order\>
Calculate directional gradient(s) of the selected data. The new gradient data will have the same Calculate directional gradient(s) of the selected data. The new gradient data will have the same