From 15bd96b9d4dc3b74e447ae2d36829949d9c49476 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 27 Aug 2010 10:03:33 +0000 Subject: [PATCH] pp --- Common/LuaBindings.cpp | 3 ++- Common/LuaBindings.h | 12 ++++++++---- Geo/ACISFace.h | 3 ++- Geo/ExtrudeParams.cpp | 38 ++++++++++++++++---------------------- Geo/ExtrudeParams.h | 22 +++++++++++----------- Geo/Geo.h | 3 ++- Geo/OCCFace.cpp | 2 -- Geo/OCCFace.h | 4 ++-- Geo/discreteEdge.cpp | 3 +-- Geo/discreteEdge.h | 10 ++++++---- Geo/gmshFace.h | 3 ++- 11 files changed, 52 insertions(+), 51 deletions(-) diff --git a/Common/LuaBindings.cpp b/Common/LuaBindings.cpp index 9af49dc826..73c2a99b67 100644 --- a/Common/LuaBindings.cpp +++ b/Common/LuaBindings.cpp @@ -439,7 +439,8 @@ binding::~binding() } } -void *binding::checkudata_with_inheritance (lua_State *L, int ud, const char *tname) { +void *binding::checkudata_with_inheritance (lua_State *L, int ud, const char *tname) +{ void *p = lua_touserdata(L, ud); if (!p) return NULL; diff --git a/Common/LuaBindings.h b/Common/LuaBindings.h index b0759438f3..931c38b656 100644 --- a/Common/LuaBindings.h +++ b/Common/LuaBindings.h @@ -298,7 +298,8 @@ class luaStack<type *>{ public: static type* get(lua_State *L, int ia) { - userdataType *ud=static_cast<userdataType*>(binding::checkudata_with_inheritance (L, ia, getName().c_str())); + userdataType *ud = static_cast<userdataType*> + (binding::checkudata_with_inheritance (L, ia, getName().c_str())); if(!ud) luaL_typerror(L, ia, className<type>::get().c_str()); return ud->pT; } @@ -323,7 +324,8 @@ class luaStack<const type *>{ public: static type* get(lua_State *L, int ia) { - userdataType *ud=static_cast<userdataType*>(binding::checkudata_with_inheritance (L, ia, getName().c_str())); + userdataType *ud = static_cast<userdataType*> + (binding::checkudata_with_inheritance (L, ia, getName().c_str())); if(!ud) luaL_typerror(L, ia, className<type>::get().c_str()); return ud->pT; } @@ -348,7 +350,8 @@ class luaStack<type &>{ public: static type& get(lua_State *L, int ia) { - userdataType *ud=static_cast<userdataType*>(binding::checkudata_with_inheritance (L, ia, getName().c_str())); + userdataType *ud = static_cast<userdataType*> + (binding::checkudata_with_inheritance (L, ia, getName().c_str())); if(!ud) luaL_typerror(L, ia, className<type>::get().c_str()); return *ud->pT; } @@ -364,7 +367,8 @@ class luaStack<const type &>{ public: static type& get(lua_State *L, int ia) { - userdataType *ud=static_cast<userdataType*>(binding::checkudata_with_inheritance (L, ia, getName().c_str())); + userdataType *ud = static_cast<userdataType*> + (binding::checkudata_with_inheritance (L, ia, getName().c_str())); if(!ud) luaL_typerror(L, ia, className<type>::get().c_str()); return *ud->pT; } diff --git a/Geo/ACISFace.h b/Geo/ACISFace.h index dcfe9a4adb..15b1bc579f 100644 --- a/Geo/ACISFace.h +++ b/Geo/ACISFace.h @@ -28,7 +28,8 @@ class ACISFace : public GFace { virtual double period(int dir) const; Range<double> parBounds(int i) const; virtual GPoint point(double par1, double par2) const; - virtual GPoint closestPoint(const SPoint3 & queryPoint, const double initialGuess[2]) const; + virtual GPoint closestPoint(const SPoint3 & queryPoint, + const double initialGuess[2]) const; virtual bool containsPoint(const SPoint3 &pt) const; virtual SVector3 normal(const SPoint2 ¶m) const; virtual Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; diff --git a/Geo/ExtrudeParams.cpp b/Geo/ExtrudeParams.cpp index 03393e9f60..46967b0da1 100644 --- a/Geo/ExtrudeParams.cpp +++ b/Geo/ExtrudeParams.cpp @@ -11,11 +11,9 @@ smooth_data* ExtrudeParams::normals = 0; static void Projette(double p[3], double mat[3][3]) { - double X, Y, Z; - - X = p[0] * mat[0][0] + p[1] * mat[0][1] + p[2] * mat[0][2]; - Y = p[0] * mat[1][0] + p[1] * mat[1][1] + p[2] * mat[1][2]; - Z = p[0] * mat[2][0] + p[1] * mat[2][1] + p[2] * mat[2][2]; + double X = p[0] * mat[0][0] + p[1] * mat[0][1] + p[2] * mat[0][2]; + double Y = p[0] * mat[1][0] + p[1] * mat[1][1] + p[2] * mat[1][2]; + double Z = p[0] * mat[2][0] + p[1] * mat[2][1] + p[2] * mat[2][2]; p[0] = X; p[1] = Y; p[2] = Z; @@ -127,9 +125,10 @@ ExtrudeParams::ExtrusionElementMap::ExtrusionElementMap(ExtrudeParams*const pare _parent = parent; } -std::vector< MElement* >* ExtrudeParams::ExtrusionElementMap::getExtrudedElems(MElement* source) +std::vector<MElement*>* ExtrudeParams:: +ExtrusionElementMap::getExtrudedElems(MElement* source) { - std::map<MElement*,std::vector<MElement*> >::iterator it = _extrudedElements.find(source); + std::map<MElement*, std::vector<MElement*> >::iterator it = _extrudedElements.find(source); if(it != _extrudedElements.end()) return &(it->second); return NULL; @@ -144,7 +143,8 @@ bool ExtrudeParams::ExtrusionElementMap::empty() return _extrudedElements.empty(); } -void ExtrudeParams::ExtrusionElementMap::addExtrudedElem(MElement* source, MElement* extrudedElem) +void ExtrudeParams:: +ExtrusionElementMap::addExtrudedElem(MElement* source, MElement* extrudedElem) { std::map<MElement*,std::vector<MElement*> >::iterator it = _extrudedElements.find(source); if(it != _extrudedElements.end()) @@ -159,37 +159,31 @@ void ExtrudeParams::ExtrusionElementMap::addExtrudedElem(MElement* source, MElem _extrudedElements.insert(std::pair<MElement*,std::vector<MElement*> >(source,*vec)); } SPoint3 np = extrudedElem->barycenter(), sp = source->barycenter(); -// if(extrudedElem->getDim() == 3) -// printf("Inst (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f) %p->%p\n",sp.x(),sp.y(),sp.z(),np.x(),np.y(),np.z(),source,extrudedElem); } -// Propagates the partition information from the source elements to the extruded elements. -// Increments the partition sizes if partitionSizes is given as argument. -// For efficient looping, this routine is within ExtrusionElementMap class. -void ExtrudeParams::ExtrusionElementMap::propagatePartitionInformation(std::vector< int >* partitionSizes) +// Propagates the partition information from the source elements to +// the extruded elements. Increments the partition sizes if +// partitionSizes is given as argument. For efficient looping, this +// routine is within ExtrusionElementMap class. +void ExtrudeParams:: +ExtrusionElementMap::propagatePartitionInformation(std::vector<int> *partitionSizes) { if (_extrudedElements.empty()) Msg::Error("No extrusion information found!"); std::map<MElement*,std::vector<MElement*> >::iterator columnit; - for(columnit=_extrudedElements.begin(); columnit != _extrudedElements.end(); columnit++) { + for(columnit=_extrudedElements.begin(); columnit != _extrudedElements.end(); + columnit++) { MElement* sourceElem = (*columnit).first; if(!sourceElem) { Msg::Warning("No source found!"); continue; } std::vector<MElement*> extrudedElements = (*columnit).second; -// if(!extrudedElements) { -// // Msg::Warning("No element vector found!"); -// continue; -// } for(unsigned int iE = 0;iE < extrudedElements.size();iE++) { if(extrudedElements[iE]) { extrudedElements[iE]->setPartition(sourceElem->getPartition()); if (partitionSizes) ++(*partitionSizes)[sourceElem->getPartition()-1]; -// SPoint3 np = extrudedElements[iE]->barycenter(), sp = sourceElem->barycenter(); -// if(extrudedElements[iE]->getDim() == 3) -// printf("Read (%.3f,%.3f,%.3f) %d -> (%.3f,%.3f,%.3f) %d %p->%p\n",sp.x(),sp.y(),sp.z(),extrudedElements[iE]->getPartition() ,np.x(),np.y(),np.z(),sourceElem->getPartition(),sourceElem,extrudedElements[iE]); } } } diff --git a/Geo/ExtrudeParams.h b/Geo/ExtrudeParams.h index ce6c344f04..b1dcf3a720 100644 --- a/Geo/ExtrudeParams.h +++ b/Geo/ExtrudeParams.h @@ -25,17 +25,17 @@ class ExtrudeParams{ public : class ExtrusionElementMap { - private: - ExtrudeParams* _parent; - // maps source element to all extruded elements - std::map<MElement*,std::vector<MElement*> > _extrudedElements; - public: - ExtrusionElementMap(ExtrudeParams* const parent); - std::vector<MElement*>* getExtrudedElems(MElement* source); - void addExtrudedElem(MElement* source,MElement* extrudedElem); - void clear(); - bool empty(); - void propagatePartitionInformation(std::vector<int>* partitionSizes = NULL); + private: + ExtrudeParams* _parent; + // maps source element to all extruded elements + std::map<MElement*,std::vector<MElement*> > _extrudedElements; + public: + ExtrusionElementMap(ExtrudeParams* const parent); + std::vector<MElement*>* getExtrudedElems(MElement* source); + void addExtrudedElem(MElement* source,MElement* extrudedElem); + void clear(); + bool empty(); + void propagatePartitionInformation(std::vector<int>* partitionSizes = NULL); } elementMap; static smooth_data *normals; ExtrudeParams(int Mode = EXTRUDED_ENTITY); diff --git a/Geo/Geo.h b/Geo/Geo.h index f4613af332..6bfc4abd22 100644 --- a/Geo/Geo.h +++ b/Geo/Geo.h @@ -148,7 +148,8 @@ class Surface{ int Method; int Recombine; int Recombine_Dir; // -1 is left, +1 is right, 0 is alternated - int TypeOfMapping; // +1 is harmonic, -1 is conformal, +2 harmonic_NoSplit , -2 conformal_NoSplit + int TypeOfMapping; // +1 is harmonic, -1 is conformal, +2 harmonic_NoSplit, + // -2 conformal_NoSplit double RecombineAngle; int TransfiniteSmoothing; List_T *Generatrices; diff --git a/Geo/OCCFace.cpp b/Geo/OCCFace.cpp index 828a68059b..10213ec439 100644 --- a/Geo/OCCFace.cpp +++ b/Geo/OCCFace.cpp @@ -31,7 +31,6 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num) : GFace(m, num), s(_s) { - // printf("NEW OCC FACE %d\n",tag()); setup(); } @@ -95,7 +94,6 @@ void OCCFace::setup() umax += fabs(du) / 100.0; vmax += fabs(dv) / 100.0; occface = BRep_Tool::Surface(s); - // printf("size = %d\n",l_edges.size()); } Range<double> OCCFace::parBounds(int i) const diff --git a/Geo/OCCFace.h b/Geo/OCCFace.h index 7f5d057a86..6a9227f5f5 100644 --- a/Geo/OCCFace.h +++ b/Geo/OCCFace.h @@ -26,12 +26,12 @@ class OCCFace : public GFace { void replaceEdgesInternal (std::list<GEdge*> &); void setup(); public: - //OCCFace(GModel *m, TopoDS_Face s, int num, TopTools_IndexedMapOfShape &emap); OCCFace(GModel *m, TopoDS_Face s, int num); virtual ~OCCFace(){} Range<double> parBounds(int i) const; virtual GPoint point(double par1, double par2) const; - virtual GPoint closestPoint(const SPoint3 & queryPoint, const double initialGuess[2]) const; + virtual GPoint closestPoint(const SPoint3 & queryPoint, + const double initialGuess[2]) const; virtual bool containsPoint(const SPoint3 &pt) const; virtual SVector3 normal(const SPoint2 ¶m) const; virtual Pair<SVector3,SVector3> firstDer(const SPoint2 ¶m) const; diff --git a/Geo/discreteEdge.cpp b/Geo/discreteEdge.cpp index a06f135058..05108fbac3 100644 --- a/Geo/discreteEdge.cpp +++ b/Geo/discreteEdge.cpp @@ -389,7 +389,6 @@ void discreteEdge::computeNormals () const // itn->second = SVector3(nx,ny,nz); // } // delete normals; - } void discreteEdge::getLocalParameter(const double &t, int &iLine, @@ -448,7 +447,7 @@ GPoint discreteEdge::point(double par) const b210 = (2*v1 + v2 -w12*n1)*0.333; b120 = (2*v2 + v1 -w21*n2)*0.333; -// //tagged PN trinagles (sigma=1) + // tagged PN trinagles (sigma=1) double theta = 0.0; SVector3 d1 = v1+.33*(1-theta)*(v2-v1); SVector3 d2 = v2+.33*(1-theta)*(v1-v2); diff --git a/Geo/discreteEdge.h b/Geo/discreteEdge.h index f1b5e46d62..3177df7e40 100644 --- a/Geo/discreteEdge.h +++ b/Geo/discreteEdge.h @@ -14,8 +14,8 @@ class discreteEdge : public GEdge { protected: std::vector<double> _pars; std::vector<int> _orientation; - std::map<MVertex*,MLine*> boundv; - mutable std::map<MVertex*,SVector3, std::less<MVertex*> > _normals; + std::map<MVertex*, MLine*> boundv; + mutable std::map<MVertex*, SVector3, std::less<MVertex*> > _normals; bool createdTopo; public: discreteEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1); @@ -25,8 +25,10 @@ class discreteEdge : public GEdge { virtual GPoint point(double p) const; virtual SVector3 firstDer(double par) const; virtual Range<double> parBounds(int) const; - void parametrize( std::map<GFace*, std::map<MVertex*, MVertex*, std::less<MVertex*> > > &face2Verts, - std::map<GRegion*, std::map<MVertex*, MVertex*, std::less<MVertex*> > > ®ion2Vert); + void parametrize(std::map<GFace*, std::map<MVertex*, MVertex*, + std::less<MVertex*> > > &face2Verts, + std::map<GRegion*, std::map<MVertex*, MVertex*, + std::less<MVertex*> > > ®ion2Vert); void orderMLines(); void setBoundVertices(); void createTopo(); diff --git a/Geo/gmshFace.h b/Geo/gmshFace.h index 56b794f3ca..ad6c31abc1 100644 --- a/Geo/gmshFace.h +++ b/Geo/gmshFace.h @@ -22,7 +22,8 @@ class gmshFace : public GFace { Range<double> parBounds(int i) const; void setModelEdges(std::list<GEdge*> &); virtual GPoint point(double par1, double par2) const; - virtual GPoint closestPoint(const SPoint3 &queryPoint, const double initialGuess[2]) const; + virtual GPoint closestPoint(const SPoint3 &queryPoint, + const double initialGuess[2]) const; virtual bool containsPoint(const SPoint3 &pt) const; virtual double getMetricEigenvalue(const SPoint2 &); virtual SVector3 normal(const SPoint2 ¶m) const; -- GitLab