Commit 50c856b0 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Independent meshes for higher order lagrange finite elements.

parent 7b836281
......@@ -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
......
......@@ -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);
......
......@@ -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;
};
}
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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;
......
......@@ -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.
*/