mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Merge branch 'archive_localh' into 'master'
DoArchive for LocalH See merge request jschoeberl/netgen!375
This commit is contained in:
commit
f63734e4a0
@ -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 & (float & d) = 0;
|
||||
virtual Archive & operator & (double & d) = 0;
|
||||
virtual Archive & operator & (int & i) = 0;
|
||||
virtual Archive & operator & (long & i) = 0;
|
||||
@ -678,6 +679,8 @@ namespace ngcore
|
||||
BinaryOutArchive& operator=(BinaryOutArchive&&) = delete;
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (float & f) override
|
||||
{ return Write(f); }
|
||||
Archive & operator & (double & d) override
|
||||
{ return Write(d); }
|
||||
Archive & operator & (int & i) override
|
||||
@ -749,6 +752,8 @@ namespace ngcore
|
||||
: BinaryInArchive(std::make_shared<std::ifstream>(filename)) { ; }
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (float & f) override
|
||||
{ Read(f); return *this; }
|
||||
Archive & operator & (double & d) override
|
||||
{ Read(d); return *this; }
|
||||
Archive & operator & (int & i) override
|
||||
@ -813,6 +818,8 @@ namespace ngcore
|
||||
TextOutArchive(std::make_shared<std::ofstream>(filename)) { }
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (float & f) override
|
||||
{ *stream << f << '\n'; return *this; }
|
||||
Archive & operator & (double & d) override
|
||||
{ *stream << d << '\n'; return *this; }
|
||||
Archive & operator & (int & i) override
|
||||
@ -864,6 +871,8 @@ namespace ngcore
|
||||
: TextInArchive(std::make_shared<std::ifstream>(filename)) {}
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (float & f) override
|
||||
{ *stream >> f; return *this; }
|
||||
Archive & operator & (double & d) override
|
||||
{ *stream >> d; return *this; }
|
||||
Archive & operator & (int & i) override
|
||||
@ -924,6 +933,7 @@ namespace ngcore
|
||||
{ h = (char*)&hash_value; }
|
||||
|
||||
using Archive::operator&;
|
||||
Archive & operator & (float & f) override { return ApplyHash(f); }
|
||||
Archive & operator & (double & d) override { return ApplyHash(d); }
|
||||
Archive & operator & (int & i) override { return ApplyHash(i); }
|
||||
Archive & operator & (short & i) override { return ApplyHash(i); }
|
||||
|
@ -23,6 +23,13 @@ namespace netgen
|
||||
hopt = 2 * h2;
|
||||
}
|
||||
|
||||
void GradingBox :: DoArchive(Archive& ar)
|
||||
{
|
||||
ar & xmid[0] & xmid[1] & xmid[2] & h2 & father & hopt &
|
||||
flags.cutboundary & flags.isinner & flags.oldcell & flags.pinner;
|
||||
for(auto i : Range(8))
|
||||
ar & childs[i];
|
||||
}
|
||||
|
||||
BlockAllocator GradingBox :: ball(sizeof (GradingBox));
|
||||
|
||||
@ -93,6 +100,11 @@ namespace netgen
|
||||
root->DeleteChilds();
|
||||
}
|
||||
|
||||
void LocalH :: DoArchive(Archive& ar)
|
||||
{
|
||||
ar & root & grading & boxes & boundingbox & dimension;
|
||||
}
|
||||
|
||||
void LocalH :: SetH (Point<3> p, double h)
|
||||
{
|
||||
if (dimension == 2)
|
||||
|
@ -44,10 +44,14 @@ namespace netgen
|
||||
|
||||
///
|
||||
GradingBox (const double * ax1, const double * ax2);
|
||||
/// default constructor for Archive
|
||||
GradingBox() = default;
|
||||
///
|
||||
void DeleteChilds();
|
||||
///
|
||||
|
||||
void DoArchive(Archive& ar);
|
||||
|
||||
Point<3> PMid() const { return Point<3> (xmid[0], xmid[1], xmid[2]); }
|
||||
double H2() const { return h2; }
|
||||
|
||||
@ -78,7 +82,7 @@ namespace netgen
|
||||
///
|
||||
double grading;
|
||||
///
|
||||
NgArray<GradingBox*> boxes;
|
||||
Array<GradingBox*> boxes;
|
||||
///
|
||||
Box<3> boundingbox;
|
||||
/// octree or quadtree
|
||||
@ -89,11 +93,15 @@ namespace netgen
|
||||
///
|
||||
LocalH (const Box<3> & box, double grading, int adimension = 3)
|
||||
: LocalH (box.PMin(), box.PMax(), grading, adimension) { ; }
|
||||
///
|
||||
/// Default ctor for archive
|
||||
LocalH() = default;
|
||||
|
||||
~LocalH();
|
||||
///
|
||||
void Delete();
|
||||
///
|
||||
void DoArchive(Archive& ar);
|
||||
///
|
||||
void SetGrading (double agrading) { grading = agrading; }
|
||||
///
|
||||
void SetH (Point<3> x, double h);
|
||||
|
Loading…
Reference in New Issue
Block a user