mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
.vol.bin format (using archiver)
This commit is contained in:
parent
0aa63880c4
commit
639bbb2c0a
@ -413,6 +413,13 @@ namespace netgen
|
||||
|
||||
void Mesh :: Save (const string & filename) const
|
||||
{
|
||||
if (filename.find(".vol.bin") != string::npos)
|
||||
{
|
||||
BinaryOutArchive in(filename);
|
||||
in & const_cast<Mesh&>(*this);
|
||||
return;
|
||||
}
|
||||
|
||||
ostream * outfile;
|
||||
if (filename.find(".vol.gz")!=string::npos)
|
||||
outfile = new ogzstream(filename.c_str());
|
||||
@ -872,6 +879,14 @@ namespace netgen
|
||||
void Mesh :: Load (const string & filename)
|
||||
{
|
||||
cout << "filename = " << filename << endl;
|
||||
|
||||
if (filename.find(".vol.bin") != string::npos)
|
||||
{
|
||||
BinaryInArchive in(filename);
|
||||
in & (*this);
|
||||
return;
|
||||
}
|
||||
|
||||
istream * infile = NULL;
|
||||
|
||||
if (filename.find(".vol.gz") != string::npos)
|
||||
|
@ -685,18 +685,21 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
return;
|
||||
}
|
||||
|
||||
istream * infile;
|
||||
istream * infile = nullptr;
|
||||
NgArray<char> buf; // for distributing geometry!
|
||||
int strs;
|
||||
|
||||
if( id == 0) {
|
||||
|
||||
if (filename.substr (filename.length()-3, 3) == ".gz")
|
||||
if (filename.substr (filename.length()-8, 8) == ".vol.bin")
|
||||
mesh -> Load(filename);
|
||||
else if (filename.substr (filename.length()-3, 3) == ".gz")
|
||||
infile = new igzstream (filename.c_str());
|
||||
else
|
||||
infile = new ifstream (filename.c_str());
|
||||
mesh -> Load(*infile);
|
||||
|
||||
if(infile)
|
||||
{
|
||||
mesh -> Load(*infile);
|
||||
// make string from rest of file (for geometry info!)
|
||||
// (this might be empty, in which case we take the global ng_geometry)
|
||||
stringstream geom_part;
|
||||
@ -706,8 +709,9 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
// buf = new char[strs];
|
||||
buf.SetSize(strs);
|
||||
memcpy(&buf[0], geom_part_string.c_str(), strs*sizeof(char));
|
||||
|
||||
delete infile;
|
||||
}
|
||||
|
||||
|
||||
if (ntasks > 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user