From 2d038944216b606183f8c658d153b18d41c7ee9d Mon Sep 17 00:00:00 2001 From: Stefen Guzik <guzik2@llnl.gov> Date: Wed, 7 Jan 2009 05:36:34 +0000 Subject: [PATCH] Propagation of _const_ GFace/Edge * from reparamMeshVertex... to isSeam and reparamOnFace --- Geo/GEdge.cpp | 2 +- Geo/GEdge.h | 4 ++-- Geo/GVertex.cpp | 2 +- Geo/GVertex.h | 2 +- Geo/MVertex.cpp | 6 +++--- Geo/MVertex.h | 4 ++-- Geo/MZoneBoundary.cpp | 3 ++- Geo/OCCEdge.cpp | 4 ++-- Geo/OCCEdge.h | 4 ++-- Geo/OCCVertex.cpp | 2 +- Geo/OCCVertex.h | 2 +- Geo/gmshEdge.cpp | 2 +- Geo/gmshEdge.h | 2 +- Geo/gmshVertex.cpp | 2 +- Geo/gmshVertex.h | 2 +- 15 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 902f242c0f..75925212db 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -134,7 +134,7 @@ SVector3 GEdge::secondDer(double par) const return 500 * (x2 - x1); } -SPoint2 GEdge::reparamOnFace(GFace *face, double epar,int dir) const +SPoint2 GEdge::reparamOnFace(const GFace *face, double epar,int dir) const { // reparmaterize the point onto the given face. const GPoint p3 = point(epar); diff --git a/Geo/GEdge.h b/Geo/GEdge.h index 1f1074ee01..0ac4cfc769 100644 --- a/Geo/GEdge.h +++ b/Geo/GEdge.h @@ -48,7 +48,7 @@ class GEdge : public GEntity { virtual void setVisibility(char val, bool recursive=false); // true if the edge is a seam for the given face. - virtual bool isSeam(GFace *face) const { return false; } + virtual bool isSeam(const GFace *face) const { return false; } // get the bounding box virtual SBoundingBox3d bounds() const; @@ -73,7 +73,7 @@ class GEdge : public GEntity { virtual double curvature(double par) const; // reparmaterize the point onto the given face - virtual SPoint2 reparamOnFace(GFace *face, double epar, int dir) const; + virtual SPoint2 reparamOnFace(const GFace *face, double epar, int dir) const; // return the minimum number of segments used for meshing the edge virtual int minimumMeshSegments() const { return 1; } diff --git a/Geo/GVertex.cpp b/Geo/GVertex.cpp index df10ac83bc..f7796d8249 100644 --- a/Geo/GVertex.cpp +++ b/Geo/GVertex.cpp @@ -42,7 +42,7 @@ void GVertex::delEdge(GEdge *e) l_edges.erase(std::find(l_edges.begin(), l_edges.end(), e)); } -SPoint2 GVertex::reparamOnFace(GFace *gf, int) const +SPoint2 GVertex::reparamOnFace(const GFace *gf, int) const { return gf->parFromPoint(SPoint3(x(), y(), z())); } diff --git a/Geo/GVertex.h b/Geo/GVertex.h index 01b0fd8c85..5d525c251c 100644 --- a/Geo/GVertex.h +++ b/Geo/GVertex.h @@ -53,7 +53,7 @@ class GVertex : public GEntity virtual SBoundingBox3d bounds() const { return SBoundingBox3d(SPoint3(x(), y(), z())); } // reparmaterize the point onto the given face - virtual SPoint2 reparamOnFace(GFace *gf, int) const; + virtual SPoint2 reparamOnFace(const GFace *gf, int) const; // return a type-specific additional information string virtual std::string getAdditionalInfoString(); diff --git a/Geo/MVertex.cpp b/Geo/MVertex.cpp index 658dd4f8ce..1a14720c41 100644 --- a/Geo/MVertex.cpp +++ b/Geo/MVertex.cpp @@ -303,12 +303,12 @@ bool reparamMeshEdgeOnFace(MVertex *v1, MVertex *v2, GFace *gf, } } -bool reparamMeshVertexOnFace(MVertex *v, GFace *gf, SPoint2 ¶m) +bool reparamMeshVertexOnFace(const MVertex *v, const GFace *gf, SPoint2 ¶m) { if (gf->geomType() == GEntity::CompoundSurface && v->onWhat()->dim() < 2){ GFaceCompound *gfc = (GFaceCompound*) gf; - param = gfc->getCoordinates(v); + param = gfc->getCoordinates(const_cast<MVertex*>(v)); return true; } @@ -350,7 +350,7 @@ bool reparamMeshVertexOnFace(MVertex *v, GFace *gf, SPoint2 ¶m) return true; } -bool reparamMeshVertexOnEdge(MVertex *v, GEdge *ge, double ¶m) +bool reparamMeshVertexOnEdge(const MVertex *v, const GEdge *ge, double ¶m) { param = 1.e6; Range<double> bounds = ge->parBounds(0); diff --git a/Geo/MVertex.h b/Geo/MVertex.h index a75755c579..3f8ed42632 100644 --- a/Geo/MVertex.h +++ b/Geo/MVertex.h @@ -156,7 +156,7 @@ class MFaceVertex : public MVertex{ bool reparamMeshEdgeOnFace(MVertex *v1, MVertex *v2, GFace *gf, SPoint2 ¶m1, SPoint2 ¶m2); -bool reparamMeshVertexOnFace(MVertex *v, GFace *gf, SPoint2 ¶m); -bool reparamMeshVertexOnEdge(MVertex *v, GEdge *ge, double ¶m); +bool reparamMeshVertexOnFace(const MVertex *v, const GFace *gf, SPoint2 ¶m); +bool reparamMeshVertexOnEdge(const MVertex *v, const GEdge *ge, double ¶m); #endif diff --git a/Geo/MZoneBoundary.cpp b/Geo/MZoneBoundary.cpp index 786bfad512..d91ac615b4 100644 --- a/Geo/MZoneBoundary.cpp +++ b/Geo/MZoneBoundary.cpp @@ -216,6 +216,7 @@ int edge_normal { double par; + // Note: const_cast used to match MVertex.cpp interface if(!reparamMeshVertexOnEdge(vertex, gEdge, par)) return 1; const SVector3 tangent(gEdge->firstDer(par)); @@ -641,7 +642,7 @@ void updateBoVec<3, MFace> gFIt != useGFace.end(); ++gFIt) { SPoint2 par; - if(!reparamMeshVertexOnFace(vertex, (*gFIt), par)) + if(!reparamMeshVertexOnFace(vertex, *gFIt, par)) goto getNormalFromElements; // :P After all that! SVector3 boNormal = (*gFIt)->normal(par); diff --git a/Geo/OCCEdge.cpp b/Geo/OCCEdge.cpp index f5ac05e957..df47ffd733 100644 --- a/Geo/OCCEdge.cpp +++ b/Geo/OCCEdge.cpp @@ -64,7 +64,7 @@ void OCCEdge::setTrimmed (OCCFace *f) } } -SPoint2 OCCEdge::reparamOnFace(GFace *face, double epar, int dir) const +SPoint2 OCCEdge::reparamOnFace(const GFace *face, double epar, int dir) const { const TopoDS_Face *s = (TopoDS_Face*) face->getNativePtr(); double t0, t1; @@ -107,7 +107,7 @@ SPoint2 OCCEdge::reparamOnFace(GFace *face, double epar, int dir) const } // True if the edge is a seam for the given face -bool OCCEdge::isSeam(GFace *face) const +bool OCCEdge::isSeam(const GFace *face) const { if (face->geomType() == GEntity::CompoundSurface)return false; const TopoDS_Face *s = (TopoDS_Face*) face->getNativePtr(); diff --git a/Geo/OCCEdge.h b/Geo/OCCEdge.h index 725d49242c..969d9046ef 100644 --- a/Geo/OCCEdge.h +++ b/Geo/OCCEdge.h @@ -32,14 +32,14 @@ class OCCEdge : public GEdge { virtual GPoint point(double p) const; virtual SVector3 firstDer(double par) const; virtual double curvature (double par) const; - virtual SPoint2 reparamOnFace(GFace * face, double epar, int dir) const ; + virtual SPoint2 reparamOnFace(const GFace *face, double epar, int dir) const; ModelType getNativeType() const { return OpenCascadeModel; } void * getNativePtr() const { return (void*)&c; } virtual int minimumMeshSegments () const; virtual int minimumDrawSegments () const; bool is3D() const { return !curve.IsNull(); } void setTrimmed(OCCFace *); - bool isSeam(GFace *) const; + bool isSeam(const GFace *) const; }; #endif diff --git a/Geo/OCCVertex.cpp b/Geo/OCCVertex.cpp index 0a1e4bf60b..0ba1a03e67 100644 --- a/Geo/OCCVertex.cpp +++ b/Geo/OCCVertex.cpp @@ -65,7 +65,7 @@ double OCCVertex::max_curvature_of_surfaces() const return max_curvature; } -SPoint2 OCCVertex::reparamOnFace(GFace *gf, int dir) const +SPoint2 OCCVertex::reparamOnFace(const GFace *gf, int dir) const { std::list<GEdge*>::const_iterator it = l_edges.begin(); while(it != l_edges.end()){ diff --git a/Geo/OCCVertex.h b/Geo/OCCVertex.h index bd2e9b89fc..1e3d304aff 100644 --- a/Geo/OCCVertex.h +++ b/Geo/OCCVertex.h @@ -28,7 +28,7 @@ class OCCVertex : public GVertex { virtual void setPosition(GPoint &p); ModelType getNativeType() const { return OpenCascadeModel; } void * getNativePtr() const { return (void*)&v; } - virtual SPoint2 reparamOnFace(GFace *gf, int) const; + virtual SPoint2 reparamOnFace(const GFace *gf, int) const; }; #endif diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp index 4f4152544b..38a9156faf 100644 --- a/Geo/gmshEdge.cpp +++ b/Geo/gmshEdge.cpp @@ -89,7 +89,7 @@ int gmshEdge::minimumDrawSegments () const return CTX.geom.num_sub_edges * n; } -SPoint2 gmshEdge::reparamOnFace(GFace *face, double epar,int dir) const +SPoint2 gmshEdge::reparamOnFace(const GFace *face, double epar,int dir) const { Surface *s = (Surface*) face->getNativePtr(); diff --git a/Geo/gmshEdge.h b/Geo/gmshEdge.h index bf197c7d59..0c3d2daf29 100644 --- a/Geo/gmshEdge.h +++ b/Geo/gmshEdge.h @@ -25,7 +25,7 @@ class gmshEdge : public GEdge { virtual int minimumMeshSegments() const; virtual int minimumDrawSegments() const; virtual void resetMeshAttributes(); - virtual SPoint2 reparamOnFace(GFace *face, double epar, int dir) const; + virtual SPoint2 reparamOnFace(const GFace *face, double epar, int dir) const; }; #endif diff --git a/Geo/gmshVertex.cpp b/Geo/gmshVertex.cpp index 70b2142178..dfa94f0360 100644 --- a/Geo/gmshVertex.cpp +++ b/Geo/gmshVertex.cpp @@ -39,7 +39,7 @@ GEntity::GeomType gmshVertex::geomType() const return Point; } -SPoint2 gmshVertex::reparamOnFace(GFace *face, int dir) const +SPoint2 gmshVertex::reparamOnFace(const GFace *face, int dir) const { Surface *s = (Surface*)face->getNativePtr(); diff --git a/Geo/gmshVertex.h b/Geo/gmshVertex.h index e01a709e45..afdd9b00c3 100644 --- a/Geo/gmshVertex.h +++ b/Geo/gmshVertex.h @@ -32,7 +32,7 @@ class gmshVertex : public GVertex { meshSize = l; v->lc = meshSize; } - virtual SPoint2 reparamOnFace(GFace *gf, int) const; + virtual SPoint2 reparamOnFace(const GFace *gf, int) const; }; #endif -- GitLab