Commit 23ec2c99 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Dirichlet BC with DOFVector instead of a function possible.

parent b1872344
...@@ -19,15 +19,16 @@ namespace AMDiS { ...@@ -19,15 +19,16 @@ namespace AMDiS {
worldCoords.resize(omp_get_overall_max_threads()); worldCoords.resize(omp_get_overall_max_threads());
} }
DirichletBC::DirichletBC(BoundaryType type, DirichletBC::DirichletBC(BoundaryType type,
DOFVectorBase<double> *vec) DOFVectorBase<double> *vec,
: BoundaryCondition(type, vec->getFESpace()), bool apply)
: BoundaryCondition(type, vec->getFESpace(), vec->getFESpace()),
f(NULL), f(NULL),
dofVec(vec), dofVec(vec),
applyBC(true) applyBC(apply)
{ {}
worldCoords.resize(omp_get_overall_max_threads());
}
void DirichletBC::fillBoundaryCondition(DOFMatrix* matrix, void DirichletBC::fillBoundaryCondition(DOFMatrix* matrix,
ElInfo* elInfo, ElInfo* elInfo,
...@@ -39,6 +40,7 @@ namespace AMDiS { ...@@ -39,6 +40,7 @@ namespace AMDiS {
TEST_EXIT_DBG(matrix->getRowFESpace() == rowFESpace)("invalid row fe space\n"); TEST_EXIT_DBG(matrix->getRowFESpace() == rowFESpace)("invalid row fe space\n");
} }
void DirichletBC::fillBoundaryCondition(DOFVectorBase<double>* vector, void DirichletBC::fillBoundaryCondition(DOFVectorBase<double>* vector,
ElInfo* elInfo, ElInfo* elInfo,
const DegreeOfFreedom* dofIndices, const DegreeOfFreedom* dofIndices,
......
...@@ -49,7 +49,8 @@ namespace AMDiS { ...@@ -49,7 +49,8 @@ namespace AMDiS {
/// Constructor. /// Constructor.
DirichletBC(BoundaryType type, DirichletBC(BoundaryType type,
DOFVectorBase<double> *vec); DOFVectorBase<double> *vec,
bool apply = true);
/// Implementation of BoundaryCondition::fillBoundaryCondition(). /// Implementation of BoundaryCondition::fillBoundaryCondition().
void fillBoundaryCondition(DOFMatrix* matrix, void fillBoundaryCondition(DOFMatrix* matrix,
......
...@@ -1189,14 +1189,39 @@ namespace AMDiS { ...@@ -1189,14 +1189,39 @@ namespace AMDiS {
DirichletBC *dirichletNotApply = DirichletBC *dirichletNotApply =
new DirichletBC(type, b, componentSpaces[row], componentSpaces[col], false); new DirichletBC(type, b, componentSpaces[row], componentSpaces[col], false);
for (int i = 0; i < nComponents; i++) { for (int i = 0; i < nComponents; i++)
if (systemMatrix && (*systemMatrix)[row][i]) { if (systemMatrix && (*systemMatrix)[row][i])
if (i == col)
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply);
else
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply);
if (rhs)
rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
if (solution)
solution->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
}
void ProblemVec::addDirichletBC(BoundaryType type, int row, int col,
DOFVector<double> *vec)
{
FUNCNAME("ProblemVec::addDirichletBC()");
TEST_EXIT(row >= 0 && row < nComponents)("Wrong row number: %d\n", row);
TEST_EXIT(col >= 0 && col < nComponents)("Wrong col number: %d\n", col);
boundaryConditionSet = true;
DirichletBC *dirichletApply = new DirichletBC(type, vec, true);
DirichletBC *dirichletNotApply = new DirichletBC(type, vec, false);
for (int i = 0; i < nComponents; i++)
if (systemMatrix && (*systemMatrix)[row][i])
if (i == col) if (i == col)
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply); (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply);
else else
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply); (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply);
}
}
if (rhs) if (rhs)
rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply); rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
......
...@@ -244,6 +244,9 @@ namespace AMDiS { ...@@ -244,6 +244,9 @@ namespace AMDiS {
virtual void addDirichletBC(BoundaryType type, int row, int col, virtual void addDirichletBC(BoundaryType type, int row, int col,
AbstractFunction<double, WorldVector<double> > *b); AbstractFunction<double, WorldVector<double> > *b);
virtual void addDirichletBC(BoundaryType type, int row, int col,
DOFVector<double> *vec);
/// Adds neumann boundary conditions. /// Adds neumann boundary conditions.
virtual void addNeumannBC(BoundaryType type, int row, int col, virtual void addNeumannBC(BoundaryType type, int row, int col,
AbstractFunction<double, WorldVector<double> > *n); AbstractFunction<double, WorldVector<double> > *n);
......
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