diff --git a/Geo/GModel.h b/Geo/GModel.h index ccb17c793b3d31983dcec5e0ba9c5820e0c3a2d1..1cc562c7008d2c1ff693c451c99679db476002d7 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -317,7 +317,8 @@ class GModel int readOCCBREP(const std::string &name); int readOCCIGES(const std::string &name); int readOCCSTEP(const std::string &name); - int importOCCShape(const void *shape, const void *meshConstraints=0); + int importOCCShape(const void *shape); + int applyOCCMeshConstraints(const void *constraints); // Gmsh mesh file format int readMSH(const std::string &name); diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp index 336e17c47f879703efd6829c005f3f532730a536..ea8b1121d93d90de6cda018cc923652e37d20c6d 100644 --- a/Geo/GModelIO_OCC.cpp +++ b/Geo/GModelIO_OCC.cpp @@ -585,15 +585,25 @@ int GModel::readOCCSTEP(const std::string &fn) return 1; } -static void applyOCCMeshConstraints(GModel *m, const void *constraints) +int GModel::importOCCShape(const void *shape) +{ + _occ_internals = new OCC_Internals; + _occ_internals->loadShape((TopoDS_Shape*)shape); + _occ_internals->buildGModel(this); + snapVertices(); + SetBoundingBox(); + return 1; +} + +int GModel::applyOCCMeshConstraints(const void *constraints) { #if defined(HAVE_OCC_MESH_CONSTRAINTS) MeshGmsh_Constrain *meshConstraints = (MeshGmsh_Constrain*)constraints; - + // apply mesh constraints on model vertices MeshGmsh_DataMapOfShapeOfVertexConstrain vertexConstraints; meshConstraints->GetVertexConstrain(vertexConstraints); - for(GModel::viter it = m->firstVertex(); it != m->lastVertex(); ++it){ + for(GModel::viter it = firstVertex(); it != lastVertex(); ++it){ GVertex *gv = *it; if(gv->getNativeType() != GEntity::OpenCascadeModel) continue; TopoDS_Shape *s = (TopoDS_Shape*)gv->getNativePtr(); @@ -611,7 +621,7 @@ static void applyOCCMeshConstraints(GModel *m, const void *constraints) TopoDS_Shape shape = c.GetFace(); Standard_Integer nodeNum; c.GetNodeNumber(nodeNum); - for(GModel::fiter it2 = m->firstFace(); it2 != m->lastFace(); ++it2){ + for(GModel::fiter it2 = firstFace(); it2 != lastFace(); ++it2){ GFace *gf = *it2; if(gf->getNativeType() != GEntity::OpenCascadeModel) continue; TopoDS_Shape *shape2 = (TopoDS_Shape*)gf->getNativePtr(); @@ -628,7 +638,7 @@ static void applyOCCMeshConstraints(GModel *m, const void *constraints) // apply mesh constraints on model edges MeshGmsh_DataMapOfShapeOfEdgeConstrain edgeConstraints; meshConstraints->GetEdgeConstrain(edgeConstraints); - for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); ++it){ + for(GModel::eiter it = firstEdge(); it != lastEdge(); ++it){ GEdge *ge = *it; if(ge->getNativeType() != GEntity::OpenCascadeModel) continue; TopoDS_Shape *s = (TopoDS_Shape*)ge->getNativePtr(); @@ -682,7 +692,7 @@ static void applyOCCMeshConstraints(GModel *m, const void *constraints) // embedding constraint if(c.IsEmbedded() && !c.GetFace().IsNull()){ TopoDS_Shape shape = c.GetFace(); - for(GModel::fiter it2 = m->firstFace(); it2 != m->lastFace(); ++it2){ + for(GModel::fiter it2 = firstFace(); it2 != lastFace(); ++it2){ GFace *gf = *it2; if(gf->getNativeType() != GEntity::OpenCascadeModel) continue; TopoDS_Shape *shape2 = (TopoDS_Shape*)gf->getNativePtr(); @@ -697,18 +707,10 @@ static void applyOCCMeshConstraints(GModel *m, const void *constraints) } } } -#endif -} - -int GModel::importOCCShape(const void *shape, const void *meshConstraints) -{ - _occ_internals = new OCC_Internals; - _occ_internals->loadShape((TopoDS_Shape*)shape); - _occ_internals->buildGModel(this); - snapVertices(); - SetBoundingBox(); - if(meshConstraints) applyOCCMeshConstraints(this, meshConstraints); return 1; +#else + return 0; +#endif } #else diff --git a/Mesh/gmshSmoothHighOrder.cpp b/Mesh/gmshSmoothHighOrder.cpp index eba8d32bffee66c13155e30d2fb4926505c130c3..1253033e0eb52b93b08d6388007c16fcf2c8f370 100644 --- a/Mesh/gmshSmoothHighOrder.cpp +++ b/Mesh/gmshSmoothHighOrder.cpp @@ -36,7 +36,7 @@ static int _gmshFindOptimalLocationsPN(GFace *gf,gmshHighOrderSmoother *s); static double shapeMeasure (MElement *e) { const double d1 = e->distoShapeMeasure(); - const double d2 = e->gammaShapeMeasure(); + //const double d2 = e->gammaShapeMeasure(); return d1; } @@ -146,7 +146,6 @@ static double _DeformationEnergy (MElement *e, dx.scale(0.0); Kdx.scale(0.0); - int C = 0; for (int i=0;i<N;i++){ SVector3 disp = s->getDisplacement(e->getVertex(i)); SVector3 str = s->getSSL(e->getVertex(i)); @@ -225,7 +224,7 @@ static double _function_pNt (gmshVector<double> &x, void *data){ static double xx[256]; static double yy[256]; static double zz[256]; - for (int i=0;i<p->n.size();i++){ + for (unsigned int i=0;i<p->n.size();i++){ GPoint gp12 = p->gf->point(SPoint2(x(2*i),x(2*i+1))); // printf("%g %g = %g %g\n",x(0),x(1),gp12.x(),gp12.y()); xx[i] = p->n[i]->x(); @@ -236,7 +235,7 @@ static double _function_pNt (gmshVector<double> &x, void *data){ p->n[i]->z() = gp12.z(); } double q = std::min(shapeMeasure(p->t1),shapeMeasure(p->t2)); - for (int i=0;i<p->n.size();i++){ + for (unsigned int i=0;i<p->n.size();i++){ p->n[i]->x() = xx[i]; p->n[i]->y() = yy[i]; p->n[i]->z() = zz[i]; @@ -249,7 +248,7 @@ static double _function_pNtB (gmshVector<double> &x, void *data){ static double xx[256]; static double yy[256]; static double zz[256]; - for (int i=0;i<p->n.size();i++){ + for (unsigned int i=0;i<p->n.size();i++){ GPoint gp12 = p->gf->point(SPoint2(x(2*i),x(2*i+1))); // printf("%g %g = %g %g\n",x(0),x(1),gp12.x(),gp12.y()); xx[i] = p->n[i]->x(); @@ -260,7 +259,7 @@ static double _function_pNtB (gmshVector<double> &x, void *data){ p->n[i]->z() = gp12.z(); } double E = _DeformationEnergy(p); - for (int i=0;i<p->n.size();i++){ + for (unsigned int i=0;i<p->n.size();i++){ p->n[i]->x() = xx[i]; p->n[i]->y() = yy[i]; p->n[i]->z() = zz[i]; @@ -555,7 +554,7 @@ double gmshHighOrderSmoother::smooth_metric_ ( std::vector<MElement*> & v, if (myAssembler.sizeOfR()){ - for (int i=0;i<v.size();i++){ + for (unsigned int i=0;i<v.size();i++){ MElement *e = v[i]; int nbNodes = e->getNumVertices(); const int n2 = 2*nbNodes; @@ -901,7 +900,7 @@ struct swap_triangles_p2 gmshVector<double> pp(2); pp(0) = p34_linear.x(); pp(1) = p34_linear.y(); - double opti = minimize_grad_fd (_function_p2tB, pp, &data); + minimize_grad_fd (_function_p2tB, pp, &data); return _test; } @@ -1042,7 +1041,6 @@ static int optimalLocationP2_ (GFace *gf, reparamMeshEdgeOnFace(n3,n4,gf,p3,p4); SPoint2 p34_linear = (p1+p2)*.5; SPoint2 dirt = p4-p3; - SPoint2 dirn = (-dirt.y(), dirt.x()); gmshVector<double> pp(2); pp(0) = p12.x(); @@ -1081,7 +1079,6 @@ int optimalLocationPN_ (GFace *gf, const MEdge &me, MTriangle *t1, MTriangle *t2 MVertex *n2 = me.getVertex(1); // get all the other nodes that are on the edge int N = t1->getNumVertices(); - int NF = t1->getNumFaceVertices(); int NE = t1->getNumEdgeVertices(); std::vector<MVertex*> toOptimize; for (int i=3;i<3+NE;i++){ @@ -1102,7 +1099,7 @@ int optimalLocationPN_ (GFace *gf, const MEdge &me, MTriangle *t1, MTriangle *t2 } gmshVector<double> pp(2*toOptimize.size()); - for (int i=0;i<toOptimize.size();i++){ + for (unsigned int i=0;i<toOptimize.size();i++){ SPoint2 pt; reparamMeshVertexOnFace(toOptimize[i],gf,pt); pp(2*i) = pt[0]; @@ -1116,7 +1113,7 @@ int optimalLocationPN_ (GFace *gf, const MEdge &me, MTriangle *t1, MTriangle *t2 if (init-opti < 1.e-5*(init))return 0; printf("Optimization has reduced the deformation energy %g -> %g\n", init,opti); - for (int i=0;i<toOptimize.size();i++){ + for (unsigned int i=0;i<toOptimize.size();i++){ GPoint gp12 = gf->point(SPoint2(pp(2*i),pp(2*i+1))); toOptimize[i]->x() = gp12.x(); toOptimize[i]->y() = gp12.y(); @@ -1493,8 +1490,8 @@ void optimizeNodeLocations(GFace *gf, smoothVertexDataHON &vdN, double eps = .2) double F = -smooth_obj_HighOrderN(uv, &vdN); if (F < eps){ - double val = 0.; Msg::Error("Fletcher-Reeves minimizer routine must be reimplemented"); + // double val = 0.; //minimize_N(2 * vdN.v.size(), smooth_obj_HighOrderN, // deriv_smoothing_objective_function_HighOrderN, // &vdN, 1, uv, val); @@ -1590,9 +1587,9 @@ void localHarmonicMapping(GModel *gm, const double V = myAssembler1.getDofValue (v, 0 ,1); printf("point %g %g -> %g %g\n",v->x(),v->y(),U,V); // we are in t1 - if (U >= V){ - const double ut = U; - } + //if (U >= V){ + //const double ut = U; + //} } diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index fd9b358a954450e9aeefee1a092f30661dd91518..9391abe4e1d06eeb56bfeaaaa5ce6afe4488ed11 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1459,7 +1459,7 @@ void orientMeshGFace::operator()(GFace *gf) // surface orientions in OCC do not seem to be consistent with the // orientation of the bounding edges, so we compare the normals // pointwise in an element - for(int i = 0; i < gf->getNumMeshElements(); i++){ + for(unsigned int i = 0; i < gf->getNumMeshElements(); i++){ MElement *e = gf->getMeshElement(i); for(int j = 0; j < e->getNumVertices(); j++){ MVertex *v = e->getVertex(j); @@ -1469,7 +1469,7 @@ void orientMeshGFace::operator()(GFace *gf) SVector3 nf = gf->normal(param); if(dot(ne, nf) < 0){ Msg::Debug("Reverting orientation of mesh in face %d", gf->tag()); - for(int k = 0; k < gf->getNumMeshElements(); k++) + for(unsigned int k = 0; k < gf->getNumMeshElements(); k++) gf->getMeshElement(k)->revert(); } return; diff --git a/Numeric/gmshLaplace.h b/Numeric/gmshLaplace.h index 223b5696dac9c50bff7ea00132129642bf7434b2..afc45dd65334f226db79315ab26ca1fa804c7f53 100644 --- a/Numeric/gmshLaplace.h +++ b/Numeric/gmshLaplace.h @@ -36,7 +36,7 @@ class gmshLaplaceTerm2DParametric : gmshLaplaceTerm { GFace *_gf; public: gmshLaplaceTerm2DParametric(GFace *gf, gmshFunction<double> *diffusivity, int iField = 0) : - _gf(gf),gmshLaplaceTerm(gf->model(),diffusivity,iField){} + gmshLaplaceTerm(gf->model(), diffusivity, iField), _gf(gf) {} virtual void elementMatrix(MElement *e, gmshMatrix<double> &m) const; }; diff --git a/Numeric/gmshLinearSystem.h b/Numeric/gmshLinearSystem.h index 4a288a1befb2a90f6a7c5b813b99cf1ad77fcf7a..caf623604c0bc868a6adca7c1f0fa68b35e2f997 100644 --- a/Numeric/gmshLinearSystem.h +++ b/Numeric/gmshLinearSystem.h @@ -13,6 +13,7 @@ template <class scalar> class gmshLinearSystem { public : gmshLinearSystem (){} + virtual ~gmshLinearSystem (){} virtual bool isAllocated() const = 0; virtual void allocate(int nbRows) = 0; virtual void addToMatrix(int _row, int _col, scalar val) = 0;