gctl_potential/lib/potential/mkernel_tricone.h
2025-01-08 19:27:51 +08:00

82 lines
4.1 KiB
C++

/********************************************************
* ██████╗ ██████╗████████╗██╗
* ██╔════╝ ██╔════╝╚══██╔══╝██║
* ██║ ███╗██║ ██║ ██║
* ██║ ██║██║ ██║ ██║
* ╚██████╔╝╚██████╗ ██║ ███████╗
* ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2022 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_MAG_KERNEL_TRICONE_H
#define _GCTL_MAG_KERNEL_TRICONE_H
#include "gm_data.h"
namespace gctl
{
struct magcone_para
{
point3dc B; ///< 磁化强度矢量 directional magnetizations
tensor F[4]; ///< tensor products of four facets
tensor E[12]; ///< tensor products of six edges
double edglen[12]; ///< edge lengths of six edges
};
typedef type_tricone<magcone_para> magcone; ///< 带magcone_para属性的三角锥结构体
/**
* @brief Calculate the magnetic parameters of given tricone elements.
*
* @param in_tet Input and output elements
* @param out_para Output parameters
* @param mag_B magnetization vecrtors
*/
void callink_magnetic_para(array<magcone> &in_cone, array<magcone_para> &out_para, const array<point3dc> &mag_B);
/**
* @brief Calculate the magnetic parameters of given tricone elements wrt. the spherical coordinates.
*
* @note The value of magnetic susceptibility is taken as one here. This is usefull for calculating
* kernel matrix of the magnetic anomalies.
*
* @param in_tet Input elements
* @param out_para Output parameters
* @param inclina_deg inclination angle of the magnetization vector wrt. the local Cartesian coordinates at every tricone elements
* @param declina_deg declination angle of the magnetization vector wrt. the local Cartesian coordinates at every tricone elements
* @param mag_vec Output magnetization vectors (This is useful for data visualization)
* @param field_tense Tense of the Earth's magnetic field
*/
void callink_magnetic_para_earth_sph(array<magcone> &in_tet, array<magcone_para> &out_para,
double inclina_deg, double declina_deg, array<point3dc> *mag_vec = nullptr, double field_tense = GCTL_T0);
point3dc magkernel_single(const magcone &a_ele, const point3ds &a_op, tensor *R_ptr = nullptr);
void magkernel(matrix<double> &kernel, const array<magcone> &top_ele, const array<magcone> &btm_ele,
const array<point3ds> &obsp, magnetic_field_type_e comp_type = Bz, verbose_type_e verbose = FullMsg);
void magkernel(spmat<double> &kernel, const array<magcone> &top_ele, const array<magcone> &btm_ele,
const array<point3ds> &obsp, double cut_angle, magnetic_field_type_e comp_type = Bz, verbose_type_e verbose = FullMsg);
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);
}
#endif // _GCTL_MAG_KERNEL_TRICONE_H