tmp update

This commit is contained in:
张壹 2024-07-05 15:32:50 +08:00
parent 87d348c8ad
commit 98dc47eb00
7 changed files with 11198 additions and 18 deletions

3721
m3d/test/B.dat Normal file

File diff suppressed because it is too large Load Diff

3721
m3d/test/T.dat Normal file

File diff suppressed because it is too large Load Diff

3721
m3d/test/V.dat Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,7 +1,7 @@
CXX := g++ CXX := g++
CXXFLAGS := -Xpreprocessor -fopenmp -O2 -lomp CXXFLAGS := -Xpreprocessor -fopenmp -O2 -L/opt/homebrew/lib -lomp
M3DINCLUDE := -I../src M3DINCLUDE := -I../src -I/opt/homebrew/include
INCS:= $(wildcard ../src/*.h) INCS:= $(wildcard ../src/*.h)
SRCS:= $(wildcard ../src/*.cpp) SRCS:= $(wildcard ../src/*.cpp)

View File

@ -1,3 +1,4 @@
21
0 -30 10 0 -30 10
0 -27 10 0 -27 10
0 -24 10 0 -24 10

View File

@ -19,7 +19,7 @@ void read_sites(std::string site_file, std::vector<Point>& sites)
for (unsigned int i=0; i<n_sites; i++) { for (unsigned int i=0; i<n_sites; i++) {
unsigned int site_id=0; unsigned int site_id=0;
Point xyz; Point xyz;
site_stream >> site_id site_stream //>> site_id
>> xyz(0) // x-coordinate value >> xyz(0) // x-coordinate value
>> xyz(1) // y-coordinate value >> xyz(1) // y-coordinate value
>> xyz(2); // z-coordinate value >> xyz(2); // z-coordinate value
@ -29,7 +29,7 @@ void read_sites(std::string site_file, std::vector<Point>& sites)
} }
//------------------write---------------------------------------------- //------------------write----------------------------------------------
void write_vector(std::string name, std::vector<double>& v) void write_vector(std::string name, std::vector<Point>& sites, std::vector<double>& v)
{ {
// Open the of stream // Open the of stream
std::ofstream out(name.c_str()); std::ofstream out(name.c_str());
@ -37,14 +37,16 @@ void write_vector(std::string name, std::vector<double>& v)
std::cerr<<"Can not open file:\t"<<name std::cerr<<"Can not open file:\t"<<name
<<std::endl; <<std::endl;
} else { } else {
for(unsigned int i=0; i<v.size(); i++) for(unsigned int i=0; i<v.size(); i++) {
out<< sites[i](0) << " " << sites[i](1) << " " << sites[i](2) << " ";
out<<std::setprecision(16)<<v[i]<<"\n"; out<<std::setprecision(16)<<v[i]<<"\n";
}
} }
out.close(); out.close();
} }
void write_vector(std::string name, std::vector<Point>& v) void write_vector(std::string name, std::vector<Point>& sites, std::vector<Point>& v)
{ {
// Open the of stream // Open the of stream
std::ofstream out(name.c_str()); std::ofstream out(name.c_str());
@ -52,14 +54,17 @@ void write_vector(std::string name, std::vector<Point>& v)
std::cerr<<"Can not open file:\t"<<name std::cerr<<"Can not open file:\t"<<name
<<std::endl; <<std::endl;
} else { } else {
for(unsigned int i=0; i<v.size(); i++) for(unsigned int i=0; i<v.size(); i++) {
out<<std::setprecision(16)<<v[i](0)<<"\t"<<v[i](1)<<"\t"<<v[i](2)<<"\n"; out<< sites[i](0) << " " << sites[i](1) << " " << sites[i](2) << " ";
out<<std::setprecision(16)<<v[i](0)<<" "<<v[i](1)<<" "<<v[i](2)<<"\n";
}
} }
out.close(); out.close();
} }
void write_vector(std::string name, std::vector<Point> & TBx, void write_vector(std::string name, std::vector<Point>& sites,
std::vector<Point> & TBx,
std::vector<Point> & TBy, std::vector<Point> & TBy,
std::vector<Point> & TBz) std::vector<Point> & TBz)
{ {
@ -70,9 +75,10 @@ void write_vector(std::string name, std::vector<Point> & TBx,
<<std::endl; <<std::endl;
} else { } else {
for(unsigned int i=0; i<TBx.size(); i++) { for(unsigned int i=0; i<TBx.size(); i++) {
out<<std::setprecision(16)<<TBx[i](0)<<"\t"<<TBx[i](1)<<"\t"<<TBx[i](2)<<"\t"; out<< sites[i](0) << " " << sites[i](1) << " " << sites[i](2) << " ";
out<<std::setprecision(16)<<TBy[i](0)<<"\t"<<TBy[i](1)<<"\t"<<TBy[i](2)<<"\t"; out<<std::setprecision(16)<<TBx[i](0)<<" "<<TBx[i](1)<<" "<<TBx[i](2)<<" ";
out<<std::setprecision(16)<<TBz[i](0)<<"\t"<<TBz[i](1)<<"\t"<<TBz[i](2)<<"\n"; out<<std::setprecision(16)<<TBy[i](0)<<" "<<TBy[i](1)<<" "<<TBy[i](2)<<" ";
out<<std::setprecision(16)<<TBz[i](0)<<" "<<TBz[i](1)<<" "<<TBz[i](2)<<"\n";
} }
} }
out.close(); out.close();
@ -95,9 +101,19 @@ int main(int argc, char *argv[])
// read grid // read grid
Grid grid(node_file, tet_file); Grid grid(node_file, tet_file);
// read sites // read sites
std::vector<Point> sites; std::vector<Point> sites(61*61);
read_sites(site_file, sites); for (int i = 0; i < 61; i++)
write_vector("xyz.dat", sites); {
for (int j = 0; j < 61; j++)
{
sites[i*61 + j](0) = -30 + j;
sites[i*61 + j](1) = -30 + i;
sites[i*61 + j](2) = 10;
}
}
//read_sites(site_file, sites);
//write_vector("xyz.dat", sites);
// loop each site and tet pair // loop each site and tet pair
const int n_sites = sites.size(); const int n_sites = sites.size();
@ -141,9 +157,9 @@ int main(int argc, char *argv[])
} // done. } // done.
write_vector("V.dat", Vs); // NA-1m-3 write_vector("V.dat", sites, Vs); // NA-1m-3
write_vector("B.dat", Bs); // nT write_vector("B.dat", sites, Bs); // nT
write_vector("T.dat", Tx, Ty, Tz); // nT/m write_vector("T.dat", sites, Tx, Ty, Tz); // nT/m
return 0; return 0;
} }