diff --git a/Common/onelab.h b/Common/onelab.h index 73bb0c81e799cbbe7795f47004faf85b3c9a0f1c..bebb05fce22ca02271d7e44900bd6a4e968aace6 100644 --- a/Common/onelab.h +++ b/Common/onelab.h @@ -67,6 +67,7 @@ namespace onelab{ const std::string &help="") : _name(name), _label(label), _help(help), _changed(true), _visible(true), _readOnly(false) {} + virtual ~parameter(){} void setName(const std::string &name){ _name = name; } void setLabel(const std::string &label){ _label = label; } void setHelp(const std::string &help){ _help = help; } diff --git a/Geo/Cell.h b/Geo/Cell.h index 9fd14e014dbfb34b85998b15a9d33003530e3ff0..a1db14df78bd7c82c8fd0aa26b0409fa8a0f6a60 100644 --- a/Geo/Cell.h +++ b/Geo/Cell.h @@ -71,6 +71,8 @@ class Cell { Cell(MElement* element, int domain); Cell(Cell* parent, int i); + virtual ~Cell(){} + int getDomain() const { return _domain; } void setDomain(int domain) { _domain = domain; } int getNum() const { return _num; } diff --git a/Geo/Chain.h b/Geo/Chain.h index 2241ccf9342053d914656eb00158189afe73d69c..eea7a8bc1abc3a8ab28285191e03d3f6ff8365fe 100644 --- a/Geo/Chain.h +++ b/Geo/Chain.h @@ -32,7 +32,7 @@ template <class Type> class PosetCat { public: - + virtual ~PosetCat(){} /// instantiated in derived classes virtual bool lessThan(const Type& t2) const = 0; @@ -71,6 +71,8 @@ class VectorSpaceCat { public: + virtual ~VectorSpaceCat(){} + /// instantiated in derived classes virtual V& operator+=(const V& v) = 0; virtual V& operator*=(const S& s) = 0; diff --git a/Geo/Curvature.cpp b/Geo/Curvature.cpp index 4e2482b3cbd19745234d7527da9a951c597aa48f..d799330e16af55ccff8e6bf3d011bc23c8598e1b 100644 --- a/Geo/Curvature.cpp +++ b/Geo/Curvature.cpp @@ -1272,7 +1272,7 @@ void Curvature::computeCurvature_RBF() for(std::set<MVertex *>::iterator itv = allNodes.begin(); itv !=allNodes.end() ; ++itv){ MVertex *v = *itv; std::map<int,int>::iterator vertexIterator; - int V0; + int V0 = 0; vertexIterator = _VertexToInt.find( v->getNum() ); if ( vertexIterator != _VertexToInt.end() ) V0 = (*vertexIterator).second; _VertexCurve[V0] = curvRBF[v]; diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 9547e3c0360cded10bbdbc8ff290ee54329a7298..951ce31cc6a1b5b8812019babac1cecf031b5138 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -327,9 +327,9 @@ GPoint GEdge::closestPoint(const SPoint3 &q, double &t) const double tMax = std::max(interval.high(), interval.low()); double DMIN = 1.e22; - double topt; - const double DT = (tMax-tMin)/(nbSamples-1) ; - for (int i=0;i<nbSamples;i++){ + double topt = tMin; + const double DT = (tMax - tMin) / (nbSamples - 1.) ; + for (int i = 0; i < nbSamples; i++){ t = tMin + i * DT; const SVector3 dp = q - position(t); const double D = dp.norm(); diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index 1788115957014984cbf3ea0f10a65e2aa6b852f1..f6f504586e7b2d836f1798ec3191303fdcf5ccc5 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -311,22 +311,23 @@ static bool closedCavity(MVertex *v, std::vector<MElement*> &vTri) return vs.empty(); } -static MVertex* findVertexInTri(v2t_cont &adjv, MVertex*v0, MVertex*v1, +static MVertex* findVertexInTri(v2t_cont &adjv, MVertex *v0, MVertex *v1, std::map<MVertex*, SPoint3> &vCoord, double nTot, bool &inverted) { - MVertex *v2; + MVertex *v2 = 0; v2t_cont :: iterator it0 = adjv.find(v0); std::vector<MElement*> vTri0 = it0->second; - MElement *myTri; + MElement *myTri = 0; for (unsigned int j = 0; j < vTri0.size(); j++){ MVertex *vt0 = vTri0[j]->getVertex(0); MVertex *vt1 = vTri0[j]->getVertex(1); MVertex *vt2 = vTri0[j]->getVertex(2); bool found0 = (vt0==v0 || vt1 ==v0 || vt2 ==v0) ? true: false; bool found1 = (vt0==v1 || vt1 ==v1 || vt2 ==v1) ? true: false; - if (found0 && found1) { myTri = vTri0[j]; break; } + if (found0 && found1) { myTri = vTri0[j]; break; } } + if(!myTri) return 0; for (unsigned int j = 0; j < 3; j++){ MVertex *vj = myTri->getVertex(j); if (vj!=v0 && vj!=v1) { v2 = vj; break;} diff --git a/Geo/GeomMeshMatcher.cpp b/Geo/GeomMeshMatcher.cpp index 22bdddf500c2090cebd90d095a423396bdf43d1f..20c5b5e828309bef02079360c3955b26d55c58a1 100644 --- a/Geo/GeomMeshMatcher.cpp +++ b/Geo/GeomMeshMatcher.cpp @@ -89,7 +89,7 @@ GeomMeshMatcher::matchVertices(GModel* m1, GModel *m2, bool& ok) // FIXME: need a *much* better way to fix the tolerance... double tol = 10e-8; - discreteVertex* best_candidate; + discreteVertex* best_candidate = 0; GEntity* best_candidate_ge = 0; double best_score = DBL_MAX; diff --git a/Geo/intersectCurveSurface.h b/Geo/intersectCurveSurface.h index 7745bfd40c2f97d6769d384cfe3b837f45eefeae..d55306d2796f8f46d3884892659bf84a7c376bc2 100644 --- a/Geo/intersectCurveSurface.h +++ b/Geo/intersectCurveSurface.h @@ -17,12 +17,14 @@ class surfaceFunctor { public : + virtual ~surfaceFunctor(){} virtual SPoint3 operator () (double u, double v) const = 0; }; class curveFunctor { public : + virtual ~curveFunctor(){} virtual SPoint3 operator () (double t) const = 0; }; diff --git a/Mesh/QuadTriExtruded3D.cpp b/Mesh/QuadTriExtruded3D.cpp index 1495a96ca4b39e33a64725c91fe5eef7e304fc6e..3b33a52950c279020177003abef52121f7e6311d 100644 --- a/Mesh/QuadTriExtruded3D.cpp +++ b/Mesh/QuadTriExtruded3D.cpp @@ -740,7 +740,7 @@ static void bruteForceEdgeQuadToTriPrism( GRegion *gr, MElement *elem, // t=2, allow free faces to be meshed with lowest vertex pointer in diagonal // t=3, allow any diagonal that works bool valid_division = false; - int face_done[2]; // holds the face numbers for the two faces that are done + int face_done[2]={0,0}; // holds the face numbers for the two faces that are done for( int t = 0; t < 4; t++ ){ // variables that hold the face diagonal nodes. @@ -955,8 +955,8 @@ static void addEdgesForQuadToTriTwoPtDegenHexa( GRegion *gr, MElement *elem, Ext int p_lat = (degen_face+2)%4, n1_lat = -10, n2_lat = -11; bool p_lat_is_free = false; for( int s = 0; s < 3; s++ ){ - int p_tmp, *n1_tmp, *n2_tmp; - bool *p_is_free_tmp; + int p_tmp=0, *n1_tmp=0, *n2_tmp=0; + bool *p_is_free_tmp=0; if( !s ){ p_tmp = p_bot; n1_tmp = &n1_bot; @@ -1600,7 +1600,7 @@ static void addEdgesForQuadToTriFullHexa( GRegion *gr, MElement *elem, ExtrudePa // don't really want to forbid surfaces, though...that's why two prisms are not immediately // cut when found. int p1_hold = -1, p2_hold = -2; // if found two opposite diags that could work alone - int n1_hold[2], n2_hold[2]; // hold diag nodes for p1_hold, p2_hold. + int n1_hold[2]={0,0}, n2_hold[2]={0,0}; // hold diag nodes for p1_hold, p2_hold. bool valid_division = false; for( int t = 0; t < 4; t++ ){ @@ -3082,7 +3082,7 @@ static int makeEdgesForOtherBndHexa( GRegion *gr, bool is_dbl, CategorizedSource // Get a count of bnd verts. If one point, that index will be in one_point_ind. // For 3 bnd vert quads record the empty spot in 'skip.' - int bnd_count = 0, skip, one_point_ind; + int bnd_count = 0, skip = 0, one_point_ind = 0; for( int s = 0; s < elem_size; s++ ){ if( vert_bnd[s] ){ bnd_count++; diff --git a/Mesh/QuadTriUtils.cpp b/Mesh/QuadTriUtils.cpp index 070b40d06a1fbbae9749f5bf2c1a95723aa17626..84cc192a82f7e65fce0a660c3c7a573214051a73 100644 --- a/Mesh/QuadTriUtils.cpp +++ b/Mesh/QuadTriUtils.cpp @@ -343,7 +343,7 @@ MVertex* QtMakeCentroidVertex( std::vector<MVertex*> v, std::vector<MVertex*> *t // find the centroid of vertices std::vector<double> centroid = QtFindVertsCentroid(v); - double x, y, z; + double x = 0., y = 0., z = 0.; if( centroid.size() ){ x = centroid[0]; y = centroid[1]; diff --git a/Mesh/meshGFaceBoundaryLayers.cpp b/Mesh/meshGFaceBoundaryLayers.cpp index 722db88afdf113e769a400638154d3f420d71660..3e3bd8850abd6cb77d7d8f4138740541e0ce265f 100644 --- a/Mesh/meshGFaceBoundaryLayers.cpp +++ b/Mesh/meshGFaceBoundaryLayers.cpp @@ -310,7 +310,7 @@ BoundaryLayerColumns* buidAdditionalPoints2D (GFace *gf) // printf("start with point %g %g (%g %g)\n",current->x(),current->y(),p.x(),p.y()); AttractorField *catt = 0; SPoint3 _close; - double _current_distance; + double _current_distance = 0.; while(1){ SMetric3 m; diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp index df06bbeee90592a7a1c2cac3b3eb4c9c54e1d3df..9be733a8ddcee485d6b12195fd2781362a8d591c 100644 --- a/Mesh/meshGFaceLloyd.cpp +++ b/Mesh/meshGFaceLloyd.cpp @@ -1071,7 +1071,7 @@ void lpcvt::step5(DocRecord& triangulator,GFace* gf){ int k; int num; int start; - int opposite; + int opposite = 0; bool flag; SPoint2 p1,p2,p3,p4,reference,val; SVector3 n; diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index 0af7a0d05f52eb9d5cc77961e77c38a3d05e7e09..166f13183ef2124b242175cf394dc0ebd5a8e235 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -2186,7 +2186,7 @@ int postProcessExtraEdges (GFace *gf, std::vector<std::pair<MElement*,MElement*> p.x(), p.y()); gf->mesh_vertices.push_back(newVertex); - int start1,start2; + int start1 = 0,start2 = 0; int orientation1=1, orientation2=1; for (int k=0;k<3;k++){ if (t1->getVertex(k) == it->first){ @@ -2851,7 +2851,7 @@ static int _recombineIntoQuads(GFace *gf, int recur_level, bool cubicGraph = 1) break; } } - int start; + int start = 0; for(int i = 0; i < 3; i++) { if (t2->getVertex(0) != t1->getVertex(i) && t2->getVertex(1) != t1->getVertex(i) && diff --git a/Plugin/Scal2Vec.cpp b/Plugin/Scal2Vec.cpp index 5d68c68d561ca13bdb57e9ec077942051b93750b..da1b8a49ef0bf6b0fae431d52c0243009abe0182 100644 --- a/Plugin/Scal2Vec.cpp +++ b/Plugin/Scal2Vec.cpp @@ -63,7 +63,7 @@ PView *GMSH_Scal2VecPlugin::execute(PView *v) std::string nameNewView = Scal2VecOptions_String[0].def; PView *vRef = 0, *vX = 0, *vY = 0, *vZ = 0; - PViewData *dataRef, *dataX, *dataY, *dataZ; + PViewData *dataRef = 0, *dataX = 0, *dataY = 0, *dataZ = 0; // Load data if(iViewX >= 0){ diff --git a/Solver/dofManager.h b/Solver/dofManager.h index 34d6d3fa04aa28b5dd1c79517790d970fe5414b4..48633e23bfaf64bbb675751c686cebaf274955f1 100644 --- a/Solver/dofManager.h +++ b/Solver/dofManager.h @@ -148,6 +148,7 @@ class dofManager : public dofManagerBase{ _linearSystems.insert(std::make_pair("A", l1)); _linearSystems.insert(std::make_pair("B", l2)); } + virtual ~dofManager(){} virtual inline void fixDof(Dof key, const dataVec &value) { if(unknown.find(key) != unknown.end()) diff --git a/Solver/filters.h b/Solver/filters.h index f12f9a1d3f483e7542d1afff769935cc3cb9d839..8e2ec868a3b0aa83f639e40cb5f32d5cf64e1bf7 100644 --- a/Solver/filters.h +++ b/Solver/filters.h @@ -27,6 +27,7 @@ class FilterNodeEnriched _TagEnrichedVertex = TagEnrichedVertex; _EnrichComp = EnrichComp; } + virtual ~FilterNodeEnriched(){} virtual bool operator() (Dof &key) const{ std::set<int>::iterator it1; @@ -81,7 +82,7 @@ class FilterElementsCutByLevelSet } } } - + virtual ~FilterElementsCutByLevelSet(){} virtual bool operator () (Dof & key) const{ std::set<int>::const_iterator it1; std::set<int>::const_iterator it2; diff --git a/Solver/functionSpace.h b/Solver/functionSpace.h index 8343eb1e65787cc0a397ed37c46627077d44b91d..cbb0f9340835eb0f9ba37e5e2a0d5dca5887731f 100644 --- a/Solver/functionSpace.h +++ b/Solver/functionSpace.h @@ -66,6 +66,7 @@ template<> struct TensorialTraits<STensor3> class FunctionSpaceBase { public: + virtual ~FunctionSpaceBase(){} virtual int getNumKeys(MElement *ele) = 0; // if one needs the number of dofs virtual void getKeys(MElement *ele, std::vector<Dof> &keys) = 0; }; diff --git a/Solver/groupOfElements.h b/Solver/groupOfElements.h index 4ade2d7072dd842d3beec4495d3def0f0044f13c..3a653f256d6f5896b346db3990f85b921e893534 100644 --- a/Solver/groupOfElements.h +++ b/Solver/groupOfElements.h @@ -11,111 +11,89 @@ #include "MElement.h" class elementFilter { -public: + public: + virtual ~elementFilter(){} virtual bool operator() (MElement *) const = 0; }; class elementFilterTrivial : public elementFilter { -public: + public: bool operator() (MElement *) const {return true;} }; class groupOfElements { + public: + typedef std::set<MElement*> elementContainer; + typedef std::set<MVertex*> vertexContainer; - public: + protected: + vertexContainer _vertices; + elementContainer _elements; + elementContainer _parents; - typedef std::set<MElement*> elementContainer; - typedef std::set<MVertex*> vertexContainer; + public: + groupOfElements(){} + groupOfElements (int dim, int physical) { addPhysical (dim, physical); } + groupOfElements (GFace*); + groupOfElements (GRegion*); + groupOfElements(std::vector<MElement*> &elems); - protected: + virtual ~groupOfElements(){} - vertexContainer _vertices; - elementContainer _elements; - elementContainer _parents; - - public: - - groupOfElements(){} - - groupOfElements (int dim, int physical) { - addPhysical (dim, physical); - } - - groupOfElements (GFace*); - groupOfElements (GRegion*); - groupOfElements(std::vector<MElement*> &elems); - - virtual void addPhysical(int dim, int physical) { - elementFilterTrivial filter; - addPhysical (dim, physical, filter); - } - - virtual void addElementary(GEntity *ge, const elementFilter &f); - - virtual void addPhysical(int dim, int physical, const elementFilter &); - - vertexContainer::const_iterator vbegin() const { - return _vertices.begin(); - } - vertexContainer::const_iterator vend() const { - return _vertices.end(); - } - - elementContainer::const_iterator begin() const { - return _elements.begin(); - } - elementContainer::const_iterator end() const { - return _elements.end(); - } - - size_t size() const { - return _elements.size(); - } - - size_t vsize() const { - return _vertices.size(); - } + virtual void addPhysical(int dim, int physical) + { + elementFilterTrivial filter; + addPhysical (dim, physical, filter); + } - // FIXME : NOT VERY ELEGANT !!! - bool find (MElement *e) const // if same parent but different physicals return true ?! - { - if (e->getParent() && _parents.find(e->getParent()) != _parents.end()) return true; - return (_elements.find(e) != _elements.end()); - } + virtual void addElementary(GEntity *ge, const elementFilter &f); - inline void insert (MElement *e) - { + virtual void addPhysical(int dim, int physical, const elementFilter &); + + vertexContainer::const_iterator vbegin() const { return _vertices.begin(); } + vertexContainer::const_iterator vend() const { return _vertices.end(); } + elementContainer::const_iterator begin() const { return _elements.begin(); } + elementContainer::const_iterator end() const { return _elements.end(); } - _elements.insert(e); + size_t size() const { return _elements.size(); } + size_t vsize() const { return _vertices.size(); } - if (e->getParent()){ - _parents.insert(e->getParent()); - for (int i = 0; i < e->getParent()->getNumVertices(); i++){ - _vertices.insert(e->getParent()->getVertex(i)); - } - } - else{ - for (int i = 0; i < e->getNumVertices(); i++){ - _vertices.insert(e->getVertex(i)); - } + // FIXME : NOT VERY ELEGANT !!! + bool find (MElement *e) const // if same parent but different physicals return true ?! + { + if (e->getParent() && _parents.find(e->getParent()) != _parents.end()) return true; + return (_elements.find(e) != _elements.end()); + } + + inline void insert (MElement *e) + { + _elements.insert(e); + + if (e->getParent()){ + _parents.insert(e->getParent()); + for (int i = 0; i < e->getParent()->getNumVertices(); i++){ + _vertices.insert(e->getParent()->getVertex(i)); } } - - inline void clearAll() - { - _vertices.clear(); - _elements.clear(); - _parents.clear(); + else{ + for (int i = 0; i < e->getNumVertices(); i++){ + _vertices.insert(e->getVertex(i)); + } } + } + + inline void clearAll() + { + _vertices.clear(); + _elements.clear(); + _parents.clear(); + } }; // child elements in pElem restricted to elements who have parent in sElem class groupOfLagMultElements : public groupOfElements { - - private : - - + private : void fillElementContainer(groupOfElements &pElem, groupOfElements &sElem) { groupOfElements::elementContainer::const_iterator itp = pElem.begin(); @@ -129,8 +107,7 @@ class groupOfLagMultElements : public groupOfElements } } - public : - + public : groupOfLagMultElements(int dim, int physical, groupOfElements &sElem) : groupOfElements() { groupOfElements pElem(dim , physical); @@ -148,5 +125,4 @@ class groupOfLagMultElements : public groupOfElements }; - #endif diff --git a/Solver/linearSystem.h b/Solver/linearSystem.h index 89285413f338ef94a0e9c212b3cac462253ac543..ef701944257310de9f61c03006c44e734471864a 100644 --- a/Solver/linearSystem.h +++ b/Solver/linearSystem.h @@ -15,6 +15,7 @@ class linearSystemBase { protected: std::map<std::string, std::string> _parameters; public : + virtual ~linearSystemBase(){} virtual bool isAllocated() const = 0; virtual void allocate(int nbRows) = 0; virtual void clear() = 0; diff --git a/Solver/solverAlgorithms.h b/Solver/solverAlgorithms.h index 49654c8c503362be64145fb67e587e3c4f1e00b5..ea9abe904a2003d6a25baf1782d9bb312dec21f8 100644 --- a/Solver/solverAlgorithms.h +++ b/Solver/solverAlgorithms.h @@ -159,6 +159,7 @@ template<class Assembler> void FixDofs(Assembler &assembler, std::vector<Dof> &d class FilterDof { public: + virtual ~FilterDof(){} virtual bool operator()(Dof key) = 0; }; diff --git a/contrib/DiscreteIntegration/Integration3D.h b/contrib/DiscreteIntegration/Integration3D.h index 4e7f1cf3aa5ffb3a5c4adc61f353fec5bf9a777e..fdc1b93f8a397733adb7a8ee4985633acdf25e4f 100644 --- a/contrib/DiscreteIntegration/Integration3D.h +++ b/contrib/DiscreteIntegration/Integration3D.h @@ -47,6 +47,7 @@ class DI_Point DI_Point (double x, double y, double z, const double ls) : x_(x), y_(y), z_(z) {addLs(ls);} DI_Point (double x, double y, double z, const DI_Element *e, const std::vector<gLevelset *> &RPNi) : x_(x), y_(y), z_(z) {computeLs(e, RPNi);} + virtual ~DI_Point(){} virtual const polynomialBasis* getFunctionSpace(int o) const { return polynomialBases::find(MSH_PNT); } virtual void getShapeFunctions(double u, double v, double w, double s[], int o)