From d34c885752008fd8c7c1e451b225bee4a25ce7a2 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Thu, 3 Dec 2009 07:55:01 +0000 Subject: [PATCH] Code refactoring. --- AMDiS/src/ElInfo.cc | 46 +++---- AMDiS/src/ElInfo.h | 154 ++++++++++++------------ AMDiS/src/ElInfo1d.cc | 111 ++++++++--------- AMDiS/src/ElInfo2d.cc | 261 ++++++++++++++++++++-------------------- AMDiS/src/ElInfo3d.cc | 202 +++++++++++++++---------------- AMDiS/src/Element.h | 9 +- AMDiS/src/Line.cc | 2 - AMDiS/src/Line.h | 10 +- AMDiS/src/Tetrahedron.h | 4 +- AMDiS/src/Triangle.cc | 6 +- 10 files changed, 398 insertions(+), 407 deletions(-) diff --git a/AMDiS/src/ElInfo.cc b/AMDiS/src/ElInfo.cc index 6a7680a1..b56f0ccc 100644 --- a/AMDiS/src/ElInfo.cc +++ b/AMDiS/src/ElInfo.cc @@ -15,28 +15,28 @@ namespace AMDiS { ElInfo::ElInfo(Mesh *aMesh) - : mesh_(aMesh), - element_(NULL), - parent_(NULL), - macroElement_(NULL), + : mesh(aMesh), + element(NULL), + parent(NULL), + macroElement(NULL), level(0), elType(0), iChild(0), - coord_(mesh_->getDim(), NO_INIT), - boundary_(mesh_->getDim(), DEFAULT_VALUE, INTERIOR), - projection_(mesh_->getDim(), NO_INIT), - oppCoord_(mesh_->getDim(), NO_INIT), - neighbour_(mesh_->getDim(), NO_INIT), - neighbourCoord(mesh_->getDim(), NO_INIT), - oppVertex(mesh_->getDim(), NO_INIT), - grdLambda(mesh_->getDim(), NO_INIT), + coord(mesh->getDim(), NO_INIT), + boundary(mesh->getDim(), DEFAULT_VALUE, INTERIOR), + projection(mesh->getDim(), NO_INIT), + oppCoord(mesh->getDim(), NO_INIT), + neighbour(mesh->getDim(), NO_INIT), + neighbourCoord(mesh->getDim(), NO_INIT), + oppVertex(mesh->getDim(), NO_INIT), + grdLambda(mesh->getDim(), NO_INIT), refinementPath(0), refinementPathLength(0) { - projection_.set(NULL); + projection.set(NULL); for (int i = 0; i < neighbourCoord.getSize(); i++) - neighbourCoord[i].init(mesh_->getDim()); + neighbourCoord[i].init(mesh->getDim()); dimOfWorld = Global::getGeo(WORLD); } @@ -53,21 +53,21 @@ namespace AMDiS { double c = l[0]; for (int j = 0; j < dimOfWorld; j++) - w[j] = c * coord_[0][j]; + w[j] = c * coord[0][j]; int vertices = Global::getGeo(VERTEX, l.getSize() - 1); for (int i = 1; i < vertices; i++) { c = l[i]; for (int j = 0; j < dimOfWorld; j++) - w[j] += c * coord_[i][j]; + w[j] += c * coord[i][j]; } } double ElInfo::calcDet() const { testFlag(Mesh::FILL_COORDS); - return calcDet(coord_); + return calcDet(coord); } double ElInfo::calcDet(const FixVec<WorldVector<double>, VERTEX> &coords) const @@ -147,11 +147,11 @@ namespace AMDiS { void ElInfo::fillDetGrdLambda() { - if (fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { - det_ = calcGrdLambda(grdLambda); + if (fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { + det = calcGrdLambda(grdLambda); } else { - if (fillFlag_.isSet(Mesh::FILL_DET)) - det_ = calcDet(); + if (fillFlag.isSet(Mesh::FILL_DET)) + det = calcDet(); } } @@ -163,11 +163,11 @@ namespace AMDiS { {10, 4, 0} }; - int dim = mesh_->getDim(); + int dim = mesh->getDim(); int posIndex = DIM_OF_INDEX(pos, dim); int offset = indexOffset[dim - 1][posIndex]; - return boundary_[offset + i]; + return boundary[offset + i]; } } diff --git a/AMDiS/src/ElInfo.h b/AMDiS/src/ElInfo.h index 171ba40f..d00b3ca1 100644 --- a/AMDiS/src/ElInfo.h +++ b/AMDiS/src/ElInfo.h @@ -66,17 +66,17 @@ namespace AMDiS { */ ElInfo& operator=(const ElInfo& rhs) { - mesh_ = rhs.mesh_; - element_ = rhs.element_; - parent_ = rhs.parent_; - macroElement_ = rhs.macroElement_; - fillFlag_ = rhs.fillFlag_; + mesh = rhs.mesh; + element = rhs.element; + parent = rhs.parent; + macroElement = rhs.macroElement; + fillFlag = rhs.fillFlag; level = rhs.level; iChild = rhs.iChild; - coord_ = rhs.coord_; - boundary_ = rhs.boundary_; - oppCoord_ = rhs.oppCoord_; - neighbour_ = rhs.neighbour_; + coord = rhs.coord; + boundary = rhs.boundary; + oppCoord = rhs.oppCoord; + neighbour = rhs.neighbour; neighbourCoord = rhs.neighbourCoord; oppVertex = rhs.oppVertex; return *this; @@ -87,34 +87,34 @@ namespace AMDiS { * \{ */ - /// Get ElInfo's \ref mesh_ + /// Get ElInfo's \ref mesh inline Mesh* getMesh() const { - return mesh_; + return mesh; } - /// Get ElInfo's \ref macroElement_ + /// Get ElInfo's \ref macroElement inline MacroElement* getMacroElement() const { - return macroElement_; + return macroElement; } /// Get ElInfo's \ref element inline Element* getElement() const { - return element_; + return element; } - /// Get ElInfo's \ref parent_ + /// Get ElInfo's \ref parent inline Element* getParent() const { - return parent_; + return parent; } - /// Get ElInfo's \ref fillFlag_ + /// Get ElInfo's \ref fillFlag inline Flag getFillFlag() const { - return fillFlag_; + return fillFlag; } /// Get ElInfo's \ref level @@ -130,60 +130,60 @@ namespace AMDiS { } /** \brief - * Get ElInfo's \ref coord_[i]. This is a WorldVector<double> filled with the + * Get ElInfo's \ref coord[i]. This is a WorldVector<double> filled with the * coordinates of the i-th vertex of element \ref el. */ inline WorldVector<double>& getCoord(int i) { - return coord_[i]; + return coord[i]; } /** \brief - * Get ElInfo's \ref coord_[i]. This is a WorldVector<double> filled with the + * Get ElInfo's \ref coord[i]. This is a WorldVector<double> filled with the * coordinates of the i-th vertex of element \ref el. */ inline const WorldVector<double>& getCoord(int i) const { - return coord_[i]; + return coord[i]; } /** \brief - * Get ElInfo's \ref coord_. This is a FixVec<WorldVector<double> > filled with the + * Get ElInfo's \ref coord. This is a FixVec<WorldVector<double> > filled with the * coordinates of the all vertice of element \ref el. */ inline FixVec<WorldVector<double>, VERTEX>& getCoords() { - return coord_; + return coord; } /** \brief - * Get ElInfo's \ref coord_. This is a FixVec<WorldVector<double> > filled with the + * Get ElInfo's \ref coord. This is a FixVec<WorldVector<double> > filled with the * coordinates of the all vertice of element \ref el. */ inline const FixVec<WorldVector<double>, VERTEX>& getCoords() const { - return coord_; + return coord; } - /// Get ElInfo's \ref oppCoord_[i] + /// Get ElInfo's \ref oppCoord[i] inline WorldVector<double>& getOppCoord(int i) { - return oppCoord_[i]; + return oppCoord[i]; } - /// Get ElInfo's \ref boundary_[i] + /// Get ElInfo's \ref boundary[i] inline BoundaryType getBoundary(int i) const { - return boundary_[i]; + return boundary[i]; } /// Get boundary type of i-th vertex/edge/face (pos). BoundaryType getBoundary(GeoIndex pos, int i); - /// Get ElInfo's \ref neighbour_[i] + /// Get ElInfo's \ref neighbour[i] inline Element* getNeighbour(int i) const { - return neighbour_[i]; + return neighbour[i]; } /// Get ElInfo's \ref neighbourCoord[i] @@ -203,10 +203,10 @@ namespace AMDiS { return oppVertex[i]; } - /// Get ElInfo's \ref det_ + /// Get ElInfo's \ref det inline double getDet() const { - return det_; + return det; } /// Returns \ref grdLambda @@ -215,10 +215,10 @@ namespace AMDiS { return grdLambda; } - /// Returns \ref projection_[i] + /// Returns \ref projection[i] inline Projection *getProjection(int i) const { - return projection_[i]; + return projection[i]; } /// Returns \ref parametric @@ -239,46 +239,46 @@ namespace AMDiS { * \{ */ - /// Set ElInfo's \ref mesh_ + /// Set ElInfo's \ref mesh inline void setMesh(Mesh* aMesh) { - mesh_ = aMesh; + mesh = aMesh; } - /// Set ElInfo's \ref macroElement_ + /// Set ElInfo's \ref macroElement inline void setMacroElement(MacroElement* mel) { - macroElement_ = mel; + macroElement = mel; } /// Set ElInfo's \ref element inline void setElement(Element* elem) { - element_ = elem; + element = elem; } - /// Set ElInfo's \ref parent_ + /// Set ElInfo's \ref parent inline void setParent(Element* elem) { - parent_ = elem; + parent = elem; } - /// Set ElInfo's \ref fillFlag_ + /// Set ElInfo's \ref fillFlag inline void setFillFlag(Flag flag) { - fillFlag_ = flag; + fillFlag = flag; } - /// Sets ElInfo's \ref coord_[i]. - inline void setCoord(int i,WorldVector<double>& coord) + /// Sets ElInfo's \ref coord[i]. + inline void setCoord(int i,WorldVector<double>& c) { - coord_[i] = coord; + coord[i] = c; } /// Sets ElInfo's \ref coord. - inline void setCoords(FixVec<WorldVector<double>,VERTEX >& coords) + inline void setCoords(FixVec<WorldVector<double>,VERTEX >& c) { - coord_ = coords; + coord = c; } /// Set ElInfo's \ref level @@ -287,22 +287,22 @@ namespace AMDiS { level = l; } - /// Set ElInfo's \ref boundary_[i] + /// Set ElInfo's \ref boundary[i] inline void setBoundary(int i, BoundaryType t) { - boundary_[i] = newBound(boundary_[i], t); + boundary[i] = newBound(boundary[i], t); } - /// Set \ref projection_[i] = p + /// Set \ref projection[i] = p inline void setProjection(int i, Projection *p) { - projection_[i] = p; + projection[i] = p; } - /// Set \ref det_ = d + /// Set \ref det = d inline void setDet(double d) { - det_ = d; + det = d; } /// Set \ref parametric = param @@ -345,7 +345,7 @@ namespace AMDiS { double calcDet(const FixVec<WorldVector<double>, VERTEX> &coords) const; /** \brief - * Checks whether flag is set in ElInfo's \ref fillFlag_. If not, the program + * Checks whether flag is set in ElInfo's \ref fillFlag. If not, the program * exits. */ void testFlag(const Flag& flag) const; @@ -357,7 +357,7 @@ namespace AMDiS { void coordToWorld(const DimVec<double>& lambda, WorldVector<double>& world) const; - /// Fills ElInfo's \ref det_ and \ref grdLambda entries. + /// Fills ElInfo's \ref det and \ref grdLambda entries. virtual void fillDetGrdLambda(); /** \brief @@ -422,25 +422,25 @@ namespace AMDiS { protected: /// Pointer to the current mesh - Mesh *mesh_; + Mesh *mesh; /// Pointer to the current element - Element *element_; + Element *element; - /// \ref element is child of element parent_ - Element *parent_; + /// \ref element is child of element parent + Element *parent; /** \brief * \ref element is an element of the binary tree located at MacroElement - * macroElement_ + * macroElement */ - MacroElement *macroElement_; + MacroElement *macroElement; /** \brief * Indicates wich elements will be called and wich information should be * present while mesh traversal. */ - Flag fillFlag_; + Flag fillFlag; /** \brief * Level of the element. The level is zero for macro elements and the level @@ -462,36 +462,36 @@ namespace AMDiS { int iChild; /** \brief - * \ref coord_[i] is a WorldVector<double> storing the world coordinates of the + * \ref coord[i] is a WorldVector<double> storing the world coordinates of the * i-th vertex of element \ref element. */ - FixVec<WorldVector<double>, VERTEX> coord_; + FixVec<WorldVector<double>, VERTEX> coord; /** \brief - * boundary_[i] is the BoundaryType of the i-th edge/face + * boundary[i] is the BoundaryType of the i-th edge/face * for i=0,...,N_NEIGH - 1. In 3d - * (*boundary_)[N_FACES + i] is a pointer to the Boundary + * (*boundary)[N_FACES + i] is a pointer to the Boundary * object of the i-th edge, for i=0,..,N_EDGES - 1. It is * a pointer to NULL for an interior edge/face. */ - FixVec<BoundaryType, BOUNDARY> boundary_; + FixVec<BoundaryType, BOUNDARY> boundary; /** \brief * Vector storing pointers to projections for each face, edge, vertex. */ - FixVec<Projection*, PROJECTION> projection_; + FixVec<Projection*, PROJECTION> projection; /** \brief - * oppCoord_[i] coordinates of the i-th neighbour vertex opposite the + * oppCoord[i] coordinates of the i-th neighbour vertex opposite the * common edge/face. */ - FixVec<WorldVector<double>, NEIGH> oppCoord_; + FixVec<WorldVector<double>, NEIGH> oppCoord; /** \brief - * neighbour_[i] pointer to the element at the edge/face with local index i. + * neighbour[i] pointer to the element at the edge/face with local index i. * It is a pointer to NULL for boundary edges/faces. */ - FixVec<Element*, NEIGH> neighbour_; + FixVec<Element*, NEIGH> neighbour; /** \brief * neighbourCoord[i][j] are the coordinate of the j-th vertex of the i-th @@ -500,14 +500,14 @@ namespace AMDiS { FixVec<FixVec<WorldVector<double>, VERTEX>, NEIGH> neighbourCoord; /** \brief - * oppVertex[i] is undefined if neighbour_[i] is a pointer to NULL. + * oppVertex[i] is undefined if neighbour[i] is a pointer to NULL. * Otherwise it is the local index of the neighbour's vertex opposite the * common edge/face. */ FixVec<unsigned char, NEIGH> oppVertex; /// Elements determinant. - double det_; + double det; /// Gradient of lambda. DimVec<WorldVector<double> > grdLambda; diff --git a/AMDiS/src/ElInfo1d.cc b/AMDiS/src/ElInfo1d.cc index 40d65884..1a05bd0a 100644 --- a/AMDiS/src/ElInfo1d.cc +++ b/AMDiS/src/ElInfo1d.cc @@ -52,35 +52,35 @@ namespace AMDiS { Element *nb; MacroElement *mnb; - macroElement_ = const_cast<MacroElement*>( mel); - element_ = const_cast<Element*>( mel->getElement()); - parent_ = NULL; + macroElement = const_cast<MacroElement*>( mel); + element = const_cast<Element*>( mel->getElement()); + parent = NULL; level = 0; - int vertices = mesh_->getGeo(VERTEX); + int vertices = mesh->getGeo(VERTEX); - if (fillFlag_.isSet(Mesh::FILL_COORDS) || fillFlag_.isSet(Mesh::FILL_DET) || - fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { + if (fillFlag.isSet(Mesh::FILL_COORDS) || fillFlag.isSet(Mesh::FILL_DET) || + fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { for (int i = 0; i < vertices; i++) - coord_[i] = mel->coord[i]; + coord[i] = mel->coord[i]; } - if (fillFlag_.isSet(Mesh::FILL_NEIGH) || fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag.isSet(Mesh::FILL_NEIGH) || fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { WorldVector<double> oppC; - int neighbours = mesh_->getGeo(NEIGH); + int neighbours = mesh->getGeo(NEIGH); for (int i = 0; i < neighbours; i++) { nb = NULL; if ((mnb = const_cast<MacroElement*>( mel->getNeighbour(i)))) { - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { oppC = mnb->coord[i]; } nb = const_cast<Element*>( mnb->getElement()); while (!(nb->isLeaf())) { // make nb nearest element - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { if (nb->isNewCoordSet()) { oppC = *(nb->getNewCoord()); } else { @@ -90,21 +90,21 @@ namespace AMDiS { nb = const_cast<Element*>( nb->getChild(1-i)); } - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { - oppCoord_[i] = oppC; + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { + oppCoord[i] = oppC; } } - neighbour_[i] = nb; + neighbour[i] = nb; oppVertex[i] = nb ? i : -1; } } - if (fillFlag_.isSet(Mesh::FILL_BOUND) ) { + if (fillFlag.isSet(Mesh::FILL_BOUND) ) { for (int i = 0; i < vertices; i++) - boundary_[i] = mel->getBoundary(i); + boundary[i] = mel->getBoundary(i); - for (int i = 0; i < element_->getGeo(PROJECTION); i++) - projection_[i] = mel->getProjection(i); + for (int i = 0; i < element->getGeo(PROJECTION); i++) + projection[i] = mel->getProjection(i); } } @@ -120,8 +120,8 @@ namespace AMDiS { testFlag(Mesh::FILL_COORDS); WorldVector<double> e; - e = coord_[1]; - e -= coord_[0]; + e = coord[1]; + e -= coord[0]; double adet2 = e * e; if (adet2 < 1.0E-15) { @@ -141,9 +141,9 @@ namespace AMDiS { FUNCNAME("ElInfo1d::worldToCoord()"); double lmin; - double a = coord_[0][0]; - double length = (coord_[1][0] - a); - int dim = mesh_->getDim(); + double a = coord[0][0]; + double length = (coord[1][0] - a); + int dim = mesh->getDim(); static DimVec<double> vec(dim, NO_INIT); @@ -180,7 +180,7 @@ namespace AMDiS { /****************************************************************************/ double ElInfo1d::getNormal(int side, WorldVector<double> &normal) { - normal = coord_[side] - coord_[(side + 1) % 2]; + normal = coord[side] - coord[(side + 1) % 2]; double det = norm(&normal); TEST_EXIT_DBG(det > 1.e-30)("det = 0 on side %d\n", side); normal *= 1.0 / det; @@ -201,8 +201,8 @@ namespace AMDiS { TEST_EXIT_DBG(dimOfWorld == 2) (" element normal only well defined for DIM_OF_WORLD = DIM + 1 !!"); - elementNormal[0] = coord_[1][1] - coord_[0][1]; - elementNormal[1] = coord_[0][0] - coord_[1][0]; + elementNormal[0] = coord[1][1] - coord[0][1]; + elementNormal[1] = coord[0][0] - coord[1][0]; double det = norm(&elementNormal); @@ -219,77 +219,77 @@ namespace AMDiS { FUNCNAME("ElInfo1d::fillElInfo()"); Element *nb; - Element *elem = elInfoOld->element_; + Element *elem = elInfoOld->element; TEST_EXIT_DBG(elem->getChild(0))("no children?\n"); - element_ = const_cast<Element*>(elem->getChild(ichild)); + element = const_cast<Element*>(elem->getChild(ichild)); - TEST_EXIT_DBG(element_)("missing child %d?\n", ichild); + TEST_EXIT_DBG(element)("missing child %d?\n", ichild); - macroElement_ = elInfoOld->macroElement_; - fillFlag_ = elInfoOld->fillFlag_; - parent_ = elem; + macroElement = elInfoOld->macroElement; + fillFlag = elInfoOld->fillFlag; + parent = elem; level = elInfoOld->level + 1; iChild = ichild; - int neighbours = mesh_->getGeo(NEIGH); + int neighbours = mesh->getGeo(NEIGH); - if (fillFlag_.isSet(Mesh::FILL_COORDS) || fillFlag_.isSet(Mesh::FILL_DET) || - fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { + if (fillFlag.isSet(Mesh::FILL_COORDS) || fillFlag.isSet(Mesh::FILL_DET) || + fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { - const FixVec<WorldVector<double>, VERTEX> *old_coord = &(elInfoOld->coord_); + const FixVec<WorldVector<double>, VERTEX> *old_coord = &(elInfoOld->coord); - coord_[ichild] = (*old_coord)[ichild]; + coord[ichild] = (*old_coord)[ichild]; if (elem->isNewCoordSet()) - coord_[1 - ichild] = *(elem->getNewCoord()); + coord[1 - ichild] = *(elem->getNewCoord()); else - coord_[1 - ichild] = ((*old_coord)[0] + (*old_coord)[1]) * 0.5; + coord[1 - ichild] = ((*old_coord)[0] + (*old_coord)[1]) * 0.5; } - if (fillFlag_.isSet(Mesh::FILL_NEIGH) || fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag.isSet(Mesh::FILL_NEIGH) || fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { WorldVector<double> oppC; - TEST_EXIT_DBG(fillFlag_.isSet(Mesh::FILL_COORDS)) + TEST_EXIT_DBG(fillFlag.isSet(Mesh::FILL_COORDS)) ("FILL_OPP_COORDS only with FILL_COORDS\n"); for (int i = 0; i < neighbours; i++) { if (i != ichild) { nb = const_cast<Element*>(elem->getChild(1-ichild)); - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) - oppC = elInfoOld->coord_[i]; + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) + oppC = elInfoOld->coord[i]; } else { nb = const_cast<Element*>( elInfoOld->getNeighbour(i)); - if (nb && fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) - oppC = elInfoOld->oppCoord_[i]; + if (nb && fillFlag.isSet(Mesh::FILL_OPP_COORDS)) + oppC = elInfoOld->oppCoord[i]; } if (nb) { while (nb->getChild(0)) { // make nb nearest element - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { if (nb->isNewCoordSet()) oppC = *(nb->getNewCoord()); else - oppC = (coord_[i] + oppC) * 0.5; + oppC = (coord[i] + oppC) * 0.5; } nb = const_cast<Element*>( nb->getChild(1-i)); } - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) - oppCoord_[i] = oppC; + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) + oppCoord[i] = oppC; } - neighbour_[i] = nb; + neighbour[i] = nb; oppVertex[i] = nb ? i : -1; } } - if (fillFlag_.isSet(Mesh::FILL_BOUND)) { - boundary_[ichild] = elInfoOld->getBoundary(ichild); - boundary_[1 - ichild] = INTERIOR; + if (fillFlag.isSet(Mesh::FILL_BOUND)) { + boundary[ichild] = elInfoOld->getBoundary(ichild); + boundary[1 - ichild] = INTERIOR; if (elInfoOld->getProjection(0) && elInfoOld->getProjection(0)->getType() == VOLUME_PROJECTION) { - projection_[0] = elInfoOld->getProjection(0); + projection[0] = elInfoOld->getProjection(0); } } } @@ -327,7 +327,8 @@ namespace AMDiS { } } - void ElInfo1d::getSubElemCoordsMat_so(mtl::dense2D<double>& mat, int basisFctsDegree) const + void ElInfo1d::getSubElemCoordsMat_so(mtl::dense2D<double>& mat, + int basisFctsDegree) const { switch (basisFctsDegree) { case 1: diff --git a/AMDiS/src/ElInfo2d.cc b/AMDiS/src/ElInfo2d.cc index 7f8f209f..f7f541ff 100644 --- a/AMDiS/src/ElInfo2d.cc +++ b/AMDiS/src/ElInfo2d.cc @@ -48,33 +48,33 @@ namespace AMDiS { { FUNCNAME("ElInfo::fillMacroInfo()"); - macroElement_ = const_cast<MacroElement*>(mel); - element_ = const_cast<Element*>(mel->getElement()); - parent_ = NULL; + macroElement = const_cast<MacroElement*>(mel); + element = const_cast<Element*>(mel->getElement()); + parent = NULL; level = 0; - if (fillFlag_.isSet(Mesh::FILL_COORDS) || - fillFlag_.isSet(Mesh::FILL_DET) || - fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { + if (fillFlag.isSet(Mesh::FILL_COORDS) || + fillFlag.isSet(Mesh::FILL_DET) || + fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { - int vertices = mesh_->getGeo(VERTEX); + int vertices = mesh->getGeo(VERTEX); for (int i = 0; i < vertices; i++) - coord_[i] = mel->coord[i]; + coord[i] = mel->coord[i]; } - int neighbours = mesh_->getGeo(NEIGH); + int neighbours = mesh->getGeo(NEIGH); - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS) || - fillFlag_.isSet(Mesh::FILL_NEIGH)) { + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS) || + fillFlag.isSet(Mesh::FILL_NEIGH)) { - bool fill_opp_coords = (fillFlag_.isSet(Mesh::FILL_OPP_COORDS)); + bool fill_opp_coords = (fillFlag.isSet(Mesh::FILL_OPP_COORDS)); for (int i = 0; i < neighbours; i++) { MacroElement *macroNeighbour = mel->getNeighbour(i); if (macroNeighbour) { - neighbour_[i] = macroNeighbour->getElement(); - Element *nb = const_cast<Element*>(neighbour_[i]); + neighbour[i] = macroNeighbour->getElement(); + Element *nb = const_cast<Element*>(neighbour[i]); int edgeNo = oppVertex[i] = mel->getOppVertex(i); @@ -118,11 +118,11 @@ namespace AMDiS { // edge, i.e., the direct neighbour is the second child of the same // level neighbour. - nb = neighbour_[i] = nb->getSecondChild(); + nb = neighbour[i] = nb->getSecondChild(); } else { // The situation is as shown in the picture above. So the next // neighbour is the first child of the same level neighbour element. - nb = neighbour_[i] = nb->getFirstChild(); + nb = neighbour[i] = nb->getFirstChild(); } // In both cases the opp vertex number is 2, as one can see in the @@ -131,12 +131,12 @@ namespace AMDiS { if (fill_opp_coords) { if (nb->isNewCoordSet()) { - oppCoord_[i] = *(nb->getNewCoord()); + oppCoord[i] = *(nb->getNewCoord()); } else { // In both cases, that are shown in the pictures above, the opp // vertex of the neighbour edge is the midpoint of the vertex 0 // and vertex 1 of the same level neighbour element. - oppCoord_[i] = (macroNeighbour->coord[0] + + oppCoord[i] = (macroNeighbour->coord[0] + macroNeighbour->coord[1]) * 0.5; } @@ -157,7 +157,7 @@ namespace AMDiS { ERROR_EXIT("Should not happen!\n"); } - neighbourCoord[i][2] = oppCoord_[i]; + neighbourCoord[i][2] = oppCoord[i]; break; case 1: @@ -175,14 +175,14 @@ namespace AMDiS { ERROR_EXIT("Should not happen!\n"); } - neighbourCoord[i][2] = oppCoord_[i]; + neighbourCoord[i][2] = oppCoord[i]; break; case 2: - if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(0))) { + if (*(macroNeighbour->getElement()->getDOF(2)) == *(element->getDOF(0))) { neighbourCoord[i][0] = macroNeighbour->coord[2]; neighbourCoord[i][1] = macroNeighbour->coord[1]; - } else if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(1))) { + } else if (*(macroNeighbour->getElement()->getDOF(2)) == *(element->getDOF(1))) { neighbourCoord[i][0] = macroNeighbour->coord[0]; neighbourCoord[i][1] = macroNeighbour->coord[2]; } else { @@ -199,7 +199,7 @@ namespace AMDiS { default: std::cout << "------------- Error --------------" << std::endl; std::cout << " Neighbour counter = " << i << "\n"; - std::cout << " Element index = " << element_->getIndex() << "\n\n"; + std::cout << " Element index = " << element->getIndex() << "\n\n"; for (int j = 0; j < neighbours; j++) { if (mel->getNeighbour(j)) { std::cout << " Neighbour " << j << ": " @@ -225,24 +225,21 @@ namespace AMDiS { // refinement, because they share the refinement edge. if (fill_opp_coords) { - oppCoord_[i] = macroNeighbour->coord[edgeNo]; + oppCoord[i] = macroNeighbour->coord[edgeNo]; neighbourCoord[i] = macroNeighbour->coord; } } } else { - neighbour_[i] = NULL; + neighbour[i] = NULL; } } } - if (fillFlag_.isSet(Mesh::FILL_BOUND)) { - for (int i = 0; i < element_->getGeo(BOUNDARY); i++) { - boundary_[i] = mel->getBoundary(i); - } - - for (int i = 0; i < element_->getGeo(PROJECTION); i++) { - projection_[i] = mel->getProjection(i); - } + if (fillFlag.isSet(Mesh::FILL_BOUND)) { + for (int i = 0; i < element->getGeo(BOUNDARY); i++) + boundary[i] = mel->getBoundary(i); + for (int i = 0; i < element->getGeo(PROJECTION); i++) + projection[i] = mel->getProjection(i); } } @@ -255,38 +252,38 @@ namespace AMDiS { { FUNCNAME("ElInfo::fillElInfo()"); - Element *elem = elInfoOld->element_; + Element *elem = elInfoOld->element; Element *nb; - Flag fill_flag = elInfoOld->fillFlag_; + Flag fill_flag = elInfoOld->fillFlag; TEST_EXIT_DBG(elem->getFirstChild())("no children?\n"); - element_ = const_cast<Element*>((ichild == 0) ? + element = const_cast<Element*>((ichild == 0) ? elem->getFirstChild() : elem->getSecondChild()); - TEST_EXIT_DBG(element_)("missing child %d?\n", ichild); + TEST_EXIT_DBG(element)("missing child %d?\n", ichild); - macroElement_ = elInfoOld->macroElement_; - fillFlag_ = fill_flag; - parent_ = elem; + macroElement = elInfoOld->macroElement; + fillFlag = fill_flag; + parent = elem; level = elInfoOld->level + 1; iChild = ichild; - if (fillFlag_.isSet(Mesh::FILL_COORDS) || - fillFlag_.isSet(Mesh::FILL_DET) || - fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { + if (fillFlag.isSet(Mesh::FILL_COORDS) || + fillFlag.isSet(Mesh::FILL_DET) || + fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { if (elem->isNewCoordSet()) - coord_[2] = *(elem->getNewCoord()); + coord[2] = *(elem->getNewCoord()); else - coord_[2].setMidpoint(elInfoOld->coord_[0], elInfoOld->coord_[1]); + coord[2].setMidpoint(elInfoOld->coord[0], elInfoOld->coord[1]); if (ichild == 0) { - coord_[0] = elInfoOld->coord_[2]; - coord_[1] = elInfoOld->coord_[0]; + coord[0] = elInfoOld->coord[2]; + coord[1] = elInfoOld->coord[0]; } else { - coord_[0] = elInfoOld->coord_[1]; - coord_[1] = elInfoOld->coord_[2]; + coord[0] = elInfoOld->coord[1]; + coord[1] = elInfoOld->coord[2]; } } @@ -297,11 +294,11 @@ namespace AMDiS { // Calculation of the neighbour 2, its oppCoords and the // cooresponding oppVertex. - neighbour_[2] = elInfoOld->neighbour_[1]; + neighbour[2] = elInfoOld->neighbour[1]; oppVertex[2] = elInfoOld->oppVertex[1]; - if (neighbour_[2] && fill_opp_coords) { - oppCoord_[2] = elInfoOld->oppCoord_[1]; + if (neighbour[2] && fill_opp_coords) { + oppCoord[2] = elInfoOld->oppCoord[1]; neighbourCoord[2] = elInfoOld->neighbourCoord[1]; } @@ -313,31 +310,29 @@ namespace AMDiS { elem->getSecondChild()->getFirstChild() && elem->getSecondChild()->getFirstChild()) { - neighbour_[1] = elem->getSecondChild()->getSecondChild(); + neighbour[1] = elem->getSecondChild()->getSecondChild(); oppVertex[1] = 2; if (fill_opp_coords) { - if (elem->getSecondChild()->isNewCoordSet()) { - oppCoord_[1] = *(elem->getSecondChild()->getNewCoord()); - } else { - oppCoord_[1].setMidpoint(elInfoOld->coord_[1], - elInfoOld->coord_[2]); - } - - neighbourCoord[1][0] = coord_[0]; - neighbourCoord[1][1] = coord_[2]; - neighbourCoord[1][2] = oppCoord_[1]; + if (elem->getSecondChild()->isNewCoordSet()) + oppCoord[1] = *(elem->getSecondChild()->getNewCoord()); + else + oppCoord[1].setMidpoint(elInfoOld->coord[1], elInfoOld->coord[2]); + + neighbourCoord[1][0] = coord[0]; + neighbourCoord[1][1] = coord[2]; + neighbourCoord[1][2] = oppCoord[1]; } } else { - neighbour_[1] = elem->getSecondChild(); + neighbour[1] = elem->getSecondChild(); oppVertex[1] = 0; if (fill_opp_coords) { - oppCoord_[1] = elInfoOld->coord_[1]; + oppCoord[1] = elInfoOld->coord[1]; - neighbourCoord[1][0] = elInfoOld->coord_[1]; - neighbourCoord[1][1] = elInfoOld->coord_[2]; - neighbourCoord[1][2] = coord_[2]; + neighbourCoord[1][0] = elInfoOld->coord[1]; + neighbourCoord[1][1] = elInfoOld->coord[2]; + neighbourCoord[1][2] = coord[2]; } } @@ -345,7 +340,7 @@ namespace AMDiS { // Calculation of the neighbour 0, its oppCoords and the // cooresponding oppVertex. - nb = elInfoOld->neighbour_[2]; + nb = elInfoOld->neighbour[2]; if (nb) { TEST(elInfoOld->oppVertex[2] == 2)("invalid neighbour\n"); TEST_EXIT_DBG(nb->getFirstChild())("missing first child?\n"); @@ -358,16 +353,16 @@ namespace AMDiS { if (fill_opp_coords) { if (nb->isNewCoordSet()) { - oppCoord_[0] = *(nb->getNewCoord()); + oppCoord[0] = *(nb->getNewCoord()); } else { - oppCoord_[0].setMidpoint(elInfoOld->neighbourCoord[2][1], + oppCoord[0].setMidpoint(elInfoOld->neighbourCoord[2][1], elInfoOld->neighbourCoord[2][2]); } neighbourCoord[0][0].setMidpoint(elInfoOld->neighbourCoord[2][0], elInfoOld->neighbourCoord[2][1]); neighbourCoord[0][1] = elInfoOld->neighbourCoord[2][1]; - neighbourCoord[0][2] = oppCoord_[0]; + neighbourCoord[0][2] = oppCoord[0]; } nb = nb->getFirstChild(); @@ -375,7 +370,7 @@ namespace AMDiS { oppVertex[0] = 1; if (fill_opp_coords) { - oppCoord_[0] = elInfoOld->oppCoord_[2]; + oppCoord[0] = elInfoOld->oppCoord[2]; neighbourCoord[0][0] = elInfoOld->neighbourCoord[2][0]; neighbourCoord[0][1] = elInfoOld->neighbourCoord[2][2]; @@ -385,16 +380,16 @@ namespace AMDiS { } } - neighbour_[0] = nb; + neighbour[0] = nb; } else { /* ichild == 1 */ // Calculation of the neighbour 2, its oppCoords and the // cooresponding oppVertex. - neighbour_[2] = elInfoOld->neighbour_[0]; + neighbour[2] = elInfoOld->neighbour[0]; oppVertex[2] = elInfoOld->oppVertex[0]; - if (neighbour_[2] && fill_opp_coords) { - oppCoord_[2] = elInfoOld->oppCoord_[0]; + if (neighbour[2] && fill_opp_coords) { + oppCoord[2] = elInfoOld->oppCoord[0]; neighbourCoord[2] = elInfoOld->neighbourCoord[0]; } @@ -403,38 +398,38 @@ namespace AMDiS { // cooresponding oppVertex. if (elem->getFirstChild()->getFirstChild()) { - neighbour_[0] = elem->getFirstChild()->getFirstChild(); + neighbour[0] = elem->getFirstChild()->getFirstChild(); oppVertex[0] = 2; if (fill_opp_coords) { if (elem->getFirstChild()->isNewCoordSet()) { - oppCoord_[0] = *(elem->getFirstChild()->getNewCoord()); + oppCoord[0] = *(elem->getFirstChild()->getNewCoord()); } else { - oppCoord_[0].setMidpoint(elInfoOld->coord_[0], - elInfoOld->coord_[2]); + oppCoord[0].setMidpoint(elInfoOld->coord[0], + elInfoOld->coord[2]); } - neighbourCoord[0][0] = coord_[2]; - neighbourCoord[0][1] = coord_[1]; - neighbourCoord[0][2] = oppCoord_[0]; + neighbourCoord[0][0] = coord[2]; + neighbourCoord[0][1] = coord[1]; + neighbourCoord[0][2] = oppCoord[0]; } } else { - neighbour_[0] = elem->getFirstChild(); + neighbour[0] = elem->getFirstChild(); oppVertex[0] = 1; if (fill_opp_coords) { - oppCoord_[0] = elInfoOld->coord_[0]; + oppCoord[0] = elInfoOld->coord[0]; - neighbourCoord[0][0] = elInfoOld->coord_[2]; - neighbourCoord[0][1] = elInfoOld->coord_[0]; - neighbourCoord[0][2] = coord_[2]; + neighbourCoord[0][0] = elInfoOld->coord[2]; + neighbourCoord[0][1] = elInfoOld->coord[0]; + neighbourCoord[0][2] = coord[2]; } } // Calculation of the neighbour 1, its oppCoords and the // cooresponding oppVertex. - nb = elInfoOld->neighbour_[2]; + nb = elInfoOld->neighbour[2]; if (nb) { TEST(elInfoOld->oppVertex[2] == 2)("invalid neighbour\n"); TEST((nb = nb->getFirstChild()))("missing child?\n"); @@ -444,16 +439,16 @@ namespace AMDiS { if (fill_opp_coords) { if (nb->isNewCoordSet()) { - oppCoord_[1] = *(nb->getNewCoord()); + oppCoord[1] = *(nb->getNewCoord()); } else { - oppCoord_[1].setMidpoint(elInfoOld->neighbourCoord[2][0], + oppCoord[1].setMidpoint(elInfoOld->neighbourCoord[2][0], elInfoOld->neighbourCoord[2][2]); } neighbourCoord[1][0] = elInfoOld->neighbourCoord[2][0]; neighbourCoord[1][1].setMidpoint(elInfoOld->neighbourCoord[2][0], elInfoOld->neighbourCoord[2][1]); - neighbourCoord[1][2] = oppCoord_[1]; + neighbourCoord[1][2] = oppCoord[1]; } nb = nb->getSecondChild(); @@ -461,7 +456,7 @@ namespace AMDiS { oppVertex[1] = 0; if (fill_opp_coords) { - oppCoord_[1] = elInfoOld->oppCoord_[2]; + oppCoord[1] = elInfoOld->oppCoord[2]; neighbourCoord[1][0] = elInfoOld->neighbourCoord[2][2]; neighbourCoord[1][1] = elInfoOld->neighbourCoord[2][0]; @@ -470,44 +465,44 @@ namespace AMDiS { } } } - neighbour_[1] = nb; + neighbour[1] = nb; } // if (ichild == 0) {} else - } // if (fill_flag.isSet(Mesh::FILL_NEIGH) || fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) + } // if (fill_flag.isSet(Mesh::FILL_NEIGH) || fillFlag.isSet(Mesh::FILL_OPP_COORDS)) if (fill_flag.isSet(Mesh::FILL_BOUND)) { if (elInfoOld->getBoundary(2)) - boundary_[5] = elInfoOld->getBoundary(2); + boundary[5] = elInfoOld->getBoundary(2); else - boundary_[5] = INTERIOR; + boundary[5] = INTERIOR; if (ichild == 0) { - boundary_[3] = elInfoOld->getBoundary(5); - boundary_[4] = elInfoOld->getBoundary(3); - boundary_[0] = elInfoOld->getBoundary(2); - boundary_[1] = INTERIOR; - boundary_[2] = elInfoOld->getBoundary(1); + boundary[3] = elInfoOld->getBoundary(5); + boundary[4] = elInfoOld->getBoundary(3); + boundary[0] = elInfoOld->getBoundary(2); + boundary[1] = INTERIOR; + boundary[2] = elInfoOld->getBoundary(1); } else { - boundary_[3] = elInfoOld->getBoundary(4); - boundary_[4] = elInfoOld->getBoundary(5); - boundary_[0] = INTERIOR; - boundary_[1] = elInfoOld->getBoundary(2); - boundary_[2] = elInfoOld->getBoundary(0); + boundary[3] = elInfoOld->getBoundary(4); + boundary[4] = elInfoOld->getBoundary(5); + boundary[0] = INTERIOR; + boundary[1] = elInfoOld->getBoundary(2); + boundary[2] = elInfoOld->getBoundary(0); } if (elInfoOld->getProjection(0) && elInfoOld->getProjection(0)->getType() == VOLUME_PROJECTION) { - projection_[0] = elInfoOld->getProjection(0); + projection[0] = elInfoOld->getProjection(0); } else { // boundary projection if (ichild == 0) { - projection_[0] = elInfoOld->getProjection(2); - projection_[1] = NULL; - projection_[2] = elInfoOld->getProjection(1); + projection[0] = elInfoOld->getProjection(2); + projection[1] = NULL; + projection[2] = elInfoOld->getProjection(1); } else { - projection_[0] = NULL; - projection_[1] = elInfoOld->getProjection(2); - projection_[2] = elInfoOld->getProjection(0); + projection[0] = NULL; + projection[1] = elInfoOld->getProjection(2); + projection[2] = elInfoOld->getProjection(0); } } } @@ -520,11 +515,11 @@ namespace AMDiS { testFlag(Mesh::FILL_COORDS); double adet = 0.0; - int dim = mesh_->getDim(); + int dim = mesh->getDim(); for (int i = 0; i < dimOfWorld; i++) { - (*e1)[i] = coord_[1][i] - coord_[0][i]; - (*e2)[i] = coord_[2][i] - coord_[0][i]; + (*e1)[i] = coord[1][i] - coord[0][i]; + (*e2)[i] = coord[2][i] - coord[0][i]; } if (dimOfWorld == 2) { @@ -583,17 +578,17 @@ namespace AMDiS { TEST_EXIT_DBG(lambda)("lambda must not be NULL\n"); - DimVec<WorldVector<double> > edge(mesh_->getDim(), NO_INIT); + DimVec<WorldVector<double> > edge(mesh->getDim(), NO_INIT); WorldVector<double> x; - static DimVec<double> vec(mesh_->getDim(), NO_INIT); + static DimVec<double> vec(mesh->getDim(), NO_INIT); - int dim = mesh_->getDim(); + int dim = mesh->getDim(); for (int j = 0; j < dimOfWorld; j++) { - double x0 = coord_[dim][j]; + double x0 = coord[dim][j]; x[j] = xy[j] - x0; for (int i = 0; i < dim; i++) - edge[i][j] = coord_[i][j] - x0; + edge[i][j] = coord[i][j] - x0; } double det = edge[0][0] * edge[1][1] - edge[0][1] * edge[1][0]; @@ -634,17 +629,17 @@ namespace AMDiS { int i1 = (side + 2) % 3; if (dimOfWorld == 2){ - normal[0] = coord_[i1][1] - coord_[i0][1]; - normal[1] = coord_[i0][0] - coord_[i1][0]; + normal[0] = coord[i1][1] - coord[i0][1]; + normal[1] = coord[i0][0] - coord[i1][0]; } else { // dow == 3 WorldVector<double> e0, e1,e2, elementNormal; - e0 = coord_[i1]; - e0 -= coord_[i0]; - e1 = coord_[i1]; - e1 -= coord_[side]; - e2 = coord_[i0]; - e2 -= coord_[side]; + e0 = coord[i1]; + e0 -= coord[i0]; + e1 = coord[i1]; + e1 -= coord[side]; + e2 = coord[i0]; + e2 -= coord[side]; vectorProduct(e1, e2, elementNormal); vectorProduct(elementNormal, e0, normal); @@ -671,8 +666,8 @@ namespace AMDiS { TEST_EXIT_DBG(dimOfWorld == 3) (" element normal only well defined for DIM_OF_WORLD = DIM + 1 !!"); - WorldVector<double> e0 = coord_[1] - coord_[0]; - WorldVector<double> e1 = coord_[2] - coord_[0]; + WorldVector<double> e0 = coord[1] - coord[0]; + WorldVector<double> e1 = coord[2] - coord[0]; vectorProduct(e0, e1, elementNormal); diff --git a/AMDiS/src/ElInfo3d.cc b/AMDiS/src/ElInfo3d.cc index 948f775b..44d495d2 100644 --- a/AMDiS/src/ElInfo3d.cc +++ b/AMDiS/src/ElInfo3d.cc @@ -21,70 +21,70 @@ namespace AMDiS { MacroElement *mnb; Flag fill_opp_coords; - macroElement_ = const_cast<MacroElement*>( mel); - element_ = const_cast<Element*>( mel->getElement()); - parent_ = NULL; + macroElement = const_cast<MacroElement*>( mel); + element = const_cast<Element*>( mel->getElement()); + parent = NULL; level = 0; elType = const_cast<MacroElement*>(mel)->getElType(); - int vertices = mesh_->getGeo(VERTEX); + int vertices = mesh->getGeo(VERTEX); - if (fillFlag_.isSet(Mesh::FILL_COORDS) || - fillFlag_.isSet(Mesh::FILL_DET) || - fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { + if (fillFlag.isSet(Mesh::FILL_COORDS) || + fillFlag.isSet(Mesh::FILL_DET) || + fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { for (int i = 0; i < vertices; i++) - coord_[i] = mel->coord[i]; + coord[i] = mel->coord[i]; } - int neighbours = mesh_->getGeo(NEIGH); + int neighbours = mesh->getGeo(NEIGH); - if (fillFlag_.isSet(Mesh::FILL_OPP_COORDS) || - fillFlag_.isSet(Mesh::FILL_NEIGH)) { + if (fillFlag.isSet(Mesh::FILL_OPP_COORDS) || + fillFlag.isSet(Mesh::FILL_NEIGH)) { - fill_opp_coords.setFlags(fillFlag_ & Mesh::FILL_OPP_COORDS); + fill_opp_coords.setFlags(fillFlag & Mesh::FILL_OPP_COORDS); for (int i = 0; i < neighbours; i++) { if ((mnb = const_cast<MacroElement*>( mel->getNeighbour(i)))) { - neighbour_[i] = const_cast<Element*>( mel->getNeighbour(i)->getElement()); - nb = const_cast<Element*>( neighbour_[i]); + neighbour[i] = const_cast<Element*>( mel->getNeighbour(i)->getElement()); + nb = const_cast<Element*>( neighbour[i]); int k; k = oppVertex[i] = mel->getOppVertex(i); if (nb->getChild(0) && (k < 2)) { /*make nb nearest element.*/ if (k == 1) { - neighbour_[i] = const_cast<Element*>( nb->getChild(0)); - nb = const_cast<Element*>( neighbour_[i]); + neighbour[i] = const_cast<Element*>( nb->getChild(0)); + nb = const_cast<Element*>( neighbour[i]); } else { - neighbour_[i] = const_cast<Element*>( nb->getChild(1)); - nb = const_cast<Element*>( neighbour_[i]); + neighbour[i] = const_cast<Element*>( nb->getChild(1)); + nb = const_cast<Element*>( neighbour[i]); } k = oppVertex[i] = 3; if (fill_opp_coords.isAnySet()) { /* always edge between vertices 0 and 1 is bisected! */ if (mnb->getElement()->isNewCoordSet()) - oppCoord_[i] = *(mnb->getElement()->getNewCoord()); + oppCoord[i] = *(mnb->getElement()->getNewCoord()); else - oppCoord_[i] = (mnb->coord[0] + mnb->coord[1]) * 0.5; + oppCoord[i] = (mnb->coord[0] + mnb->coord[1]) * 0.5; } } else { if (fill_opp_coords.isAnySet()) { - oppCoord_[i] = mnb->coord[k]; + oppCoord[i] = mnb->coord[k]; } } } else { - neighbour_[i] = NULL; + neighbour[i] = NULL; } } } - if (fillFlag_.isSet(Mesh::FILL_BOUND)) { - for (int i = 0; i < element_->getGeo(BOUNDARY); i++) - boundary_[i] = mel->getBoundary(i); + if (fillFlag.isSet(Mesh::FILL_BOUND)) { + for (int i = 0; i < element->getGeo(BOUNDARY); i++) + boundary[i] = mel->getBoundary(i); - for (int i = 0; i < element_->getGeo(PROJECTION); i++) - projection_[i] = mel->getProjection(i); + for (int i = 0; i < element->getGeo(PROJECTION); i++) + projection[i] = mel->getProjection(i); } - if (fillFlag_.isSet(Mesh::FILL_ORIENTATION)) { + if (fillFlag.isSet(Mesh::FILL_ORIENTATION)) { WorldVector<WorldVector<double> > a; double s; @@ -121,11 +121,11 @@ namespace AMDiS { testFlag(Mesh::FILL_COORDS); - *v0 = coord_[0]; + *v0 = coord[0]; for (int i = 0; i < 3; i++) { - (*e1)[i] = coord_[1][i] - (*v0)[i]; - (*e2)[i] = coord_[2][i] - (*v0)[i]; - (*e3)[i] = coord_[3][i] - (*v0)[i]; + (*e1)[i] = coord[1][i] - (*v0)[i]; + (*e2)[i] = coord[2][i] - (*v0)[i]; + (*e3)[i] = coord[3][i] - (*v0)[i]; } det = (*e1)[0] * ((*e2)[1] * (*e3)[2] - (*e2)[2] * (*e3)[1]) @@ -174,15 +174,15 @@ namespace AMDiS { { FUNCNAME("ElInfo::worldToCoord()"); - DimVec<WorldVector<double> > edge(mesh_->getDim(), NO_INIT); + DimVec<WorldVector<double> > edge(mesh->getDim(), NO_INIT); WorldVector<double> x; double x0, det, det0, det1, det2; - static DimVec<double> vec(mesh_->getDim(), NO_INIT); + static DimVec<double> vec(mesh->getDim(), NO_INIT); TEST_EXIT_DBG(lambda)("lambda must not be NULL\n"); - int dim = mesh_->getDim(); + int dim = mesh->getDim(); TEST_EXIT_DBG(dim == dimOfWorld)("dim!=dimOfWorld not yet implemented\n"); @@ -193,11 +193,11 @@ namespace AMDiS { /* mit qi=pi-p3, q=xy-p3 */ for (int j = 0; j < dimOfWorld; j++) { - x0 = coord_[dim][j]; + x0 = coord[dim][j]; x[j] = xy[j] - x0; for (int i = 0; i < dim; i++) - edge[i][j] = coord_[i][j] - x0; + edge[i][j] = coord[i][j] - x0; } det = edge[0][0] * edge[1][1] * edge[2][2] @@ -263,37 +263,37 @@ namespace AMDiS { { FUNCNAME("ElInfo::update()"); - int neighbours = mesh_->getGeo(NEIGH); - int vertices = mesh_->getGeo(VERTEX); + int neighbours = mesh->getGeo(NEIGH); + int vertices = mesh->getGeo(VERTEX); - if (fillFlag_.isSet(Mesh::FILL_NEIGH) || fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag.isSet(Mesh::FILL_NEIGH) || fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { Tetrahedron *nb; - Flag fill_opp_coords = fillFlag_ & Mesh::FILL_OPP_COORDS; + Flag fill_opp_coords = fillFlag & Mesh::FILL_OPP_COORDS; for (int ineigh = 0; ineigh < neighbours; ineigh++) { - if ((nb = dynamic_cast<Tetrahedron*>(const_cast<Element*>(neighbour_[ineigh])))) { + if ((nb = dynamic_cast<Tetrahedron*>(const_cast<Element*>(neighbour[ineigh])))) { int ov = oppVertex[ineigh]; if (ov < 2 && nb->getFirstChild()) { if (fill_opp_coords != Flag(0)) { int k = -1; for (int j = 0; j < vertices; j++) - if (element_->getDOF(j) == nb->getDOF(1 - ov)) + if (element->getDOF(j) == nb->getDOF(1 - ov)) k = j; if (k == -1) { for (int j = 0; j < vertices; j++) - if (mesh_->associated(element_->getDOF(j, 0), nb->getDOF(1 - ov, 0))) + if (mesh->associated(element->getDOF(j, 0), nb->getDOF(1 - ov, 0))) k = j; } TEST_EXIT_DBG(k >= 0)("neighbour dof not found\n"); if (nb->isNewCoordSet()) - oppCoord_[ineigh] = *(nb->getNewCoord()); + oppCoord[ineigh] = *(nb->getNewCoord()); else for (int j = 0; j < dimOfWorld; j++) - oppCoord_[ineigh][j] = (oppCoord_[ineigh][j] + coord_[k][j]) / 2; + oppCoord[ineigh][j] = (oppCoord[ineigh][j] + coord[k][j]) / 2; } - neighbour_[ineigh] = dynamic_cast<Tetrahedron*>(const_cast<Element*>(nb->getChild(1-ov))); + neighbour[ineigh] = dynamic_cast<Tetrahedron*>(const_cast<Element*>(nb->getChild(1-ov))); oppVertex[ineigh] = 3; } } @@ -318,9 +318,9 @@ namespace AMDiS { int i2 = (face + 3) % 4; for (int i = 0; i < dimOfWorld; i++) { - (*e0)[i] = coord_[i1][i] - coord_[i0][i]; - (*e1)[i] = coord_[i2][i] - coord_[i0][i]; - (*e2)[i] = coord_[face][i] - coord_[i0][i]; + (*e0)[i] = coord[i1][i] - coord[i0][i]; + (*e1)[i] = coord[i2][i] - coord[i0][i]; + (*e2)[i] = coord[face][i] - coord[i0][i]; } vectorProduct(*e0, *e1, normal); @@ -354,54 +354,54 @@ namespace AMDiS { const int (*cvg)[4] = NULL; /* cvg = child_vertex[el_type] */ int *ce; /* ce = child_edge[el_type][ichild] */ Element *nb, *nbk; - Element *el_old = elInfoOld->element_; - Flag fillFlag__local = elInfoOld->fillFlag_; + Element *el_old = elInfoOld->element; + Flag fillFlag_local = elInfoOld->fillFlag; DegreeOfFreedom *dof; int ov = -1; Mesh *mesh = elInfoOld->getMesh(); TEST_EXIT_DBG(el_old->getChild(0))("missing child?\n"); - element_ = const_cast<Element*>( el_old->getChild(ichild)); - macroElement_ = elInfoOld->macroElement_; - fillFlag_ = fillFlag__local; - parent_ = el_old; + element = const_cast<Element*>( el_old->getChild(ichild)); + macroElement = elInfoOld->macroElement; + fillFlag = fillFlag_local; + parent = el_old; level = elInfoOld->level + 1; iChild = ichild; int el_type_local = (dynamic_cast<const ElInfo3d*>(elInfoOld))->getType(); elType = (el_type_local + 1) % 3; - TEST_EXIT_DBG(element_)("missing child %d?\n", ichild); + TEST_EXIT_DBG(element)("missing child %d?\n", ichild); - if (fillFlag__local.isAnySet()) { + if (fillFlag_local.isAnySet()) { cvg = Tetrahedron::childVertex[el_type_local]; cv = const_cast<int*>(cvg[ichild]); ochild = 1 - ichild; } - if (fillFlag__local.isSet(Mesh::FILL_COORDS) || - fillFlag_.isSet(Mesh::FILL_DET) || - fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { + if (fillFlag_local.isSet(Mesh::FILL_COORDS) || + fillFlag.isSet(Mesh::FILL_DET) || + fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) { for (int i = 0; i < 3; i++) { for (int j = 0; j < dimOfWorld; j++) - coord_[i][j] = elInfoOld->coord_[cv[i]][j]; + coord[i][j] = elInfoOld->coord[cv[i]][j]; } if (el_old->getNewCoord()) { - coord_[3] = *(el_old->getNewCoord()); + coord[3] = *(el_old->getNewCoord()); } else { for (int j = 0; j < dimOfWorld; j++) - coord_[3][j] = (elInfoOld->coord_[0][j] + elInfoOld->coord_[1][j]) / 2; + coord[3][j] = (elInfoOld->coord[0][j] + elInfoOld->coord[1][j]) / 2; } } - if (fillFlag__local.isSet(Mesh::FILL_NEIGH) || - fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { + if (fillFlag_local.isSet(Mesh::FILL_NEIGH) || + fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { - FixVec<Element*, NEIGH> *neigh_local = &neighbour_; - const FixVec<Element*, NEIGH> *neigh_old = &elInfoOld->neighbour_; + FixVec<Element*, NEIGH> *neigh_local = &neighbour; + const FixVec<Element*, NEIGH> *neigh_old = &elInfoOld->neighbour; Flag fill_opp_coords; - fill_opp_coords.setFlags(fillFlag__local & Mesh::FILL_OPP_COORDS); + fill_opp_coords.setFlags(fillFlag_local & Mesh::FILL_OPP_COORDS); /*----- nb[0] is other child --------------------------------------------*/ @@ -412,11 +412,11 @@ namespace AMDiS { if (nb->getChild(0)) { /* go down one level for direct neighbour */ if (fill_opp_coords.isAnySet()) { if (nb->getNewCoord()) { - oppCoord_[0]= *(nb->getNewCoord()); + oppCoord[0]= *(nb->getNewCoord()); } else { int k = cvg[ochild][1]; for (int j = 0; j < dimOfWorld; j++) - oppCoord_[0][j] = (elInfoOld->coord_[ochild][j] + elInfoOld->coord_[k][j]) / 2; + oppCoord[0][j] = (elInfoOld->coord[ochild][j] + elInfoOld->coord[k][j]) / 2; } } (*neigh_local)[0] = const_cast<Element*>( nb->getChild(1)); @@ -424,7 +424,7 @@ namespace AMDiS { } else { if (fill_opp_coords.isAnySet()) for (int j = 0; j < dimOfWorld; j++) - oppCoord_[0][j] = elInfoOld->coord_[ochild][j]; + oppCoord[0][j] = elInfoOld->coord[ochild][j]; (*neigh_local)[0] = nb; oppVertex[0] = 0; @@ -453,11 +453,11 @@ namespace AMDiS { if (nbk->getChild(0)) { if (fill_opp_coords.isAnySet()) { if (nbk->getNewCoord()) { - oppCoord_[i] = *(nbk->getNewCoord()); + oppCoord[i] = *(nbk->getNewCoord()); } else { for (int j = 0; j < dimOfWorld; j++) - oppCoord_[i][j] = (elInfoOld->oppCoord_[cv[i]][j] + - elInfoOld->coord_[ichild][j]) / 2; + oppCoord[i][j] = (elInfoOld->oppCoord[cv[i]][j] + + elInfoOld->coord[ichild][j]) / 2; } } (*neigh_local)[i] = nbk->getChild(0); @@ -474,7 +474,7 @@ namespace AMDiS { if (fill_opp_coords.isAnySet()) for (int j = 0; j < dimOfWorld; j++) - oppCoord_[i][j] = elInfoOld->oppCoord_[cv[i]][j]; + oppCoord[i][j] = elInfoOld->oppCoord[cv[i]][j]; (*neigh_local)[i] = nbk; oppVertex[i] = ov; @@ -498,11 +498,11 @@ namespace AMDiS { if (nbk->getChild(0)) { if (fill_opp_coords.isAnySet()) { if (nbk->getNewCoord()) { - oppCoord_[i] = *(nbk->getNewCoord()); + oppCoord[i] = *(nbk->getNewCoord()); } else { for (int j = 0; j < dimOfWorld; j++) - oppCoord_[i][j] = (elInfoOld->oppCoord_[cv[i]][j] + - elInfoOld->coord_[ichild][j]) / 2; + oppCoord[i][j] = (elInfoOld->oppCoord[cv[i]][j] + + elInfoOld->coord[ichild][j]) / 2; } } (*neigh_local)[i] = nbk->getChild(0); @@ -518,7 +518,7 @@ namespace AMDiS { if (fill_opp_coords.isAnySet()) for (int j = 0; j < dimOfWorld; j++) - oppCoord_[i][j] = elInfoOld->oppCoord_[cv[i]][j]; + oppCoord[i][j] = elInfoOld->oppCoord[cv[i]][j]; (*neigh_local)[i] = nbk; oppVertex[i] = ov; @@ -542,50 +542,48 @@ namespace AMDiS { if (fill_opp_coords.isAnySet()) for (int j = 0; j < dimOfWorld; j++) - oppCoord_[3][j] = elInfoOld->oppCoord_[ochild][j]; + oppCoord[3][j] = elInfoOld->oppCoord[ochild][j]; } } - if (fillFlag__local.isSet(Mesh::FILL_BOUND)) { + if (fillFlag_local.isSet(Mesh::FILL_BOUND)) { for (int i = 0; i < 3; i++) - boundary_[10 + i] = elInfoOld->getBoundary(10 + cv[i]); + boundary[10 + i] = elInfoOld->getBoundary(10 + cv[i]); - boundary_[13] = elInfoOld->getBoundary(4); + boundary[13] = elInfoOld->getBoundary(4); - boundary_[0] = INTERIOR; - boundary_[1] = elInfoOld->getBoundary(cv[1]); - boundary_[2] = elInfoOld->getBoundary(cv[2]); - boundary_[3] = elInfoOld->getBoundary(ochild); + boundary[0] = INTERIOR; + boundary[1] = elInfoOld->getBoundary(cv[1]); + boundary[2] = elInfoOld->getBoundary(cv[2]); + boundary[3] = elInfoOld->getBoundary(ochild); - int geoFace = mesh_->getGeo(FACE); + int geoFace = mesh->getGeo(FACE); ce = const_cast<int*>(Tetrahedron::childEdge[el_type_local][ichild]); for (int iedge = 0; iedge < 4; iedge++) - boundary_[geoFace + iedge] = elInfoOld->getBoundary(geoFace + ce[iedge]); - for (int iedge = 4; iedge < 6; iedge++) { - int i = 5 - cv[iedge - 3]; /* old vertex opposite new edge */ - boundary_[geoFace + iedge] = elInfoOld->getBoundary(i); - } + boundary[geoFace + iedge] = elInfoOld->getBoundary(geoFace + ce[iedge]); + for (int iedge = 4; iedge < 6; iedge++) + boundary[geoFace + iedge] = elInfoOld->getBoundary(5 - cv[iedge - 3]); if (elInfoOld->getProjection(0) && elInfoOld->getProjection(0)->getType() == VOLUME_PROJECTION) { - projection_[0] = elInfoOld->getProjection(0); + projection[0] = elInfoOld->getProjection(0); } else { // boundary projection - projection_[0] = NULL; - projection_[1] = elInfoOld->getProjection(cv[1]); - projection_[2] = elInfoOld->getProjection(cv[2]); - projection_[3] = elInfoOld->getProjection(ochild); + projection[0] = NULL; + projection[1] = elInfoOld->getProjection(cv[1]); + projection[2] = elInfoOld->getProjection(cv[2]); + projection[3] = elInfoOld->getProjection(ochild); for (int iedge = 0; iedge < 4; iedge++) - projection_[geoFace + iedge] = elInfoOld->getProjection(geoFace + ce[iedge]); + projection[geoFace + iedge] = elInfoOld->getProjection(geoFace + ce[iedge]); for (int iedge = 4; iedge < 6; iedge++) - projection_[geoFace + iedge] = elInfoOld->getProjection(5 - cv[iedge - 3]); + projection[geoFace + iedge] = elInfoOld->getProjection(5 - cv[iedge - 3]); } } - if (fillFlag_.isSet(Mesh::FILL_ORIENTATION)) { + if (fillFlag.isSet(Mesh::FILL_ORIENTATION)) { orientation = (dynamic_cast<ElInfo3d*>(const_cast<ElInfo*>(elInfoOld)))->orientation * Tetrahedron::childOrientation[el_type_local][ichild]; diff --git a/AMDiS/src/Element.h b/AMDiS/src/Element.h index f5e07c3b..70c8c97a 100644 --- a/AMDiS/src/Element.h +++ b/AMDiS/src/Element.h @@ -344,11 +344,10 @@ namespace AMDiS { virtual Element *clone() = 0; /** \brief - * Returns which side of child[childnr] corresponds to side sidenr of - * this Element. If the child has no corresponding - * side, the return value is negative. *isBisected is true after the - * function call, if the side of the child is only a part of element's - * side, false otherwise. + * Returns which side of child[childnr] corresponds to side sidenr of this + * Element. If the child has no corresponding side, the return value is negative. + * isBisected is true after the function call, if the side of the child is only + * a part of element's side, false otherwise. */ virtual int getSideOfChild(int childnr, int sidenr, int elType = 0) const = 0; diff --git a/AMDiS/src/Line.cc b/AMDiS/src/Line.cc index d4620817..40cc2f55 100644 --- a/AMDiS/src/Line.cc +++ b/AMDiS/src/Line.cc @@ -36,8 +36,6 @@ namespace AMDiS { const FixVec<int, WORLD>& Line::sortFaceIndices(int face, FixVec<int,WORLD> *vec) const { - // FUNCNAME("Line::sortFaceIndices"); - // ERROR_EXIT("must not be called for dim = 1!"); static FixVec<int, WORLD> result(1, NO_INIT); FixVec<int, WORLD> *v = vec ? vec : &result; (*v)[0] = face; diff --git a/AMDiS/src/Line.h b/AMDiS/src/Line.h index 486c523a..bc5bc675 100644 --- a/AMDiS/src/Line.h +++ b/AMDiS/src/Line.h @@ -99,11 +99,11 @@ namespace AMDiS { } /// implements Element::getSideOfChild() - virtual int getSideOfChild(int child, int side, int ) const + virtual int getSideOfChild(int child, int side, int) const { FUNCNAME("Line::getSideOfChild()"); - TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n"); - TEST_EXIT_DBG(side >= 0 && side <= 1)("side must be between 0 and 1\n"); + TEST_EXIT_DBG(child == 0 || child == 1)("Child must be either 0 or 1!\n"); + TEST_EXIT_DBG(side >= 0 && side <= 1)("Side must be either 0 or 1!\n"); return sideOfChild[child][side]; } @@ -111,8 +111,8 @@ namespace AMDiS { virtual int getVertexOfParent(int child, int side, int) const { FUNCNAME("Line::getVertexOfParent()"); - TEST_EXIT_DBG(child==0 || child==1)("child must be in (0,1)\n"); - TEST_EXIT_DBG(side >= 0 && side <= 2)("side must be between 0 and 1\n"); + TEST_EXIT_DBG(child == 0 || child == 1)("Child must be either 0 or 1!\n"); + TEST_EXIT_DBG(side >= 0 && side <= 1)("Side must be between 0 and 2!\n"); return vertexOfParent[child][side]; } diff --git a/AMDiS/src/Tetrahedron.h b/AMDiS/src/Tetrahedron.h index d08907b8..f56e49f1 100644 --- a/AMDiS/src/Tetrahedron.h +++ b/AMDiS/src/Tetrahedron.h @@ -222,10 +222,10 @@ namespace AMDiS { /// vertexOfFace[i][j] is the local number of the j-vertex of face i static const int vertexOfFace[4][3]; - /// + /// See \ref Element::getSideOfChild for more information. static const int sideOfChild[3][2][4]; - /// + /// See \ref Element::getVertexOfParent for more information. static const int vertexOfParent[3][2][4]; }; diff --git a/AMDiS/src/Triangle.cc b/AMDiS/src/Triangle.cc index 5731f4b6..65bcc2ea 100644 --- a/AMDiS/src/Triangle.cc +++ b/AMDiS/src/Triangle.cc @@ -7,9 +7,9 @@ namespace AMDiS { - const int Triangle::vertexOfEdge[3][2] = {{1,2}, {2,0}, {0,1}}; - const int Triangle::sideOfChild[2][3] = {{-1,2,0}, {2,-1,1}}; - const int Triangle::vertexOfParent[2][3] = {{2,0,-1}, {1,2,-1}}; + const int Triangle::vertexOfEdge[3][2] = {{1, 2}, {2, 0}, {0, 1}}; + const int Triangle::sideOfChild[2][3] = {{-1, 2, 0}, {2, -1, 1}}; + const int Triangle::vertexOfParent[2][3] = {{2, 0, -1}, {1, 2, -1}}; bool Triangle::hasSide(Element* sideElem) const { -- GitLab