diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index d211b700..f3c5e536 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -428,10 +428,6 @@ namespace netgen unsigned int orderx:6; unsigned int ordery:6; - // #ifdef PARALLEL - // int partitionNumber; - // #endif - /// a linked list for all segments in the same face SurfaceElementIndex next; @@ -687,13 +683,6 @@ namespace netgen int meshdocval; /// int hp_elnr; - - /* -#ifdef PARALLEL - int GetPartition () const { return partitionNumber; } - void SetPartition (int nr) { partitionNumber = nr; }; -#endif - */ }; ostream & operator<<(ostream & s, const Element2d & el); @@ -757,12 +746,6 @@ namespace netgen /// stored shape-badness of element float badness; bool is_curved:1; // element is (high order) curved - - // #ifdef PARALLEL - /// number of partition for parallel computation - // int partitionNumber; - - // #endif public: flagstruct flags; @@ -1010,15 +993,6 @@ namespace netgen bool IsCurved () const { return is_curved; } 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; }; @@ -1076,11 +1050,6 @@ namespace netgen /// int meshdocval; - // #ifdef PARALLEL - /// number of partition for parallel computation - // int partitionNumber; - // #endif - private: bool is_curved; @@ -1118,15 +1087,6 @@ namespace netgen bool IsCurved () const { return is_curved; } 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); #ifdef PARALLEL diff --git a/libsrc/occ/occgenmesh.cpp b/libsrc/occ/occgenmesh.cpp index 8683c36f..eb7f8210 100644 --- a/libsrc/occ/occgenmesh.cpp +++ b/libsrc/occ/occgenmesh.cpp @@ -316,29 +316,17 @@ namespace netgen double eps = 1e-6 * geom.GetBoundingBox().Diam(); 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))); - double hpref = OCCGeometry::global_shape_properties[TopoDS::Vertex(geom.vmap(i)).TShape()].hpref; - MeshPoint mp(occ2ng(pnt)); - // mp.Singularity(hpref); + TopoDS_Vertex vertex = TopoDS::Vertex(vshape); + gp_Pnt pnt = BRep_Tool::Pnt (vertex); - bool exists = false; - 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); - } + mesh.AddPoint (occ2ng(pnt)); - 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); } tsearch.Stop(); @@ -356,6 +344,7 @@ namespace netgen face2solid[i] = 0; } + /* int solidnr = 0; for (TopExp_Explorer exp0(geom.shape, TopAbs_SOLID); exp0.More(); exp0.Next()) { @@ -372,6 +361,22 @@ namespace netgen 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; + } + } + /* diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 3f9c4671..2ca0c746 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1045,11 +1045,15 @@ namespace netgen } eprops.SetSize(emap.Extent()); + /* for (TopExp_Explorer e(shape, TopAbs_EDGE); e.More(); e.Next()) { auto s = e.Current(); eprops[emap.FindIndex(s)-1] = &global_shape_properties[s.TShape()]; } + */ + for (auto [nr,s] : Enumerate(emap)) + eprops[nr-1] = &global_shape_properties[s.TShape()]; } diff --git a/libsrc/occ/occgeom.hpp b/libsrc/occ/occgeom.hpp index 3ab07700..af61bd1f 100644 --- a/libsrc/occ/occgeom.hpp +++ b/libsrc/occ/occgeom.hpp @@ -313,6 +313,8 @@ namespace netgen TopTools_IndexedMapOfShape fmap, emap, vmap, somap, shmap, wmap; NgArray fsingular, esingular, vsingular; Box<3> boundingbox; + + // should we use 1-based arrays (JS->MH) ? Array fprops, eprops, sprops; // pointers to the gobal property map mutable int changed;