Commit 1a50a838 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Bugfix when compiling with mpi and some other things ...

parent ed8e83c8
...@@ -70,6 +70,7 @@ namespace AMDiS { ...@@ -70,6 +70,7 @@ namespace AMDiS {
template<typename T> class MatVecMultiplier; template<typename T> class MatVecMultiplier;
template<typename T> class SolverMatrix; template<typename T> class SolverMatrix;
template<typename T> class Vector; template<typename T> class Vector;
template<typename T> class WorldVector;
template <typename ITLSolver> class ITL_OEMSolver; template <typename ITLSolver> class ITL_OEMSolver;
......
...@@ -22,32 +22,13 @@ ...@@ -22,32 +22,13 @@
#ifndef AMDIS_COARSENINGMANAGER_H #ifndef AMDIS_COARSENINGMANAGER_H
#define AMDIS_COARSENINGMANAGER_H #define AMDIS_COARSENINGMANAGER_H
// ============================================================================
// ===== includes =============================================================
// ============================================================================
#include "Global.h" #include "Global.h"
#include "Mesh.h" #include "Mesh.h"
#include "ProblemStatBase.h" #include "ProblemStatBase.h"
#include "AMDiS_fwd.h"
namespace AMDiS { namespace AMDiS {
// ============================================================================
// ===== forward declarations =================================================
// ============================================================================
class Element;
class Line;
class Triangle;
class Tetrahedron;
class RCNeighbourList;
class ElInfo;
class TraverseStack;
// ============================================================================
// ===== class CoarseningManager ==============================================
// ============================================================================
/** \ingroup Adaption /** \ingroup Adaption
* \brief * \brief
* Base class of CoarseningManager1d, CoarseningManager2d, CoarseningManager3d. * Base class of CoarseningManager1d, CoarseningManager2d, CoarseningManager3d.
...@@ -57,22 +38,19 @@ namespace AMDiS { ...@@ -57,22 +38,19 @@ namespace AMDiS {
class CoarseningManager class CoarseningManager
{ {
public: public:
/** \brief /// Constructs a CoarseningManager which belongs to aMesh
* constructs a CoarseningManager which belongs to aMesh
*/
CoarseningManager() CoarseningManager()
: mesh(NULL), stack(NULL), globalMark(0), doMore(0) : mesh(NULL),
{}; stack(NULL),
globalMark(0),
doMore(0)
{}
/** \brief /// destructor
* destructor virtual ~CoarseningManager() {}
*/
virtual ~CoarseningManager() {};
/** \brief /// Returns the Mesh the CoarseningManager belongs to.
* Returns the Mesh the CoarseningManager belongs to. inline Mesh* getMesh() { return mesh; }
*/
inline Mesh* getMesh() { return mesh; };
/** \brief /** \brief
* Tries to coarsen every element of mesh at least mark times. First * Tries to coarsen every element of mesh at least mark times. First
...@@ -108,45 +86,29 @@ namespace AMDiS { ...@@ -108,45 +86,29 @@ namespace AMDiS {
*/ */
void spreadCoarsenMark(); void spreadCoarsenMark();
/** \brief /// Used while traversal in spreadCoarsenMark
* Used while traversal in spreadCoarsenMark
*/
static int spreadCoarsenMarkFunction(ElInfo* el_info); static int spreadCoarsenMarkFunction(ElInfo* el_info);
/** \brief /// Used while traversal in cleanUpAfterCoarsen
*Used while traversal in cleanUpAfterCoarsen
*/
static int cleanUpAfterCoarsenFunction(ElInfo* el_info); static int cleanUpAfterCoarsenFunction(ElInfo* el_info);
/** \brief /// Sets the mark on all elements that have to be coarsend
* Sets the mark on all elements that have to be coarsend
*/
static int coarsenMarkFunction(ElInfo *el_info); static int coarsenMarkFunction(ElInfo *el_info);
/** \brief /// Resets the element marks
* Resets the element marks
*/
void cleanUpAfterCoarsen(); void cleanUpAfterCoarsen();
protected: protected:
/** \brief /// The Mesh this CoarseningManager belongs to.
* the Mesh this CoarseningManager belongs to Mesh *mesh;
*/
Mesh *mesh;
/** \brief /// Used for non recursive mesh traversal.
* Used for non recursive mesh traversal.
*/
TraverseStack *stack; TraverseStack *stack;
/** \brief /// Used by globalCoarsen to remember the given mark value
* Used by globalCoarsen to remember the given mark value int globalMark;
*/
int globalMark;
/** \brief /// Spezifies whether the coarsening operation is still in progress
* Spezifies whether the coarsening operation is still in progress
*/
bool doMore; bool doMore;
/** \brief /** \brief
...@@ -155,9 +117,7 @@ namespace AMDiS { ...@@ -155,9 +117,7 @@ namespace AMDiS {
*/ */
static CoarseningManager* traversePtr; static CoarseningManager* traversePtr;
/** \brief /// Spezifies how many DOFVectors should restricted while coarsening
* Spezifies how many DOFVectors should restricted while coarsening
*/
int callCoarseRestrict; int callCoarseRestrict;
friend class RCNeighbourList; friend class RCNeighbourList;
......
...@@ -55,7 +55,7 @@ namespace AMDiS { ...@@ -55,7 +55,7 @@ namespace AMDiS {
applyDBCs.clear(); applyDBCs.clear();
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
applicationOrdering = NULL; applicationOrdering = NULL;
#endif #endif
} }
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "Boundary.h" #include "Boundary.h"
#include "Serializable.h" #include "Serializable.h"
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include "petscao.h" #include "petscao.h"
#endif #endif
...@@ -430,7 +430,7 @@ namespace AMDiS { ...@@ -430,7 +430,7 @@ namespace AMDiS {
/// ///
int memsize(); int memsize();
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Sets the petsc application ordering object to map dof indices. /// Sets the petsc application ordering object to map dof indices.
void useApplicationOrdering(AO *ao) { void useApplicationOrdering(AO *ao) {
applicationOrdering = ao; applicationOrdering = ao;
...@@ -495,7 +495,7 @@ namespace AMDiS { ...@@ -495,7 +495,7 @@ namespace AMDiS {
*/ */
std::set<int> applyDBCs; std::set<int> applyDBCs;
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Petsc application ordering to map dof indices. /// Petsc application ordering to map dof indices.
AO *applicationOrdering; AO *applicationOrdering;
#endif #endif
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "DOFMatrix.h" #include "DOFMatrix.h"
#include "BasisFunction.h" #include "BasisFunction.h"
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include "petscao.h" #include "petscao.h"
#endif #endif
...@@ -517,7 +517,7 @@ namespace AMDiS { ...@@ -517,7 +517,7 @@ namespace AMDiS {
DOFVector<WorldVector<T> >* getRecoveryGradient(DOFVector<WorldVector<T> >*) const; DOFVector<WorldVector<T> >* getRecoveryGradient(DOFVector<WorldVector<T> >*) const;
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Sets the petsc application ordering object to map dof indices. /// Sets the petsc application ordering object to map dof indices.
void useApplicationOrdering(AO *ao) { void useApplicationOrdering(AO *ao) {
applicationOrdering = ao; applicationOrdering = ao;
...@@ -559,7 +559,7 @@ namespace AMDiS { ...@@ -559,7 +559,7 @@ namespace AMDiS {
/// Used for mesh traversal /// Used for mesh traversal
static DOFVector<T> *traverseVector; static DOFVector<T> *traverseVector;
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Petsc application ordering to map dof indices. /// Petsc application ordering to map dof indices.
AO *applicationOrdering; AO *applicationOrdering;
#endif #endif
......
...@@ -116,7 +116,7 @@ namespace AMDiS { ...@@ -116,7 +116,7 @@ namespace AMDiS {
{ {
init(f, n); init(f, n);
#ifdef HAVE_PARALLEL_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
applicationOrdering = NULL; applicationOrdering = NULL;
#endif #endif
} }
......
#ifndef AMDIS_DIRECTSOLVERINTERFACE_H
#define AMDIS_DIRECTSOLVERINTERFACE_H
namespace AMDiS {
template<typename MatrixType, typename VectorType>
class DirectSolverInterface
{
public:
DirectSolverInterface() {};
virtual ~DirectSolverInterface() {};
virtual void solve(MatrixType &A,
VectorType &b,
VectorType &x,
int numUnknowns) = 0;
};
}
#endif
...@@ -319,14 +319,9 @@ namespace AMDiS { ...@@ -319,14 +319,9 @@ 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.
/** \brief
* Fills ElInfo's \ref det_ and \ref grdLambda entries.
*/
virtual void fillDetGrdLambda(); virtual void fillDetGrdLambda();
// ===== pure virtual functions. Must be overriden in sub-classes ============
/** \brief /** \brief
* Returns a pointer to a vector, which contains the barycentric coordinates * Returns a pointer to a vector, which contains the barycentric coordinates
* with respect to \ref element of a point with world coordinates world. * with respect to \ref element of a point with world coordinates world.
...@@ -488,7 +483,6 @@ namespace AMDiS { ...@@ -488,7 +483,6 @@ namespace AMDiS {
*/ */
DimMat<double> *subElemCoordsMat; DimMat<double> *subElemCoordsMat;
// ===== static public members ================================================
public: public:
/** \brief /** \brief
* child_vertex[el_type][child][i] = father's local vertex index of new * child_vertex[el_type][child][i] = father's local vertex index of new
......
...@@ -289,6 +289,16 @@ namespace AMDiS { ...@@ -289,6 +289,16 @@ namespace AMDiS {
} }
} }
void ElInfo1d::getRefSimplexCoords(const BasisFunction *basisFcts,
mtl::dense2D<double>& coords) const
{
TEST_EXIT(basisFcts->getDegree() == 1)("Wrong basis function degree!\n");
double deg1[][2] = {{ 1.0, 0.0 },
{ 0.0, 1.0 }};
coords = deg1;
}
void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts, void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts,
int iChild, int iChild,
DimMat<double> *coords) const DimMat<double> *coords) const
...@@ -312,4 +322,33 @@ namespace AMDiS { ...@@ -312,4 +322,33 @@ namespace AMDiS {
} }
} }
void ElInfo1d::getSubElementCoords(const BasisFunction *basisFcts,
int iChild,
mtl::dense2D<double>& coords) const
{
FUNCNAME("ElInfo1d::getSubElementCoords()");
double deg1_left[][2] = {{ 1.0, 0.5 },
{ 0.0, 0.5 }};
mtl::dense2D<double> deg1_left_mat(deg1_left);
double deg1_right[][2] = {{ 0.5, 1.0 },
{ 0.5, 0.0 }};
mtl::dense2D<double> deg1_right_mat(deg1_right);
switch (basisFcts->getDegree()) {
case 1:
if (iChild == 0)
coords *= deg1_left_mat;
else
coords *= deg1_right_mat;
break;
case 2:
break;
default:
ERROR_EXIT("Not yet implemented!\n");
}
}
} }
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#ifndef AMDIS_ELINFO1D_H #ifndef AMDIS_ELINFO1D_H
#define AMDIS_ELINFO1D_H #define AMDIS_ELINFO1D_H
#include <boost/numeric/mtl/mtl.hpp>
#include "ElInfo.h" #include "ElInfo.h"
#include "MemoryManager.h" #include "MemoryManager.h"
...@@ -34,8 +36,6 @@ namespace AMDiS { ...@@ -34,8 +36,6 @@ namespace AMDiS {
class ElInfo1d : public ElInfo class ElInfo1d : public ElInfo
{ {
public: public:
MEMORY_MANAGED(ElInfo1d);
/// Constructor. Calls ElInfo's protected Constructor. /// Constructor. Calls ElInfo's protected Constructor.
ElInfo1d(Mesh* aMesh) ElInfo1d(Mesh* aMesh)
: ElInfo(aMesh) : ElInfo(aMesh)
...@@ -66,10 +66,16 @@ namespace AMDiS { ...@@ -66,10 +66,16 @@ namespace AMDiS {
void getRefSimplexCoords(const BasisFunction *basisFcts, void getRefSimplexCoords(const BasisFunction *basisFcts,
DimMat<double> *coords) const; DimMat<double> *coords) const;
void getRefSimplexCoords(const BasisFunction *basisFcts,
mtl::dense2D<double>& coords) const;
void getSubElementCoords(const BasisFunction *basisFcts, void getSubElementCoords(const BasisFunction *basisFcts,
int iChild, int iChild,
DimMat<double> *coords) const; DimMat<double> *coords) const;
void getSubElementCoords(const BasisFunction *basisFcts,
int iChild,
mtl::dense2D<double>& coords) const;
}; };
} }
......
...@@ -22,78 +22,47 @@ ...@@ -22,78 +22,47 @@
#ifndef AMDIS_ELINFOSTACK_H #ifndef AMDIS_ELINFOSTACK_H
#define AMDIS_ELINFOSTACK_H #define AMDIS_ELINFOSTACK_H
// ============================================================================
// ===== includes =============================================================
// ============================================================================
#include <vector> #include <vector>
#include "ElInfo.h" #include "ElInfo.h"
#include "AMDiS_fwd.h"
namespace AMDiS { namespace AMDiS {
// ============================================================================
// ===== forward declarations =================================================
// ============================================================================
class Mesh;
// ============================================================================
// ===== class ElInfoStack ====================================================
// ============================================================================
/** \ingroup Traverse /** \ingroup Traverse
* \brief * \brief
* Stores a stack of ElInfo object. Is used by meshes for recursive mesh * Stores a stack of ElInfo object. Is used by meshes for recursive mesh
* traverse. The use of a stack is cheaper than allocating the ElInfo objects * traverse. The use of a stack is cheaper than allocating the ElInfo objects
* at every recursive step. * at every recursive step.
*/ */
class ElInfoStack class ElInfoStack
{ {
public: public:
/** \brief /// Constructer, creates the stack.
* Constructer, creates the stack.
*/
ElInfoStack(Mesh *mesh); ElInfoStack(Mesh *mesh);
/** \brief /// Destructor, deletes all ElInfos on the stack.
* Destructor, deletes all ElInfos on the stack.
*/
~ElInfoStack(); ~ElInfoStack();
/** \brief /// Get a new element from the stack an increase the stack position.
* Get a new element from the stack an increase the stack position.
*/
ElInfo* getNextElement(); ElInfo* getNextElement();
/** \brief /// Decrease the stack position.
* Decrease the stack position.
*/
void getBackElement(); void getBackElement();
/** \brief /// Returns a pointer to the currently used element of the stack.
* Returns a pointer to the currently used element of the stack.
*/
ElInfo* getCurrentElement(); ElInfo* getCurrentElement();
protected: protected:
/** \brief /// The mesh on which the traverse is done.
* The mesh on which the traverse is done.
*/
Mesh *mesh_; Mesh *mesh_;
/** \brief /// The stack of pointers to ElInfo objects.
* The stack of pointers to ElInfo objects.
*/
std::vector<ElInfo*> elInfoStack_; std::vector<ElInfo*> elInfoStack_;
/** \brief /// Current position (depth) of the recursive mesh traverse.
* Current position (depth) of the recursive mesh traverse.
*/
int stackPosition_; int stackPosition_;
}; };
} }
#endif // AMDIS_ELINFOSTACK_H #endif // AMDIS_ELINFOSTACK_H
#ifndef AMDIS_GAUSSELIMINATION_H
#define AMDIS_GAUSSELIMINATION_H
#include "DirectSolverInterface.h"
#include "Global.h"
#include "MemoryManager.h"
namespace AMDiS
{
template<typename MatrixType, typename VectorType>
class GaussElimination : public DirectSolverInterface<MatrixType, VectorType>
{
public:
MEMORY_MANAGED(GaussElimination<MatrixType COMMA VectorType>);
GaussElimination() {};
virtual ~GaussElimination() {};
void solve(MatrixType &a, VectorType &b, VectorType &x, int n)
{
FUNCNAME("GaussElimination::solve()");
int i, j, k, row;
double a_ji, max, tmp = 0.0;
// forward elimination
for(i = 0; i < n - 1; i++) {
// pivoting
max = abs(a[i][i]);
row = i;
for(j = i + 1; j < n; j++) {
if(abs(a[j][i]) > max) {
max = abs(a[j][i]);
row = j;
}
}
TEST_EXIT(max > 0.0)("pivoting failed (max entry = 0)\n");
if(row != i) {
tmp = b[i];
b[i] = b[row];
b[row] = tmp;
for(j = 0; j < n; j++) {
tmp = a[i][j];
a[i][j] = a[row][j];
a[row][j] = tmp;
}