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 {
template<typename T> class MatVecMultiplier;
template<typename T> class SolverMatrix;
template<typename T> class Vector;
template<typename T> class WorldVector;
template <typename ITLSolver> class ITL_OEMSolver;
......
......@@ -22,32 +22,13 @@
#ifndef AMDIS_COARSENINGMANAGER_H
#define AMDIS_COARSENINGMANAGER_H
// ============================================================================
// ===== includes =============================================================
// ============================================================================
#include "Global.h"
#include "Mesh.h"
#include "ProblemStatBase.h"
#include "AMDiS_fwd.h"
namespace AMDiS {
// ============================================================================
// ===== forward declarations =================================================
// ============================================================================
class Element;
class Line;
class Triangle;
class Tetrahedron;
class RCNeighbourList;
class ElInfo;
class TraverseStack;
// ============================================================================
// ===== class CoarseningManager ==============================================
// ============================================================================
/** \ingroup Adaption
* \brief
* Base class of CoarseningManager1d, CoarseningManager2d, CoarseningManager3d.
......@@ -57,22 +38,19 @@ namespace AMDiS {
class CoarseningManager
{
public:
/** \brief
* constructs a CoarseningManager which belongs to aMesh
*/
/// Constructs a CoarseningManager which belongs to aMesh
CoarseningManager()
: mesh(NULL), stack(NULL), globalMark(0), doMore(0)
{};
: mesh(NULL),
stack(NULL),
globalMark(0),
doMore(0)
{}
/** \brief
* destructor
*/
virtual ~CoarseningManager() {};
/// destructor
virtual ~CoarseningManager() {}
/** \brief
* Returns the Mesh the CoarseningManager belongs to.
*/
inline Mesh* getMesh() { return mesh; };
/// Returns the Mesh the CoarseningManager belongs to.
inline Mesh* getMesh() { return mesh; }
/** \brief
* Tries to coarsen every element of mesh at least mark times. First
......@@ -108,45 +86,29 @@ namespace AMDiS {
*/
void spreadCoarsenMark();
/** \brief
* Used while traversal in spreadCoarsenMark
*/
/// Used while traversal in spreadCoarsenMark
static int spreadCoarsenMarkFunction(ElInfo* el_info);
/** \brief
*Used while traversal in cleanUpAfterCoarsen
*/
/// Used while traversal in cleanUpAfterCoarsen
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);
/** \brief
* Resets the element marks
*/
/// Resets the element marks
void cleanUpAfterCoarsen();
protected:
/** \brief
* the Mesh this CoarseningManager belongs to
*/
Mesh *mesh;
/// The Mesh this CoarseningManager belongs to.
Mesh *mesh;
/** \brief
* Used for non recursive mesh traversal.
*/
/// Used for non recursive mesh traversal.
TraverseStack *stack;
/** \brief
* Used by globalCoarsen to remember the given mark value
*/
int globalMark;
/// Used by globalCoarsen to remember the given mark value
int globalMark;
/** \brief
* Spezifies whether the coarsening operation is still in progress
*/
/// Spezifies whether the coarsening operation is still in progress
bool doMore;
/** \brief
......@@ -155,9 +117,7 @@ namespace AMDiS {
*/
static CoarseningManager* traversePtr;
/** \brief
* Spezifies how many DOFVectors should restricted while coarsening
*/
/// Spezifies how many DOFVectors should restricted while coarsening
int callCoarseRestrict;
friend class RCNeighbourList;
......
......@@ -55,7 +55,7 @@ namespace AMDiS {
applyDBCs.clear();
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
applicationOrdering = NULL;
#endif
}
......
......@@ -39,7 +39,7 @@
#include "Boundary.h"
#include "Serializable.h"
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include "petscao.h"
#endif
......@@ -430,7 +430,7 @@ namespace AMDiS {
///
int memsize();
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Sets the petsc application ordering object to map dof indices.
void useApplicationOrdering(AO *ao) {
applicationOrdering = ao;
......@@ -495,7 +495,7 @@ namespace AMDiS {
*/
std::set<int> applyDBCs;
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Petsc application ordering to map dof indices.
AO *applicationOrdering;
#endif
......
......@@ -41,7 +41,7 @@
#include "DOFMatrix.h"
#include "BasisFunction.h"
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include "petscao.h"
#endif
......@@ -517,7 +517,7 @@ namespace AMDiS {
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.
void useApplicationOrdering(AO *ao) {
applicationOrdering = ao;
......@@ -559,7 +559,7 @@ namespace AMDiS {
/// Used for mesh traversal
static DOFVector<T> *traverseVector;
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
/// Petsc application ordering to map dof indices.
AO *applicationOrdering;
#endif
......
......@@ -116,7 +116,7 @@ namespace AMDiS {
{
init(f, n);
#ifdef HAVE_PARALLEL_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
applicationOrdering = NULL;
#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 {
void coordToWorld(const DimVec<double>& lambda,
WorldVector<double>& world) const;
/** \brief
* Fills ElInfo's \ref det_ and \ref grdLambda entries.
*/
/// Fills ElInfo's \ref det_ and \ref grdLambda entries.
virtual void fillDetGrdLambda();
// ===== pure virtual functions. Must be overriden in sub-classes ============
/** \brief
* Returns a pointer to a vector, which contains the barycentric coordinates
* with respect to \ref element of a point with world coordinates world.
......@@ -488,7 +483,6 @@ namespace AMDiS {
*/
DimMat<double> *subElemCoordsMat;
// ===== static public members ================================================
public:
/** \brief
* child_vertex[el_type][child][i] = father's local vertex index of new
......
......@@ -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,
int iChild,
DimMat<double> *coords) const
......@@ -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 @@
#ifndef AMDIS_ELINFO1D_H
#define AMDIS_ELINFO1D_H
#include <boost/numeric/mtl/mtl.hpp>
#include "ElInfo.h"
#include "MemoryManager.h"
......@@ -34,8 +36,6 @@ namespace AMDiS {
class ElInfo1d : public ElInfo
{
public:
MEMORY_MANAGED(ElInfo1d);
/// Constructor. Calls ElInfo's protected Constructor.
ElInfo1d(Mesh* aMesh)
: ElInfo(aMesh)
......@@ -66,10 +66,16 @@ namespace AMDiS {
void getRefSimplexCoords(const BasisFunction *basisFcts,
DimMat<double> *coords) const;
void getRefSimplexCoords(const BasisFunction *basisFcts,
mtl::dense2D<double>& coords) const;
void getSubElementCoords(const BasisFunction *basisFcts,
int iChild,
DimMat<double> *coords) const;
void getSubElementCoords(const BasisFunction *basisFcts,
int iChild,
mtl::dense2D<double>& coords) const;
};
}
......
......@@ -22,78 +22,47 @@
#ifndef AMDIS_ELINFOSTACK_H
#define AMDIS_ELINFOSTACK_H
// ============================================================================
// ===== includes =============================================================
// ============================================================================
#include <vector>
#include "ElInfo.h"
#include "AMDiS_fwd.h"
namespace AMDiS {
// ============================================================================
// ===== forward declarations =================================================
// ============================================================================
class Mesh;
// ============================================================================
// ===== class ElInfoStack ====================================================
// ============================================================================
/** \ingroup Traverse
* \brief
* 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
* at every recursive step.
*/
class ElInfoStack
{
public:
/** \brief
* Constructer, creates the stack.
*/
/// Constructer, creates the stack.
ElInfoStack(Mesh *mesh);
/** \brief
* Destructor, deletes all ElInfos on the stack.
*/
/// Destructor, deletes all ElInfos on the stack.
~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();
/** \brief
* Decrease the stack position.
*/
/// Decrease the stack position.
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();
protected:
/** \brief
* The mesh on which the traverse is done.
*/
/// The mesh on which the traverse is done.
Mesh *mesh_;
/** \brief
* The stack of pointers to ElInfo objects.
*/
/// The stack of pointers to ElInfo objects.
std::vector<ElInfo*> elInfoStack_;
/** \brief
* Current position (depth) of the recursive mesh traverse.
*/
/// Current position (depth) of the recursive mesh traverse.
int stackPosition_;
};
}
#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;
}
}
// make zeros
for(j = i + 1; j < n; j++) {
a_ji = (a[j][i] /= a[i][i]);
for(k = i; k < n; k++) {
a[j][k] -= a_ji * a[i][k];
}
b[j] -= a_ji * b[i];
}
}
// backward elimination
for(i = n - 1; i >= 0; i--) {
for(j = i + 1; j < n; j++) {
b[i] -= a[i][j] * x[j];
}
x[i] = b[i] / a[i][i];
}
};
};
}
#endif
......@@ -38,10 +38,6 @@
/** \brief current AMDiS version */
#define AMDIS_VERSION "AMDiS: Version 0.100"
// ============================================================================
// ===== includes =============================================================
// ============================================================================
#include <string>
#include <vector>
#include <fstream>
......@@ -51,13 +47,9 @@
#include <functional>
#include <float.h>
namespace AMDiS {
// ============================================================================
// ===== forward declarations =================================================
// ============================================================================
#include "AMDiS_fwd.h"
class Mesh;
class Element;
namespace AMDiS {
extern const char *funcName;
......@@ -139,9 +131,6 @@ namespace AMDiS {
#define DBL_TOL DBL_EPSILON
#define FLT_TOL FLT_EPSILON
// ============================================================================
// ===== class Msg ============================================================
// ============================================================================
/** \brief
* Manages the output of messages, warnings, errors, ...
......@@ -270,8 +259,10 @@ namespace AMDiS {
/// In debug mode, it corresponds to ERROR_EXIT, otherwise it is noop.
#if (DEBUG == 0)
#define TEST_EXIT_DBG(test) if (false) Msg::catch_error_exit
#define DBG_VAR(var)
#else
#define TEST_EXIT_DBG(test) if ((test));else ERROR_EXIT
#define DBG_VAR(var) var
#endif
/// prints a message
......@@ -337,9 +328,6 @@ namespace AMDiS {
#define MAXPART FACE
#define MINPART PROJECTION
// ============================================================================
// ===== class Global =========================================================
// ============================================================================
/** \ingroup Common
* \brief
......@@ -359,9 +347,7 @@ namespace AMDiS {
return referenceElement[dim];
}
/** \brief
* returns geometrical information. Currently this is only dimOfWorld.
*/
/// returns geometrical information. Currently this is only dimOfWorld.
static inline int getGeo(GeoIndex p) {
if (WORLD == p)
return dimOfWorld;
......
......@@ -22,24 +22,13 @@
#ifndef AMDIS_GLOBALDOFNUMBERING_H
#define AMDIS_GLOBALDOFNUMBERING_H
// ===========================================================================
// ===== includes ============================================================
// ===========================================================================
#include <map>
#include <vector>
#include "Global.h"
#include "AMDiS_fwd.h"
namespace AMDiS {
// =========================================================================
// ===== forward declarations ==============================================
// =========================================================================
class MeshStructure;
// =========================================================================
// ===== class GlobalDOFNumbering ======================================
// =========================================================================
/** \ingroup Parallel
* \brief
* Creates a global DOF numbering.
......@@ -47,21 +36,15 @@ namespace AMDiS {
class GlobalDOFNumbering
{
public:
/** \brief
* Constructor
*/
/// Constructor
GlobalDOFNumbering(std::vector<MeshStructure*> &meshCodes,
std::vector< std::vector<DegreeOfFreedom> > &dofCodes,
int dofsPerElement);
/** \brief
* Returns the local index of rank corresponding to global index.
*/
/// Returns the local index of rank corresponding to global index.
int getLocalIndex(int rank, int globalIndex);
/** \brief
* Returns the global index corresponing to local index of rank.
*/
/// Returns the global index corresponing to local index of rank.
int getGlobalIndex(int rank, int localIndex);
protected:
......