Set flags correctly when loading Element from Archive

This commit is contained in:
Matthias Hochsteger 2021-06-14 11:58:46 +02:00
parent a51f8ed307
commit 958bbb1ae0
2 changed files with 21 additions and 12 deletions

View File

@ -1124,6 +1124,26 @@ namespace netgen
is_curved = typ != TET; // false;
}
void Element :: DoArchive (Archive & ar)
{
short _np, _typ;
bool _curved;
if (ar.Output())
{ _np = np; _typ = typ; _curved = is_curved; }
ar & _np;
// placement new to init flags
if (ar.Input())
new (this) Element(_np);
ar & _typ & index & _curved;
typ = ELEMENT_TYPE(_typ);
is_curved = _curved;
for (size_t i = 0; i < np; i++)
ar & pnum[i];
}
void Element :: SetOrder (const int aorder)
{
orderx = aorder;

View File

@ -836,18 +836,7 @@ namespace netgen
///
const PointIndex & PNumMod (int i) const { return pnum[(i-1) % np]; }
void DoArchive (Archive & ar)
{
short _np, _typ;
bool _curved;
if (ar.Output())
{ _np = np; _typ = typ; _curved = is_curved; }
ar & _np & _typ & index & _curved;
if (ar.Input())
{ np = _np; typ = ELEMENT_TYPE(_typ); is_curved = _curved; }
for (size_t i = 0; i < np; i++)
ar & pnum[i];
}
void DoArchive (Archive & ar);
#ifdef PARALLEL
static MPI_Datatype MyGetMPIType();