add profile support

This commit is contained in:
张壹 2021-07-28 17:41:18 +08:00
parent 755282373a
commit d5231db068
6 changed files with 162 additions and 19671 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

16
job.sh
View File

@ -1,10 +1,15 @@
#!/bin/bash
# tet-file needs both .node and .ele files generated by Tetgen. No file extension is needed
# mag-file: magnetization vectors. format1: <filename> format2: (<magz-x>,<magz-y>,<magz-z>)
# mag-file: line format: <magz-x> <magz-y> <magz-z>
# site-file format: 1. <filename> 2. <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xnum>/<ynum>
# site-file line format: <x> <y> <z>
# mag-file: magnetization vectors.
# mag-file format:
# 1. <filename>. Line format: <magz-x> <magz-y> <magz-z>
# 2: (<magz-x>,<magz-y>,<magz-z>)
# site-file: observation positions.
# site-file format:
# 1. <filename>. Line format: <x> <y> <z>
# 2. <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xnum>/<ynum>
# 3. (<x1>,<y1>,<z1>)/(<x2>,<y2>,<z2>)/<num>
# obs-file needs only the output file's name with no file extension
# available calculating types: potential, gradient and tensor
@ -19,7 +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/-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,5 +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/-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,20 @@ void magtet::init_site(std::string para)
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;
int pnum;
if (-1 != gctl::parse_string_to_value(para, '/', p1_str, p2_str, pnum))
{
p1.str(p1_str);
p2.str(p2_str);
gctl::linespace(p1, p2, pnum, site_);
site_num_ = site_.size();
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;
@ -501,18 +515,18 @@ int main(int argc, char const *argv[])
{
if (argc == 1)
{
std::clog << "Magnetic gradient tensors of homologous tetrahedrons.\n";
std::clog << "Usage: ./magtet <para-file>\n";
std::clog << "Option format:\n";
std::clog << "<option> = <value>\n";
std::clog << "Available options:\n";
std::clog << "tet-file: 3D model file. this option needs both .node and .ele files generated by Tetgen. No file extension is needed\n";
std::clog << "mag-file: magnetization vectors. format1: <filename> format2: (<magz-x>,<magz-y>,<magz-z>)\n";
std::clog << "mag-file: line format: <magz-x> <magz-y> <magz-z>\n";
std::clog << "site-file: observation points. format1: <filename> format2: <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xnum>/<ynum>\n";
std::clog << "site-file: line format: <x> <y> <z>\n";
std::clog << "obs-file: output observation files. No file extension is needed\n";
std::clog << "cal-type: available calculating types: potential, gradient and tensor\n";
std::cout << "tet-file needs both .node and .ele files generated by Tetgen. No file extension is needed\n";
std::cout << "mag-file: magnetization vectors.\n";
std::cout << "mag-file format:\n";
std::cout << "1. <filename>. Line format: <magz-x> <magz-y> <magz-z>\n";
std::cout << "2: (<magz-x>,<magz-y>,<magz-z>)\n";
std::cout << "site-file: observation positions.\n";
std::cout << "site-file format:\n";
std::cout << "1. <filename>. Line format: <x> <y> <z>\n";
std::cout << "2. <xmin>/<xmax>/<ymin>/<ymax>/<z>/<xnum>/<ynum>\n";
std::cout << "3. (<x1>,<y1>,<z1>)/(<x2>,<y2>,<z2>)/<num>\n";
std::cout << "obs-file needs only the output file's name with no file extension\n";
std::cout << "available calculating types: potential, gradient and tensor\n";
return -1;
}