Commit 06988363 authored by Thomas Witkowski's avatar Thomas Witkowski

Work on pdd.

parent 22315a82
......@@ -54,7 +54,7 @@ namespace AMDiS {
virtual int adapt() = 0;
/// Returns \ref name
inline const std::string& getName() const
inline std::string getName() const
{
return name;
}
......
......@@ -246,7 +246,7 @@ namespace AMDiS {
return errorCode;
}
void AdaptInstationary::initialize(const std::string& aName)
void AdaptInstationary::initialize(std::string aName)
{
FUNCNAME("AdaptInstationary::initialize()");
......@@ -262,9 +262,8 @@ namespace AMDiS {
GET_PARAMETER(0, aName + "->info", "%d", &info_);
GET_PARAMETER(0, aName + "->break when stable", "%d", &breakWhenStable);
GET_PARAMETER(0, aName + "->queue->runtime", "%d", &queueRuntime_);
GET_PARAMETER(0, aName + "->queue->serialization filename", &queueSerializationFilename_);
return;
GET_PARAMETER(0, aName + "->queue->serialization filename",
&queueSerializationFilename_);
}
void AdaptInstationary::serialize(std::ostream &out)
......
......@@ -90,7 +90,7 @@ namespace AMDiS {
virtual void oneTimestep();
/// 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().
virtual void explicitTimeStrategy();
......
......@@ -7,7 +7,7 @@
namespace AMDiS {
AdaptStationary::AdaptStationary(const std::string &name,
AdaptStationary::AdaptStationary(std::string name,
ProblemIterationInterface *prob,
AdaptInfo *info)
: AdaptBase(name, prob, info)
......
......@@ -46,7 +46,7 @@ namespace AMDiS {
{
public:
/// Creates a AdaptStationary object with given name.
AdaptStationary(const std::string &name,
AdaptStationary(std::string name,
ProblemIterationInterface *prob,
AdaptInfo *info);
......
......@@ -15,7 +15,7 @@ namespace AMDiS {
/* 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_),
degree(degree_),
dim(dim_)
......
......@@ -83,7 +83,7 @@ namespace AMDiS {
{
protected:
/// 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
virtual ~BasisFunction();
......@@ -154,7 +154,7 @@ namespace AMDiS {
}
/// Returns \ref name of BasisFunction
inline const std::string& getName() const
inline std::string getName() const
{
return name;
}
......
......@@ -62,142 +62,112 @@ namespace AMDiS {
basisFcts->getBound(elInfo, localBound);
// get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(),
feSpace->getAdmin(), &dofVec);
basisFcts->getLocalIndicesVec(elInfo->getElement(), feSpace->getAdmin(), &dofVec);
// apply non dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if (!(*it).second->isDirichlet()) {
(*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0], localBound, nBasFcts);
}
}
}
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second && !(*it).second->isDirichlet())
(*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0],
localBound, nBasFcts);
// apply dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if ((*it).second->isDirichlet()) {
(*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0], localBound, nBasFcts);
}
}
}
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second && (*it).second->isDirichlet())
(*it).second->fillBoundaryCondition(vec, elInfo, &dofVec[0],
localBound, nBasFcts);
}
}
void BoundaryManager::fillBoundaryConditions(ElInfo *elInfo,
DOFMatrix *mat)
{
if (localBCs.size() > 0) {
const FiniteElemSpace *feSpace = mat->getRowFESpace();
Vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
const BasisFunction *basisFcts = feSpace->getBasisFcts();
int nBasFcts = basisFcts->getNumber();
std::map<BoundaryType, BoundaryCondition*>::iterator it;
// get boundaries of all DOFs
BoundaryType *localBound = localBounds[omp_get_thread_num()];
basisFcts->getBound(elInfo, localBound);
// get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(),
feSpace->getAdmin(), &dofVec);
// apply non dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if (!(*it).second->isDirichlet()) {
(*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0], localBound, nBasFcts);
}
}
}
// apply dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if ((*it).second->isDirichlet()) {
(*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0], localBound, nBasFcts);
}
}
}
}
if (localBCs.size() <= 0)
return;
const FiniteElemSpace *feSpace = mat->getRowFESpace();
Vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
const BasisFunction *basisFcts = feSpace->getBasisFcts();
int nBasFcts = basisFcts->getNumber();
std::map<BoundaryType, BoundaryCondition*>::iterator it;
// get boundaries of all DOFs
BoundaryType *localBound = localBounds[omp_get_thread_num()];
basisFcts->getBound(elInfo, localBound);
// get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(),
feSpace->getAdmin(), &dofVec);
// apply non dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if (!(*it).second->isDirichlet())
(*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0],
localBound, nBasFcts);
// apply dirichlet boundary conditions
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if ((*it).second->isDirichlet())
(*it).second->fillBoundaryCondition(mat, elInfo, &dofVec[0],
localBound, nBasFcts);
}
void BoundaryManager::initMatrix(DOFMatrix *matrix)
{
std::map<BoundaryType, BoundaryCondition*>::iterator it;
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if (!(*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if (!(*it).second->isDirichlet())
(*it).second->initMatrix(matrix);
}
}
}
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if ((*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if ((*it).second->isDirichlet())
(*it).second->initMatrix(matrix);
}
}
}
}
void BoundaryManager::exitMatrix(DOFMatrix *matrix)
{
std::map<BoundaryType, BoundaryCondition*>::iterator it;
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if (!(*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if (!(*it).second->isDirichlet())
(*it).second->exitMatrix(matrix);
}
}
}
for(it = localBCs.begin(); it != localBCs.end(); ++it) {
if((*it).second) {
if((*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if ((*it).second->isDirichlet())
(*it).second->exitMatrix(matrix);
}
}
}
}
void BoundaryManager::initVector(DOFVectorBase<double> *vector)
{
std::map<BoundaryType, BoundaryCondition*>::iterator it;
for(it = localBCs.begin(); it != localBCs.end(); ++it) {
if((*it).second) {
if(!(*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if (!(*it).second->isDirichlet())
(*it).second->initVector(vector);
}
}
}
for(it = localBCs.begin(); it != localBCs.end(); ++it) {
if((*it).second) {
if((*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if ((*it).second->isDirichlet())
(*it).second->initVector(vector);
}
}
}
}
void BoundaryManager::exitVector(DOFVectorBase<double> *vector)
{
std::map<BoundaryType, BoundaryCondition*>::iterator it;
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if (!(*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if (!(*it).second->isDirichlet())
(*it).second->exitVector(vector);
}
}
}
for (it = localBCs.begin(); it != localBCs.end(); ++it) {
if ((*it).second) {
if ((*it).second->isDirichlet()) {
for (it = localBCs.begin(); it != localBCs.end(); ++it)
if ((*it).second)
if ((*it).second->isDirichlet())
(*it).second->exitVector(vector);
}
}
}
}
}
......@@ -41,7 +41,7 @@ namespace AMDiS {
{
public:
/// Constructor.
ConditionalMarker(const std::string name,
ConditionalMarker(std::string name,
int row,
Marker *decoratedMarker,
int globalCoarseGridLevel,
......
......@@ -145,7 +145,7 @@ namespace AMDiS {
}
/// Returns \ref name
inline const std::string& getName() const
inline std::string getName() const
{
return name;
}
......@@ -231,7 +231,7 @@ namespace AMDiS {
void setNumberOfPreDOFs(int i, int v);
/// Sets \ref name = n
inline void setName(const std::string& n)
inline void setName(std::string n)
{
name = n;
}
......
......@@ -310,7 +310,7 @@ namespace AMDiS {
}
/// Returns \ref name
inline const std::string& getName() const
inline std::string getName() const
{
return name;
}
......
......@@ -39,6 +39,7 @@
#include "Serializable.h"
#include "DOFMatrix.h"
#include "BasisFunction.h"
#include "FiniteElemSpace.h"
namespace AMDiS {
......@@ -194,7 +195,7 @@ namespace AMDiS {
}
/// Returns \ref name
inline const std::string& getName() const
inline std::string getName() const
{
return name;
}
......@@ -209,6 +210,18 @@ namespace AMDiS {
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:
///
const FiniteElemSpace *feSpace;
......@@ -251,6 +264,10 @@ namespace AMDiS {
/// Dimension of the mesh this DOFVectorBase belongs to
int dim;
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
std::map<DegreeOfFreedom, bool> rankDofs;
#endif
};
/// Specifies which operation should be done after coarsening
......@@ -777,6 +794,16 @@ namespace AMDiS {
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>*> *result);
}
......
This diff is collapsed.
......@@ -54,11 +54,13 @@ namespace AMDiS {
int myRank = omp_get_thread_num();
for (int i = 0; i < nBasFcts; i++) {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (vector->isRankDof(dofIndices[i]))
#endif
if (localBound[i] == boundaryType) {
if (f) {
elInfo->coordToWorld(*(basFcts->getCoords(i)), worldCoords[myRank]);
double fAtCoords = (*f)(worldCoords[myRank]);
(*vector)[dofIndices[i]] = fAtCoords;
(*vector)[dofIndices[i]] = (*f)(worldCoords[myRank]);
}
if (dofVec)
(*vector)[dofIndices[i]] = (*dofVec)[dofIndices[i]];
......
......@@ -53,7 +53,7 @@ namespace AMDiS {
virtual ~Estimator() {}
/// Returns \ref name of the Estimator
inline const std::string& getName() const
inline std::string getName() const
{
return name;
}
......
......@@ -19,9 +19,7 @@
namespace AMDiS {
FileWriter::FileWriter(const std::string &str,
Mesh *m,
DOFVector<double> *vec)
FileWriter::FileWriter(std::string str, Mesh *m, DOFVector<double> *vec)
: name(str),
mesh(m)
{
......@@ -36,8 +34,8 @@ namespace AMDiS {
}
FileWriter::FileWriter(const std::string &name_,
Mesh *mesh_,
FileWriter::FileWriter(std::string name_,
Mesh *mesh_,
std::vector< DOFVector<double>* > vecs)
: name(name_),
mesh(mesh_)
......@@ -55,7 +53,7 @@ namespace AMDiS {
}
FileWriter::FileWriter(const std::string &name_,
FileWriter::FileWriter(std::string name_,
Mesh *mesh_,
DOFVector< WorldVector<double> > *vec)
: name(name_),
......
......@@ -114,12 +114,10 @@ namespace AMDiS {
{
public:
/// Constructor for a filewriter for one data component.
FileWriter(const std::string& name,
Mesh *mesh,
DOFVector<double> *vec);
FileWriter(std::string name, Mesh *mesh, DOFVector<double> *vec);
/// Constructor for a filewriter with more than one data component.
FileWriter(const std::string& name,
FileWriter(std::string name,
Mesh *mesh,
std::vector< DOFVector<double>* > vecs);
......@@ -127,7 +125,7 @@ namespace AMDiS {
* Constructor for a filewriter, when the solution vector is a vector
* of WorldVectors.
*/
FileWriter(const std::string &name,
FileWriter(std::string name,
Mesh *mesh,
DOFVector< WorldVector<double> > *vec);
......
......@@ -12,7 +12,7 @@ namespace AMDiS {
FiniteElemSpace::FiniteElemSpace(DOFAdmin* admin_,
const BasisFunction* bas_fcts,
Mesh* aMesh,
const std::string& aString)
std::string aString)
: name(aString),
admin(admin_),
basFcts(bas_fcts),
......@@ -71,7 +71,7 @@ namespace AMDiS {
FiniteElemSpace *FiniteElemSpace::provideFESpace(DOFAdmin *admin,
const BasisFunction *basFcts,
Mesh *mesh,
const std::string& name_)
std::string name_)
{
int numSpaces = static_cast<int>(feSpaces.size());
......
......@@ -46,7 +46,7 @@ namespace AMDiS {
static FiniteElemSpace *provideFESpace(DOFAdmin *admin,
const BasisFunction *basFcts,
Mesh *mesh,
const std::string& name_ = "");
std::string name_ = "");
/// Destructor.
~FiniteElemSpace();
......@@ -95,7 +95,7 @@ namespace AMDiS {
FiniteElemSpace(DOFAdmin* admin_,
const BasisFunction* basisFcts,
Mesh* mesh,
const std::string& name = "");
std::string name = "");
protected:
/// Name of this FiniteElemSpace.
......
......@@ -75,12 +75,12 @@ namespace AMDiS {
int i, counter = 0;
// for all DOFs
for(it.reset(); !it.end(); ++it) {
for (it.reset(); !it.end(); ++it) {
// for all vertex infos of this DOF
std::list<VertexInfo>::iterator it2;
for(it2 = it->begin(); it2 != it->end(); ++it2) {
for (it2 = it->begin(); it2 != it->end(); ++it2) {
it2->outputIndex = counter++;
for(i = 0; i < dow; i++) {
for (i = 0; i < dow; i++) {
file << std::scientific << it2->coords[i] << " ";
}
file << std::endl;
......@@ -93,9 +93,9 @@ namespace AMDiS {
// iterate the element list
std::list<ElementInfo>::iterator elementIt;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
// for all vertices
for(i = 0; i < vertices; i++) {
for (i = 0; i < vertices; i++) {
file << elementIt->vertexInfo[i]->outputIndex << " ";
}
file << std::endl;
......@@ -104,9 +104,9 @@ namespace AMDiS {
// === print boundaries ===
file << std::endl << "element boundaries:" << std::endl;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
// for all vertices
for(i = 0; i < vertices; i++) {
for (i = 0; i < vertices; i++) {
file << elementIt->boundary[i] << " ";
}
file << std::endl;
......@@ -115,9 +115,9 @@ namespace AMDiS {
// === print neighbours ===
file << std::endl << "element neighbours:" << std::endl;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
// for all vertices
for(i = 0; i < vertices; i++) {
for (i = 0; i < vertices; i++) {
file << elementIt->neighbour[i] << " ";
}
file << std::endl;
......@@ -126,9 +126,9 @@ namespace AMDiS {
// === print boundary projections ===
file << std::endl << "projections:" << std::endl;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
// for all vertices
for(i = 0; i < vertices; i++) {
for (i = 0; i < vertices; i++) {
if(elementIt->projection[i])
file << elementIt->projection[i]->getID() << " ";
else
......@@ -140,17 +140,16 @@ namespace AMDiS {
// === print element regions ===
file << std::endl << "element region:" << std::endl;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt)
file << elementIt->elementRegion << std::endl;
}
// === print surface regions ===
file << std::endl << "surface region:" << std::endl;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for(i = 0; i < vertices; i++) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (i = 0; i < vertices; i++)
file << elementIt->surfaceRegions[i] << " ";
}
file << std::endl;
}
......@@ -158,9 +157,9 @@ namespace AMDiS {
if (dim == 3) {
file << std::endl << "element type:" << std::endl;
for(elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) {
for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt)
file << (int)(elementIt->type) << " ";