Commit 9692c1a2 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Small bugfix for compiling without OpenMP

parent 3b97cf2b
......@@ -6,18 +6,31 @@
namespace AMDiS {
DirichletBC::DirichletBC(BoundaryType type,
DirichletBC::DirichletBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *fct,
FiniteElemSpace *rowFESpace,
FiniteElemSpace *colFESpace)
: BoundaryCondition(type, rowFESpace, colFESpace),
f(fct),
dofVec(NULL)
{
worldCoords.resize(omp_get_max_threads());
};
DirichletBC::DirichletBC(BoundaryType type,
DOFVectorBase<double> *vec)
: BoundaryCondition(type, vec->getFESpace()),
f(NULL),
dofVec(vec)
{}
{
worldCoords.resize(omp_get_max_threads());
}
void DirichletBC::fillBoundaryCondition(DOFMatrix* matrix,
ElInfo* elInfo,
void DirichletBC::fillBoundaryCondition(DOFMatrix* matrix,
ElInfo* elInfo,
const DegreeOfFreedom* dofIndices,
const BoundaryType* localBound,
int nBasFcts)
const BoundaryType* localBound,
int nBasFcts)
{
FUNCNAME("DirichletBC::fillBoundaryCondition()");
......@@ -25,11 +38,11 @@ namespace AMDiS {
("invalid row fe space\n");
}
void DirichletBC::fillBoundaryCondition(DOFVectorBase<double>* vector,
ElInfo* elInfo,
void DirichletBC::fillBoundaryCondition(DOFVectorBase<double>* vector,
ElInfo* elInfo,
const DegreeOfFreedom* dofIndices,
const BoundaryType* localBound,
int nBasFcts)
const BoundaryType* localBound,
int nBasFcts)
{
FUNCNAME("DirichletBC::fillBoundaryCondition()");
......@@ -37,12 +50,14 @@ namespace AMDiS {
("invalid row fe space\n");
const BasisFunction *basFcts = rowFESpace->getBasisFcts();
int myRank = omp_get_thread_num();
for (int i = 0; i < nBasFcts; i++) {
if (localBound[i] == boundaryType) {
if (f) {
DimVec<double> *coords = basFcts->getCoords(i);
const WorldVector<double> *worldCoords = elInfo->coordToWorld(*coords, NULL);
double fAtCoords = (*f)(*worldCoords);
elInfo->coordToWorld(*coords, &(worldCoords[myRank]));
double fAtCoords = (*f)(worldCoords[myRank]);
(*vector)[dofIndices[i]] = fAtCoords;
}
if (dofVec) {
......
......@@ -24,6 +24,7 @@
#include "BoundaryCondition.h"
#include "AbstractFunction.h"
#include "OpenMP.h"
namespace AMDiS {
......@@ -49,38 +50,34 @@ namespace AMDiS {
/** \brief
* Constructor.
*/
DirichletBC(BoundaryType type,
DirichletBC(BoundaryType type,
AbstractFunction<double, WorldVector<double> > *fct,
FiniteElemSpace *rowFESpace,
FiniteElemSpace *colFESpace = NULL)
: BoundaryCondition(type, rowFESpace, colFESpace),
f(fct),
dofVec(NULL)
{};
FiniteElemSpace *rowFESpace,
FiniteElemSpace *colFESpace = NULL);
/** \brief
* Constructor.
*/
DirichletBC(BoundaryType type,
DirichletBC(BoundaryType type,
DOFVectorBase<double> *vec);
/** \brief
* Implementation of BoundaryCondition::fillBoundaryCondition().
*/
void fillBoundaryCondition(DOFMatrix* matrix,
ElInfo* elInfo,
void fillBoundaryCondition(DOFMatrix* matrix,
ElInfo* elInfo,
const DegreeOfFreedom* dofIndices,
const BoundaryType* localBound,
int nBasFcts);
const BoundaryType* localBound,
int nBasFcts);
/** \brief
* Implementation of BoundaryCondition::fillBoundaryCondition().
*/
void fillBoundaryCondition(DOFVectorBase<double>* vector,
ElInfo* elInfo,
void fillBoundaryCondition(DOFVectorBase<double>* vector,
ElInfo* elInfo,
const DegreeOfFreedom* dofIndices,
const BoundaryType* localBound,
int nBasFcts);
const BoundaryType* localBound,
int nBasFcts);
/** \brief
* Implementation of BoundaryCondition::boundResidual().
......@@ -109,6 +106,8 @@ namespace AMDiS {
*/
AbstractFunction<double, WorldVector<double> > *f;
std::vector<WorldVector<double> > worldCoords;
/** \brief
* DOFVector containing the boundary values
*/
......
......@@ -62,8 +62,8 @@ namespace AMDiS {
{
int dim = l.getSize() - 1;
static WorldVector<double> world[4];
WorldVector<double> *ret = w ? w : &world[omp_get_thread_num()];
static WorldVector<double> world;
WorldVector<double> *ret = w ? w : &world;
double c = l[0];
for (int j = 0; j < dimOfWorld; j++)
......
......@@ -764,13 +764,14 @@ namespace AMDiS {
if (solution_->getDOFVector(i)->getBoundaryManager())
solution_->getDOFVector(i)->getBoundaryManager()->
fillBoundaryConditions(elInfo, solution_->getDOFVector(i));
elInfo = stack.traverseNext(elInfo);
}
if (rhs_->getDOFVector(i)->getBoundaryManager())
rhs_->getDOFVector(i)->getBoundaryManager()->exitVector(rhs_->getDOFVector(i));
if (solution_->getDOFVector(i)->getBoundaryManager())
solution_->getDOFVector(i)->getBoundaryManager()->exitVector(solution_->getDOFVector(i));
solution_->getDOFVector(i)->getBoundaryManager()->exitVector(solution_->getDOFVector(i));
}
#ifdef _OPENMP
......@@ -939,9 +940,16 @@ namespace AMDiS {
{
Mesh *mesh = feSpace->getMesh();
const BasisFunction *basisFcts = feSpace->getBasisFcts();
#ifdef _OPENMP
TraverseParallelStack stack;
#else
TraverseStack stack;
#endif
#ifdef _OPENMP
#pragma omp parallel
#endif
{
BoundaryType *bound = useGetBound_ ? GET_MEMORY(BoundaryType, basisFcts->getNumber()) : NULL;
......@@ -1004,7 +1012,9 @@ namespace AMDiS {
// the same time.
if (matrix) {
#ifdef _OPENMP
#pragma omp critical
#endif
{
addDOFMatrix(matrix, tmpMatrix);
......@@ -1016,7 +1026,9 @@ namespace AMDiS {
}
if (vector) {
#ifdef _OPENMP
#pragma omp critical
#endif
*vector += *tmpVector;
DELETE tmpVector;
......
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