diff --git a/libsrc/meshing/meshtype.cpp b/libsrc/meshing/meshtype.cpp index 9bebaec4..46ea7b57 100644 --- a/libsrc/meshing/meshtype.cpp +++ b/libsrc/meshing/meshtype.cpp @@ -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; diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 9bf8084b..3a63a9ca 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -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();