mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
Merge remote-tracking branch 'origin/master' into parallel_meshing
This commit is contained in:
commit
34629749d6
@ -153,6 +153,7 @@ namespace ngcore
|
|||||||
virtual void NeedsVersion(const std::string& /*unused*/, const std::string& /*unused*/) {}
|
virtual void NeedsVersion(const std::string& /*unused*/, const std::string& /*unused*/) {}
|
||||||
|
|
||||||
// Pure virtual functions that have to be implemented by In-/OutArchive
|
// 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 & (float & d) = 0;
|
||||||
virtual Archive & operator & (double & d) = 0;
|
virtual Archive & operator & (double & d) = 0;
|
||||||
virtual Archive & operator & (int & i) = 0;
|
virtual Archive & operator & (int & i) = 0;
|
||||||
@ -275,6 +276,9 @@ namespace ngcore
|
|||||||
Archive & Do (T * data, size_t n)
|
Archive & Do (T * data, size_t n)
|
||||||
{ for (size_t j = 0; j < n; j++) { (*this) & data[j]; }; return *this; }; // NOLINT
|
{ 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)
|
virtual Archive & Do (double * d, size_t n)
|
||||||
{ for (size_t j = 0; j < n; j++) { (*this) & d[j]; }; return *this; }; // NOLINT
|
{ for (size_t j = 0; j < n; j++) { (*this) & d[j]; }; return *this; }; // NOLINT
|
||||||
|
|
||||||
@ -679,6 +683,8 @@ namespace ngcore
|
|||||||
BinaryOutArchive& operator=(BinaryOutArchive&&) = delete;
|
BinaryOutArchive& operator=(BinaryOutArchive&&) = delete;
|
||||||
|
|
||||||
using Archive::operator&;
|
using Archive::operator&;
|
||||||
|
Archive & operator & (std::byte & d) override
|
||||||
|
{ return Write(d); }
|
||||||
Archive & operator & (float & f) override
|
Archive & operator & (float & f) override
|
||||||
{ return Write(f); }
|
{ return Write(f); }
|
||||||
Archive & operator & (double & d) override
|
Archive & operator & (double & d) override
|
||||||
@ -755,6 +761,8 @@ namespace ngcore
|
|||||||
: BinaryInArchive(std::make_shared<std::ifstream>(filename)) { ; }
|
: BinaryInArchive(std::make_shared<std::ifstream>(filename)) { ; }
|
||||||
|
|
||||||
using Archive::operator&;
|
using Archive::operator&;
|
||||||
|
Archive & operator & (std::byte & d) override
|
||||||
|
{ Read(d); return *this; }
|
||||||
Archive & operator & (float & f) override
|
Archive & operator & (float & f) override
|
||||||
{ Read(f); return *this; }
|
{ Read(f); return *this; }
|
||||||
Archive & operator & (double & d) override
|
Archive & operator & (double & d) override
|
||||||
@ -826,6 +834,8 @@ namespace ngcore
|
|||||||
TextOutArchive(std::make_shared<std::ofstream>(filename)) { }
|
TextOutArchive(std::make_shared<std::ofstream>(filename)) { }
|
||||||
|
|
||||||
using Archive::operator&;
|
using Archive::operator&;
|
||||||
|
Archive & operator & (std::byte & d) override
|
||||||
|
{ *stream << std::hex << int(d) << ' '; return *this; }
|
||||||
Archive & operator & (float & f) override
|
Archive & operator & (float & f) override
|
||||||
{ *stream << f << '\n'; return *this; }
|
{ *stream << f << '\n'; return *this; }
|
||||||
Archive & operator & (double & d) override
|
Archive & operator & (double & d) override
|
||||||
@ -879,6 +889,8 @@ namespace ngcore
|
|||||||
: TextInArchive(std::make_shared<std::ifstream>(filename)) {}
|
: TextInArchive(std::make_shared<std::ifstream>(filename)) {}
|
||||||
|
|
||||||
using Archive::operator&;
|
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
|
Archive & operator & (float & f) override
|
||||||
{ *stream >> f; return *this; }
|
{ *stream >> f; return *this; }
|
||||||
Archive & operator & (double & d) override
|
Archive & operator & (double & d) override
|
||||||
@ -941,6 +953,7 @@ namespace ngcore
|
|||||||
{ h = (char*)&hash_value; }
|
{ h = (char*)&hash_value; }
|
||||||
|
|
||||||
using Archive::operator&;
|
using Archive::operator&;
|
||||||
|
Archive & operator & (std::byte & d) override { return ApplyHash(d); }
|
||||||
Archive & operator & (float & f) override { return ApplyHash(f); }
|
Archive & operator & (float & f) override { return ApplyHash(f); }
|
||||||
Archive & operator & (double & d) override { return ApplyHash(d); }
|
Archive & operator & (double & d) override { return ApplyHash(d); }
|
||||||
Archive & operator & (int & i) override { return ApplyHash(i); }
|
Archive & operator & (int & i) override { return ApplyHash(i); }
|
||||||
|
@ -150,7 +150,7 @@ void Ng_LoadMesh (const char * filename, ngcore::NgMPI_Comm comm)
|
|||||||
mesh->SetCommunicator(comm);
|
mesh->SetCommunicator(comm);
|
||||||
|
|
||||||
string fn(filename);
|
string fn(filename);
|
||||||
if (fn.substr (fn.length()-8, 8) == ".vol.bin")
|
if (fn.length() > 8 && fn.substr (fn.length()-8, 8) == ".vol.bin")
|
||||||
{
|
{
|
||||||
mesh -> Load(fn);
|
mesh -> Load(fn);
|
||||||
SetGlobalMesh (mesh);
|
SetGlobalMesh (mesh);
|
||||||
|
@ -331,7 +331,7 @@ double BFGS (
|
|||||||
{
|
{
|
||||||
if (LDLtUpdate (l, d, 1 / a1, y) != 0)
|
if (LDLtUpdate (l, d, 1 / a1, y) != 0)
|
||||||
{
|
{
|
||||||
cerr << "BFGS update error1" << endl;
|
// cerr << "BFGS update error1" << endl;
|
||||||
(*testout) << "BFGS update error1" << endl;
|
(*testout) << "BFGS update error1" << endl;
|
||||||
(*testout) << "l " << endl << l << endl
|
(*testout) << "l " << endl << l << endl
|
||||||
<< "d " << d << endl;
|
<< "d " << d << endl;
|
||||||
@ -341,7 +341,7 @@ double BFGS (
|
|||||||
|
|
||||||
if (LDLtUpdate (l, d, -1 / a2, bs) != 0)
|
if (LDLtUpdate (l, d, -1 / a2, bs) != 0)
|
||||||
{
|
{
|
||||||
cerr << "BFGS update error2" << endl;
|
// cerr << "BFGS update error2" << endl;
|
||||||
(*testout) << "BFGS update error2" << endl;
|
(*testout) << "BFGS update error2" << endl;
|
||||||
(*testout) << "l " << endl << l << endl
|
(*testout) << "l " << endl << l << endl
|
||||||
<< "d " << d << endl;
|
<< "d " << d << endl;
|
||||||
|
@ -1140,8 +1140,8 @@ namespace netgen
|
|||||||
typ = ELEMENT_TYPE(_typ);
|
typ = ELEMENT_TYPE(_typ);
|
||||||
is_curved = _curved;
|
is_curved = _curved;
|
||||||
|
|
||||||
for (size_t i = 0; i < np; i++)
|
static_assert(sizeof(int) == sizeof (PointIndex));
|
||||||
ar & pnum[i];
|
ar.Do( (int*)&pnum[0], np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element :: SetOrder (const int aorder)
|
void Element :: SetOrder (const int aorder)
|
||||||
|
@ -377,7 +377,9 @@ namespace netgen
|
|||||||
|
|
||||||
void DoArchive (Archive & ar)
|
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);
|
ar & (unsigned char&)(type);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
buildedges = static_buildedges;
|
buildedges = static_buildedges;
|
||||||
buildfaces = static_buildfaces;
|
buildfaces = static_buildfaces;
|
||||||
|
buildvertex2element = static_buildvertex2element;
|
||||||
timestamp = -1;
|
timestamp = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +76,7 @@ namespace netgen
|
|||||||
|
|
||||||
bool MeshTopology :: static_buildedges = true;
|
bool MeshTopology :: static_buildedges = true;
|
||||||
bool MeshTopology :: static_buildfaces = true;
|
bool MeshTopology :: static_buildfaces = true;
|
||||||
|
bool MeshTopology :: static_buildvertex2element = true;
|
||||||
|
|
||||||
void MeshTopology :: EnableTableStatic (string name, bool set)
|
void MeshTopology :: EnableTableStatic (string name, bool set)
|
||||||
{
|
{
|
||||||
@ -82,9 +84,11 @@ namespace netgen
|
|||||||
static_buildedges = set;
|
static_buildedges = set;
|
||||||
else if (name == "faces")
|
else if (name == "faces")
|
||||||
static_buildfaces = set;
|
static_buildfaces = set;
|
||||||
|
else if (name == "vertex2element")
|
||||||
|
static_buildvertex2element = set;
|
||||||
else
|
else
|
||||||
throw Exception ("noting known about table "+name +"\n"
|
throw Exception ("noting known about table "+name +"\n"
|
||||||
"knwon are 'edges', 'faces'");
|
"knwon are 'edges', 'faces', 'vertex2element'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,12 +43,12 @@ struct T_FACE
|
|||||||
class MeshTopology
|
class MeshTopology
|
||||||
{
|
{
|
||||||
const Mesh * mesh;
|
const Mesh * mesh;
|
||||||
bool buildvertex2element = true;
|
bool buildvertex2element;
|
||||||
bool buildedges;
|
bool buildedges;
|
||||||
bool buildfaces;
|
bool buildfaces;
|
||||||
bool build_parent_edges = false; // may be changed to default = false
|
bool build_parent_edges = false; // may be changed to default = false
|
||||||
bool build_parent_faces = false; // may be changed to default = false
|
bool build_parent_faces = false; // may be changed to default = false
|
||||||
static bool static_buildedges, static_buildfaces;
|
static bool static_buildedges, static_buildfaces, static_buildvertex2element;
|
||||||
|
|
||||||
NgArray<INDEX_2> edge2vert;
|
NgArray<INDEX_2> edge2vert;
|
||||||
NgArray<INDEX_4> face2vert;
|
NgArray<INDEX_4> face2vert;
|
||||||
|
Loading…
Reference in New Issue
Block a user