mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
pickle mesh-load also via ngsolve.Mesh('filename.vol.bin')
This commit is contained in:
parent
4b40a7eb31
commit
b51df253fd
@ -146,13 +146,21 @@ void Ng_LoadMesh (const char * filename, ngcore::NgMPI_Comm comm)
|
|||||||
|
|
||||||
if( id == 0) {
|
if( id == 0) {
|
||||||
|
|
||||||
|
mesh.reset (new Mesh());
|
||||||
|
mesh->SetCommunicator(comm);
|
||||||
|
|
||||||
string fn(filename);
|
string fn(filename);
|
||||||
|
if (fn.substr (fn.length()-8, 8) == ".vol.bin")
|
||||||
|
{
|
||||||
|
mesh -> Load(fn);
|
||||||
|
SetGlobalMesh (mesh);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (fn.substr (fn.length()-3, 3) == ".gz")
|
if (fn.substr (fn.length()-3, 3) == ".gz")
|
||||||
infile = new igzstream (filename);
|
infile = new igzstream (filename);
|
||||||
else
|
else
|
||||||
infile = new ifstream (filename);
|
infile = new ifstream (filename);
|
||||||
mesh.reset (new Mesh());
|
|
||||||
mesh->SetCommunicator(comm);
|
|
||||||
mesh -> Load(*infile);
|
mesh -> Load(*infile);
|
||||||
SetGlobalMesh (mesh);
|
SetGlobalMesh (mesh);
|
||||||
|
|
||||||
@ -167,6 +175,8 @@ void Ng_LoadMesh (const char * filename, ngcore::NgMPI_Comm comm)
|
|||||||
memcpy(&buf[0], geom_part_string.c_str(), strs*sizeof(char));
|
memcpy(&buf[0], geom_part_string.c_str(), strs*sizeof(char));
|
||||||
|
|
||||||
delete infile;
|
delete infile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ntasks > 1)
|
if (ntasks > 1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user