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