From 87b65fb5ff666c4b008785d08fce87bf9761ad6a Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Fri, 5 Jan 2024 20:06:55 +0100 Subject: [PATCH 1/2] remove warnings --- libsrc/interface/rw_medit.cpp | 24 +++++++++++----------- libsrc/meshing/basegeom.cpp | 2 +- libsrc/meshing/boundarylayer.cpp | 32 +++++++++++++++++------------- libsrc/meshing/boundarylayer2d.cpp | 18 +++++++++-------- libsrc/meshing/meshclass.cpp | 2 ++ libsrc/meshing/topology.cpp | 28 +++++++++++++------------- libsrc/occ/Partition_Inter2d.cxx | 2 +- libsrc/occ/Partition_Loop.cxx | 6 +++--- libsrc/occ/Partition_Spliter.cxx | 4 ++-- libsrc/occ/occgeom.cpp | 2 ++ libsrc/occ/python_occ_shapes.cpp | 4 ++-- libsrc/stlgeom/python_stl.cpp | 2 +- nglib/nglib_occ.cpp | 6 ++++-- 13 files changed, 72 insertions(+), 60 deletions(-) diff --git a/libsrc/interface/rw_medit.cpp b/libsrc/interface/rw_medit.cpp index ba8d1d95..e2d63854 100644 --- a/libsrc/interface/rw_medit.cpp +++ b/libsrc/interface/rw_medit.cpp @@ -50,7 +50,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nvert; Point<3> p{0.,0.,0.}; - for(auto k : Range(nvert)) { + for([[maybe_unused]] auto k : Range(nvert)) { for(auto i : Range(dim)) fin >> p[i]; fin >> index; @@ -61,7 +61,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nedge; Segment seg; - for(auto k : Range(nedge)) { + for([[maybe_unused]] auto k : Range(nedge)) { for(auto i : Range(2)) fin >> seg[i]; fin >> seg.edgenr; @@ -74,7 +74,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> ntrig; Element2d sel; - for(auto k : Range(ntrig)) { + for([[maybe_unused]] auto k : Range(ntrig)) { for(auto i : Range(3)) fin >> sel[i]; fin >> index; @@ -86,7 +86,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> ntet; Element el(4); - for(auto k : Range(ntet)) { + for([[maybe_unused]] auto k : Range(ntet)) { for(auto i : Range(4)) fin >> el[i]; fin >> index; @@ -99,7 +99,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> ncorners; Element0d el; - for(auto k : Range(ncorners)) { + for([[maybe_unused]] auto k : Range(ncorners)) { fin >> el.pnum; } } @@ -107,7 +107,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nverts; int vert; - for(auto k : Range(nverts)) { + for([[maybe_unused]] auto k : Range(nverts)) { fin >> vert; } } @@ -115,7 +115,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nnormals; Vec<3> normal; - for(auto k : Range(nnormals)) { + for([[maybe_unused]] auto k : Range(nnormals)) { fin >> normal[0]; fin >> normal[1]; fin >> normal[2]; @@ -126,7 +126,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nnormals; int vert; int normal; - for(auto k : Range(nnormals)) { + for([[maybe_unused]] auto k : Range(nnormals)) { fin >> normal; fin >> vert; } @@ -135,7 +135,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> ntangents; Vec<3> tangent; - for(auto k : Range(ntangents)) { + for([[maybe_unused]] auto k : Range(ntangents)) { fin >> tangent[0]; fin >> tangent[1]; fin >> tangent[2]; @@ -146,7 +146,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> ntangents; int vert; int tangent; - for(auto k : Range(ntangents)) { + for([[maybe_unused]] auto k : Range(ntangents)) { fin >> tangent; fin >> vert; } @@ -155,7 +155,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nridges; int ridge; - for(auto k : Range(nridges)) { + for([[maybe_unused]] auto k : Range(nridges)) { fin >> ridge; } } @@ -164,7 +164,7 @@ void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map> nitems; string s; - for(auto i : Range(nitems)) + for([[maybe_unused]] auto i : Range(nitems)) fin >> s; // read one line } } diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index a5e2a2dd..0e6900e2 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -829,7 +829,7 @@ namespace netgen if(face.primary == &face) { // check if this face connects two identified closesurfaces - auto & idents = mesh.GetIdentifications(); + // auto & idents = mesh.GetIdentifications(); std::set relevant_edges; auto segments = face.GetBoundary(mesh); for(const auto &s : segments) diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index 1cf942af..0abfdb34 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -66,7 +66,7 @@ namespace netgen auto p0 = larger_trig[i]; auto p1 = larger_trig[(i+1)%3]; auto p2 = larger_trig[(i+2)%3]; - auto n = Cross(p2-p1, n_trig); + // auto n = Cross(p2-p1, n_trig); auto v0 = (p2-p1).Normalize(); auto v1 = (p0-p1).Normalize(); @@ -209,7 +209,7 @@ namespace netgen Vec<3> ab_base_norm = (b_base - a_base).Normalize(); double a_vec_x = Dot(a_vec, ab_base_norm); double b_vec_x = Dot(b_vec, -ab_base_norm); - double ratio_parallel = (a_vec_x + b_vec_x) / ab_base; + // double ratio_parallel = (a_vec_x + b_vec_x) / ab_base; // Calculate surface normal at point si Vec<3> surface_normal = getNormal(mesh[si]); @@ -238,7 +238,7 @@ namespace netgen }; auto modifiedsmooth = [&](size_t nsteps) { - for (auto i : Range(nsteps)) + for ([[maybe_unused]] auto i : Range(nsteps)) for (SurfaceElementIndex sei : mesh.SurfaceElements().Range()) { // assuming triangle @@ -248,8 +248,9 @@ namespace netgen } }; + /* auto smooth = [&] (size_t nsteps) { - for(auto i : Range(nsteps)) + for([[maybe_unused]] auto i : Range(nsteps)) for(const auto & sel : mesh.SurfaceElements()) { double min_limit = 999; @@ -259,7 +260,8 @@ namespace netgen limits[pi] = min(limits[pi], 1.4*min_limit); } }; - + */ + // check for self-intersection within new elements (prisms/hexes) auto self_intersection = [&] () { for(SurfaceElementIndex sei : mesh.SurfaceElements().Range()) @@ -446,7 +448,7 @@ namespace netgen Array BuildSegments( Mesh & mesh ) { Array segments; - auto& topo = mesh.GetTopology(); + // auto& topo = mesh.GetTopology(); NgArray surf_els; @@ -550,13 +552,13 @@ namespace netgen // smooth tangential part of growth vectors from edges to surface elements RegionTimer rtsmooth(tsmooth); - for(auto i : Range(10)) + for([[maybe_unused]] auto i : Range(10)) { for(auto pi : points) { auto sels = p2sel[pi]; Vec<3> new_gw = growthvectors[pi]; - int cnt = 1; + // int cnt = 1; std::set suround; suround.insert(pi); auto normal = normals[pi]; @@ -691,20 +693,22 @@ namespace netgen if(face_done.Test(facei)) continue; bool point_moved = false; - bool point_fixed = false; + // bool point_fixed = false; for(auto pi : sel.PNums()) { if(growthvectors[pi].Length() > 0) point_moved = true; + /* else point_fixed = true; + */ } if(point_moved && !moved_surfaces.Test(facei)) { int new_si = mesh.GetNFD()+1; const auto& fd = mesh.GetFaceDescriptor(facei); - auto isIn = domains.Test(fd.DomainIn()); - auto isOut = domains.Test(fd.DomainOut()); + // auto isIn = domains.Test(fd.DomainIn()); + // auto isOut = domains.Test(fd.DomainOut()); int si = params.sides_keep_surfaceindex ? facei : -1; // domin and domout can only be set later FaceDescriptor new_fd(si, -1, @@ -1101,7 +1105,7 @@ namespace netgen { // copy here since we will add segments and this would // invalidate a reference! - auto segi = segments[sei]; + // auto segi = segments[sei]; for(auto [sej, type] : segmap[sei]) { auto segj = segments[sej]; @@ -1473,9 +1477,9 @@ namespace netgen points.Append(pi); auto p2el = mesh.CreatePoint2ElementTable(is_inner_point); - + // smooth growth vectors to shift additional element layers to the inside and fix flipped tets - for(auto step : Range(10)) + for([[maybe_unused]] auto step : Range(10)) { for(auto pi : points) { diff --git a/libsrc/meshing/boundarylayer2d.cpp b/libsrc/meshing/boundarylayer2d.cpp index 2a19ae96..93f0cf36 100644 --- a/libsrc/meshing/boundarylayer2d.cpp +++ b/libsrc/meshing/boundarylayer2d.cpp @@ -165,11 +165,12 @@ namespace netgen } auto oldnf = mesh.GetNSE(); - auto res = meshing.GenerateMesh (mesh, mp, mp.maxh, domain); + // auto res = + meshing.GenerateMesh (mesh, mp, mp.maxh, domain); for (SurfaceElementIndex sei : Range(oldnf, mesh.GetNSE())) mesh[sei].SetIndex (domain); - - int hsteps = mp.optsteps2d; + + // int hsteps = mp.optsteps2d; const char * optstr = mp.optimize2d.c_str(); MeshOptimize2d meshopt(mesh); @@ -219,7 +220,7 @@ namespace netgen int np = mesh.GetNP(); int nseg = line_segments.Size(); - int ne = mesh.GetNSE(); + // int ne = mesh.GetNSE(); mesh.UpdateTopology(); double total_thickness = 0.0; @@ -246,7 +247,7 @@ namespace netgen Array si_map(mesh.GetNFD()+2); si_map = -1; - int fd_old = mesh.GetNFD(); + // int fd_old = mesh.GetNFD(); int max_edge_nr = -1; int max_domain = -1; @@ -284,7 +285,8 @@ namespace netgen { FaceDescriptor new_fd(0, 0, 0, -1); new_fd.SetBCProperty(new_domain); - int new_fd_index = mesh.AddFaceDescriptor(new_fd); + // int new_fd_index = + mesh.AddFaceDescriptor(new_fd); if(should_make_new_domain) mesh.SetBCName(new_domain-1, "mapped_" + mesh.GetBCName(domain-1)); } @@ -625,7 +627,7 @@ namespace netgen auto & pm0 = mapto[seg[0]]; auto & pm1 = mapto[seg[1]]; - auto newindex = si_map[domain]; + // auto newindex = si_map[domain]; Segment s = seg; s.geominfo[0] = {}; @@ -663,7 +665,7 @@ namespace netgen auto p0 = mesh[pi0]; auto p1 = mesh[pi1]; auto q0 = mesh[pi2]; - auto q1 = mesh[pi3]; + // auto q1 = mesh[pi3]; Vec<2> n = {-p1[1]+p0[1], p1[0]-p0[0]}; Vec<2> v = { q0[0]-p0[0], q0[1]-p0[1]}; diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index d69c74ea..70eff530 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -7415,6 +7415,7 @@ namespace netgen auto v = pmax-pmin; double eps = v.Length()*1e-8; + /* auto onPlane = [&] (const MeshPoint & p) -> bool { auto v = p_plane-p; @@ -7424,6 +7425,7 @@ namespace netgen // auto ret = fabs(v*n_plane)/l; return fabs(v*n_plane) < eps; }; + */ /* auto mirror = [&] (PointIndex pi) -> PointIndex diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index bb77f608..e12fe2cc 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -201,24 +201,24 @@ namespace netgen INDEX_4 face4(el[elfaces[j][0]], el[elfaces[j][1]], el[elfaces[j][2]], el[elfaces[j][3]]); - int facedir = 0; + // int facedir = 0; if (min2 (face4.I1(), face4.I2()) > min2 (face4.I4(), face4.I3())) { // z - flip - facedir += 1; + // facedir += 1; swap (face4.I1(), face4.I4()); swap (face4.I2(), face4.I3()); } if (min2 (face4.I1(), face4.I4()) > min2 (face4.I2(), face4.I3())) { // x - flip - facedir += 2; + // facedir += 2; swap (face4.I1(), face4.I2()); swap (face4.I3(), face4.I4()); } if (face4.I2() > face4.I4()) { // diagonal flip - facedir += 4; + // facedir += 4; swap (face4.I2(), face4.I4()); } @@ -263,27 +263,27 @@ namespace netgen { // triangle // int facenum; - int facedir; + // int facedir; INDEX_4 face(el.PNum(elfaces[0][0]), el.PNum(elfaces[0][1]), el.PNum(elfaces[0][2]),0); - facedir = 0; + // facedir = 0; if (face.I1() > face.I2()) { swap (face.I1(), face.I2()); - facedir += 1; + // facedir += 1; } if (face.I2() > face.I3()) { swap (face.I2(), face.I3()); - facedir += 2; + // facedir += 2; } if (face.I1() > face.I2()) { swap (face.I1(), face.I2()); - facedir += 4; + // facedir += 4; } if (face.I1() != v) continue; @@ -312,31 +312,31 @@ namespace netgen { // quad // int facenum; - int facedir; + // int facedir; INDEX_4 face4(el.PNum(elfaces[0][0]), el.PNum(elfaces[0][1]), el.PNum(elfaces[0][2]), el.PNum(elfaces[0][3])); - facedir = 0; + // facedir = 0; if (min2 (face4.I1(), face4.I2()) > min2 (face4.I4(), face4.I3())) { // z - orientation - facedir += 1; + // facedir += 1; swap (face4.I1(), face4.I4()); swap (face4.I2(), face4.I3()); } if (min2 (face4.I1(), face4.I4()) > min2 (face4.I2(), face4.I3())) { // x - orientation - facedir += 2; + // facedir += 2; swap (face4.I1(), face4.I2()); swap (face4.I3(), face4.I4()); } if (face4.I2() > face4.I4()) { - facedir += 4; + // facedir += 4; swap (face4.I2(), face4.I4()); } diff --git a/libsrc/occ/Partition_Inter2d.cxx b/libsrc/occ/Partition_Inter2d.cxx index 7fed573b..88b6f7d8 100644 --- a/libsrc/occ/Partition_Inter2d.cxx +++ b/libsrc/occ/Partition_Inter2d.cxx @@ -516,7 +516,7 @@ static void EdgesPartition(const TopoDS_Face& F, } } - Standard_Boolean AffichPurge = Standard_False; + // Standard_Boolean AffichPurge = Standard_False; if ( LV1.IsEmpty()) return; diff --git a/libsrc/occ/Partition_Loop.cxx b/libsrc/occ/Partition_Loop.cxx index 25af5287..efaf77f7 100644 --- a/libsrc/occ/Partition_Loop.cxx +++ b/libsrc/occ/Partition_Loop.cxx @@ -67,7 +67,7 @@ #include static char* name = new char[100]; -static int nbe = 0; +// static int nbe = 0; #ifdef WIN32 #define M_PI 3.14159265358979323846 @@ -198,7 +198,7 @@ static Standard_Boolean SelectEdge(const TopoDS_Face& F, Cc->D2(uc, PC, CTg1, CTg2); C->D2(u, P, Tg1, Tg2); - Standard_Real angle; + Standard_Real angle = 0.0; if (CE.Orientation () == TopAbs_REVERSED && E.Orientation () == TopAbs_FORWARD) { angle = CTg1.Angle(Tg1.Reversed()); @@ -363,7 +363,7 @@ void Partition_Loop::Perform() } } - int i = 0; + // int i = 0; while (!End) { //------------------------------- // Construction of a wire. diff --git a/libsrc/occ/Partition_Spliter.cxx b/libsrc/occ/Partition_Spliter.cxx index 1263909e..7a1d913a 100644 --- a/libsrc/occ/Partition_Spliter.cxx +++ b/libsrc/occ/Partition_Spliter.cxx @@ -1459,7 +1459,7 @@ void Partition_Spliter::MakeEdges (const TopoDS_Edge& E, if (VOnE.Extent() < 3) { // do not rebuild not cut edge if (( VF.IsSame( VOnE.First() ) && VL.IsSame( VOnE.Last() )) || - VL.IsSame( VOnE.First() ) && VF.IsSame( VOnE.Last() ) ) { + (VL.IsSame( VOnE.First() ) && VF.IsSame( VOnE.Last() )) ) { NE.Append( E ); return; } @@ -1476,7 +1476,7 @@ void Partition_Spliter::MakeEdges (const TopoDS_Edge& E, if (SV.Length() < 3) { // do not rebuild not cut edge if (( VF.IsSame( SV.First() ) && VL.IsSame( SV.Last() )) || - VL.IsSame( SV.First() ) && VF.IsSame( SV.Last() ) ) { + ( VL.IsSame( SV.First() ) && VF.IsSame( SV.Last() )) ) { NE.Append( E ); return; } diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index bc0383f9..00ed0d03 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1714,11 +1714,13 @@ namespace netgen BRepTools::Read(shape, ss, builder); } + /* // enumerate shapes and archive only integers auto my_hash = [](const TopoDS_Shape & key) { auto occ_hash = key.HashCode(1<<31UL); return std::hash()(occ_hash); }; + */ TopTools_IndexedMapOfShape shape_map; Array shape_list; diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 3496ffb9..116788c1 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1935,7 +1935,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) optional auxspine) { if (twist) { - auto [pnt, angle] = *twist; + // auto [pnt, angle] = *twist; /* cyl = Cylinder((0,0,0), Z, r=1, h=1).faces[0] @@ -2230,7 +2230,7 @@ tangents : Dict[int, gp_Vec2d] TColgp_Array1OfPnt poles(0, vpoles.size()-1); TColStd_Array1OfReal knots(0, vpoles.size()+degree); TColStd_Array1OfInteger mult(0, vpoles.size()+degree); - int cnt = 0; + // int cnt = 0; for (int i = 0; i < vpoles.size(); i++) { diff --git a/libsrc/stlgeom/python_stl.cpp b/libsrc/stlgeom/python_stl.cpp index 44b79f28..ad82be56 100644 --- a/libsrc/stlgeom/python_stl.cpp +++ b/libsrc/stlgeom/python_stl.cpp @@ -278,7 +278,7 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m) throw Exception("Point not found in triangle"); self->SetSelectTrig(trignr); self->SetNodeOfSelTrig(point_in_trig); - for(auto i : Range(count)) + for([[maybe_unused]] auto i : Range(count)) self->MoveSelectedPointToMiddle(); }) .def("Save", &STLGeometry::Save) diff --git a/nglib/nglib_occ.cpp b/nglib/nglib_occ.cpp index 58ee4d8f..8b26081d 100644 --- a/nglib/nglib_occ.cpp +++ b/nglib/nglib_occ.cpp @@ -148,13 +148,15 @@ namespace nglib numpoints = me->GetNP(); // Initially set up only for surface meshing without any optimisation - int perfstepsend = MESHCONST_MESHSURFACE; + // int perfstepsend = MESHCONST_MESHSURFACE; // Check and if required, enable surface mesh optimisation step + /* if(mp->optsurfmeshenable) { - perfstepsend = MESHCONST_OPTSURFACE; + perfstepsend = MESHCONST_OPTSURFACE; } + */ occgeom->MeshSurface(*me, mparam); occgeom->OptimizeSurface(*me, mparam); From 8362349bb8e80a3fca688d54677420f80171b626 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sat, 6 Jan 2024 18:19:11 +0100 Subject: [PATCH 2/2] fix metis warnings --- libsrc/core/exception.cpp | 2 +- libsrc/core/exception.hpp | 1 - libsrc/meshing/parallelmesh.cpp | 13 +++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libsrc/core/exception.cpp b/libsrc/core/exception.cpp index 78e5b092..9c99a138 100644 --- a/libsrc/core/exception.cpp +++ b/libsrc/core/exception.cpp @@ -80,7 +80,7 @@ namespace ngcore // 1 libngcore.dylib 0x000000010ddb298c _ZL21ngcore_signal_handleri + 316 constexpr char reset_shell[] = "\033[0m"; constexpr char green[] = "\033[32m"; - constexpr char yellow[] = "\033[33m"; + [[maybe_unused]] constexpr char yellow[] = "\033[33m"; std::istringstream in(s); diff --git a/libsrc/core/exception.hpp b/libsrc/core/exception.hpp index ed37c946..94885963 100644 --- a/libsrc/core/exception.hpp +++ b/libsrc/core/exception.hpp @@ -10,7 +10,6 @@ namespace ngcore { - NGCORE_API std::string GetBackTrace(); // Exception for code that shouldn't be executed diff --git a/libsrc/meshing/parallelmesh.cpp b/libsrc/meshing/parallelmesh.cpp index e6171ca4..37d3e941 100644 --- a/libsrc/meshing/parallelmesh.cpp +++ b/libsrc/meshing/parallelmesh.cpp @@ -1856,13 +1856,15 @@ namespace netgen void Mesh :: PartHybridMesh () { -#ifdef METIS + throw Exception("PartHybridMesh not supported"); +#ifdef METISxxx int ne = GetNE(); int nn = GetNP(); int nedges = topology.GetNEdges(); - idxtype *xadj, * adjacency, *v_weights = NULL, *e_weights = NULL; + idxtype *xadj, * adjacency; + // idxtype *v_weights = NULL, *e_weights = NULL; int weightflag = 0; int numflag = 0; @@ -1953,6 +1955,8 @@ namespace netgen void Mesh :: PartDualHybridMesh ( ) // NgArray & neloc ) { + throw Exception("PartDualHybridMesh not supported"); +#ifdef OLD #ifdef METIS int ne = GetNE(); @@ -2065,7 +2069,8 @@ namespace netgen #else cout << "partdualmesh not available" << endl; #endif - +#endif + } @@ -2131,7 +2136,6 @@ namespace netgen idxtype *v_weights = NULL, *e_weights = NULL; - idxtype weightflag = 0; // int numflag = 0; idxtype nparts = ntasks - 1; @@ -2142,6 +2146,7 @@ namespace netgen BubbleSort (adjacency.Range (xadj[el], xadj[el+1])); #ifdef METIS4 + idxtype weightflag = 0; int options[5]; options[0] = 0; METIS_PartGraphKway ( &ne, &xadj[0], &adjacency[0], v_weights, e_weights, &weightflag,