update src

This commit is contained in:
张壹 2021-10-17 13:12:15 +08:00
parent 637692075e
commit df61a914cf
7 changed files with 6585 additions and 6585 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
tet-file = data/prism/prism.1
mag-file = (0,0,200)
site-file = -30/30/-30/30/10/81/81
obs-file = data/prism/prism
tet-file = data/pipeline/pipeline
mag-file = data/pipeline/magz.txt
site-file = data/pipeline/site.txt
obs-file = data/pipeline/pipeline
cal-type = potential gradient tensor

View File

@ -16,7 +16,7 @@ void magtet::init_magz(std::string para)
if (access(para.c_str(), F_OK) != -1)
{
std::vector<gctl::point3dc> tmp_vec;
gctl::read_text2vector(para, "", tmp_vec);
gctl::read_text2vector(para, tmp_vec);
if (tmp_vec.size() != ele_num_)
{
@ -46,7 +46,7 @@ void magtet::init_site(std::string para)
if (access(para.c_str(), F_OK) != -1)
{
std::vector<gctl::point3dc> tmp_vec;
gctl::read_text2vector(para, "", tmp_vec);
gctl::read_text2vector(para, tmp_vec);
site_num_ = tmp_vec.size();
site_.resize(tmp_vec);
@ -112,11 +112,11 @@ void magtet::write_text(std::string out_name)
outfile << "# x(m) y(m) z(m) Txx(nT/m) Txy(nT/m) Txz(nT/m) Tyx(nT/m) Tyy(nT/m) Tyz(nT/m) Tzx(nT/m) Tzy(nT/m) Tzz(nT/m)" << std::endl;
for (int i = 0; i < site_num_; ++i)
{
outfile << site_[i] << std::setprecision(16) << " " << mag_tensor_[i].value(0,0) << " "
<< mag_tensor_[i].value(0,1) << " " << mag_tensor_[i].value(0,2) << " "
<< mag_tensor_[i].value(1,0) << " " << mag_tensor_[i].value(1,1) << " "
<< mag_tensor_[i].value(1,2) << " " << mag_tensor_[i].value(2,0) << " "
<< mag_tensor_[i].value(2,1) << " " << mag_tensor_[i].value(2,2) << std::endl;
outfile << site_[i] << std::setprecision(16) << " " << mag_tensor_[i].at(0,0) << " "
<< mag_tensor_[i].at(0,1) << " " << mag_tensor_[i].at(0,2) << " "
<< mag_tensor_[i].at(1,0) << " " << mag_tensor_[i].at(1,1) << " "
<< mag_tensor_[i].at(1,2) << " " << mag_tensor_[i].at(2,0) << " "
<< mag_tensor_[i].at(2,1) << " " << mag_tensor_[i].at(2,2) << std::endl;
}
outfile.close();
}
@ -228,7 +228,7 @@ gctl::point3dc magtet::mag_gradient(const mag_tetrahedron &tet, const gctl::poin
if (j == 0)
{
wi0 = gctl::dot(site - *tet.fget(f, j), mpara->fnorm[f]);
sig = sign(wi0);
sig = gctl::sign(wi0);
absw = std::abs(wi0);
}
@ -304,7 +304,7 @@ gctl::tensor magtet::mag_tensor(const mag_tetrahedron &tet, const gctl::point3dc
if (j == 0)
{
wi0 = gctl::dot(site - *tet.fget(f, j), mpara->fnorm[f]);
sig = sign(wi0);
sig = gctl::sign(wi0);
absw = std::abs(wi0);
}
@ -383,7 +383,7 @@ void magtet::total_potential()
// malloc space
mag_pot_.resize(site_num_, 0.0);
gctl::utility::progress_bar bar(ele_num_, "MagPotential");
gctl::progress_bar bar(ele_num_, "MagPotential");
for (e = 0; e < ele_num_; ++e)
{
bar.progressed(e);
@ -403,7 +403,7 @@ void magtet::total_gradient()
// malloc space
mag_grad_.resize(site_num_, gctl::point3dc(0.0, 0.0, 0.0));
gctl::utility::progress_bar bar(ele_num_, "MagGradient");
gctl::progress_bar bar(ele_num_, "MagGradient");
for (e = 0; e < ele_num_; ++e)
{
bar.progressed(e);
@ -423,7 +423,7 @@ void magtet::total_tensor()
// malloc space
mag_tensor_.resize(site_num_, gctl::tensor(0.0));
gctl::utility::progress_bar bar(ele_num_, "MagTensor");
gctl::progress_bar bar(ele_num_, "MagTensor");
for (e = 0; e < ele_num_; ++e)
{
bar.progressed(e);
@ -437,12 +437,12 @@ void magtet::total_tensor()
return;
}
double magtet::sign(double s)
{
if (s > TOL) return 1.0;
if (s < -1.0*TOL) return -1.0;
return 0.0;
}
//double magtet::sign(double s)
//{
// if (s > TOL) return 1.0;
// if (s < -1.0*TOL) return -1.0;
// return 0.0;
//}
void magtet::routine(const char *para_file)
{

View File

@ -46,7 +46,7 @@ public:
void total_gradient();
void total_tensor();
double sign(double s);
//double sign(double s);
void routine(const char *para_file);
protected:
@ -61,7 +61,7 @@ protected:
gctl::array<gctl::point3dc> mag_grad_; // 正演磁场分量
gctl::array<gctl::tensor> mag_tensor_; // 正演磁场张量
gctl::utility::getoption gopt_; // 参数文件解释对象
gctl::getoption gopt_; // 参数文件解释对象
};
#endif // _MAGTET_H