From 5d297fdc7fe6ad0555c400de2506d23f11c2731a Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 19 Aug 2014 19:58:36 +0000 Subject: [PATCH] eliminate warnings --- configure.ac | 24 ++++++++++++++++-------- libsrc/csg/Makefile.am | 14 +++++++------- libsrc/csg/algprim.cpp | 2 +- libsrc/geom2d/genmesh2d.cpp | 2 +- libsrc/gprim/geomobjects.hpp | 28 +++++++++++++++++++--------- libsrc/gprim/spline.cpp | 7 ++++++- libsrc/gprim/spline.hpp | 25 ++++++++++++++++++++++--- libsrc/interface/nginterface.cpp | 4 ++++ libsrc/interface/readtetmesh.cpp | 12 ++++++------ libsrc/interface/readuser.cpp | 2 +- libsrc/meshing/hprefinement.cpp | 13 ++++++++++--- libsrc/meshing/improve2.hpp | 1 + libsrc/meshing/localh.cpp | 2 +- libsrc/meshing/meshtool.cpp | 14 ++++++-------- libsrc/meshing/parser3.cpp | 2 +- libsrc/meshing/ruler3.cpp | 3 ++- libsrc/meshing/smoothing3.cpp | 2 +- ng/ngpkg.cpp | 8 +++++++- 18 files changed, 112 insertions(+), 53 deletions(-) diff --git a/configure.ac b/configure.ac index d533d5a1..c8959704 100644 --- a/configure.ac +++ b/configure.ac @@ -171,7 +171,7 @@ TEA_PUBLIC_TCL_HEADERS TEA_PUBLIC_TK_HEADERS AC_SUBST([TOGLLIBDIR], ["$togllibfl"]) -AC_CHECK_HEADER([togl.h]) +# AC_CHECK_HEADER([togl.h]) AC_CHECK_HEADER([GL/gl.h]) @@ -190,7 +190,7 @@ case "${TEA_WINDOWINGSYSTEM}" in ;; x11) AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_X11) - TEA_ADD_LIBS([-lGL -lXmu]) + TEA_ADD_LIBS([-lGL -lXmu -lX11]) LIBGLU=-lGLU ;; win32) @@ -217,16 +217,24 @@ AM_CONDITIONAL([NGGUI], [test x$ngguion = xtrue]) AM_CONDITIONAL([NGMKL], [test x$mklon = xtrue]) AM_CONDITIONAL([NGPYTHON], [test x$pythonon = xtrue]) -AC_CHECK_HEADER(pthread.h) +# AC_CHECK_HEADER(pthread.h) -AC_CHECK_FUNCS([pow]) -AC_CHECK_FUNCS([floor]) -AC_CHECK_FUNCS([matherr]) -AC_CHECK_HEADERS([limits.h]) +# AC_CHECK_FUNCS([pow]) +# AC_CHECK_FUNCS([floor]) +# AC_CHECK_FUNCS([matherr]) +# AC_CHECK_HEADERS([limits.h]) -AC_CHECK_LIB(pthread, pthread_create) +# AC_CHECK_LIB(pthread, pthread_create) +# LDFLAGS+=" -L/usr/lib/Togl1.7" +# AC_SEARCH_LIBS(Togl_Init,[Togl Togl1.7], +# MYTOGL_LIB=$LIBS +# LIBS="", +# , +# [-lGL -lXmu -ltk8.5 -ltcl8.5]) +# echo "libs = $LIBS" +# echo "TOGL_LIB = $MYTOGL_LIB" AC_CONFIG_FILES(Makefile libsrc/Makefile libsrc/csg/Makefile diff --git a/libsrc/csg/Makefile.am b/libsrc/csg/Makefile.am index 2c9f9b75..dc40cec9 100644 --- a/libsrc/csg/Makefile.am +++ b/libsrc/csg/Makefile.am @@ -10,10 +10,6 @@ METASOURCES = AUTO lib_LTLIBRARIES = libcsg.la -if NGGUI -lib_LTLIBRARIES += libcsgvis.la -endif - libcsg_la_SOURCES = algprim.cpp brick.cpp \ bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp \ @@ -21,12 +17,16 @@ explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp \ manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \ solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp +libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la + + + +if NGGUI +lib_LTLIBRARIES += libcsgvis.la libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp - - libcsgvis_la_LIBADD = libcsg.la -libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la +endif # $(top_builddir)/libsrc/geom2d/libgeom2d.la diff --git a/libsrc/csg/algprim.cpp b/libsrc/csg/algprim.cpp index 09bad013..31f014cc 100644 --- a/libsrc/csg/algprim.cpp +++ b/libsrc/csg/algprim.cpp @@ -1608,7 +1608,7 @@ namespace netgen double abs2 = Abs2(v1); double tau = v1 * n; double rho = sqrt (abs2 - tau*tau); - double func = sqr (R - rho) + tau*tau - r*r; + // double func = sqr (R - rho) + tau*tau - r*r; Vec<3> gradabs2 = 2 * v1; Vec<3> gradtau = n; diff --git a/libsrc/geom2d/genmesh2d.cpp b/libsrc/geom2d/genmesh2d.cpp index 56dfcf96..9efc62a6 100644 --- a/libsrc/geom2d/genmesh2d.cpp +++ b/libsrc/geom2d/genmesh2d.cpp @@ -50,7 +50,7 @@ namespace netgen double sum = 0; for (int i = 1; i <= n; i++) { - double t = (i-0.5)*dt; + // double t = (i-0.5)*dt; double fun = hi[i-1]; sum += dt / fun; } diff --git a/libsrc/gprim/geomobjects.hpp b/libsrc/gprim/geomobjects.hpp index c4e72aef..ea80f7ff 100644 --- a/libsrc/gprim/geomobjects.hpp +++ b/libsrc/gprim/geomobjects.hpp @@ -26,9 +26,16 @@ namespace netgen public: Point () { ; } Point (double ax) { for (int i = 0; i < D; i++) x[i] = ax; } - Point (double ax, double ay) { x[0] = ax; x[1] = ay; } - Point (double ax, double ay, double az) - { x[0] = ax; x[1] = ay; x[2] = az; } + Point (double ax, double ay) + { + // static_assert(D==2, "Point constructor with 2 args called"); + x[0] = ax; x[1] = ay; + } + Point (double ax, double ay, double az) + { + // static_assert(D==3, "Point constructor with 3 args called"); + x[0] = ax; x[1] = ay; x[2] = az; + } Point (double ax, double ay, double az, double au) { x[0] = ax; x[1] = ay; x[2] = az; x[3] = au;} @@ -57,10 +64,6 @@ namespace netgen operator const double* () const { return x; } }; - - - - template class Vec { @@ -71,9 +74,16 @@ namespace netgen public: Vec () { ; } // for (int i = 0; i < D; i++) x[i] = 0; } Vec (double ax) { for (int i = 0; i < D; i++) x[i] = ax; } - Vec (double ax, double ay) { x[0] = ax; x[1] = ay; } + Vec (double ax, double ay) + { + // static_assert(D==2, "Vec constructor with 2 args called"); + x[0] = ax; x[1] = ay; + } Vec (double ax, double ay, double az) - { x[0] = ax; x[1] = ay; x[2] = az; } + { + // static_assert(D==3, "Vec constructor with 3 args called"); + x[0] = ax; x[1] = ay; x[2] = az; + } Vec (double ax, double ay, double az, double au) { x[0] = ax; x[1] = ay; x[2] = az; x[3] = au; } diff --git a/libsrc/gprim/spline.cpp b/libsrc/gprim/spline.cpp index b6789913..cc4c44d7 100644 --- a/libsrc/gprim/spline.cpp +++ b/libsrc/gprim/spline.cpp @@ -101,13 +101,17 @@ namespace netgen template inline Point SplineSeg3 :: GetPoint (double t) const { - double x, y, w; double b1, b2, b3; b1 = (1-t)*(1-t); b2 = weight * t * (1-t); b3 = t * t; + Vec hp = b1 * Vec(p1) + b2 * Vec(p2) + b3 * Vec(p3); + double w = b1+b2+b3; + return Point ((1.0/w)*hp); + /* + double x, y, w; x = p1(0) * b1 + p2(0) * b2 + p3(0) * b3; y = p1(1) * b1 + p2(1) * b2 + p3(1) * b3; w = b1 + b2 + b3; @@ -119,6 +123,7 @@ namespace netgen } else return Point (x/w, y/w); + */ } diff --git a/libsrc/gprim/spline.hpp b/libsrc/gprim/spline.hpp index 10a6f9a1..a872d6e9 100644 --- a/libsrc/gprim/spline.hpp +++ b/libsrc/gprim/spline.hpp @@ -483,19 +483,38 @@ namespace netgen if ( w1>M_PI ) w1 -= 2*M_PI; } } - + /* template Point CircleSeg :: GetPoint (double t) const { if (t >= 1.0) { return p3; } - double phi = StartAngle() + t*(EndAngle()-StartAngle()); Vec tmp(cos(phi),sin(phi)); - + return pm + Radius()*tmp; + } + */ + template<> + inline Point<3> CircleSeg<3> :: GetPoint (double t) const + { + // not really useful, but keep it as it was ... + if (t >= 1.0) { return p3; } + double phi = StartAngle() + t*(EndAngle()-StartAngle()); + Vec<3> tmp(cos(phi),sin(phi),0); return pm + Radius()*tmp; } + template<> + inline Point<2> CircleSeg<2> :: GetPoint (double t) const + { + if (t >= 1.0) { return p3; } + + double phi = StartAngle() + t*(EndAngle()-StartAngle()); + Vec<2> tmp(cos(phi),sin(phi)); + + return pm + Radius()*tmp; + } + template void CircleSeg :: GetCoeff (Vector & coeff) const { diff --git a/libsrc/interface/nginterface.cpp b/libsrc/interface/nginterface.cpp index adbe657a..066ffe46 100644 --- a/libsrc/interface/nginterface.cpp +++ b/libsrc/interface/nginterface.cpp @@ -1626,6 +1626,10 @@ int Ng_GetNVertexElements (int vnr) if ( ((*mesh)[i][0] == vnr) || ((*mesh)[i][1] == vnr) ) cnt++; return cnt; } + default: + cerr << "error: mesh->GetDimension() gives " + << mesh->GetDimension() << endl; + return 0; } } diff --git a/libsrc/interface/readtetmesh.cpp b/libsrc/interface/readtetmesh.cpp index 1258068b..db18f2ed 100644 --- a/libsrc/interface/readtetmesh.cpp +++ b/libsrc/interface/readtetmesh.cpp @@ -48,7 +48,7 @@ namespace netgen int modelverts,modeledges,modelfaces,modelcells; Point3d p; int numObj3D,numObj2D,numObj1D,numObj0D; - bool nullstarted; + // bool nullstarted; Array eldom; int minId3D = -1, minId2D = -1; int maxId3D(-1), maxId2D(-1), maxId1D(-1), maxId0D(-1); @@ -222,7 +222,7 @@ namespace netgen case 14: // EdgeID, NodeID0, NodeID1, Type (0=Reg 1=PMaster 2=PSlave 3=CPMaster 4=CPSlave), PID cout << "read edges" << endl; - nullstarted = false; + // nullstarted = false; segmentdata.SetSize(nedges); for(int i=0; i> elemid; diff --git a/libsrc/interface/readuser.cpp b/libsrc/interface/readuser.cpp index f21466af..3f798a93 100644 --- a/libsrc/interface/readuser.cpp +++ b/libsrc/interface/readuser.cpp @@ -89,7 +89,7 @@ namespace netgen strcmp (&filename[strlen (filename)-4], ".unv") == 0 ) { char reco[100]; - int invert; + // int invert; ifstream in(filename); diff --git a/libsrc/meshing/hprefinement.cpp b/libsrc/meshing/hprefinement.cpp index 21b1d1fa..97285259 100644 --- a/libsrc/meshing/hprefinement.cpp +++ b/libsrc/meshing/hprefinement.cpp @@ -544,6 +544,13 @@ namespace netgen hps = &refhex_1f_0e_0v; break; case HP_HEX_1FA_1FB_0E_0V: hps = &refhex_1fa_1fb_0e_0v; break; + + + + default: + { + hps = NULL; + } } /* @@ -1518,7 +1525,7 @@ namespace netgen } for(SurfaceElementIndex i=0;i & edges, INDEX_2_HAS } case HP_HEX: { - hpel.type = hpel.type = ClassifyHex(hpel, edges, edgepoint_dom, cornerpoint, edgepoint, faces, - face_edges, surf_edges, facepoint); + hpel.type = ClassifyHex(hpel, edges, edgepoint_dom, cornerpoint, edgepoint, faces, + face_edges, surf_edges, facepoint); break; } case HP_TRIG: diff --git a/libsrc/meshing/improve2.hpp b/libsrc/meshing/improve2.hpp index dad6a3ae..9c3c1be1 100644 --- a/libsrc/meshing/improve2.hpp +++ b/libsrc/meshing/improve2.hpp @@ -14,6 +14,7 @@ class MeshOptimize2d public: /// MeshOptimize2d (); + virtual ~MeshOptimize2d() { ; } /// void ImproveMesh (Mesh & mesh2d, const MeshingParameters & mp); void ImproveMeshJacobian (Mesh & mesh2d, const MeshingParameters & mp); diff --git a/libsrc/meshing/localh.cpp b/libsrc/meshing/localh.cpp index 99767360..0b0fa963 100644 --- a/libsrc/meshing/localh.cpp +++ b/libsrc/meshing/localh.cpp @@ -474,7 +474,7 @@ namespace netgen root->flags.isinner = 0; - Point<2> rpmid(root->xmid[0], root->xmid[1], root->xmid[2]); + Point<2> rpmid(root->xmid[0], root->xmid[1]); // , root->xmid[2]); Vec<2> rv(root->h2, root->h2); Point<2> rx2 = rpmid + rv; // Point<2> rx1 = rpmid - rv; diff --git a/libsrc/meshing/meshtool.cpp b/libsrc/meshing/meshtool.cpp index 4a349ac9..271b8747 100644 --- a/libsrc/meshing/meshtool.cpp +++ b/libsrc/meshing/meshtool.cpp @@ -356,18 +356,16 @@ namespace netgen if(teterrpow < 1) teterrpow = 1; if (teterrpow == 1) - { - errpow = err; - grad = graderr; - } - - if (teterrpow == 2) + { + errpow = err; + grad = graderr; + } + else if (teterrpow == 2) { errpow = err*err; grad = (2 * err) * graderr; } - - if(teterrpow > 2) + else { errpow = pow (err, teterrpow); grad = (teterrpow * errpow / err) * graderr; diff --git a/libsrc/meshing/parser3.cpp b/libsrc/meshing/parser3.cpp index c6ccba4a..a661fced 100644 --- a/libsrc/meshing/parser3.cpp +++ b/libsrc/meshing/parser3.cpp @@ -869,7 +869,7 @@ void vnetrule :: LoadRule (istream & ist) for (k = 1; k <= freesetfaces.Size(); k++) { - threeint tr = freesetfaces.Get(k); + // threeint tr = freesetfaces.Get(k); for (l = k+1; l <= freesetfaces.Size(); l++) { diff --git a/libsrc/meshing/ruler3.cpp b/libsrc/meshing/ruler3.cpp index 3b6f7a91..c83b1db5 100644 --- a/libsrc/meshing/ruler3.cpp +++ b/libsrc/meshing/ruler3.cpp @@ -229,7 +229,8 @@ int Meshing3 :: ApplyRules NgProfiler::RegionTimer regx1(base); NgProfiler::RegionTimer regx(base+ri); - sprintf (problems.Elem(ri), ""); + // sprintf (problems.Elem(ri), ""); + *problems.Elem(ri) = '\0'; rule = rules.Get(ri); diff --git a/libsrc/meshing/smoothing3.cpp b/libsrc/meshing/smoothing3.cpp index 24f1ef71..20c8e461 100644 --- a/libsrc/meshing/smoothing3.cpp +++ b/libsrc/meshing/smoothing3.cpp @@ -310,7 +310,7 @@ namespace netgen PointFunction (Mesh::T_POINTS & apoints, const Mesh::T_VOLELEMENTS & aelements, const MeshingParameters & amp); - + virtual ~PointFunction () { ; } virtual void SetPointIndex (PointIndex aactpind); void SetLocalH (double ah) { h = ah; } double GetLocalH () const { return h; } diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 1e943381..04d96f70 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -2116,7 +2116,13 @@ namespace netgen return TCL_ERROR; } sprintf(str,"rm %s", filename2); - system(str); + + err = system(str); + if (err != 0) + { + Tcl_SetResult (Togl_Interp(togl), (char*)"Cannot delete temporary file", TCL_VOLATILE); + return TCL_ERROR; + } return TCL_OK; }