Commit d34c8857 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Code refactoring.

parent 85f42967
...@@ -15,28 +15,28 @@ ...@@ -15,28 +15,28 @@
namespace AMDiS { namespace AMDiS {
ElInfo::ElInfo(Mesh *aMesh) ElInfo::ElInfo(Mesh *aMesh)
: mesh_(aMesh), : mesh(aMesh),
element_(NULL), element(NULL),
parent_(NULL), parent(NULL),
macroElement_(NULL), macroElement(NULL),
level(0), level(0),
elType(0), elType(0),
iChild(0), iChild(0),
coord_(mesh_->getDim(), NO_INIT), coord(mesh->getDim(), NO_INIT),
boundary_(mesh_->getDim(), DEFAULT_VALUE, INTERIOR), boundary(mesh->getDim(), DEFAULT_VALUE, INTERIOR),
projection_(mesh_->getDim(), NO_INIT), projection(mesh->getDim(), NO_INIT),
oppCoord_(mesh_->getDim(), NO_INIT), oppCoord(mesh->getDim(), NO_INIT),
neighbour_(mesh_->getDim(), NO_INIT), neighbour(mesh->getDim(), NO_INIT),
neighbourCoord(mesh_->getDim(), NO_INIT), neighbourCoord(mesh->getDim(), NO_INIT),
oppVertex(mesh_->getDim(), NO_INIT), oppVertex(mesh->getDim(), NO_INIT),
grdLambda(mesh_->getDim(), NO_INIT), grdLambda(mesh->getDim(), NO_INIT),
refinementPath(0), refinementPath(0),
refinementPathLength(0) refinementPathLength(0)
{ {
projection_.set(NULL); projection.set(NULL);
for (int i = 0; i < neighbourCoord.getSize(); i++) for (int i = 0; i < neighbourCoord.getSize(); i++)
neighbourCoord[i].init(mesh_->getDim()); neighbourCoord[i].init(mesh->getDim());
dimOfWorld = Global::getGeo(WORLD); dimOfWorld = Global::getGeo(WORLD);
} }
...@@ -53,21 +53,21 @@ namespace AMDiS { ...@@ -53,21 +53,21 @@ namespace AMDiS {
double c = l[0]; double c = l[0];
for (int j = 0; j < dimOfWorld; j++) 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); int vertices = Global::getGeo(VERTEX, l.getSize() - 1);
for (int i = 1; i < vertices; i++) { for (int i = 1; i < vertices; i++) {
c = l[i]; c = l[i];
for (int j = 0; j < dimOfWorld; j++) for (int j = 0; j < dimOfWorld; j++)
w[j] += c * coord_[i][j]; w[j] += c * coord[i][j];
} }
} }
double ElInfo::calcDet() const double ElInfo::calcDet() const
{ {
testFlag(Mesh::FILL_COORDS); testFlag(Mesh::FILL_COORDS);
return calcDet(coord_); return calcDet(coord);
} }
double ElInfo::calcDet(const FixVec<WorldVector<double>, VERTEX> &coords) const double ElInfo::calcDet(const FixVec<WorldVector<double>, VERTEX> &coords) const
...@@ -147,11 +147,11 @@ namespace AMDiS { ...@@ -147,11 +147,11 @@ namespace AMDiS {
void ElInfo::fillDetGrdLambda() void ElInfo::fillDetGrdLambda()
{ {
if (fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { if (fillFlag.isSet(Mesh::FILL_GRD_LAMBDA)) {
det_ = calcGrdLambda(grdLambda); det = calcGrdLambda(grdLambda);
} else { } else {
if (fillFlag_.isSet(Mesh::FILL_DET)) if (fillFlag.isSet(Mesh::FILL_DET))
det_ = calcDet(); det = calcDet();
} }
} }
...@@ -163,11 +163,11 @@ namespace AMDiS { ...@@ -163,11 +163,11 @@ namespace AMDiS {
{10, 4, 0} {10, 4, 0}
}; };
int dim = mesh_->getDim(); int dim = mesh->getDim();
int posIndex = DIM_OF_INDEX(pos, dim); int posIndex = DIM_OF_INDEX(pos, dim);
int offset = indexOffset[dim - 1][posIndex]; int offset = indexOffset[dim - 1][posIndex];
return boundary_[offset + i]; return boundary[offset + i];
} }
} }
...@@ -66,17 +66,17 @@ namespace AMDiS { ...@@ -66,17 +66,17 @@ namespace AMDiS {
*/ */
ElInfo& operator=(const ElInfo& rhs) ElInfo& operator=(const ElInfo& rhs)
{ {
mesh_ = rhs.mesh_; mesh = rhs.mesh;
element_ = rhs.element_; element = rhs.element;
parent_ = rhs.parent_; parent = rhs.parent;
macroElement_ = rhs.macroElement_; macroElement = rhs.macroElement;
fillFlag_ = rhs.fillFlag_; fillFlag = rhs.fillFlag;
level = rhs.level; level = rhs.level;
iChild = rhs.iChild; iChild = rhs.iChild;
coord_ = rhs.coord_; coord = rhs.coord;
boundary_ = rhs.boundary_; boundary = rhs.boundary;
oppCoord_ = rhs.oppCoord_; oppCoord = rhs.oppCoord;
neighbour_ = rhs.neighbour_; neighbour = rhs.neighbour;
neighbourCoord = rhs.neighbourCoord; neighbourCoord = rhs.neighbourCoord;
oppVertex = rhs.oppVertex; oppVertex = rhs.oppVertex;
return *this; return *this;
...@@ -87,34 +87,34 @@ namespace AMDiS { ...@@ -87,34 +87,34 @@ namespace AMDiS {
* \{ * \{
*/ */
/// Get ElInfo's \ref mesh_ /// Get ElInfo's \ref mesh
inline Mesh* getMesh() const inline Mesh* getMesh() const
{ {
return mesh_; return mesh;
} }
/// Get ElInfo's \ref macroElement_ /// Get ElInfo's \ref macroElement
inline MacroElement* getMacroElement() const inline MacroElement* getMacroElement() const
{ {
return macroElement_; return macroElement;
} }
/// Get ElInfo's \ref element /// Get ElInfo's \ref element
inline Element* getElement() const inline Element* getElement() const
{ {
return element_; return element;
} }
/// Get ElInfo's \ref parent_ /// Get ElInfo's \ref parent
inline Element* getParent() const inline Element* getParent() const
{ {
return parent_; return parent;
} }
/// Get ElInfo's \ref fillFlag_ /// Get ElInfo's \ref fillFlag
inline Flag getFillFlag() const inline Flag getFillFlag() const
{ {
return fillFlag_; return fillFlag;
} }
/// Get ElInfo's \ref level /// Get ElInfo's \ref level
...@@ -130,60 +130,60 @@ namespace AMDiS { ...@@ -130,60 +130,60 @@ namespace AMDiS {
} }
/** \brief /** \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. * coordinates of the i-th vertex of element \ref el.
*/ */
inline WorldVector<double>& getCoord(int i) inline WorldVector<double>& getCoord(int i)
{ {
return coord_[i]; return coord[i];
} }
/** \brief /** \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. * coordinates of the i-th vertex of element \ref el.
*/ */
inline const WorldVector<double>& getCoord(int i) const inline const WorldVector<double>& getCoord(int i) const
{ {
return coord_[i]; return coord[i];
} }
/** \brief /** \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. * coordinates of the all vertice of element \ref el.
*/ */
inline FixVec<WorldVector<double>, VERTEX>& getCoords() inline FixVec<WorldVector<double>, VERTEX>& getCoords()
{ {
return coord_; return coord;
} }
/** \brief /** \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. * coordinates of the all vertice of element \ref el.
*/ */
inline const FixVec<WorldVector<double>, VERTEX>& getCoords() const 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) 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 inline BoundaryType getBoundary(int i) const
{ {
return boundary_[i]; return boundary[i];
} }
/// Get boundary type of i-th vertex/edge/face (pos). /// Get boundary type of i-th vertex/edge/face (pos).
BoundaryType getBoundary(GeoIndex pos, int i); BoundaryType getBoundary(GeoIndex pos, int i);
/// Get ElInfo's \ref neighbour_[i] /// Get ElInfo's \ref neighbour[i]
inline Element* getNeighbour(int i) const inline Element* getNeighbour(int i) const
{ {
return neighbour_[i]; return neighbour[i];
} }
/// Get ElInfo's \ref neighbourCoord[i] /// Get ElInfo's \ref neighbourCoord[i]
...@@ -203,10 +203,10 @@ namespace AMDiS { ...@@ -203,10 +203,10 @@ namespace AMDiS {
return oppVertex[i]; return oppVertex[i];
} }
/// Get ElInfo's \ref det_ /// Get ElInfo's \ref det
inline double getDet() const inline double getDet() const
{ {
return det_; return det;
} }
/// Returns \ref grdLambda /// Returns \ref grdLambda
...@@ -215,10 +215,10 @@ namespace AMDiS { ...@@ -215,10 +215,10 @@ namespace AMDiS {
return grdLambda; return grdLambda;
} }
/// Returns \ref projection_[i] /// Returns \ref projection[i]
inline Projection *getProjection(int i) const inline Projection *getProjection(int i) const
{ {
return projection_[i]; return projection[i];
} }
/// Returns \ref parametric /// Returns \ref parametric
...@@ -239,46 +239,46 @@ namespace AMDiS { ...@@ -239,46 +239,46 @@ namespace AMDiS {
* \{ * \{
*/ */
/// Set ElInfo's \ref mesh_ /// Set ElInfo's \ref mesh
inline void setMesh(Mesh* aMesh) inline void setMesh(Mesh* aMesh)
{ {
mesh_ = aMesh; mesh = aMesh;
} }
/// Set ElInfo's \ref macroElement_ /// Set ElInfo's \ref macroElement
inline void setMacroElement(MacroElement* mel) inline void setMacroElement(MacroElement* mel)
{ {
macroElement_ = mel; macroElement = mel;
} }
/// Set ElInfo's \ref element /// Set ElInfo's \ref element
inline void setElement(Element* elem) inline void setElement(Element* elem)
{ {
element_ = elem; element = elem;
} }
/// Set ElInfo's \ref parent_ /// Set ElInfo's \ref parent
inline void setParent(Element* elem) inline void setParent(Element* elem)
{ {
parent_ = elem; parent = elem;
} }
/// Set ElInfo's \ref fillFlag_ /// Set ElInfo's \ref fillFlag
inline void setFillFlag(Flag flag) inline void setFillFlag(Flag flag)
{ {
fillFlag_ = flag; fillFlag = flag;
} }
/// Sets ElInfo's \ref coord_[i]. /// Sets ElInfo's \ref coord[i].
inline void setCoord(int i,WorldVector<double>& coord) inline void setCoord(int i,WorldVector<double>& c)
{ {
coord_[i] = coord; coord[i] = c;
} }
/// Sets ElInfo's \ref coord. /// 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 /// Set ElInfo's \ref level
...@@ -287,22 +287,22 @@ namespace AMDiS { ...@@ -287,22 +287,22 @@ namespace AMDiS {
level = l; level = l;
} }
/// Set ElInfo's \ref boundary_[i] /// Set ElInfo's \ref boundary[i]
inline void setBoundary(int i, BoundaryType t) 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) 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) inline void setDet(double d)
{ {
det_ = d; det = d;
} }
/// Set \ref parametric = param /// Set \ref parametric = param
...@@ -345,7 +345,7 @@ namespace AMDiS { ...@@ -345,7 +345,7 @@ namespace AMDiS {
double calcDet(const FixVec<WorldVector<double>, VERTEX> &coords) const; double calcDet(const FixVec<WorldVector<double>, VERTEX> &coords) const;
/** \brief /** \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. * exits.
*/ */
void testFlag(const Flag& flag) const; void testFlag(const Flag& flag) const;
...@@ -357,7 +357,7 @@ namespace AMDiS { ...@@ -357,7 +357,7 @@ namespace AMDiS {
void coordToWorld(const DimVec<double>& lambda, void coordToWorld(const DimVec<double>& lambda,
WorldVector<double>& world) const; 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(); virtual void fillDetGrdLambda();
/** \brief /** \brief
...@@ -422,25 +422,25 @@ namespace AMDiS { ...@@ -422,25 +422,25 @@ namespace AMDiS {
protected: protected:
/// Pointer to the current mesh /// Pointer to the current mesh
Mesh *mesh_; Mesh *mesh;
/// Pointer to the current element /// Pointer to the current element
Element *element_; Element *element;
/// \ref element is child of element parent_ /// \ref element is child of element parent
Element *parent_; Element *parent;
/** \brief /** \brief
* \ref element is an element of the binary tree located at MacroElement * \ref element is an element of the binary tree located at MacroElement
* macroElement_ * macroElement
*/ */
MacroElement *macroElement_; MacroElement *macroElement;
/** \brief /** \brief
* Indicates wich elements will be called and wich information should be * Indicates wich elements will be called and wich information should be
* present while mesh traversal. * present while mesh traversal.
*/ */
Flag fillFlag_; Flag fillFlag;
/** \brief /** \brief
* Level of the element. The level is zero for macro elements and the level * Level of the element. The level is zero for macro elements and the level
...@@ -462,36 +462,36 @@ namespace AMDiS { ...@@ -462,36 +462,36 @@ namespace AMDiS {
int iChild; int iChild;
/** \brief /** \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. * i-th vertex of element \ref element.
*/ */
FixVec<WorldVector<double>, VERTEX> coord_; FixVec<WorldVector<double>, VERTEX> coord;
/** \brief /** \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 * 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 * object of the i-th edge, for i=0,..,N_EDGES - 1. It is
* a pointer to NULL for an interior edge/face. * a pointer to NULL for an interior edge/face.
*/ */
FixVec<BoundaryType, BOUNDARY> boundary_; FixVec<BoundaryType, BOUNDARY> boundary;
/** \brief /** \brief
* Vector storing pointers to projections for each face, edge, vertex. * Vector storing pointers to projections for each face, edge, vertex.
*/ */
FixVec<Projection*, PROJECTION> projection_; FixVec<Projection*, PROJECTION> projection;
/** \brief /** \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. * common edge/face.
*/ */
FixVec<WorldVector<double>, NEIGH> oppCoord_; FixVec<WorldVector<double>, NEIGH> oppCoord;
/** \brief /** \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. * It is a pointer to NULL for boundary edges/faces.
*/ */
FixVec<Element*, NEIGH> neighbour_; FixVec<Element*, NEIGH> neighbour;
/** \brief /** \brief