Commit 47066205 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed problem with using different stationary problems with periodic boundary conditions.

parent b921fbdc
...@@ -45,6 +45,22 @@ namespace AMDiS { ...@@ -45,6 +45,22 @@ namespace AMDiS {
} }
void BoundaryManager::addBoundaryCondition(BoundaryCondition *localBC)
{
FUNCNAME("BoundaryManager::addBoundaryCondition()");
MSG("ADD BC\n");
BoundaryType type = localBC->getBoundaryType();
TEST_EXIT(localBCs[type] == NULL)
("There is already a condition for this type %d.\n",type);
localBCs[type] = localBC;
std::vector<BoundaryCondition*>& boundMap = globalBoundaryMap[type];
boundMap.push_back(localBC);
}
double BoundaryManager::boundResidual(ElInfo *elInfo, double BoundaryManager::boundResidual(ElInfo *elInfo,
DOFMatrix *matrix, DOFMatrix *matrix,
const DOFVectorBase<double> *dv) const DOFVectorBase<double> *dv)
......
...@@ -51,18 +51,7 @@ namespace AMDiS { ...@@ -51,18 +51,7 @@ namespace AMDiS {
~BoundaryManager(); ~BoundaryManager();
/// Adds a local boundary condition to the list of managed conditions. /// Adds a local boundary condition to the list of managed conditions.
void addBoundaryCondition(BoundaryCondition *localBC) void addBoundaryCondition(BoundaryCondition *localBC);
{
FUNCNAME("BoundaryManager::addBoundaryCondition()");
BoundaryType type = localBC->getBoundaryType();
TEST_EXIT(localBCs[type] == NULL)
("There is already a condition for this type %d.\n",type);
localBCs[type] = localBC;
std::vector<BoundaryCondition*>& boundMap = globalBoundaryMap[type];
boundMap.push_back(localBC);
}
void initMatrix(DOFMatrix *matrix); void initMatrix(DOFMatrix *matrix);
...@@ -72,22 +61,16 @@ namespace AMDiS { ...@@ -72,22 +61,16 @@ namespace AMDiS {
void exitVector(DOFVectorBase<double> *vector); void exitVector(DOFVectorBase<double> *vector);
/** \brief /// Calls DOFVectorBase::fillBoundaryCondition() for each local boundary
* Calls DOFVectorBase::fillBoundaryCondition() for each local boundary condition /// condition in \ref localBCs.
* in \ref localBCs.
*/
void fillBoundaryConditions(ElInfo *elInfo, DOFVectorBase<double> *vec); void fillBoundaryConditions(ElInfo *elInfo, DOFVectorBase<double> *vec);
/** \brief /// Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition
* Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition /// in \ref localBCs.
* in \ref localBCs.
*/
void fillBoundaryConditions(ElInfo *elInfo, DOFMatrix *mat); void fillBoundaryConditions(ElInfo *elInfo, DOFMatrix *mat);
/** \brief /// Calls BoundaryCondition::boundResidual() for each boundary condition in
* Calls BoundaryCondition::boundResidual() for each boundary condition in /// \ref localBCs.
* \ref localBCs.
*/
double boundResidual(ElInfo *elInfo, DOFMatrix *matrix, double boundResidual(ElInfo *elInfo, DOFMatrix *matrix,
const DOFVectorBase<double> *dv); const DOFVectorBase<double> *dv);
...@@ -106,10 +89,8 @@ namespace AMDiS { ...@@ -106,10 +89,8 @@ namespace AMDiS {
localBCs = bcs; localBCs = bcs;
} }
/** \brief /// Returns true, if there is at least one boundary object with the given
* Returns true, if there is at least one boundary object with the given boundary /// boundary id, which implements a periodic boundary.
* id, which implements a periodic boundary.
*/
static bool isBoundaryPeriodic(BoundaryType b) static bool isBoundaryPeriodic(BoundaryType b)
{ {
for (int i = 0; i < static_cast<int>(globalBoundaryMap[b].size()); i++) for (int i = 0; i < static_cast<int>(globalBoundaryMap[b].size()); i++)
...@@ -129,10 +110,8 @@ namespace AMDiS { ...@@ -129,10 +110,8 @@ namespace AMDiS {
/// Temporary variable for functions fillBoundaryconditions. /// Temporary variable for functions fillBoundaryconditions.
std::vector<DegreeOfFreedom> dofVec; std::vector<DegreeOfFreedom> dofVec;
/** \brief /// Stores the number of byte that were allocated in the constructor for
* Stores the number of byte that were allocated in the constructor for /// each localBounds value. Is used to free the memory in the destructor.
* each localBounds value. Is used to free the memory in the destructor.
*/
int allocatedMemoryLocalBounds; int allocatedMemoryLocalBounds;
/** \brief /** \brief
......
...@@ -821,21 +821,8 @@ namespace AMDiS { ...@@ -821,21 +821,8 @@ namespace AMDiS {
continue; continue;
} }
if (assembleMatrix && matrix->getBoundaryManager()) { if (assembleMatrix && matrix->getBoundaryManager())
MSG("TEST MAT FOR PERIODIC BC: %p on problem %s\n", matrix, name.c_str());
BoundaryIndexMap &boundaryMap = const_cast<BoundaryIndexMap&>(matrix->getBoundaryManager()->getBoundaryConditionMap());
MSG("PTR: %p\n", &boundaryMap);
BoundaryIndexMap::iterator it = boundaryMap.begin();
while (it != boundaryMap.end()) {
if (it->second->isPeriodic())
MSG("HAS PERIODIC!\n");
++it;
}
MSG("TEST A\n");
matrix->getBoundaryManager()->initMatrix(matrix); matrix->getBoundaryManager()->initMatrix(matrix);
MSG("TEST B\n");
}
// The simplest case: either the right hand side has no operaters, no aux // The simplest case: either the right hand side has no operaters, no aux
// fe spaces, or all aux fe spaces are equal to the row and col fe space. // fe spaces, or all aux fe spaces are equal to the row and col fe space.
......
...@@ -465,11 +465,8 @@ namespace AMDiS { ...@@ -465,11 +465,8 @@ namespace AMDiS {
// and to remove the periodic boundary conditions on these objects. // and to remove the periodic boundary conditions on these objects.
if (initialized) { if (initialized) {
MSG("INIT 0\n");
setRankDofs(probStat); setRankDofs(probStat);
removePeriodicBoundaryConditions(probStat); removePeriodicBoundaryConditions(probStat);
} else {
MSG("INIT 1\n");
} }
} }
...@@ -744,12 +741,8 @@ namespace AMDiS { ...@@ -744,12 +741,8 @@ namespace AMDiS {
{ {
FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()"); FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()");
MSG("REMOVE ON PROB STAT %s\n", probStat->getName().c_str());
int nComponents = probStat->getNumComponents(); int nComponents = probStat->getNumComponents();
MSG("NUM: %d\n", nComponents);
for (int j = 0; j < nComponents; j++) { for (int j = 0; j < nComponents; j++) {
for (int k = 0; k < nComponents; k++) { for (int k = 0; k < nComponents; k++) {
DOFMatrix* mat = probStat->getSystemMatrix(j, k); DOFMatrix* mat = probStat->getSystemMatrix(j, k);
...@@ -770,26 +763,13 @@ namespace AMDiS { ...@@ -770,26 +763,13 @@ namespace AMDiS {
{ {
FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()"); FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()");
MSG("START REMOVE: %p\n", &boundaryMap);
BoundaryIndexMap::iterator it = boundaryMap.begin(); BoundaryIndexMap::iterator it = boundaryMap.begin();
while (it != boundaryMap.end()) { while (it != boundaryMap.end()) {
if (it->second->isPeriodic()) { if (it->second->isPeriodic())
MSG("FOUND AND REMOVE!\n");
boundaryMap.erase(it++); boundaryMap.erase(it++);
} else else
++it; ++it;
} }
MSG("AND TEST AGAIN!\n");
it = boundaryMap.begin();
while (it != boundaryMap.end()) {
if (it->second->isPeriodic())
MSG("FOUND PER!\n");
++it;
}
} }
......
...@@ -367,6 +367,11 @@ namespace AMDiS { ...@@ -367,6 +367,11 @@ namespace AMDiS {
return mpiComm; return mpiComm;
} }
inline bool isInitialized()
{
return initialized;
}
/// Creates a set of all DOFs that are on interior boundaries of rank's /// Creates a set of all DOFs that are on interior boundaries of rank's
/// domain. Thus, it creates the union of \ref sendDofs and \ref recvDofs. /// domain. Thus, it creates the union of \ref sendDofs and \ref recvDofs.
void createBoundaryDofs(const FiniteElemSpace *feSpace, void createBoundaryDofs(const FiniteElemSpace *feSpace,
......
...@@ -58,5 +58,14 @@ namespace AMDiS { ...@@ -58,5 +58,14 @@ namespace AMDiS {
meshDistributor = MeshDistributor::globalMeshDistributor; meshDistributor = MeshDistributor::globalMeshDistributor;
} }
void ParallelProblemStatBase::addPeriodicBC(BoundaryType type, int row, int col)
{
FUNCNAME("ParallelProblemStatBase::addPeriodicBC()");
if (MeshDistributor::globalMeshDistributor->isInitialized())
return;
ProblemStatSeq::addPeriodicBC(type, row, col);
}
} }
...@@ -47,6 +47,8 @@ namespace AMDiS { ...@@ -47,6 +47,8 @@ namespace AMDiS {
ProblemStatSeq *adoptProblem = NULL, ProblemStatSeq *adoptProblem = NULL,
Flag adoptFlag = INIT_NOTHING); Flag adoptFlag = INIT_NOTHING);
void addPeriodicBC(BoundaryType type, int row, int col);
protected: protected:
MeshDistributor *meshDistributor; MeshDistributor *meshDistributor;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment