mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
tuning mesh(un)pickling
This commit is contained in:
parent
e84d4e90c8
commit
54db7941d0
@ -809,6 +809,8 @@ namespace ngcore
|
||||
return *this;
|
||||
}
|
||||
|
||||
Archive & Do (std::byte * d, size_t n) override
|
||||
{ stream->read(reinterpret_cast<char*>(d), n*sizeof(std::byte)); return *this; } // NOLINT
|
||||
Archive & Do (double * d, size_t n) override
|
||||
{ stream->read(reinterpret_cast<char*>(d), n*sizeof(double)); return *this; } // NOLINT
|
||||
Archive & Do (int * i, size_t n) override
|
||||
|
@ -840,6 +840,7 @@ namespace netgen
|
||||
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
/*
|
||||
short _np, _typ;
|
||||
bool _curved;
|
||||
if (ar.Output())
|
||||
@ -847,10 +848,24 @@ namespace netgen
|
||||
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];
|
||||
*/
|
||||
|
||||
if (ar.Output())
|
||||
{
|
||||
short _np, _typ;
|
||||
bool _curved;
|
||||
_np = np; _typ = typ; _curved = is_curved;
|
||||
ar & _np & _typ & index & _curved;
|
||||
}
|
||||
else
|
||||
{
|
||||
alignas (4) std::byte tmp[9];
|
||||
ar.Do (&tmp[0], 9);
|
||||
np = *(short*)(void*)&tmp[0];
|
||||
typ = ELEMENT_TYPE(*(short*)(void*)&tmp[2]);
|
||||
index = *(int*)(void*)&tmp[4];
|
||||
is_curved = *(bool*)(void*)&tmp[8];
|
||||
}
|
||||
static_assert(sizeof(int) == sizeof (PointIndex));
|
||||
ar.Do( (int*)&pnum[0], np);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user