mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Use TextOutArchive to store OCCGeometry in mesh files
This commit is contained in:
parent
17458889aa
commit
e0afa0a916
@ -507,6 +507,24 @@ namespace netgen
|
|||||||
|
|
||||||
shared_ptr<NetgenGeometry> GeometryRegisterArray :: LoadFromMeshFile (istream & ist) const
|
shared_ptr<NetgenGeometry> GeometryRegisterArray :: LoadFromMeshFile (istream & ist) const
|
||||||
{
|
{
|
||||||
|
if (!ist.good())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
string token;
|
||||||
|
ist >> token;
|
||||||
|
if(token == "TextOutArchive")
|
||||||
|
{
|
||||||
|
NetgenGeometry *geo = nullptr;
|
||||||
|
size_t string_length;
|
||||||
|
ist >> string_length;
|
||||||
|
string buffer(string_length+1, '\0');
|
||||||
|
ist.read(&buffer[0], string_length);
|
||||||
|
auto ss = make_shared<stringstream>(buffer);
|
||||||
|
TextInArchive in(ss);
|
||||||
|
in & geo;
|
||||||
|
|
||||||
|
return shared_ptr<NetgenGeometry>(geo);
|
||||||
|
}
|
||||||
for (int i = 0; i < Size(); i++)
|
for (int i = 0; i < Size(); i++)
|
||||||
{
|
{
|
||||||
NetgenGeometry * hgeom = (*this)[i]->LoadFromMeshFile (ist, token);
|
NetgenGeometry * hgeom = (*this)[i]->LoadFromMeshFile (ist, token);
|
||||||
|
@ -1654,6 +1654,18 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OCCGeometry :: SaveToMeshFile (ostream & ost) const
|
||||||
|
{
|
||||||
|
auto ss = make_shared<stringstream>();
|
||||||
|
TextOutArchive out(ss);
|
||||||
|
NetgenGeometry *geo = const_cast<OCCGeometry*>(this);
|
||||||
|
out & geo;
|
||||||
|
|
||||||
|
ost << "TextOutArchive" << endl;
|
||||||
|
ost << ss->str().size() << endl;
|
||||||
|
ost << ss->str();
|
||||||
|
}
|
||||||
|
|
||||||
void OCCGeometry :: DoArchive(Archive& ar)
|
void OCCGeometry :: DoArchive(Archive& ar)
|
||||||
{
|
{
|
||||||
if(ar.Output())
|
if(ar.Output())
|
||||||
|
@ -380,6 +380,7 @@ namespace netgen
|
|||||||
void FinalizeMesh(Mesh& mesh) const override;
|
void FinalizeMesh(Mesh& mesh) const override;
|
||||||
|
|
||||||
void Save (string filename) const override;
|
void Save (string filename) const override;
|
||||||
|
void SaveToMeshFile (ostream & /* ost */) const override;
|
||||||
|
|
||||||
void DoArchive(Archive& ar) override;
|
void DoArchive(Archive& ar) override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user