Merge branch 'attach_marked_els_to_mesh' into 'master'

marked elements now in BisectionInfo member of meshclass instead of global

See merge request ngsolve/netgen!606
This commit is contained in:
Schöberl, Joachim 2023-09-13 11:16:18 +02:00
commit 3c33c7c07a
2 changed files with 65 additions and 25 deletions

View File

@ -8,20 +8,6 @@
namespace netgen namespace netgen
{ {
class MarkedTet;
class MarkedPrism;
class MarkedIdentification;
class MarkedTri;
class MarkedQuad;
typedef Array<MarkedTet> T_MTETS;
typedef NgArray<MarkedPrism> T_MPRISMS;
typedef NgArray<MarkedIdentification> T_MIDS;
typedef NgArray<MarkedTri> T_MTRIS;
typedef NgArray<MarkedQuad> T_MQUADS;
class MarkedTet class MarkedTet
{ {
public: public:
@ -1867,20 +1853,25 @@ namespace netgen
} }
} }
BisectionInfo::BisectionInfo()
{
mtets = make_unique<T_MTETS>();
mprisms = make_unique<T_MPRISMS>();
mids = make_unique<T_MIDS>();
mtris = make_unique<T_MTRIS>();
mquads = make_unique<T_MQUADS>();
}
BisectionInfo::~BisectionInfo() {}
void WriteMarkedElements(const Mesh& mesh, ostream & ost)
T_MTETS mtets;
T_MPRISMS mprisms;
T_MIDS mids;
T_MTRIS mtris;
T_MQUADS mquads;
void WriteMarkedElements(ostream & ost)
{ {
ost << "Marked Elements\n"; ost << "Marked Elements\n";
const auto& mtets = *mesh.bisectioninfo.mtets;
const auto& mprisms = *mesh.bisectioninfo.mprisms;
const auto& mids = *mesh.bisectioninfo.mids;
const auto& mtris = *mesh.bisectioninfo.mtris;
const auto& mquads = *mesh.bisectioninfo.mquads;
ost << mtets.Size() << "\n"; ost << mtets.Size() << "\n";
for(int i=0; i<mtets.Size(); i++) for(int i=0; i<mtets.Size(); i++)
ost << mtets[i]; ost << mtets[i];
@ -1905,6 +1896,12 @@ namespace netgen
bool ReadMarkedElements(istream & ist, const Mesh & mesh) bool ReadMarkedElements(istream & ist, const Mesh & mesh)
{ {
auto& mtets = *mesh.bisectioninfo.mtets;
auto& mprisms = *mesh.bisectioninfo.mprisms;
auto& mids = *mesh.bisectioninfo.mids;
auto& mtris = *mesh.bisectioninfo.mtris;
auto& mquads = *mesh.bisectioninfo.mquads;
string auxstring(""); string auxstring("");
if(ist) if(ist)
ist >> auxstring; ist >> auxstring;
@ -1964,6 +1961,11 @@ namespace netgen
const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps, const NgArray< NgArray<int,PointIndex::BASE>* > & idmaps,
const string & refinfofile) const string & refinfofile)
{ {
auto& mtets = *mesh.bisectioninfo.mtets;
auto& mprisms = *mesh.bisectioninfo.mprisms;
auto& mids = *mesh.bisectioninfo.mids;
auto& mtris = *mesh.bisectioninfo.mtris;
auto& mquads = *mesh.bisectioninfo.mquads;
if (mesh.GetDimension() < 2) if (mesh.GetDimension() < 2)
throw Exception ("Mesh bisection is available in 2D and 3D"); throw Exception ("Mesh bisection is available in 2D and 3D");
// mtets.SetName ("bisection, tets"); // mtets.SetName ("bisection, tets");
@ -2475,6 +2477,13 @@ namespace netgen
T_MTRIS mtris_old; mtris_old.Copy(mtris); T_MTRIS mtris_old; mtris_old.Copy(mtris);
T_MQUADS mquads_old; mquads_old.Copy(mquads); T_MQUADS mquads_old; mquads_old.Copy(mquads);
*/ */
auto& mtets = *mesh.bisectioninfo.mtets;
auto& mprisms = *mesh.bisectioninfo.mprisms;
auto& mids = *mesh.bisectioninfo.mids;
auto& mtris = *mesh.bisectioninfo.mtris;
auto& mquads = *mesh.bisectioninfo.mquads;
T_MTETS mtets_old (mtets); T_MTETS mtets_old (mtets);
T_MPRISMS mprisms_old (mprisms); T_MPRISMS mprisms_old (mprisms);
T_MIDS mids_old (mids); T_MIDS mids_old (mids);
@ -2700,6 +2709,12 @@ namespace netgen
PrintMessage(1,"Mesh bisection"); PrintMessage(1,"Mesh bisection");
PushStatus("Mesh bisection"); PushStatus("Mesh bisection");
auto& mtets = *mesh.bisectioninfo.mtets;
auto& mprisms = *mesh.bisectioninfo.mprisms;
auto& mids = *mesh.bisectioninfo.mids;
auto& mtris = *mesh.bisectioninfo.mtris;
auto& mquads = *mesh.bisectioninfo.mquads;
static int timer = NgProfiler::CreateTimer ("Bisect"); static int timer = NgProfiler::CreateTimer ("Bisect");
static int timer1 = NgProfiler::CreateTimer ("Bisect 1"); static int timer1 = NgProfiler::CreateTimer ("Bisect 1");
static int timer1a = NgProfiler::CreateTimer ("Bisect 1a"); static int timer1a = NgProfiler::CreateTimer ("Bisect 1a");
@ -4104,7 +4119,7 @@ namespace netgen
PrintMessage(3,"writing marked-elements information to \"",refelementinfofilewrite,"\""); PrintMessage(3,"writing marked-elements information to \"",refelementinfofilewrite,"\"");
ofstream ofst(refelementinfofilewrite.c_str()); ofstream ofst(refelementinfofilewrite.c_str());
WriteMarkedElements(ofst); WriteMarkedElements(mesh, ofst);
ofst.close(); ofst.close();
} }

View File

@ -35,6 +35,30 @@ namespace netgen
class CurvedElements; class CurvedElements;
class AnisotropicClusters; class AnisotropicClusters;
class ParallelMeshTopology; class ParallelMeshTopology;
class MarkedTet;
class MarkedPrism;
class MarkedIdentification;
class MarkedTri;
class MarkedQuad;
typedef Array<MarkedTet> T_MTETS;
typedef NgArray<MarkedPrism> T_MPRISMS;
typedef NgArray<MarkedIdentification> T_MIDS;
typedef NgArray<MarkedTri> T_MTRIS;
typedef NgArray<MarkedQuad> T_MQUADS;
struct BisectionInfo
{
unique_ptr<T_MTETS> mtets;
unique_ptr<T_MPRISMS> mprisms;
unique_ptr<T_MIDS> mids;
unique_ptr<T_MTRIS> mtris;
unique_ptr<T_MQUADS> mquads;
BisectionInfo();
~BisectionInfo();
};
/// 2d/3d mesh /// 2d/3d mesh
class Mesh class Mesh
@ -186,6 +210,7 @@ namespace netgen
public: public:
Signal<> updateSignal; Signal<> updateSignal;
BisectionInfo bisectioninfo;
// store coarse mesh before hp-refinement // store coarse mesh before hp-refinement
unique_ptr<NgArray<HPRefElement>> hpelements; unique_ptr<NgArray<HPRefElement>> hpelements;