Commit 2a497e01 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Blub

parent 4757d225
...@@ -36,6 +36,7 @@ if(CMAKE_CXX_COMPILER MATCHES ".*icpc") ...@@ -36,6 +36,7 @@ if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
set(CMAKE_CXX_FLAGS "-diag-disable 654 -diag-disable 858") set(CMAKE_CXX_FLAGS "-diag-disable 654 -diag-disable 858")
endif() endif()
SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" ) SET(ENABLE_PARALLEL_DOMAIN "OFF" CACHE STRING "use parallel domain decomposition. please set to one of: PMTL, PETSC, OFF" )
option(USE_PETSC_DEV false) option(USE_PETSC_DEV false)
option(ENABLE_ZOLTAN false) option(ENABLE_ZOLTAN false)
...@@ -43,6 +44,12 @@ option(ENABLE_UMFPACK "Use of UMFPACK solver" false) ...@@ -43,6 +44,12 @@ option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_PNG "use png reader/writer" false) option(ENABLE_PNG "use png reader/writer" false)
option(ENABLE_BDDCML "Use of BDDCML library" false) option(ENABLE_BDDCML "Use of BDDCML library" false)
option(ENABLE_EXTENSIONS "Use extensions" false) option(ENABLE_EXTENSIONS "Use extensions" false)
option(ENABLE_OPENMP "Use OpenMP" false)
option(ENABLE_OUTPUT "AMDiS output priniting, disable only for debugging!" true)
mark_as_advanced(ENABLE_OUTPUT)
find_package(Boost 1.42 REQUIRED) find_package(Boost 1.42 REQUIRED)
if(Boost_FOUND) if(Boost_FOUND)
...@@ -307,6 +314,12 @@ if(ENABLE_PNG) ...@@ -307,6 +314,12 @@ if(ENABLE_PNG)
endif(ENABLE_PNG) endif(ENABLE_PNG)
if(NOT ENABLE_OUTPUT)
message(WARNING "AMDiS cout output disabled!")
list(APPEND COMPILEFLAGS "-DSUPPRESS_OUTPUT")
endif(NOT ENABLE_OUTPUT)
if(ENABLE_BDDCML) if(ENABLE_BDDCML)
SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML") SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML")
...@@ -440,6 +453,10 @@ if(ENABLE_EXTENSIONS) ...@@ -440,6 +453,10 @@ if(ENABLE_EXTENSIONS)
endif(ENABLE_EXTENSIONS) endif(ENABLE_EXTENSIONS)
if(ENABLE_OPENMP)
list(APPEND COMPILEFLAGS "-fopenmp")
endif(ENABLE_OPENMP)
SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM) SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM)
SET(COMPOSITE_FEM_SRC ${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc SET(COMPOSITE_FEM_SRC ${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc
${COMPOSITE_SOURCE_DIR}/CFE_NormAndErrorFcts.cc ${COMPOSITE_SOURCE_DIR}/CFE_NormAndErrorFcts.cc
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define AMDIS_AMDIS_FWD_INCLUDE #define AMDIS_AMDIS_FWD_INCLUDE
#include <boost/numeric/mtl/mtl.hpp> #include <boost/numeric/mtl/mtl.hpp>
#include "OpenMP.h"
namespace AMDiS { namespace AMDiS {
......
...@@ -252,16 +252,12 @@ namespace AMDiS { ...@@ -252,16 +252,12 @@ namespace AMDiS {
/// ///
ElementMatrix tmpMat; ElementMatrix tmpMat;
/** \brief /// Used to check whether \ref initElement() must be called, because
* Used to check whether \ref initElement() must be called, because /// a new Element is visited.
* a new Element is visited.
*/
Element* lastMatEl; Element* lastMatEl;
/** \brief /// Used to check whether \ref initElement() must be called, because
* Used to check whether \ref initElement() must be called, because /// a new Element is visited.
* a new Element is visited.
*/
Element* lastVecEl; Element* lastVecEl;
/// Used to check for new traverse. /// Used to check for new traverse.
......
...@@ -111,23 +111,6 @@ namespace AMDiS { ...@@ -111,23 +111,6 @@ namespace AMDiS {
virtual int* orderOfPositionIndices(const Element* el, GeoIndex position, virtual int* orderOfPositionIndices(const Element* el, GeoIndex position,
int positionIndex) const = 0; int positionIndex) const = 0;
/** \brief
* Pointer to a function which connects the set of local basis functions
* with its global DOFs.
* getDOFIndices(el, admin, dof) returns a pointer to a const vector of
* length \ref nBasFcts where the i-th entry is the index of the DOF
* associated to the i-th basis function; arguments are the actual element
* el and the DOF admin admin of the corresponding finite element space
* (these indices depend on all defined DOF admins and thus on the
* corresponding admin); if the last argument dof is NULL, getDOFndices
* has to provide memory for storing this vector, which is overwritten on the
* next call of getDOFIndices; if dof is not NULL, dof is a pointer to a
* vector which has to be filled;
*/
virtual const DegreeOfFreedom* getDOFIndices(const Element*,
const DOFAdmin&,
DegreeOfFreedom*) const = 0;
/** \brief /** \brief
* The second argument 'bound' has to be a pointer to a vector which has * The second argument 'bound' has to be a pointer to a vector which has
* to be filled. Its length is \ref nBasFcts (the number of basis functions * to be filled. Its length is \ref nBasFcts (the number of basis functions
...@@ -190,8 +173,7 @@ namespace AMDiS { ...@@ -190,8 +173,7 @@ namespace AMDiS {
* , indices[n-1] are the local indices of the basis functions where the * , indices[n-1] are the local indices of the basis functions where the
* coefficients have to be calculated, and the i-th entry in the return * coefficients have to be calculated, and the i-th entry in the return
* vector is then the coefficient of the indices[i]-th basis function; coeff * vector is then the coefficient of the indices[i]-th basis function; coeff
* may be a pointer to a vector which has to be filled * may be a pointer to a vector which has to be filled.
* (compare the dof argument of \ref getDOFIndices());
* such a function usually needs vertex coordinate information; thus, all * such a function usually needs vertex coordinate information; thus, all
* routines using this function on the elements need the FILL COORDS flag * routines using this function on the elements need the FILL COORDS flag
* during mesh traversal. * during mesh traversal.
...@@ -285,35 +267,20 @@ namespace AMDiS { ...@@ -285,35 +267,20 @@ namespace AMDiS {
{} {}
/// Returns local dof indices of the element for the given fe space. /// Returns local dof indices of the element for the given fe space.
virtual const DegreeOfFreedom *getLocalIndices(const Element *el, virtual void getLocalIndices(const Element *el,
const DOFAdmin *admin, const DOFAdmin *admin,
DegreeOfFreedom *dofPtr) const vector<DegreeOfFreedom> &indices) const
{ {}
return NULL;
}
inline void getLocalIndices(const Element *el,
const DOFAdmin *admin,
vector<DegreeOfFreedom> &indices) const
{
FUNCNAME("BasisFunction::getLocalIndices()");
TEST_EXIT_DBG(static_cast<int>(indices.size()) >= nBasFcts)
("Index vector is too small!\n");
getLocalIndices(el, admin, &(indices[0]));
}
///
virtual void getLocalDofPtrVec(const Element *el, virtual void getLocalDofPtrVec(const Element *el,
const DOFAdmin *admin, const DOFAdmin *admin,
vector<const DegreeOfFreedom*>& vec) const vector<const DegreeOfFreedom*>& vec) const
{} {}
/** \brief /// Evaluates elements value at barycentric coordinates lambda with local
* Evaluates elements value at barycentric coordinates lambda with local /// coefficient vector uh.
* coefficient vector uh.
*/
template<typename T> template<typename T>
T evalUh(const DimVec<double>& lambda, const mtl::dense_vector<T>& uh) const; T evalUh(const DimVec<double>& lambda, const mtl::dense_vector<T>& uh) const;
......
...@@ -60,28 +60,20 @@ namespace AMDiS { ...@@ -60,28 +60,20 @@ namespace AMDiS {
virtual void compressDOFIndexed(int first, int last, virtual void compressDOFIndexed(int first, int last,
std::vector<DegreeOfFreedom> &newDOF) = 0; std::vector<DegreeOfFreedom> &newDOF) = 0;
/** \brief /// Performs needed action when a DOF index is freed. Can be overriden in
* Performs needed action when a DOF index is freed. Can be overriden in /// sub classes. The default behavior is to do nothing.
* sub classes. The default behavior is to do nothing.
*/
virtual void freeDOFContent(int) {} virtual void freeDOFContent(int) {}
/** \brief /// Interpolation after refinement. Can be overriden in subclasses.
* Interpolation after refinement. Can be overriden in subclasses. /// The default behavior is to do nothing.
* The default behavior is to do nothing.
*/
virtual void refineInterpol(RCNeighbourList&, int) {} virtual void refineInterpol(RCNeighbourList&, int) {}
/** \brief /// Restriction after coarsening. Can be overriden in subclasses.
* Restriction after coarsening. Can be overriden in subclasses. /// The default behavior is to do nothing.
* The default behavior is to do nothing.
*/
virtual void coarseRestrict(RCNeighbourList&, int) {} virtual void coarseRestrict(RCNeighbourList&, int) {}
/** \brief /// Returns the finite element space of this DOFIndexed object. Must be
* Returns the finite element space of this DOFIndexed object. Must be /// overriden in sub classes.
* overriden in sub classes.
*/
virtual const FiniteElemSpace* getFeSpace() const = 0; virtual const FiniteElemSpace* getFeSpace() const = 0;
}; };
......
...@@ -231,16 +231,8 @@ namespace AMDiS { ...@@ -231,16 +231,8 @@ namespace AMDiS {
bound ? boundaryManager->getBoundaryCondition(bound[i]) : NULL; bound ? boundaryManager->getBoundaryCondition(bound[i]) : NULL;
if (condition && condition->isDirichlet()) { if (condition && condition->isDirichlet()) {
if (condition->applyBoundaryCondition()) { if (condition->applyBoundaryCondition())
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (dofMap->isRankDof(rowIndices[i])) {
dirichletDofs.insert(row);
}
#else
dirichletDofs.insert(row); dirichletDofs.insert(row);
#endif
}
} else { } else {
for (int j = 0; j < nCol; j++) { for (int j = 0; j < nCol; j++) {
DegreeOfFreedom col = colIndices[j]; DegreeOfFreedom col = colIndices[j];
...@@ -497,7 +489,10 @@ namespace AMDiS { ...@@ -497,7 +489,10 @@ namespace AMDiS {
inserter_type &ins = *inserter; inserter_type &ins = *inserter;
for (std::set<int>::iterator it = dirichletDofs.begin(); for (std::set<int>::iterator it = dirichletDofs.begin();
it != dirichletDofs.end(); ++it) it != dirichletDofs.end(); ++it)
ins[*it][*it] = 1.0; #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (dofMap->isRankDof(*it))
#endif
ins[*it][*it] = 1.0;
} }
......
...@@ -313,6 +313,11 @@ namespace AMDiS { ...@@ -313,6 +313,11 @@ namespace AMDiS {
return rowFeSpace->getAdmin()->getUsedSize(); return rowFeSpace->getAdmin()->getUsedSize();
} }
std::set<DegreeOfFreedom>& getDirichletRows()
{
return dirichletDofs;
}
/// Returns \ref name /// Returns \ref name
inline string getName() const inline string getName() const
{ {
......
...@@ -79,7 +79,7 @@ namespace AMDiS { ...@@ -79,7 +79,7 @@ namespace AMDiS {
int dim = mesh->getDim(); int dim = mesh->getDim();
int nBasFcts = basFcts->getNumber(); int nBasFcts = basFcts->getNumber();
DegreeOfFreedom *localIndices = new DegreeOfFreedom[nBasFcts]; std::vector<DegreeOfFreedom> localIndices(nBasFcts);
DimVec<double> lambda(dim, NO_INIT); DimVec<double> lambda(dim, NO_INIT);
ElInfo *elInfo = mesh->createNewElInfo(); ElInfo *elInfo = mesh->createNewElInfo();
...@@ -104,7 +104,6 @@ namespace AMDiS { ...@@ -104,7 +104,6 @@ namespace AMDiS {
} else } else
throw(std::runtime_error("Can not eval DOFVector at point p, because point is outside geometry.")); throw(std::runtime_error("Can not eval DOFVector at point p, because point is outside geometry."));
delete [] localIndices;
if (oldElInfo == NULL) if (oldElInfo == NULL)
delete elInfo; delete elInfo;
...@@ -124,11 +123,9 @@ namespace AMDiS { ...@@ -124,11 +123,9 @@ namespace AMDiS {
int dim = mesh->getDim(); int dim = mesh->getDim();
int nBasFcts = basFcts->getNumber(); int nBasFcts = basFcts->getNumber();
DegreeOfFreedom *localIndices = new DegreeOfFreedom[nBasFcts]; std::vector<DegreeOfFreedom> localIndices(nBasFcts);
DimVec<double> lambda(dim, NO_INIT); DimVec<double> lambda(dim, NO_INIT);
ElInfo *elInfo = mesh->createNewElInfo(); ElInfo *elInfo = mesh->createNewElInfo();
WorldVector<double> value(DEFAULT_VALUE, 0.0); WorldVector<double> value(DEFAULT_VALUE, 0.0);
bool inside = false; bool inside = false;
...@@ -150,7 +147,6 @@ namespace AMDiS { ...@@ -150,7 +147,6 @@ namespace AMDiS {
} else } else
throw(std::runtime_error("Can not eval DOFVector at point p, because point is outside geometry.")); throw(std::runtime_error("Can not eval DOFVector at point p, because point is outside geometry."));
delete [] localIndices;
if (oldElInfo == NULL) if (oldElInfo == NULL)
delete elInfo; delete elInfo;
......
...@@ -237,6 +237,18 @@ namespace AMDiS { ...@@ -237,6 +237,18 @@ namespace AMDiS {
boundaryManager = bm; boundaryManager = bm;
} }
inline void setDirichletDofValue(DegreeOfFreedom dof,
T value)
{
dirichletDofValues[dof] = value;
}
map<DegreeOfFreedom, T>& getDirichletValues()
{
return dirichletDofValues;
}
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void setDofMap(FeSpaceDofMap& m) void setDofMap(FeSpaceDofMap& m)
{ {
...@@ -249,17 +261,6 @@ namespace AMDiS { ...@@ -249,17 +261,6 @@ namespace AMDiS {
return dofMap->isRankDof(dof); return dofMap->isRankDof(dof);
} }
inline void setDirichletDofValue(DegreeOfFreedom dof,
T value)
{
dirichletDofValues[dof] = value;
}
map<DegreeOfFreedom, T>& getDirichletValues()
{
return dirichletDofValues;
}
#endif #endif
protected: protected:
...@@ -290,10 +291,10 @@ namespace AMDiS { ...@@ -290,10 +291,10 @@ namespace AMDiS {
/// Dimension of the mesh this DOFVectorBase belongs to /// Dimension of the mesh this DOFVectorBase belongs to
int dim; int dim;
map<DegreeOfFreedom, T> dirichletDofValues;
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
FeSpaceDofMap *dofMap; FeSpaceDofMap *dofMap;
map<DegreeOfFreedom, T> dirichletDofValues;
#endif #endif
}; };
......
...@@ -1374,9 +1374,9 @@ namespace AMDiS { ...@@ -1374,9 +1374,9 @@ namespace AMDiS {
TEST_EXIT_DBG(feSpace->getMesh() == el->getMesh()) TEST_EXIT_DBG(feSpace->getMesh() == el->getMesh())
("Element is defined on a different mesh than the DOF vector!\n"); ("Element is defined on a different mesh than the DOF vector!\n");
std::vector<int> localIndices(nBasFcts);
const DOFAdmin* admin = feSpace->getAdmin(); const DOFAdmin* admin = feSpace->getAdmin();
const DegreeOfFreedom *localIndices = feSpace->getBasisFcts()->getLocalIndices(el, admin, localIndices);
feSpace->getBasisFcts()->getLocalIndices(el, admin, NULL);
for (int i = 0; i < nBasFcts; i++) for (int i = 0; i < nBasFcts; i++)
d[i] = (*this)[localIndices[i]]; d[i] = (*this)[localIndices[i]];
......
...@@ -65,7 +65,6 @@ namespace AMDiS { ...@@ -65,7 +65,6 @@ namespace AMDiS {
for (int i = 0; i < nBasFcts; i++) { for (int i = 0; i < nBasFcts; i++) {
#if 1
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (vector->isRankDof(dofIndices[i])) if (vector->isRankDof(dofIndices[i]))
#endif #endif
...@@ -80,29 +79,10 @@ namespace AMDiS { ...@@ -80,29 +79,10 @@ namespace AMDiS {
else else
ERROR_EXIT("There is something wrong!\n"); ERROR_EXIT("There is something wrong!\n");
} }
vector->setDirichletDofValue(dofIndices[i], value);
(*vector)[dofIndices[i]] = value; (*vector)[dofIndices[i]] = value;
} }
#else
if (localBound[i] == boundaryType) {
double value = 0.0;
if (f) {
elInfo->coordToWorld(*(basFcts->getCoords(i)), worldCoords);
value = (*f)(worldCoords);
}
if (dofVec)
value = (*dofVec)[dofIndices[i]];
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
vector->setDirichletDofValue(dofIndices[i], value);
#else
(*vector)[dofIndices[i]] = value;
#endif
}
#endif
} }
} }
} }
...@@ -22,11 +22,15 @@ ...@@ -22,11 +22,15 @@
namespace AMDiS { namespace AMDiS {
std::vector<SubAssembler*> FirstOrderAssembler::optimizedSubAssemblersGrdPhi; ThreadPrivate<vector<SubAssembler*> >
std::vector<SubAssembler*> FirstOrderAssembler::optimizedSubAssemblersGrdPsi; FirstOrderAssembler::optimizedSubAssemblersGrdPhi;
ThreadPrivate<vector<SubAssembler*> >
FirstOrderAssembler::optimizedSubAssemblersGrdPsi;
std::vector<SubAssembler*> FirstOrderAssembler::standardSubAssemblersGrdPhi; ThreadPrivate<vector<SubAssembler*> >
std::vector<SubAssembler*> FirstOrderAssembler::standardSubAssemblersGrdPsi; FirstOrderAssembler::standardSubAssemblersGrdPhi;
ThreadPrivate<vector<SubAssembler*> >
FirstOrderAssembler::standardSubAssemblersGrdPsi;
FirstOrderAssembler::FirstOrderAssembler(Operator *op, FirstOrderAssembler::FirstOrderAssembler(Operator *op,
...@@ -51,16 +55,16 @@ namespace AMDiS { ...@@ -51,16 +55,16 @@ namespace AMDiS {
FirstOrderType type, FirstOrderType type,
bool optimized) bool optimized)
{ {
std::vector<SubAssembler*> *subAssemblers = vector<SubAssembler*> &subAssemblers =
optimized ? optimized ?
(type == GRD_PSI ? (type == GRD_PSI ?
&optimizedSubAssemblersGrdPsi : optimizedSubAssemblersGrdPsi.get() :
&optimizedSubAssemblersGrdPhi) : optimizedSubAssemblersGrdPhi.get()) :
(type == GRD_PSI ? (type == GRD_PSI ?
&standardSubAssemblersGrdPsi : standardSubAssemblersGrdPsi.get() :
&standardSubAssemblersGrdPhi); standardSubAssemblersGrdPhi.get());
std::vector<OperatorTerm*> opTerms = vector<OperatorTerm*> opTerms =
(type == GRD_PSI) ? op->firstOrderGrdPsi : op->firstOrderGrdPhi; (type == GRD_PSI) ? op->firstOrderGrdPsi : op->firstOrderGrdPhi;
// check if a assembler is needed at all // check if a assembler is needed at all
...@@ -72,13 +76,13 @@ namespace AMDiS { ...@@ -72,13 +76,13 @@ namespace AMDiS {
FirstOrderAssembler *newAssembler; FirstOrderAssembler *newAssembler;
// check if a new assembler is needed // check if a new assembler is needed
for (unsigned int i = 0; i < subAssemblers->size(); i++) { for (unsigned int i = 0; i < subAssemblers.size(); i++) {
std::vector<OperatorTerm*> assTerms = *((*subAssemblers)[i]->getTerms()); vector<OperatorTerm*> assTerms = *(subAssemblers[i]->getTerms());
sort(assTerms.begin(), assTerms.end()); sort(assTerms.begin(), assTerms.end());
if (opTerms == assTerms && (*subAssemblers)[i]->getQuadrature() == quad) if (opTerms == assTerms && subAssemblers[i]->getQuadrature() == quad)
return dynamic_cast<FirstOrderAssembler*>((*subAssemblers)[i]); return dynamic_cast<FirstOrderAssembler*>(subAssemblers[i]);
} }
// check if all terms are pw_const // check if all terms are pw_const
...@@ -110,7 +114,7 @@ namespace AMDiS { ...@@ -110,7 +114,7 @@ namespace AMDiS {
} }
} }
subAssemblers->push_back(newAssembler); subAssemblers.push_back(newAssembler);
return newAssembler; return newAssembler;
} }
...@@ -130,7 +134,7 @@ namespace AMDiS { ...@@ -130,7 +134,7 @@ namespace AMDiS {
mtl::dense_vector<double> grdPsi(dim + 1, 0.0); mtl::dense_vector<double> grdPsi(dim + 1, 0.0);
int nPoints = quadrature->getNumPoints(); int nPoints = quadrature->getNumPoints();
Lb.resize(nPoints); Lb.resize(nPoints);
std::vector<double> phival(nCol); vector<double> phival(nCol);
for (int iq = 0; iq < nPoints; iq++) { for (int iq = 0; iq < nPoints; iq++) {
Lb[iq].change_dim(dim + 1); Lb[iq].change_dim(dim + 1);
......
...@@ -23,11 +23,14 @@ ...@@ -23,11 +23,14 @@
#ifndef AMDIS_FIRST_ORDER_ASSEMBLER_H #ifndef AMDIS_FIRST_ORDER_ASSEMBLER_H
#define AMDIS_FIRST_ORDER_ASSEMBLER_H #define AMDIS_FIRST_ORDER_ASSEMBLER_H
#include <vector>
#include "AMDiS_fwd.h" #include "AMDiS_fwd.h"
#include "SubAssembler.h" #include "SubAssembler.h"
namespace AMDiS { namespace AMDiS {
using namespace std;