little polish

This commit is contained in:
Joachim Schoeberl 2021-11-07 00:16:57 +01:00
parent 1eca091fd3
commit 478aaf7788
4 changed files with 31 additions and 60 deletions

View File

@ -428,10 +428,6 @@ namespace netgen
unsigned int orderx:6; unsigned int orderx:6;
unsigned int ordery:6; unsigned int ordery:6;
// #ifdef PARALLEL
// int partitionNumber;
// #endif
/// a linked list for all segments in the same face /// a linked list for all segments in the same face
SurfaceElementIndex next; SurfaceElementIndex next;
@ -687,13 +683,6 @@ namespace netgen
int meshdocval; int meshdocval;
/// ///
int hp_elnr; int hp_elnr;
/*
#ifdef PARALLEL
int GetPartition () const { return partitionNumber; }
void SetPartition (int nr) { partitionNumber = nr; };
#endif
*/
}; };
ostream & operator<<(ostream & s, const Element2d & el); ostream & operator<<(ostream & s, const Element2d & el);
@ -757,12 +746,6 @@ namespace netgen
/// stored shape-badness of element /// stored shape-badness of element
float badness; float badness;
bool is_curved:1; // element is (high order) curved bool is_curved:1; // element is (high order) curved
// #ifdef PARALLEL
/// number of partition for parallel computation
// int partitionNumber;
// #endif
public: public:
flagstruct flags; flagstruct flags;
@ -1010,15 +993,6 @@ namespace netgen
bool IsCurved () const { return is_curved; } bool IsCurved () const { return is_curved; }
void SetCurved (bool acurved) { is_curved = acurved; } void SetCurved (bool acurved) { is_curved = acurved; }
/*
#ifdef PARALLEL
int GetPartition () const { return partitionNumber; }
void SetPartition (int nr) { partitionNumber = nr; };
#else
int GetPartition () const { return 0; }
#endif
*/
int hp_elnr; int hp_elnr;
}; };
@ -1076,11 +1050,6 @@ namespace netgen
/// ///
int meshdocval; int meshdocval;
// #ifdef PARALLEL
/// number of partition for parallel computation
// int partitionNumber;
// #endif
private: private:
bool is_curved; bool is_curved;
@ -1118,15 +1087,6 @@ namespace netgen
bool IsCurved () const { return is_curved; } bool IsCurved () const { return is_curved; }
void SetCurved (bool acurved) { is_curved = acurved; } void SetCurved (bool acurved) { is_curved = acurved; }
/*
#ifdef PARALLEL
int GetPartition () const { return partitionNumber; }
void SetPartition (int nr) { partitionNumber = nr; };
#else
int GetPartition () const { return 0; }
#endif
*/
void DoArchive (Archive & ar); void DoArchive (Archive & ar);
#ifdef PARALLEL #ifdef PARALLEL

View File

@ -316,29 +316,17 @@ namespace netgen
double eps = 1e-6 * geom.GetBoundingBox().Diam(); double eps = 1e-6 * geom.GetBoundingBox().Diam();
tsearch.Start(); tsearch.Start();
for (int i = 1; i <= nvertices; i++) for (auto [i,vshape] : Enumerate(geom.vmap))
{ {
gp_Pnt pnt = BRep_Tool::Pnt (TopoDS::Vertex(geom.vmap(i))); TopoDS_Vertex vertex = TopoDS::Vertex(vshape);
double hpref = OCCGeometry::global_shape_properties[TopoDS::Vertex(geom.vmap(i)).TShape()].hpref; gp_Pnt pnt = BRep_Tool::Pnt (vertex);
MeshPoint mp(occ2ng(pnt));
// mp.Singularity(hpref);
bool exists = false; mesh.AddPoint (occ2ng(pnt));
if (merge_solids)
for (PointIndex pi : mesh.Points().Range())
if (Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
{
exists = true;
break;
}
if (!exists)
{
mesh.AddPoint (mp);
mesh.Points().Last().Singularity(hpref);
}
double maxh = OCCGeometry::global_shape_properties[TopoDS::Vertex(geom.vmap(i)).TShape()].maxh; double hpref = OCCGeometry::global_shape_properties[vertex.TShape()].hpref;
mesh.Points().Last().Singularity(hpref);
double maxh = OCCGeometry::global_shape_properties[vertex.TShape()].maxh;
mesh.RestrictLocalH (occ2ng(pnt), maxh); mesh.RestrictLocalH (occ2ng(pnt), maxh);
} }
tsearch.Stop(); tsearch.Stop();
@ -356,6 +344,7 @@ namespace netgen
face2solid[i] = 0; face2solid[i] = 0;
} }
/*
int solidnr = 0; int solidnr = 0;
for (TopExp_Explorer exp0(geom.shape, TopAbs_SOLID); exp0.More(); exp0.Next()) for (TopExp_Explorer exp0(geom.shape, TopAbs_SOLID); exp0.More(); exp0.Next())
{ {
@ -372,6 +361,22 @@ namespace netgen
face2solid[1][facenr-1] = solidnr; face2solid[1][facenr-1] = solidnr;
} }
} }
*/
int solidnr = 0;
for (auto solid : Explore(geom.shape, TopAbs_SOLID))
{
solidnr++;
for (auto face : Explore (solid, TopAbs_FACE))
if (geom.fmap.Contains(face))
{
int facenr = geom.fmap.FindIndex(face);
if (face2solid[0][facenr-1] == 0)
face2solid[0][facenr-1] = solidnr;
else
face2solid[1][facenr-1] = solidnr;
}
}
/* /*

View File

@ -1045,11 +1045,15 @@ namespace netgen
} }
eprops.SetSize(emap.Extent()); eprops.SetSize(emap.Extent());
/*
for (TopExp_Explorer e(shape, TopAbs_EDGE); e.More(); e.Next()) for (TopExp_Explorer e(shape, TopAbs_EDGE); e.More(); e.Next())
{ {
auto s = e.Current(); auto s = e.Current();
eprops[emap.FindIndex(s)-1] = &global_shape_properties[s.TShape()]; eprops[emap.FindIndex(s)-1] = &global_shape_properties[s.TShape()];
} }
*/
for (auto [nr,s] : Enumerate(emap))
eprops[nr-1] = &global_shape_properties[s.TShape()];
} }

View File

@ -313,6 +313,8 @@ namespace netgen
TopTools_IndexedMapOfShape fmap, emap, vmap, somap, shmap, wmap; TopTools_IndexedMapOfShape fmap, emap, vmap, somap, shmap, wmap;
NgArray<bool> fsingular, esingular, vsingular; NgArray<bool> fsingular, esingular, vsingular;
Box<3> boundingbox; Box<3> boundingbox;
// should we use 1-based arrays (JS->MH) ?
Array<ShapeProperties*> fprops, eprops, sprops; // pointers to the gobal property map Array<ShapeProperties*> fprops, eprops, sprops; // pointers to the gobal property map
mutable int changed; mutable int changed;