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

Work on pdd.

parent 22315a82
...@@ -54,7 +54,7 @@ namespace AMDiS { ...@@ -54,7 +54,7 @@ namespace AMDiS {
virtual int adapt() = 0; virtual int adapt() = 0;
/// Returns \ref name /// Returns \ref name
inline const std::string& getName() const inline std::string getName() const
{ {
return name; return name;
} }
......
...@@ -246,7 +246,7 @@ namespace AMDiS { ...@@ -246,7 +246,7 @@ namespace AMDiS {
return errorCode; return errorCode;
} }
void AdaptInstationary::initialize(const std::string& aName) void AdaptInstationary::initialize(std::string aName)
{ {
FUNCNAME("AdaptInstationary::initialize()"); FUNCNAME("AdaptInstationary::initialize()");
...@@ -262,9 +262,8 @@ namespace AMDiS { ...@@ -262,9 +262,8 @@ namespace AMDiS {
GET_PARAMETER(0, aName + "->info", "%d", &info_); GET_PARAMETER(0, aName + "->info", "%d", &info_);
GET_PARAMETER(0, aName + "->break when stable", "%d", &breakWhenStable); GET_PARAMETER(0, aName + "->break when stable", "%d", &breakWhenStable);
GET_PARAMETER(0, aName + "->queue->runtime", "%d", &queueRuntime_); GET_PARAMETER(0, aName + "->queue->runtime", "%d", &queueRuntime_);
GET_PARAMETER(0, aName + "->queue->serialization filename", &queueSerializationFilename_); GET_PARAMETER(0, aName + "->queue->serialization filename",
&queueSerializationFilename_);
return;
} }
void AdaptInstationary::serialize(std::ostream &out) void AdaptInstationary::serialize(std::ostream &out)
......
...@@ -90,7 +90,7 @@ namespace AMDiS { ...@@ -90,7 +90,7 @@ namespace AMDiS {
virtual void oneTimestep(); virtual void oneTimestep();
/// Initialisation of this AdaptInstationary object /// Initialisation of this AdaptInstationary object
void initialize(const std::string& aName); void initialize(std::string aName);
/// Implements the explit time strategy. Used by \ref oneTimestep(). /// Implements the explit time strategy. Used by \ref oneTimestep().
virtual void explicitTimeStrategy(); virtual void explicitTimeStrategy();
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace AMDiS { namespace AMDiS {
AdaptStationary::AdaptStationary(const std::string &name, AdaptStationary::AdaptStationary(std::string name,
ProblemIterationInterface *prob, ProblemIterationInterface *prob,
AdaptInfo *info) AdaptInfo *info)
: AdaptBase(name, prob, info) : AdaptBase(name, prob, info)
......
...@@ -46,7 +46,7 @@ namespace AMDiS { ...@@ -46,7 +46,7 @@ namespace AMDiS {
{ {
public: public:
/// Creates a AdaptStationary object with given name. /// Creates a AdaptStationary object with given name.
AdaptStationary(const std::string &name, AdaptStationary(std::string name,
ProblemIterationInterface *prob, ProblemIterationInterface *prob,
AdaptInfo *info); AdaptInfo *info);
......
...@@ -15,7 +15,7 @@ namespace AMDiS { ...@@ -15,7 +15,7 @@ namespace AMDiS {
/* are those corresponding to these barycentric coordinates. */ /* are those corresponding to these barycentric coordinates. */
/****************************************************************************/ /****************************************************************************/
BasisFunction::BasisFunction(const std::string& name_, int dim_, int degree_) BasisFunction::BasisFunction(std::string name_, int dim_, int degree_)
: name(name_), : name(name_),
degree(degree_), degree(degree_),
dim(dim_) dim(dim_)
......
...@@ -83,7 +83,7 @@ namespace AMDiS { ...@@ -83,7 +83,7 @@ namespace AMDiS {
{ {
protected: protected:
/// Creates a BasisFunction object of given dim and degree /// Creates a BasisFunction object of given dim and degree
BasisFunction(const std::string& name, int dim, int degree); BasisFunction(std::string name, int dim, int degree);
/// destructor /// destructor
virtual ~BasisFunction(); virtual ~BasisFunction();
...@@ -154,7 +154,7 @@ namespace AMDiS { ...@@ -154,7 +154,7 @@ namespace AMDiS {
} }
/// Returns \ref name of BasisFunction /// Returns \ref name of BasisFunction
inline const std::string& getName() const inline std::string getName() const
{ {
return name; return name;
} }
......
...@@ -62,142 +62,112 @@ namespace AMDiS { ...@@ -62,142 +62,112 @@ namespace AMDiS {
basisFcts->getBound(elInfo, localBound); basisFcts->getBound(elInfo, localBound);
// get dof indices // get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(), basisFcts->getLocalIndicesVec(elInfo->getElement(), feSpace->getAdmin(), &dofVec);
feSpace->getAdmin(), &dofVec);
// apply non dirichlet boundary conditions // apply non dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second) { if ((*it).second && !(*it).second->isDirichlet())
if (!(*it).second->isDirichlet()) { (*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0],
(*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0], localBound, nBasFcts); localBound, nBasFcts);
}
}
}
// apply dirichlet boundary conditions // apply dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second) { if ((*it).second && (*it).second->isDirichlet())
if ((*it).second->isDirichlet()) { (*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0],
(*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0], localBound, nBasFcts); localBound, nBasFcts);
}
}
}
} }
} }
void BoundaryManager::fillBoundaryConditions(ElInfo *elInfo, void BoundaryManager::fillBoundaryConditions(ElInfo *elInfo,
DOFMatrix *mat) DOFMatrix *mat)
{ {
if (localBCs.size() > 0) { if (localBCs.size() <= 0)
const FiniteElemSpace *feSpace = mat->getRowFESpace(); return;
Vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
const BasisFunction *basisFcts = feSpace->getBasisFcts(); const FiniteElemSpace *feSpace = mat->getRowFESpace();
int nBasFcts = basisFcts->getNumber(); Vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
std::map<BoundaryType, BoundaryCondition*>::iterator it; const BasisFunction *basisFcts = feSpace->getBasisFcts();
int nBasFcts = basisFcts->getNumber();
// get boundaries of all DOFs std::map<BoundaryType, BoundaryCondition*>::iterator it;
BoundaryType *localBound = localBounds[omp_get_thread_num()];
basisFcts->getBound(elInfo, localBound); // get boundaries of all DOFs
BoundaryType *localBound = localBounds[omp_get_thread_num()];
// get dof indices basisFcts->getBound(elInfo, localBound);
basisFcts->getLocalIndicesVec(elInfo->getElement(),
feSpace->getAdmin(), &dofVec); // get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(),
// apply non dirichlet boundary conditions feSpace->getAdmin(), &dofVec);
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) { // apply non dirichlet boundary conditions
if (!(*it).second->isDirichlet()) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
(*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0], localBound, nBasFcts); if ((*it).second)
} if (!(*it).second->isDirichlet())
} (*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0],
} localBound, nBasFcts);
// apply dirichlet boundary conditions // apply dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second) { if ((*it).second)
if ((*it).second->isDirichlet()) { if ((*it).second->isDirichlet())
(*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0], localBound, nBasFcts); (*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0],
} localBound, nBasFcts);
}
}
}
} }
void BoundaryManager::initMatrix(DOFMatrix *matrix) void BoundaryManager::initMatrix(DOFMatrix *matrix)
{ {
std::map<BoundaryType, BoundaryCondition*>::iterator it; std::map<BoundaryType, BoundaryCondition*>::iterator it;
for (it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second) { if ((*it).second)
if (!(*it).second->isDirichlet()) { if (!(*it).second->isDirichlet())
(*it).second->initMatrix(matrix); (*it).second->initMatrix(matrix);
}
} for (it = localBCs.begin(); it != localBCs.end(); ++it)
} if ((*it).second)
for (it = localBCs.begin(); it != localBCs.end(); ++it) { if ((*it).second->isDirichlet())
if ((*it).second) {
if ((*it).second->isDirichlet()) {
(*it).second->initMatrix(matrix); (*it).second->initMatrix(matrix);
}
}
}
} }
void BoundaryManager::exitMatrix(DOFMatrix *matrix) void BoundaryManager::exitMatrix(DOFMatrix *matrix)
{ {
std::map<BoundaryType, BoundaryCondition*>::iterator it; std::map<BoundaryType, BoundaryCondition*>::iterator it;
for (it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second) { if ((*it).second)
if (!(*it).second->isDirichlet()) { if (!(*it).second->isDirichlet())
(*it).second->exitMatrix(matrix); (*it).second->exitMatrix(matrix);
}
} for (it = localBCs.begin(); it != localBCs.end(); ++it)
} if ((*it).second)
for(it = localBCs.begin(); it != localBCs.end(); ++it) { if ((*it).second->isDirichlet())
if((*it).second) {
if((*it).second->isDirichlet()) {
(*it).second->exitMatrix(matrix); (*it).second->exitMatrix(matrix);
}
}
}
} }
void BoundaryManager::initVector(DOFVectorBase<double> *vector) void BoundaryManager::initVector(DOFVectorBase<double> *vector)
{ {
std::map<BoundaryType, BoundaryCondition*>::iterator it; std::map<BoundaryType, BoundaryCondition*>::iterator it;
for(it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if((*it).second) { if ((*it).second)
if(!(*it).second->isDirichlet()) { if (!(*it).second->isDirichlet())
(*it).second->initVector(vector); (*it).second->initVector(vector);
}
} for (it = localBCs.begin(); it != localBCs.end(); ++it)
} if ((*it).second)
for(it = localBCs.begin(); it != localBCs.end(); ++it) { if ((*it).second->isDirichlet())
if((*it).second) {
if((*it).second->isDirichlet()) {
(*it).second->initVector(vector); (*it).second->initVector(vector);
}
}
}
} }
void BoundaryManager::exitVector(DOFVectorBase<double> *vector) void BoundaryManager::exitVector(DOFVectorBase<double> *vector)
{ {
std::map<BoundaryType, BoundaryCondition*>::iterator it; std::map<BoundaryType, BoundaryCondition*>::iterator it;
for (it = localBCs.begin(); it != localBCs.end(); ++it) { for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second) { if ((*it).second)
if (!(*it).second->isDirichlet()) { if (!(*it).second->isDirichlet())
(*it).second->exitVector(vector); (*it).second->exitVector(vector);
}
} for (it = localBCs.begin(); it != localBCs.end(); ++it)
} if ((*it).second)
for (it = localBCs.begin(); it != localBCs.end(); ++it) { if ((*it).second->isDirichlet())
if ((*it).second) {
if ((*it).second->isDirichlet()) {
(*it).second->exitVector(vector); (*it).second->exitVector(vector);
}
}
}
} }
} }
...@@ -41,7 +41,7 @@ namespace AMDiS { ...@@ -41,7 +41,7 @@ namespace AMDiS {
{ {
public: public:
/// Constructor. /// Constructor.
ConditionalMarker(const std::string name, ConditionalMarker(std::string name,
int row, int row,
Marker *decoratedMarker, Marker *decoratedMarker,
int globalCoarseGridLevel, int globalCoarseGridLevel,
......
...@@ -145,7 +145,7 @@ namespace AMDiS { ...@@ -145,7 +145,7 @@ namespace AMDiS {
} }
/// Returns \ref name /// Returns \ref name
inline const std::string& getName() const inline std::string getName() const
{ {
return name; return name;
} }
...@@ -231,7 +231,7 @@ namespace AMDiS { ...@@ -231,7 +231,7 @@ namespace AMDiS {
void setNumberOfPreDOFs(int i, int v); void setNumberOfPreDOFs(int i, int v);
/// Sets \ref name = n /// Sets \ref name = n
inline void setName(const std::string& n) inline void setName(std::string n)
{ {
name = n; name = n;
} }
......
...@@ -310,7 +310,7 @@ namespace AMDiS { ...@@ -310,7 +310,7 @@ namespace AMDiS {
} }
/// Returns \ref name /// Returns \ref name
inline const std::string& getName() const inline std::string getName() const
{ {
return name; return name;
} }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "Serializable.h" #include "Serializable.h"
#include "DOFMatrix.h" #include "DOFMatrix.h"
#include "BasisFunction.h" #include "BasisFunction.h"
#include "FiniteElemSpace.h"
namespace AMDiS { namespace AMDiS {
...@@ -194,7 +195,7 @@ namespace AMDiS { ...@@ -194,7 +195,7 @@ namespace AMDiS {
} }
/// Returns \ref name /// Returns \ref name
inline const std::string& getName() const inline std::string getName() const
{ {
return name; return name;
} }
...@@ -209,6 +210,18 @@ namespace AMDiS { ...@@ -209,6 +210,18 @@ namespace AMDiS {
boundaryManager = bm; boundaryManager = bm;
} }
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void setRankDofs(std::map<DegreeOfFreedom, bool>& dofmap)
{
rankDofs = dofmap;
}
inline bool isRankDof(DegreeOfFreedom dof)
{
return rankDofs[dof];
}
#endif
protected: protected:
/// ///
const FiniteElemSpace *feSpace; const FiniteElemSpace *feSpace;
...@@ -251,6 +264,10 @@ namespace AMDiS { ...@@ -251,6 +264,10 @@ namespace AMDiS {
/// Dimension of the mesh this DOFVectorBase belongs to /// Dimension of the mesh this DOFVectorBase belongs to
int dim; int dim;
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
std::map<DegreeOfFreedom, bool> rankDofs;
#endif
}; };
/// Specifies which operation should be done after coarsening /// Specifies which operation should be done after coarsening
...@@ -777,6 +794,16 @@ namespace AMDiS { ...@@ -777,6 +794,16 @@ namespace AMDiS {
return vec->getUsedSize(); return vec->getUsedSize();
} }
template<typename T>
inline void checkFeSpace(const FiniteElemSpace* feSpace, const std::vector<T>& vec)
{
TEST_EXIT_DBG(feSpace)("feSpace is NULL\n");
TEST_EXIT_DBG(feSpace->getAdmin())("admin is NULL\n");
TEST_EXIT_DBG(static_cast<int>(vec.size()) >= feSpace->getAdmin()->getUsedSize())
("size = %d too small: admin->sizeUsed = %d\n", vec.size(),
feSpace->getAdmin()->getUsedSize());
}
WorldVector<DOFVector<double>*> *transform(DOFVector<WorldVector<double> > *vec, WorldVector<DOFVector<double>*> *transform(DOFVector<WorldVector<double> > *vec,
WorldVector<DOFVector<double>*> *result); WorldVector<DOFVector<double>*> *result);
} }
......
...@@ -117,9 +117,9 @@ namespace AMDiS { ...@@ -117,9 +117,9 @@ namespace AMDiS {
{ {
name = n; name = n;
feSpace = f; feSpace = f;
if(feSpace && feSpace->getAdmin()) { if (feSpace && feSpace->getAdmin())
(feSpace->getAdmin())->addDOFIndexed(this); (feSpace->getAdmin())->addDOFIndexed(this);
}
this->boundaryManager = new BoundaryManager(f); this->boundaryManager = new BoundaryManager(f);
} }
...@@ -164,8 +164,12 @@ namespace AMDiS { ...@@ -164,8 +164,12 @@ namespace AMDiS {
if (!(condition && condition->isDirichlet())) { if (!(condition && condition->isDirichlet())) {
DegreeOfFreedom irow = indices[i]; DegreeOfFreedom irow = indices[i];
(*this)[irow] = (add ? (*this)[irow] : 0.0);
(*this)[irow] += factor * elVec[i]; if (add) {
(*this)[irow] += factor * elVec[i];
} else {
(*this)[irow] = factor * elVec[i];
}
} }
} }
} }
...@@ -175,14 +179,11 @@ namespace AMDiS { ...@@ -175,14 +179,11 @@ namespace AMDiS {
{ {
FUNCNAME("DOFVector<T>::nrm2()"); FUNCNAME("DOFVector<T>::nrm2()");
TEST_EXIT_DBG(feSpace)("feSpace is NULL\n"); checkFeSpace(feSpace, vec);
TEST_EXIT_DBG(feSpace->getAdmin())("admin is NULL\n");
TEST_EXIT_DBG(static_cast<int>(vec.size()) >= feSpace->getAdmin()->getUsedSize())
("size = %d too small: admin->sizeUsed = %d\n", vec.size(),
feSpace->getAdmin()->getUsedSize());
double nrm = 0.0; double nrm = 0.0;
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)),
USED_DOFS);
for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) for (vecIterator.reset(); !vecIterator.end(); ++vecIterator)
nrm += (*vecIterator) * (*vecIterator); nrm += (*vecIterator) * (*vecIterator);
...@@ -194,14 +195,11 @@ namespace AMDiS { ...@@ -194,14 +195,11 @@ namespace AMDiS {
{ {
FUNCNAME("DOFVector<T>::nrm2()"); FUNCNAME("DOFVector<T>::nrm2()");
TEST_EXIT_DBG(feSpace)("feSpace is NULL\n"); checkFeSpace(feSpace, vec);
TEST_EXIT_DBG(feSpace->getAdmin())("admin is NULL\n");
TEST_EXIT_DBG(static_cast<int>(vec.size()) >= feSpace->getAdmin()->getUsedSize())
("size = %d too small: admin->sizeUsed = %d\n", vec.size(),
feSpace->getAdmin()->getUsedSize());
double nrm = 0.0; double nrm = 0.0;
Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)), USED_DOFS); Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(const_cast<DOFVector<T>*>(this)),
USED_DOFS);
for (vecIterator.reset(); !vecIterator.end(); ++vecIterator) for (vecIterator.reset(); !vecIterator.end(); ++vecIterator)
nrm += (*vecIterator) * (*vecIterator); nrm += (*vecIterator) * (*vecIterator);
...@@ -213,14 +211,11 @@ namespace AMDiS { ...@@ -213,14 +211,11 @@ namespace AMDiS {
{ {
FUNCNAME("DOFVector<T>::asum()"); FUNCNAME("DOFVector<T>::asum()");
TEST_EXIT_DBG(feSpace)("feSpace is NULL\n");