update init_site

This commit is contained in:
张壹 2021-07-29 07:45:12 +08:00
parent d5231db068
commit 46b5976290
6 changed files with 19671 additions and 136 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4
job.sh
View File

@ -24,8 +24,8 @@ echo "======================"
cat <<- EOF > ${logfile}
tet-file = data/prism/prism.1
mag-file = (0,0,200)
#site-file = -30/30/-30/30/10/81/81
site-file = (-30,-30,10)/(30,30,10)/51
site-file = -30/30/-30/30/10/81/81
#site-file = (-30,-30,10)/(30,30,10)/51
obs-file = data/prism/prism
cal-type = potential gradient tensor
EOF

View File

@ -1,6 +1,6 @@
tet-file = data/prism/prism.1
mag-file = (0,0,200)
#site-file = -30/30/-30/30/10/81/81
site-file = (-30,-30,10)/(30,30,10)/51
site-file = -30/30/-30/30/10/81/81
#site-file = (-30,-30,10)/(30,30,10)/51
obs-file = data/prism/prism
cal-type = potential gradient tensor

View File

@ -55,6 +55,18 @@ void magtet::init_site(std::string para)
return;
}
// try to use the para in the format <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xsize>/<ysize>
double xmin, xmax, ymin, ymax, z;
int xsize, ysize;
if (-1 != gctl::parse_string_to_value(para, '/', xmin, xmax, ymin, ymax, z, xsize, ysize))
{
gctl::gridspace(gctl::point3dc(xmin, 0.0, 0.5*z), gctl::point3dc(xmax, 0.0, 0.5*z),
gctl::point3dc(0.0, ymin, 0.5*z), gctl::point3dc(0.0, ymax, 0.5*z), xsize, ysize, site_);
site_num_ = site_.size();
return;
}
// try to use the para inthe format (<x1>,<y1>,<z1>)/(<x2>,<y2>,<z2>)/<num>
std::string p1_str, p2_str;
gctl::point3dc p1, p2;
@ -69,14 +81,7 @@ void magtet::init_site(std::string para)
return;
}
// try to use the para in the format <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xsize>/<ysize>
double xmin, xmax, ymin, ymax, z;
int xsize, ysize;
gctl::parse_string_to_value(para, '/', xmin, xmax, ymin, ymax, z, xsize, ysize);
gctl::gridspace(gctl::point3dc(xmin, 0.0, 0.5*z), gctl::point3dc(xmax, 0.0, 0.5*z),
gctl::point3dc(0.0, ymin, 0.5*z), gctl::point3dc(0.0, ymax, 0.5*z), xsize, ysize, site_);
site_num_ = site_.size();
throw gctl::invalid_argument("Fail to parse the parameter: " + para + ". From magtet::init_site(...)");
return;
}
@ -469,7 +474,7 @@ void magtet::routine(const char *para_file)
// read tetgen files
RUN_ECHO(read_tet(gopt_.get_value(TETFILE)), "Reading 3D model file");
// read magnetization file
RUN_ECHO(init_magz(gopt_.get_value(MAGFILE)), "Reading magnetization file");
RUN_ECHO(init_magz(gopt_.get_value(MAGFILE)), "Initiating magnetization vectors");
// read site file
RUN_ECHO(init_site(gopt_.get_value(SITEFILE)), "Initiating observations points");
// initialize tensors