From bfc7e7772fc5d37c0d29bf0a09e372420e28fd7b Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 28 Apr 2014 07:09:39 +0000 Subject: [PATCH] polish --- libsrc/csg/vscsg.cpp | 18 ++++++++++-------- libsrc/include/nginterface_v2.hpp | 3 --- libsrc/interface/nginterface_v2.cpp | 2 +- libsrc/meshing/boundarylayer.cpp | 4 +++- libsrc/meshing/curvedelems.cpp | 16 ++++++++-------- libsrc/meshing/parallelmesh.cpp | 16 ++++++++-------- libsrc/meshing/ruler2.cpp | 8 +++++--- libsrc/meshing/topology.cpp | 5 +++++ libsrc/visualization/vssolution.cpp | 6 +++--- 9 files changed, 43 insertions(+), 35 deletions(-) diff --git a/libsrc/csg/vscsg.cpp b/libsrc/csg/vscsg.cpp index f6102161..2074ecae 100644 --- a/libsrc/csg/vscsg.cpp +++ b/libsrc/csg/vscsg.cpp @@ -88,7 +88,8 @@ namespace netgen const TopLevelObject * tlo = geometry -> GetTopLevelObject (i); if (tlo->GetVisible() && !tlo->GetTransparent()) { - float mat_col[] = { tlo->GetRed(), tlo->GetGreen(), tlo->GetBlue(), 1 }; + float mat_col[] = { float(tlo->GetRed()), float(tlo->GetGreen()), + float(tlo->GetBlue()), 1 }; glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col); glCallList (trilists[i]); @@ -105,7 +106,8 @@ namespace netgen const TopLevelObject * tlo = geometry -> GetTopLevelObject (i); if (tlo->GetVisible() && tlo->GetTransparent()) { - float mat_col[] = { tlo->GetRed(), tlo->GetGreen(), tlo->GetBlue(), transp }; + float mat_col[] = { float(tlo->GetRed()), float(tlo->GetGreen()), + float(tlo->GetBlue()), float(transp) }; glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col); @@ -326,9 +328,9 @@ namespace netgen if (vispar.drawededgenrs) { glEnable (GL_COLOR_MATERIAL); - GLfloat textcol[3] = { 1 - backcolor, - 1 - backcolor, - 1 - backcolor }; + GLfloat textcol[3] = { GLfloat(1 - backcolor), + GLfloat(1 - backcolor), + GLfloat(1 - backcolor) }; glColor3fv (textcol); glNormal3d (0, 0, 1); glPushAttrib (GL_LIST_BIT); @@ -397,9 +399,9 @@ namespace netgen if (vispar.drawedpointnrs) { glEnable (GL_COLOR_MATERIAL); - GLfloat textcol[3] = { 1 - backcolor, - 1 - backcolor, - 1 - backcolor }; + GLfloat textcol[3] = { GLfloat(1 - backcolor), + GLfloat(1 - backcolor), + GLfloat(1 - backcolor) }; glColor3fv (textcol); glNormal3d (0, 0, 1); glPushAttrib (GL_LIST_BIT); diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index 6ec768ab..177945c0 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -12,9 +12,6 @@ C++ interface to Netgen */ -// #include "../general/archive_base.hpp" -// namespace ngstd { class Archive; } - namespace netgen { diff --git a/libsrc/interface/nginterface_v2.cpp b/libsrc/interface/nginterface_v2.cpp index ae98f4fd..424f000e 100644 --- a/libsrc/interface/nginterface_v2.cpp +++ b/libsrc/interface/nginterface_v2.cpp @@ -7,7 +7,7 @@ #include "nginterface.h" #include "nginterface_v2.hpp" - +#include "../general/archive_base.hpp" namespace netgen { diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index dbf40437..3d7d126a 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -344,7 +344,6 @@ namespace netgen if(!surfid.Contains(mesh.LineSegment(j).si)) { int pnt_commelem = 0; - int pnum_commelem = 0; Array pnt1_elems; Array pnt2_elems; @@ -366,6 +365,8 @@ namespace netgen } } + /* + int pnum_commelem = 0; for(int k = 1; k <= mesh.SurfaceElement(pnt_commelem).GetNP(); k++) { if((mesh.SurfaceElement(pnt_commelem).PNum(k) != segpair_p1) @@ -374,6 +375,7 @@ namespace netgen pnum_commelem = mesh.SurfaceElement(pnt_commelem).PNum(k); } } + */ Vec3d surfelem_vect, surfelem_vect1; diff --git a/libsrc/meshing/curvedelems.cpp b/libsrc/meshing/curvedelems.cpp index c257049c..6869a568 100644 --- a/libsrc/meshing/curvedelems.cpp +++ b/libsrc/meshing/curvedelems.cpp @@ -652,16 +652,16 @@ namespace netgen for (int i2 = 0; i2 < edgenrs.Size(); i2++) { - PointIndex pi1 = el[edges[i2][0]]; - PointIndex pi2 = el[edges[i2][1]]; + // PointIndex pi1 = el[edges[i2][0]]; + // PointIndex pi2 = el[edges[i2][1]]; - bool swap = pi1 > pi2; + // bool swap = pi1 > pi2; - Point<3> p1 = mesh[pi1]; - Point<3> p2 = mesh[pi2]; + // Point<3> p1 = mesh[pi1]; + // Point<3> p2 = mesh[pi2]; - int order1 = edgeorder[edgenrs[i2]]; - int ndof = max (0, order1-1); + // int order1 = edgeorder[edgenrs[i2]]; + // int ndof = max (0, order1-1); surfnr[edgenrs[i2]] = mesh.GetFaceDescriptor(el.GetIndex()).SurfNr(); gi0[edgenrs[i2]] = el.GeomInfoPi(edges[i2][0]+1); @@ -1163,7 +1163,7 @@ namespace netgen for (int k = 0; k < verts.Size(); k++) pp += lami[k] * Vec<3> (mesh.Point(verts[k])); - const ELEMENT_EDGE * edges = MeshTopology::GetEdges0 (TRIG); + // const ELEMENT_EDGE * edges = MeshTopology::GetEdges0 (TRIG); for (int k = 0; k < edgenrs.Size(); k++) { int eorder = edgeorder[edgenrs[k]]; diff --git a/libsrc/meshing/parallelmesh.cpp b/libsrc/meshing/parallelmesh.cpp index 07e8124d..49f2483c 100644 --- a/libsrc/meshing/parallelmesh.cpp +++ b/libsrc/meshing/parallelmesh.cpp @@ -394,7 +394,7 @@ namespace netgen selbuf.Add (dest, sei); selbuf.Add (dest, sel.GetIndex()); - selbuf.Add (dest, 0); + // selbuf.Add (dest, 0); selbuf.Add (dest, sel.GetNP()); for ( int ii = 1; ii <= sel.GetNP(); ii++) @@ -636,7 +636,7 @@ namespace netgen { int globsel = selbuf[ii++]; int faceind = selbuf[ii++]; - bool isghost = selbuf[ii++]; + //bool isghost = selbuf[ii++]; int nep = selbuf[ii++]; Element2d tri(nep); tri.SetIndex(faceind); @@ -788,8 +788,8 @@ namespace netgen { eptr.Append (eind.Size()); const Segment & el = LineSegment(i+1); - eind.Append (el[0]); - eind.Append (el[1]); + eind.Append (el[0]-1); + eind.Append (el[1]-1); } eptr.Append (eind.Size()); Array epart(ne), npart(nn); @@ -1318,7 +1318,7 @@ namespace netgen idxtype *xadj, * adjacency, *v_weights = NULL, *e_weights = NULL; int weightflag = 0; - int numflag = 0; + // int numflag = 0; int nparts = ntasks - 1; int options[5]; @@ -1485,11 +1485,9 @@ namespace netgen idxtype *v_weights = NULL, *e_weights = NULL; int weightflag = 0; - int numflag = 0; + // int numflag = 0; int nparts = ntasks - 1; - int options[5]; - options[0] = 0; int edgecut; Array part(ne); @@ -1497,6 +1495,8 @@ namespace netgen BubbleSort (adjacency.Range (xadj[el], xadj[el+1])); #ifdef METIS4 + int options[5]; + options[0] = 0; METIS_PartGraphKway ( &ne, &xadj[0], &adjacency[0], v_weights, e_weights, &weightflag, &numflag, &nparts, options, &edgecut, &part[0] ); #else diff --git a/libsrc/meshing/ruler2.cpp b/libsrc/meshing/ruler2.cpp index e705dde7..f1c84ee4 100644 --- a/libsrc/meshing/ruler2.cpp +++ b/libsrc/meshing/ruler2.cpp @@ -181,17 +181,19 @@ namespace netgen static bool firsttime = true; - static int timers[100]; - static int timers2[100]; - static int timers3[100]; + // static int timers[100]; + // static int timers2[100]; + // static int timers3[100]; if (firsttime) { + /* for (int ri = 0; ri < rules.Size(); ri++) timers[ri] = NgProfiler::CreateTimer (string("netrule ")+rules[ri]->Name()); for (int ri = 0; ri < rules.Size(); ri++) timers2[ri] = NgProfiler::CreateTimer (string("netrule,mapped ")+rules[ri]->Name()); for (int ri = 0; ri < rules.Size(); ri++) timers3[ri] = NgProfiler::CreateTimer (string("netrule,lines mapped ")+rules[ri]->Name()); + */ firsttime = false; } diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index 26ef075e..06b68d00 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -1527,6 +1527,11 @@ namespace netgen void MeshTopology :: GetEdgeVertices (int ednr, int & v1, int & v2) const { + // cout << "id = " << id << "getedgevertices, ednr = " << ednr << ", ned = " << edge2vert.Size() << "&v1 = " << &v1 << endl; + if (ednr < 1 || ednr > edge2vert.Size()) + cerr << "illegal edge nr: " << ednr << ", numedges = " << edge2vert.Size() + << " id = " << id + << endl; v1 = edge2vert.Get(ednr)[0]; v2 = edge2vert.Get(ednr)[1]; } diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 2c1fc72a..38e896e2 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -2419,7 +2419,6 @@ namespace netgen NgProfiler::RegionTimer reg1 (timer1); int ne = mesh->GetNE(); - double hminv = numeric_limits::max(); double hmaxv = -numeric_limits::max(); bool hhasit = false; @@ -2723,8 +2722,9 @@ namespace netgen { case SOL_VIRTUALFUNCTION: { + val = 0.0; double values[20]; - ok = data->solclass->GetValue (elnr, lam1, lam2, lam3, values); + ok = data->solclass->GetValue (elnr, lam1, lam2, lam3, values); val = values[comp-1]; return ok; @@ -3662,7 +3662,7 @@ namespace netgen { static int timer_vals = NgProfiler::CreateTimer ("ClipPlaneTrigs - vertex values"); static int timer1 = NgProfiler::CreateTimer ("ClipPlaneTrigs1"); - static int timer1a = NgProfiler::CreateTimer ("ClipPlaneTrigs1a"); + // static int timer1a = NgProfiler::CreateTimer ("ClipPlaneTrigs1a"); // static int timer2 = NgProfiler::CreateTimer ("ClipPlaneTrigs2"); static int timer3 = NgProfiler::CreateTimer ("ClipPlaneTrigs3"); static int timer4 = NgProfiler::CreateTimer ("ClipPlaneTrigs4");