mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
little tuning of mesh pickling
This commit is contained in:
parent
e0f3ce9cf0
commit
971d6bb465
@ -153,6 +153,7 @@ namespace ngcore
|
||||
virtual void NeedsVersion(const std::string& /*unused*/, const std::string& /*unused*/) {}
|
||||
|
||||
// Pure virtual functions that have to be implemented by In-/OutArchive
|
||||
virtual Archive & operator & (std::byte & d) = 0;
|
||||
virtual Archive & operator & (float & d) = 0;
|
||||
virtual Archive & operator & (double & d) = 0;
|
||||
virtual Archive & operator & (int & i) = 0;
|
||||
@ -275,6 +276,9 @@ namespace ngcore
|
||||
Archive & Do (T * data, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & data[j]; }; return *this; }; // NOLINT
|
||||
|
||||
virtual Archive & Do (std::byte * d, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & d[j]; }; return *this; }; // NOLINT
|
||||
|
||||
virtual Archive & Do (double * d, size_t n)
|
||||
{ for (size_t j = 0; j < n; j++) { (*this) & d[j]; }; return *this; }; // NOLINT
|
||||
|
||||
@ -679,6 +683,8 @@ namespace ngcore
|
||||
BinaryOutArchive& operator=(BinaryOutArchive&&) = delete;
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (std::byte & d) override
|
||||
{ return Write(d); }
|
||||
Archive & operator & (float & f) override
|
||||
{ return Write(f); }
|
||||
Archive & operator & (double & d) override
|
||||
@ -755,6 +761,8 @@ namespace ngcore
|
||||
: BinaryInArchive(std::make_shared<std::ifstream>(filename)) { ; }
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (std::byte & d) override
|
||||
{ Read(d); return *this; }
|
||||
Archive & operator & (float & f) override
|
||||
{ Read(f); return *this; }
|
||||
Archive & operator & (double & d) override
|
||||
@ -826,6 +834,8 @@ namespace ngcore
|
||||
TextOutArchive(std::make_shared<std::ofstream>(filename)) { }
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (std::byte & d) override
|
||||
{ *stream << std::hex << int(d) << ' '; return *this; }
|
||||
Archive & operator & (float & f) override
|
||||
{ *stream << f << '\n'; return *this; }
|
||||
Archive & operator & (double & d) override
|
||||
@ -879,6 +889,8 @@ namespace ngcore
|
||||
: TextInArchive(std::make_shared<std::ifstream>(filename)) {}
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (std::byte & d) override
|
||||
{ int tmp; *stream >> std::hex >> tmp; d = std::byte(tmp); return *this; }
|
||||
Archive & operator & (float & f) override
|
||||
{ *stream >> f; return *this; }
|
||||
Archive & operator & (double & d) override
|
||||
|
@ -377,7 +377,9 @@ namespace netgen
|
||||
|
||||
void DoArchive (Archive & ar)
|
||||
{
|
||||
ar & x[0] & x[1] & x[2] & layer & singular;
|
||||
// ar & x[0] & x[1] & x[2] & layer & singular;
|
||||
ar.Do(&x[0], 3);
|
||||
ar & layer & singular;
|
||||
ar & (unsigned char&)(type);
|
||||
}
|
||||
};
|
||||
@ -845,8 +847,12 @@ 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];
|
||||
*/
|
||||
static_assert(sizeof(int) == sizeof (PointIndex));
|
||||
ar.Do( (int*)&pnum[0], np);
|
||||
}
|
||||
|
||||
#ifdef PARALLEL
|
||||
|
Loading…
Reference in New Issue
Block a user