From 50c856b0eb0ceeb2743ce52903f4b971939d1d37 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Mon, 27 Apr 2009 12:29:58 +0000 Subject: [PATCH] Independent meshes for higher order lagrange finite elements. --- AMDiS/src/BasisFunction.h | 21 ------- AMDiS/src/DualTraverse.cc | 4 +- AMDiS/src/DualTraverse.h | 67 ++++++++-------------- AMDiS/src/ElInfo.h | 116 +++++++++----------------------------- AMDiS/src/ElInfo1d.cc | 22 ++++---- AMDiS/src/ElInfo1d.h | 42 +++++--------- AMDiS/src/ElInfo2d.cc | 8 ++- AMDiS/src/ElInfo2d.h | 47 +++++---------- AMDiS/src/ElInfo3d.cc | 8 ++- AMDiS/src/ElInfo3d.h | 69 +++++++---------------- AMDiS/src/ProblemVec.cc | 35 +++++------- AMDiS/src/Traverse.cc | 21 ++++--- AMDiS/src/Traverse.h | 9 +-- 13 files changed, 146 insertions(+), 323 deletions(-) diff --git a/AMDiS/src/BasisFunction.h b/AMDiS/src/BasisFunction.h index 848b8dd5..132c9435 100644 --- a/AMDiS/src/BasisFunction.h +++ b/AMDiS/src/BasisFunction.h @@ -22,10 +22,6 @@ #ifndef AMDIS_BASISFUNCTION_H #define AMDIS_BASISFUNCTION_H -// ============================================================================ -// ===== includes ============================================================= -// ============================================================================ - #include <string> #include "Global.h" #include "Boundary.h" @@ -33,10 +29,6 @@ namespace AMDiS { - // ============================================================================ - // ===== forward declarations ================================================= - // ============================================================================ - class DOFAdmin; class Element; class ElInfo; @@ -54,10 +46,6 @@ namespace AMDiS { template <typename T> class VectorOfFixVecs; - // ============================================================================ - // ===== function interfaces=================================================== - // ============================================================================ - /** \brief * Function interface for evaluating basis functions. */ @@ -101,20 +89,11 @@ namespace AMDiS { DimMat<double>&) const = 0; }; - - // ============================================================================ - // ===== typedefs ============================================================= - // ============================================================================ - typedef BasFctType *BFptr; typedef GrdBasFctType *GBFptr; typedef D2BasFctType *DBFptr; - // ============================================================================ - // ===== class BasisFunction ================================================== - // ============================================================================ - /** \ingroup FEMSpace * \brief * Base class for finite element basis functions. In order to build up a diff --git a/AMDiS/src/DualTraverse.cc b/AMDiS/src/DualTraverse.cc index 2b5d5856..6b8fc52e 100644 --- a/AMDiS/src/DualTraverse.cc +++ b/AMDiS/src/DualTraverse.cc @@ -176,9 +176,9 @@ namespace AMDiS { } if (elInfo1 == elInfoSmall) { - stack1.getCoordsInElem(elInfo2, subCoordsMat); + stack1.getCoordsInElem(elInfo2, basisFcts, subCoordsMat); } else { - stack2.getCoordsInElem(elInfo1, subCoordsMat); + stack2.getCoordsInElem(elInfo1, basisFcts, subCoordsMat); } elInfoSmall->setSubElemCoordsMat(subCoordsMat); diff --git a/AMDiS/src/DualTraverse.h b/AMDiS/src/DualTraverse.h index 92740e41..05d7e78d 100644 --- a/AMDiS/src/DualTraverse.h +++ b/AMDiS/src/DualTraverse.h @@ -31,28 +31,20 @@ namespace AMDiS { class Mesh; class ElInfo; - // ==================================================================== - // === class DualTraverse ============================================= - // ==================================================================== - - /** \brief - * Parallel traversal of two meshes. - */ + /// Parallel traversal of two meshes. class DualTraverse { public: MEMORY_MANAGED(DualTraverse); DualTraverse() - : fillSubElemMat(false) + : fillSubElemMat(false), + basisFcts(NULL) {} - ~DualTraverse() - {} + ~DualTraverse() {} - /** \brief - * Start dual traversal - */ + /// Start dual traversal bool traverseFirst(Mesh *mesh1, Mesh *mesh2, int level1, @@ -82,15 +74,16 @@ namespace AMDiS { } virtual bool skipEl1(ElInfo *elInfo) { - return false; - }; + return false; + } virtual bool skipEl2(ElInfo *elInfo) { - return false; - }; + return false; + } - inline void setFillSubElemMat(bool b) { + inline void setFillSubElemMat(bool b, const BasisFunction *fcts) { fillSubElemMat = b; + basisFcts = fcts; } protected: @@ -109,14 +102,10 @@ namespace AMDiS { ElInfo *elInfoLarge); protected: - /** \brief - * stack for mesh 1 - */ + /// Stack for mesh 1 TraverseStack stack1; - /** \brief - * stack for mesh 2 - */ + /// Stack for mesh 2 TraverseStack stack2; /** \brief @@ -125,34 +114,22 @@ namespace AMDiS { */ double rest; - /** \brief - * true is element 1 should be incremented (set in prepareNextStep()) - */ + /// true if element 1 should be incremented (set in prepareNextStep()) bool inc1; - /** \brief - * true is element 2 should be incremented (set in prepareNextStep()) - */ + /// true if element 2 should be incremented (set in prepareNextStep()) bool inc2; - /** \brief - * for level traverse of mesh 1 - */ + /// for level traverse of mesh 1 int level1_; - /** \brief - * for level traverse of mesh 2 - */ + /// for level traverse of mesh 2 int level2_; - /** \brief - * for leaf element level traverse of mesh 1 - */ + /// for leaf element level traverse of mesh 1 bool callLeafElLevel1_; - /** \brief - * for leaf element level traverse of mesh 2 - */ + /// for leaf element level traverse of mesh 2 bool callLeafElLevel2_; /** \brief @@ -161,6 +138,12 @@ namespace AMDiS { * points defined on the larger element to the coordinates of the smaller element. */ bool fillSubElemMat; + + /** \brief + * If \ref fillSubElemMat is set to true, the corresponding transformation + * matrices are computed. These depend on the basis functions that are used. + */ + const BasisFunction *basisFcts; }; } diff --git a/AMDiS/src/ElInfo.h b/AMDiS/src/ElInfo.h index 4ce0bfd5..aaf75891 100644 --- a/AMDiS/src/ElInfo.h +++ b/AMDiS/src/ElInfo.h @@ -22,9 +22,6 @@ #ifndef AMDIS_ELINFO_H #define AMDIS_ELINFO_H -// ============================================================================ -// ===== includes ============================================================= -// ============================================================================ #include "Flag.h" #include "Boundary.h" #include "Global.h" @@ -33,9 +30,6 @@ namespace AMDiS { - // ============================================================================ - // ===== forward declarations ================================================= - // ============================================================================ class MacroElement; class Mesh; class Element; @@ -43,11 +37,6 @@ namespace AMDiS { class Projection; template<typename ReturnType, typename ArgumentType> class AbstractFunction; - - // ============================================================================ - // ===== class ElInfo ========================================================= - // ============================================================================ - /** \ingroup Traverse * \brief * An ElInfo object holds informations wich are not stored in the corresponding @@ -61,11 +50,8 @@ namespace AMDiS { class ElInfo { - // ===== construtors, destructors ============================================= protected: - /** \brief - * Protected constructor. Avoids instatiation of the basis class - */ + /// Protected constructor. Avoids instatiation of the basis class ElInfo(); /** \brief @@ -75,9 +61,7 @@ namespace AMDiS { ElInfo(Mesh *mesh); public: - /** \brief - * Virtual destructor because ElInfo is pure virtual. - */ + /// Virtual destructor because ElInfo is pure virtual. virtual ~ElInfo(); /** \brief @@ -178,35 +162,25 @@ namespace AMDiS { return oppCoord_[i]; } - /** \brief - * Get ElInfo's \ref boundary_[i] - */ + /// Get ElInfo's \ref boundary_[i] inline BoundaryType getBoundary(int i) const { return boundary_[i]; } - /** \brief - * 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); - /** \brief - * Get ElInfo's \ref neighbour_[i] - */ + /// Get ElInfo's \ref neighbour_[i] inline Element* getNeighbour(int i) const { return neighbour_[i]; } - /** \brief - * Get ElInfo's \ref neighbourCoord_[i] - */ + /// Get ElInfo's \ref neighbourCoord_[i] inline FixVec<WorldVector<double>, VERTEX> getNeighbourCoord(int i) const { return neighbourCoord_[i]; } - /** \brief - * Get ElInfo's \ref oppVertex_[i] - */ + /// Get ElInfo's \ref oppVertex_[i] inline unsigned char getOppVertex(int i) const { return oppVertex_[i]; } @@ -215,30 +189,22 @@ namespace AMDiS { return oppVertex_[i]; } - /** \brief - * Get ElInfo's \ref det_ - */ + /// Get ElInfo's \ref det_ inline double getDet() const { return det_; } - /** \brief - * Returns \ref grdLambda - */ + /// Returns \ref grdLambda inline const DimVec<WorldVector<double> >& getGrdLambda() const { return grdLambda; } - /** \brief - * Returns \ref projection_[i] - */ + /// Returns \ref projection_[i] inline Projection *getProjection(int i) const { return projection_[i]; } - /** \brief - * Returns \ref parametric_ - */ + /// Returns \ref parametric_ inline bool getParametric() { return parametric_; } @@ -253,92 +219,66 @@ namespace AMDiS { /** \} */ - // ===== setting-methods ====================================================== - /** \name setting methods * \{ */ - /** \brief - * Set ElInfo's \ref mesh_ - */ + /// Set ElInfo's \ref mesh_ inline void setMesh(Mesh* aMesh) { mesh_ = aMesh; } - /** \brief - * Set ElInfo's \ref macroElement_ - */ + /// Set ElInfo's \ref macroElement_ inline void setMacroElement(MacroElement* mel) { macroElement_ = mel; } - /** \brief - * Set ElInfo's \ref element - */ + /// Set ElInfo's \ref element inline void setElement(Element* elem) { element_ = elem; } - /** \brief - * Set ElInfo's \ref parent_ - */ + /// Set ElInfo's \ref parent_ inline void setParent(Element* elem) { parent_ = elem; } - /** \brief - * Set ElInfo's \ref fillFlag_ - */ + /// Set ElInfo's \ref fillFlag_ inline void setFillFlag(Flag flag) { fillFlag_ = flag; } - /** \brief - * Sets ElInfo's \ref coord_[i]. - */ + /// Sets ElInfo's \ref coord_[i]. inline void setCoord(int i,WorldVector<double>& coord) { coord_[i] = coord; } - /** \brief - * Sets ElInfo's \ref coord. - */ + /// Sets ElInfo's \ref coord. inline void setCoords(FixVec<WorldVector<double>,VERTEX >& coords) { coord_ = coords; } - /** \brief - * Set ElInfo's \ref level - */ + /// Set ElInfo's \ref level inline void setLevel(int l) { level = l; } - /** \brief - * 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); } - /** \brief - * Set \ref projection_[i] = p - */ + /// Set \ref projection_[i] = p inline void setProjection(int i, Projection *p) { projection_[i] = p; } - /** \brief - * Set \ref det_ = d - */ + /// Set \ref det_ = d inline void setDet(double d) { det_ = d; } - /** \brief - * Set \ref parametric_ = param - */ + /// Set \ref parametric_ = param inline void setParametric(bool param) { parametric_ = param; } @@ -353,8 +293,6 @@ namespace AMDiS { /** \} */ - // ===== other public methods ================================================= - /** \brief * Returns the absolute value of the determinant of the affine linear @@ -443,10 +381,12 @@ namespace AMDiS { return(0.0); } - virtual void getRefSimplexCoords(DimMat<double> *coords) const = 0; + virtual void getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const = 0; - virtual void getSubElementCoords(DimMat<double> *coords, - int iChild) const = 0; + virtual void getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const = 0; protected: /// Pointer to the current mesh diff --git a/AMDiS/src/ElInfo1d.cc b/AMDiS/src/ElInfo1d.cc index 07215df7..8f8cd4b4 100644 --- a/AMDiS/src/ElInfo1d.cc +++ b/AMDiS/src/ElInfo1d.cc @@ -30,9 +30,8 @@ namespace AMDiS { if (fillFlag_.isSet(Mesh::FILL_COORDS) || fillFlag_.isSet(Mesh::FILL_DET) || fillFlag_.isSet(Mesh::FILL_GRD_LAMBDA)) { - for (int i = 0; i < vertices; i++) { + for (int i = 0; i < vertices; i++) coord_[i] = mel->coord[i]; - } } if (fillFlag_.isSet(Mesh::FILL_NEIGH) || fillFlag_.isSet(Mesh::FILL_OPP_COORDS)) { @@ -72,9 +71,8 @@ namespace AMDiS { for (int i = 0; i < vertices; i++) boundary_[i] = mel->getBoundary(i); - for (int i = 0; i < element_->getGeo(PROJECTION); i++) { + for (int i = 0; i < element_->getGeo(PROJECTION); i++) projection_[i] = mel->getProjection(i); - } } } @@ -156,7 +154,7 @@ namespace AMDiS { TEST_EXIT_DBG(det > 1.e-30)("det = 0 on side %d\n", side); normal *= 1.0 / det; - return(det); + return det; } @@ -181,7 +179,7 @@ namespace AMDiS { elementNormal *= 1.0 / det; - return(det); + return det; } @@ -267,12 +265,11 @@ namespace AMDiS { elInfoOld->getProjection(0)->getType() == VOLUME_PROJECTION) { projection_[0] = elInfoOld->getProjection(0); } - } - - return; + } } - void ElInfo1d::getRefSimplexCoords(DimMat<double> *coords) const + void ElInfo1d::getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const { (*coords)[0][0] = 1.0; (*coords)[1][0] = 0.0; @@ -281,8 +278,9 @@ namespace AMDiS { (*coords)[1][1] = 1.0; } - void ElInfo1d::getSubElementCoords(DimMat<double> *coords, - int iChild) const + void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const { if (iChild == 0) { (*coords)[0][1] = ((*coords)[0][0] + (*coords)[0][1]) * 0.5; diff --git a/AMDiS/src/ElInfo1d.h b/AMDiS/src/ElInfo1d.h index 619bf3e6..81bdd5ce 100644 --- a/AMDiS/src/ElInfo1d.h +++ b/AMDiS/src/ElInfo1d.h @@ -27,10 +27,6 @@ namespace AMDiS { - // ============================================================================ - // ===== class ElInfo1d ======================================================= - // ============================================================================ - /** \ingroup Traverse * \brief * ElInfo class for 1-dimensional elements (\ref Line). @@ -40,51 +36,39 @@ namespace AMDiS { public: MEMORY_MANAGED(ElInfo1d); - /** \brief - * Constructor. Calls ElInfo's protected Constructor. - */ + /// Constructor. Calls ElInfo's protected Constructor. ElInfo1d(Mesh* aMesh) : ElInfo(aMesh) {} - /** \brief - * 1-dimensional realisation of ElInfo's fillElInfo method. - */ + /// 1-dimensional realisation of ElInfo's fillElInfo method. void fillElInfo(int ichild, const ElInfo *elinfo_old); - /** \brief - * 1-dimensional realisation of ElInfo's fillMacroInfo method. - */ - void fillMacroInfo(const MacroElement *); + /// 1-dimensional realisation of ElInfo's fillMacroInfo method. + void fillMacroInfo(const MacroElement*); - /** \brief - * 1-dimensional realisation of ElInfo's worldToCoord method. - */ + /// 1-dimensional realisation of ElInfo's worldToCoord method. const int worldToCoord(const WorldVector<double>& w, DimVec<double>* l) const; - /** \brief - * 1-dimensional realisation of ElInfo's calcGrdLambda method. - */ + /// 1-dimensional realisation of ElInfo's calcGrdLambda method. double calcGrdLambda(DimVec<WorldVector<double> >& grd_lam); - /** \brief - * 1-dimensional realisation of ElInfo's getNormal method. - */ + /// 1-dimensional realisation of ElInfo's getNormal method. double getNormal(int side, WorldVector<double> &normal); - /** \brief - * 1-dimensional realisation of ElInfo's getElementNormal method. - */ + /// 1-dimensional realisation of ElInfo's getElementNormal method. double getElementNormal( WorldVector<double> &normal) const; int getSideOfNeighbour(int i) { return (i + 1) % 2; } - void getRefSimplexCoords(DimMat<double> *coords) const; + void getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const; - void getSubElementCoords(DimMat<double> *coords, - int iChild) const; + void getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const; }; diff --git a/AMDiS/src/ElInfo2d.cc b/AMDiS/src/ElInfo2d.cc index 890e42c8..5b5814f2 100644 --- a/AMDiS/src/ElInfo2d.cc +++ b/AMDiS/src/ElInfo2d.cc @@ -605,7 +605,8 @@ namespace AMDiS { return det; } - void ElInfo2d::getRefSimplexCoords(DimMat<double> *coords) const + void ElInfo2d::getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const { (*coords)[0][0] = 1.0; (*coords)[1][0] = 0.0; @@ -620,8 +621,9 @@ namespace AMDiS { (*coords)[2][2] = 1.0; } - void ElInfo2d::getSubElementCoords(DimMat<double> *coords, - int iChild) const + void ElInfo2d::getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const { double c0 = ((*coords)[0][0] + (*coords)[0][1]) * 0.5; double c1 = ((*coords)[1][0] + (*coords)[1][1]) * 0.5; diff --git a/AMDiS/src/ElInfo2d.h b/AMDiS/src/ElInfo2d.h index 056111ff..e2ad7c9d 100644 --- a/AMDiS/src/ElInfo2d.h +++ b/AMDiS/src/ElInfo2d.h @@ -27,10 +27,6 @@ namespace AMDiS { - // ============================================================================ - // ===== class ElInfo2d ======================================================= - // ============================================================================ - /** \ingroup Traverse * \brief * ElInfo class for 2-dimensional elements (\ref Triangle). @@ -40,52 +36,39 @@ namespace AMDiS { public: MEMORY_MANAGED(ElInfo2d); - /** \brief - * Constructor. Calls ElInfo's protected Constructor. - */ + /// Constructor. Calls ElInfo's protected Constructor. ElInfo2d(Mesh* aMesh); + /// ~ElInfo2d(); - /** \brief - * 2-dimensional realisation of ElInfo's fillElInfo method. - */ + /// 2-dimensional realisation of ElInfo's fillElInfo method. void fillElInfo(int ichild, const ElInfo *elinfo_old); - /** \brief - * 2-dimensional realisation of ElInfo's fillMacroInfo method. - */ - void fillMacroInfo(const MacroElement *); + /// 2-dimensional realisation of ElInfo's fillMacroInfo method. + void fillMacroInfo(const MacroElement*); - /** \brief - * 2-dimensional realisation of ElInfo's worldToCoord method. - */ + /// 2-dimensional realisation of ElInfo's worldToCoord method. const int worldToCoord(const WorldVector<double>& w, DimVec<double>* l) const; - /** \brief - * 2-dimensional realisation of ElInfo's calcGrdLambda method. - */ + /// 2-dimensional realisation of ElInfo's calcGrdLambda method. double calcGrdLambda(DimVec<WorldVector<double> >& grd_lam); - /** \brief - * 2-dimensional realisation of ElInfo's getNormal method. - */ + /// 2-dimensional realisation of ElInfo's getNormal method. double getNormal(int side, WorldVector<double> &normal); - /** \brief - * 2-dimensional realisation of ElInfo's getElementNormal method. - */ + /// 2-dimensional realisation of ElInfo's getElementNormal method. double getElementNormal(WorldVector<double> &normal) const; - void getRefSimplexCoords(DimMat<double> *coords) const; + void getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const; - void getSubElementCoords(DimMat<double> *coords, - int iChild) const; + void getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const; protected: - /** \brief - * Temp vectors for function \ref calcGrdLambda. - */ + /// Temp vectors for function \ref calcGrdLambda. WorldVector<double> *e1, *e2, *normal; }; diff --git a/AMDiS/src/ElInfo3d.cc b/AMDiS/src/ElInfo3d.cc index 30b28c54..196b45eb 100644 --- a/AMDiS/src/ElInfo3d.cc +++ b/AMDiS/src/ElInfo3d.cc @@ -609,7 +609,8 @@ namespace AMDiS { } } - void ElInfo3d::getRefSimplexCoords(DimMat<double> *coords) const + void ElInfo3d::getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const { (*coords)[0][0] = 1.0; (*coords)[1][0] = 0.0; @@ -632,8 +633,9 @@ namespace AMDiS { (*coords)[3][3] = 1.0; } - void ElInfo3d::getSubElementCoords(DimMat<double> *coords, - int iChild) const + void ElInfo3d::getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const { FUNCNAME("ElInfo3d::getSubElementCoords()"); diff --git a/AMDiS/src/ElInfo3d.h b/AMDiS/src/ElInfo3d.h index adc7931c..48b92fc0 100644 --- a/AMDiS/src/ElInfo3d.h +++ b/AMDiS/src/ElInfo3d.h @@ -28,11 +28,6 @@ namespace AMDiS { - // ============================================================================ - // ===== class ElInfo3d ======================================================= - // ============================================================================ - - /** \ingroup Traverse * \brief * ElInfo class for 3-dimensional elements (\ref Tetrahedron). @@ -42,18 +37,14 @@ namespace AMDiS { public: MEMORY_MANAGED(ElInfo3d); - /** \brief - * Constructor. Calls ElInfo's protected Constructor. - */ + /// Constructor. Calls ElInfo's protected Constructor. ElInfo3d(Mesh* aMesh) : ElInfo(aMesh) { tmpWorldVecs.resize(4); } - /** \brief - * Assignment operator - */ + /// Assignment operator ElInfo3d& operator=(const ElInfo3d& rhs) { ElInfo::operator=(rhs); el_type = rhs.el_type; @@ -61,73 +52,53 @@ namespace AMDiS { return *this; } - /** \brief - * 3-dimensional realisation of ElInfo's fillElInfo method. - */ + /// 3-dimensional realisation of ElInfo's fillElInfo method. void fillElInfo(int ichild, const ElInfo *elinfo_old); - /** \brief - * 3-dimensional realisation of ElInfo's fillMacroInfo method. - */ + /// 3-dimensional realisation of ElInfo's fillMacroInfo method. void fillMacroInfo(const MacroElement *); - /** \brief - * 3-dimensional realisation of ElInfo's worldToCoord method. - */ + /// 3-dimensional realisation of ElInfo's worldToCoord method. const int worldToCoord(const WorldVector<double>& w, DimVec<double>* l) const; - /** \brief - * 3-dimensional realisation of ElInfo's calcGrdLambda method. - */ + /// 3-dimensional realisation of ElInfo's calcGrdLambda method. double calcGrdLambda(DimVec<WorldVector<double> >& grd_lam); - /** \brief - * 3-dimensional realisation of ElInfo's getNormal method. - */ + /// 3-dimensional realisation of ElInfo's getNormal method. double getNormal(int side, WorldVector<double> &normal); - /** \brief - * update ElInfo after refinement (of some neighbours). Only in 3d! - */ + /// update ElInfo after refinement (of some neighbours). Only in 3d! void update(); - /** \brief - * get ElInfo's \ref el_type - */ + /// get ElInfo's \ref el_type inline unsigned char getType() const { return el_type; } - /** \brief - * get ElInfo's \ref orientation - */ + /// get ElInfo's \ref orientation inline signed char getOrientation() const { return orientation; } - /** \brief - * set ElInfo's \ref el_type to t - */ + /// set ElInfo's \ref el_type to t inline void setType(unsigned char t) { el_type = t; } - /** \brief - * set ElInfo's \ref orientation to o - */ + /// set ElInfo's \ref orientation to o inline void setOrientation(signed char o) { orientation = o; } - void getRefSimplexCoords(DimMat<double> *coords) const; + void getRefSimplexCoords(const BasisFunction *basisFcts, + DimMat<double> *coords) const; - void getSubElementCoords(DimMat<double> *coords, int iChild) const; + void getSubElementCoords(const BasisFunction *basisFcts, + int iChild, + DimMat<double> *coords) const; protected: - - /** \brief - * \ref el 's type. Is Filled automatically by the traversal routines. - */ + /// \ref el 's type. Is Filled automatically by the traversal routines. unsigned char el_type; /** \brief @@ -136,9 +107,7 @@ namespace AMDiS { */ signed char orientation; - /** \brief - * Tmp vectors used for calculations in calcGrdLambda and getNormal(). - */ + /// Tmp vectors used for calculations in calcGrdLambda and getNormal(). std::vector< WorldVector<double> > tmpWorldVecs; }; diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 5e4e8ad7..51e6c431 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -1140,15 +1140,14 @@ namespace AMDiS { { const BasisFunction *basisFcts = rowFeSpace->getBasisFcts(); BoundaryType *bound = NULL; - if (useGetBound) { + if (useGetBound) bound = GET_MEMORY(BoundaryType, basisFcts->getNumber()); - } DualTraverse dualTraverse; ElInfo *rowElInfo, *colElInfo; ElInfo *largeElInfo, *smallElInfo; - dualTraverse.setFillSubElemMat(true); + dualTraverse.setFillSubElemMat(true, basisFcts); bool cont = dualTraverse.traverseFirst(rowFeSpace->getMesh(), colFeSpace->getMesh(), -1, -1, @@ -1156,9 +1155,8 @@ namespace AMDiS { &rowElInfo, &colElInfo, &smallElInfo, &largeElInfo); while (cont) { - if (useGetBound) { + if (useGetBound) basisFcts->getBound(rowElInfo, bound); - } if (matrix) { matrix->assemble(1.0, rowElInfo, colElInfo, smallElInfo, largeElInfo, bound); @@ -1177,9 +1175,8 @@ namespace AMDiS { &smallElInfo, &largeElInfo); } - if (useGetBound) { + if (useGetBound) FREE_MEMORY(bound, BoundaryType, basisFcts->getNumber()); - } } @@ -1194,40 +1191,34 @@ namespace AMDiS { const BasisFunction *basisFcts = mainFeSpace->getBasisFcts(); BoundaryType *bound = NULL; - if (useGetBound) { - bound = GET_MEMORY(BoundaryType, basisFcts->getNumber()); - } + if (useGetBound) + bound = GET_MEMORY(BoundaryType, basisFcts->getNumber()); DualTraverse dualTraverse; ElInfo *mainElInfo, *auxElInfo; ElInfo *largeElInfo, *smallElInfo; - dualTraverse.setFillSubElemMat(true); + dualTraverse.setFillSubElemMat(true, basisFcts); bool cont = dualTraverse.traverseFirst(mainMesh, auxMesh, -1, -1, assembleFlag, assembleFlag, &mainElInfo, &auxElInfo, &smallElInfo, &largeElInfo); while (cont) { - if (useGetBound) { + if (useGetBound) basisFcts->getBound(mainElInfo, bound); - } - if (matrix) { + if (matrix) matrix->assemble2(1.0, mainElInfo, auxElInfo, smallElInfo, largeElInfo, bound); - } - if (vector) { + if (vector) vector->assemble2(1.0, mainElInfo, auxElInfo, smallElInfo, largeElInfo, bound); - } - cont = dualTraverse.traverseNext(&mainElInfo, &auxElInfo, + cont = dualTraverse.traverseNext(&mainElInfo, &auxElInfo, &smallElInfo, &largeElInfo); } - if (useGetBound) { - FREE_MEMORY(bound, BoundaryType, basisFcts->getNumber()); - } - + if (useGetBound) + FREE_MEMORY(bound, BoundaryType, basisFcts->getNumber()); } void ProblemVec::assembleBoundaryConditions(DOFVector<double> *rhs, diff --git a/AMDiS/src/Traverse.cc b/AMDiS/src/Traverse.cc index ac7a7bdc..818f3599 100644 --- a/AMDiS/src/Traverse.cc +++ b/AMDiS/src/Traverse.cc @@ -13,8 +13,7 @@ namespace AMDiS { - ElInfo* TraverseStack::traverseFirst(Mesh *mesh, int level, - Flag fill_flag) + ElInfo* TraverseStack::traverseFirst(Mesh *mesh, int level, Flag fill_flag) { FUNCNAME("TraverseStack::traverseFirst()"); @@ -30,18 +29,16 @@ namespace AMDiS { for (int i = 0; i < stack_size; i++) elinfo_stack[i]->setFillFlag(fill_flag & FILL_ANY); - elinfo_stack[0]->setMesh(mesh); elinfo_stack[1]->setMesh(mesh); - if (fill_flag.isSet(Mesh::CALL_LEAF_EL_LEVEL)) { - TEST_EXIT_DBG(level >= 0)("invalid level: %d\n", level); - } + if (fill_flag.isSet(Mesh::CALL_LEAF_EL_LEVEL)) + TEST_EXIT_DBG(level >= 0)("invalid level: %d\n", level); traverse_mel = NULL; stack_used = 0; - return(traverseNext(NULL)); + return traverseNext(NULL); } ElInfo* TraverseStack::traverseNext(ElInfo* elinfo_old) @@ -876,7 +873,7 @@ namespace AMDiS { static int coarse_nb[3][3] = {{-2,-2,-2}, {2,-1,1}, {-1,2,0}}; /* father.neigh[coarse_nb[i][j]] == child[i-1].neigh[j] */ - int sav_index, sav_neighbour = neighbour; + int sav_index, sav_neighbour = neighbour; TEST_EXIT_DBG(stack_used > 0)("no current element"); TEST_EXIT_DBG(traverse_fill_flag.isSet(Mesh::CALL_LEAF_EL))("invalid traverse_fill_flag"); @@ -1073,15 +1070,17 @@ namespace AMDiS { } void TraverseStack::getCoordsInElem(const ElInfo *upperElInfo, + const BasisFunction *basisFcts, DimMat<double> *coords) { int levelDif = elinfo_stack[stack_used]->getLevel() - upperElInfo->getLevel(); - upperElInfo->getRefSimplexCoords(coords); + upperElInfo->getRefSimplexCoords(basisFcts, coords); for (int i = 1; i <= levelDif; i++) { - upperElInfo->getSubElementCoords(coords, - elinfo_stack[stack_used - levelDif + i]->getIChild()); + upperElInfo->getSubElementCoords(basisFcts, + elinfo_stack[stack_used - levelDif + i]->getIChild(), + coords); } } diff --git a/AMDiS/src/Traverse.h b/AMDiS/src/Traverse.h index b63ce870..7f4532a7 100644 --- a/AMDiS/src/Traverse.h +++ b/AMDiS/src/Traverse.h @@ -44,10 +44,6 @@ namespace AMDiS { class MacroElement; class Mesh; - // =========================================================================== - // ===== class TraverseStack ================================================= - // =========================================================================== - /** \ingroup Traverse * \brief * Mesh refinement and coarsening routines are examples of functions which @@ -128,7 +124,7 @@ namespace AMDiS { /// Only for 3d: Calls update of all ElInfo3d onjects in \ref elinfo_stack void update(); - void getCoordsInElem(const ElInfo *upperElInfo, + void getCoordsInElem(const ElInfo *upperElInfo, const BasisFunction *basisFcts, DimMat<double> *coords); /// Is used for parallel mesh traverse. @@ -249,9 +245,6 @@ namespace AMDiS { int maxThreads_; }; - // ============================================================================ - // ===== class Traverse ======================================================= - // ============================================================================ /** \ingroup Traverse * \brief -- GitLab