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,29 +685,33 @@ 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);
|
|
||||||
|
|
||||||
// make string from rest of file (for geometry info!)
|
if(infile)
|
||||||
// (this might be empty, in which case we take the global ng_geometry)
|
{
|
||||||
stringstream geom_part;
|
mesh -> Load(*infile);
|
||||||
geom_part << infile->rdbuf();
|
// make string from rest of file (for geometry info!)
|
||||||
string geom_part_string = geom_part.str();
|
// (this might be empty, in which case we take the global ng_geometry)
|
||||||
strs = geom_part_string.size();
|
stringstream geom_part;
|
||||||
// buf = new char[strs];
|
geom_part << infile->rdbuf();
|
||||||
buf.SetSize(strs);
|
string geom_part_string = geom_part.str();
|
||||||
memcpy(&buf[0], geom_part_string.c_str(), strs*sizeof(char));
|
strs = geom_part_string.size();
|
||||||
|
// buf = new char[strs];
|
||||||
|
buf.SetSize(strs);
|
||||||
|
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