mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +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
|
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;
|
ostream * outfile;
|
||||||
if (filename.find(".vol.gz")!=string::npos)
|
if (filename.find(".vol.gz")!=string::npos)
|
||||||
outfile = new ogzstream(filename.c_str());
|
outfile = new ogzstream(filename.c_str());
|
||||||
@ -872,6 +879,14 @@ namespace netgen
|
|||||||
void Mesh :: Load (const string & filename)
|
void Mesh :: Load (const string & filename)
|
||||||
{
|
{
|
||||||
cout << "filename = " << filename << endl;
|
cout << "filename = " << filename << endl;
|
||||||
|
|
||||||
|
if (filename.find(".vol.bin") != string::npos)
|
||||||
|
{
|
||||||
|
BinaryInArchive in(filename);
|
||||||
|
in & (*this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
istream * infile = NULL;
|
istream * infile = NULL;
|
||||||
|
|
||||||
if (filename.find(".vol.gz") != string::npos)
|
if (filename.find(".vol.gz") != string::npos)
|
||||||
|
@ -685,18 +685,21 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
istream * infile;
|
istream * infile = nullptr;
|
||||||
NgArray<char> buf; // for distributing geometry!
|
NgArray<char> buf; // for distributing geometry!
|
||||||
int strs;
|
int strs;
|
||||||
|
|
||||||
if( id == 0) {
|
if( id == 0) {
|
||||||
|
if (filename.substr (filename.length()-8, 8) == ".vol.bin")
|
||||||
if (filename.substr (filename.length()-3, 3) == ".gz")
|
mesh -> Load(filename);
|
||||||
|
else if (filename.substr (filename.length()-3, 3) == ".gz")
|
||||||
infile = new igzstream (filename.c_str());
|
infile = new igzstream (filename.c_str());
|
||||||
else
|
else
|
||||||
infile = new ifstream (filename.c_str());
|
infile = new ifstream (filename.c_str());
|
||||||
mesh -> Load(*infile);
|
|
||||||
|
|
||||||
|
if(infile)
|
||||||
|
{
|
||||||
|
mesh -> Load(*infile);
|
||||||
// make string from rest of file (for geometry info!)
|
// make string from rest of file (for geometry info!)
|
||||||
// (this might be empty, in which case we take the global ng_geometry)
|
// (this might be empty, in which case we take the global ng_geometry)
|
||||||
stringstream geom_part;
|
stringstream geom_part;
|
||||||
@ -706,8 +709,9 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
// buf = new char[strs];
|
// buf = new char[strs];
|
||||||
buf.SetSize(strs);
|
buf.SetSize(strs);
|
||||||
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