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
@ -207,7 +207,7 @@ namespace ngcore
|
|||||||
Do(&v[0], size);
|
Do(&v[0], size);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// archive implementation for enums
|
// archive implementation for enums
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto operator & (T& val) -> std::enable_if_t<std::is_enum<T>::value, Archive&>
|
auto operator & (T& val) -> std::enable_if_t<std::is_enum<T>::value, Archive&>
|
||||||
@ -809,6 +809,8 @@ namespace ngcore
|
|||||||
return *this;
|
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
|
Archive & Do (double * d, size_t n) override
|
||||||
{ stream->read(reinterpret_cast<char*>(d), n*sizeof(double)); return *this; } // NOLINT
|
{ stream->read(reinterpret_cast<char*>(d), n*sizeof(double)); return *this; } // NOLINT
|
||||||
Archive & Do (int * i, size_t n) override
|
Archive & Do (int * i, size_t n) override
|
||||||
|
@ -840,6 +840,7 @@ namespace netgen
|
|||||||
|
|
||||||
void DoArchive (Archive & ar)
|
void DoArchive (Archive & ar)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
short _np, _typ;
|
short _np, _typ;
|
||||||
bool _curved;
|
bool _curved;
|
||||||
if (ar.Output())
|
if (ar.Output())
|
||||||
@ -847,10 +848,24 @@ namespace netgen
|
|||||||
ar & _np & _typ & index & _curved;
|
ar & _np & _typ & index & _curved;
|
||||||
if (ar.Input())
|
if (ar.Input())
|
||||||
{ np = _np; typ = ELEMENT_TYPE(_typ); is_curved = _curved; }
|
{ 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));
|
static_assert(sizeof(int) == sizeof (PointIndex));
|
||||||
ar.Do( (int*)&pnum[0], np);
|
ar.Do( (int*)&pnum[0], np);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user