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 {
}
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,
DOFMatrix *matrix,
const DOFVectorBase<double> *dv)
......
......@@ -51,18 +51,7 @@ namespace AMDiS {
~BoundaryManager();
/// Adds a local boundary condition to the list of managed conditions.
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 addBoundaryCondition(BoundaryCondition *localBC);
void initMatrix(DOFMatrix *matrix);
......@@ -72,22 +61,16 @@ namespace AMDiS {
void exitVector(DOFVectorBase<double> *vector);
/** \brief
* Calls DOFVectorBase::fillBoundaryCondition() for each local boundary condition
* in \ref localBCs.
*/
/// Calls DOFVectorBase::fillBoundaryCondition() for each local boundary
/// condition in \ref localBCs.
void fillBoundaryConditions(ElInfo *elInfo, DOFVectorBase<double> *vec);
/** \brief
* Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition
* in \ref localBCs.
*/
/// Calls DOFMatrix::fillBoundaryCondition() for each local boundary condition
/// in \ref localBCs.
void fillBoundaryConditions(ElInfo *elInfo, DOFMatrix *mat);
/** \brief
* Calls BoundaryCondition::boundResidual() for each boundary condition in
* \ref localBCs.
*/
/// Calls BoundaryCondition::boundResidual() for each boundary condition in
/// \ref localBCs.
double boundResidual(ElInfo *elInfo, DOFMatrix *matrix,
const DOFVectorBase<double> *dv);
......@@ -106,10 +89,8 @@ namespace AMDiS {
localBCs = bcs;
}
/** \brief
* Returns true, if there is at least one boundary object with the given boundary
* id, which implements a periodic boundary.
*/
/// Returns true, if there is at least one boundary object with the given
/// boundary id, which implements a periodic boundary.
static bool isBoundaryPeriodic(BoundaryType b)
{
for (int i = 0; i < static_cast<int>(globalBoundaryMap[b].size()); i++)
......@@ -129,10 +110,8 @@ namespace AMDiS {
/// Temporary variable for functions fillBoundaryconditions.
std::vector<DegreeOfFreedom> dofVec;
/** \brief
* Stores the number of byte that were allocated in the constructor for
* each localBounds value. Is used to free the memory in the destructor.
*/
/// Stores the number of byte that were allocated in the constructor for
/// each localBounds value. Is used to free the memory in the destructor.
int allocatedMemoryLocalBounds;
/** \brief
......
......@@ -821,21 +821,8 @@ namespace AMDiS {
continue;
}
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");
if (assembleMatrix && matrix->getBoundaryManager())
matrix->getBoundaryManager()->initMatrix(matrix);
MSG("TEST B\n");
}
// 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.
......
......@@ -465,11 +465,8 @@ namespace AMDiS {
// and to remove the periodic boundary conditions on these objects.
if (initialized) {
MSG("INIT 0\n");
setRankDofs(probStat);
removePeriodicBoundaryConditions(probStat);
} else {
MSG("INIT 1\n");
}
}
......@@ -744,12 +741,8 @@ namespace AMDiS {
{
FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()");
MSG("REMOVE ON PROB STAT %s\n", probStat->getName().c_str());
int nComponents = probStat->getNumComponents();
MSG("NUM: %d\n", nComponents);
for (int j = 0; j < nComponents; j++) {
for (int k = 0; k < nComponents; k++) {
DOFMatrix* mat = probStat->getSystemMatrix(j, k);
......@@ -770,26 +763,13 @@ namespace AMDiS {
{
FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()");
MSG("START REMOVE: %p\n", &boundaryMap);
BoundaryIndexMap::iterator it = boundaryMap.begin();
while (it != boundaryMap.end()) {
if (it->second->isPeriodic()) {
MSG("FOUND AND REMOVE!\n");
if (it->second->isPeriodic())
boundaryMap.erase(it++);
} else
else
++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 {
return mpiComm;
}
inline bool isInitialized()
{
return initialized;
}
/// 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.
void createBoundaryDofs(const FiniteElemSpace *feSpace,
......
......@@ -58,5 +58,14 @@ namespace AMDiS {
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 {
ProblemStatSeq *adoptProblem = NULL,
Flag adoptFlag = INIT_NOTHING);
void addPeriodicBC(BoundaryType type, int row, int col);
protected:
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