Commit 7908ff20 authored by Thomas Witkowski's avatar Thomas Witkowski

3d adaptivity for parallelization.

parent 82dffb9a
......@@ -140,7 +140,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PETSC_DIR = @PETSC_DIR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
......
......@@ -1578,27 +1578,10 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
# find out which ABI we are using
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*64-bit*)
libsuff=64
sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
;;
esac
fi
rm -rf conftest*
;;
esac
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
......@@ -4305,9 +4288,6 @@ CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
# Is the compiler the GNU C compiler?
with_gcc=$_LT_AC_TAGVAR(GCC, $1)
gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
gcc_ver=\`gcc -dumpversion\`
# An ERE matcher.
EGREP=$lt_EGREP
......@@ -4441,11 +4421,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
# Dependencies to place after the objects being linked to create a
# shared library.
postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
# Dependencies to place before the objects being linked to create a
# shared library.
......@@ -4457,7 +4437,7 @@ postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
......@@ -4537,7 +4517,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
# Compile-time system search path for libraries
sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
......@@ -6373,7 +6353,6 @@ do
done
done
done
IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
......@@ -6406,7 +6385,6 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
done
])
SED=$lt_cv_path_SED
AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])
......
......@@ -398,7 +398,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PETSC_DIR = @PETSC_DIR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
......
This diff is collapsed.
......@@ -79,6 +79,7 @@ ifeq ($(strip $(USE_PARALLEL_AMDIS)), 1)
endif
LIBS += $(PARMETIS_LIB) -lmpi
CPPFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS
else
ifeq ($(strip $(USE_COMPILER)), gcc)
COMPILE = g++
......@@ -96,9 +97,9 @@ endif
# ============================================================================
ifeq ($(strip $(DEBUG)), 0)
CPPFLAGS = -O2
CPPFLAGS += -O2
else
CPPFLAGS = -g -O0
CPPFLAGS += -g -O0
endif
ifeq ($(strip $(USE_OPENMP)), 1)
......
......@@ -51,6 +51,7 @@ namespace AMDiS {
class FiniteElemSpace;
class Flag;
class IdentityPreconditioner;
class InteriorBoundary;
class ITL_BasePreconditioner;
class LeafDataPeriodic;
class LevelAdmin;
......@@ -94,6 +95,9 @@ namespace AMDiS {
class VertexInfo;
class VertexVector;
struct BoundaryObject;
struct AtomicBoundary;
template<typename ReturnType, typename ArgumentType> class AbstractFunction;
template<typename T> class DOFIndexed;
template<typename T> class DOFVectorBase;
......
......@@ -49,8 +49,7 @@ namespace AMDiS {
virtual ~GrdBasFctType() {}
virtual void operator()(const DimVec<double>&,
DimVec<double>&) const = 0;
virtual void operator()(const DimVec<double>&, DimVec<double>&) const = 0;
};
/// Function interface for evaluating second derivative of basis functions.
......@@ -61,8 +60,7 @@ namespace AMDiS {
virtual ~D2BasFctType() {}
virtual void operator()(const DimVec<double>&,
DimMat<double>&) const = 0;
virtual void operator()(const DimVec<double>&, DimMat<double>&) const = 0;
};
typedef BasFctType *BFptr;
......@@ -297,12 +295,6 @@ namespace AMDiS {
getLocalIndices(el, admin, &(indices[0]));
}
/// Returns local dof indices of the element for the given fe space.
virtual void getLocalIndicesVec(const Element *el,
const DOFAdmin *admin,
Vector<DegreeOfFreedom> *ve) const
{}
virtual void getLocalDofPtrVec(const Element *el,
const DOFAdmin *admin,
std::vector<const DegreeOfFreedom*>& vec) const
......
......@@ -54,7 +54,7 @@ namespace AMDiS {
{
if (localBCs.size() > 0) {
const FiniteElemSpace *feSpace = vec->getFESpace();
Vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
std::vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
const BasisFunction *basisFcts = feSpace->getBasisFcts();
int nBasFcts = basisFcts->getNumber();
......@@ -63,7 +63,7 @@ namespace AMDiS {
basisFcts->getBound(elInfo, localBound);
// get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(), feSpace->getAdmin(), &dofVec);
basisFcts->getLocalIndices(elInfo->getElement(), feSpace->getAdmin(), dofVec);
// apply non dirichlet boundary conditions
for (BoundaryIndexMap::iterator it = localBCs.begin(); it != localBCs.end(); ++it)
......@@ -85,7 +85,7 @@ namespace AMDiS {
return;
const FiniteElemSpace *feSpace = mat->getRowFESpace();
Vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
std::vector<DegreeOfFreedom> &dofVec = dofIndices[omp_get_thread_num()];
const BasisFunction *basisFcts = feSpace->getBasisFcts();
int nBasFcts = basisFcts->getNumber();
......@@ -94,8 +94,7 @@ namespace AMDiS {
basisFcts->getBound(elInfo, localBound);
// get dof indices
basisFcts->getLocalIndicesVec(elInfo->getElement(),
feSpace->getAdmin(), &dofVec);
basisFcts->getLocalIndices(elInfo->getElement(), feSpace->getAdmin(), dofVec);
// apply non dirichlet boundary conditions
for (BoundaryIndexMap::iterator it = localBCs.begin(); it != localBCs.end(); ++it)
......
......@@ -126,7 +126,7 @@ namespace AMDiS {
std::vector<BoundaryType*> localBounds;
/// Temporary thread-safe variable for functions fillBoundaryconditions.
std::vector<Vector<DegreeOfFreedom> > dofIndices;
std::vector<std::vector<DegreeOfFreedom> > dofIndices;
/** \brief
* Stores the number of byte that were allocated in the constructor for
......
......@@ -139,7 +139,7 @@ namespace AMDiS {
firstHole = i;
} else { // if there is no hole
// enlarge dof-list
enlargeDOFLists(0);
enlargeDOFLists();
TEST_EXIT_DBG(firstHole < static_cast<int>(dofFree.size()))
("no free entry after enlargeDOFLists\n");
......
......@@ -66,7 +66,7 @@ namespace AMDiS {
* Enlarges the number of DOFs that can be managed at least to minsize by
* a step size of \ref sizeIncrement.
*/
void enlargeDOFLists(int minsize);
void enlargeDOFLists(int minsize = 0);
/// assignment operator
DOFAdmin& operator=(const DOFAdmin&);
......
......@@ -147,10 +147,9 @@ namespace AMDiS {
{
FUNCNAME("DOFVector::addElementVector()");
Vector<DegreeOfFreedom> indices(nBasFcts);
feSpace->getBasisFcts()->getLocalIndicesVec(elInfo->getElement(),
feSpace->getAdmin(),
&indices);
std::vector<DegreeOfFreedom> indices(nBasFcts);
feSpace->getBasisFcts()->getLocalIndices(elInfo->getElement(), feSpace->getAdmin(),
indices);
for (DegreeOfFreedom i = 0; i < nBasFcts; i++) {
BoundaryCondition *condition =
......@@ -159,11 +158,10 @@ namespace AMDiS {
if (!(condition && condition->isDirichlet())) {
DegreeOfFreedom irow = indices[i];
if (add) {
if (add)
(*this)[irow] += factor * elVec[i];
} else {
(*this)[irow] = factor * elVec[i];
}
else
(*this)[irow] = factor * elVec[i];
}
}
}
......
......@@ -566,30 +566,71 @@ namespace AMDiS {
return result;
}
void fitElementToMeshCode(RefinementManager *refineManager, MeshStructure &code,
Element *el, int ithSide, int elType)
bool fitElementToMeshCode(RefinementManager *refineManager,
MeshStructure &code,
Element *el,
int ithSide,
int elType)
{
FUNCNAME("fitElementToMeshCode()");
if (code.empty())
return false;
int s1 = el->getSideOfChild(0, ithSide, elType);
int s2 = el->getSideOfChild(1, ithSide, elType);
TEST_EXIT_DBG(s1 != -1 || s2 != -1)("This should not happen!\n");
if (s1 != -1 && s2 != -1)
return fitElementToMeshCode2(refineManager, code, el, ithSide, elType);
if (el->isLeaf()) {
if (code.getNumElements() == 1 && code.isLeafElement())
return false;
el->setMark(1);
refineManager->refineElement(el->getMesh(), el);
}
if (s1 != -1)
return fitElementToMeshCode2(refineManager, code,
el->getFirstChild(), s1, el->getChildType(elType));
else
return fitElementToMeshCode2(refineManager, code,
el->getSecondChild(), s2, el->getChildType(elType));
}
bool fitElementToMeshCode2(RefinementManager *refineManager, MeshStructure &code,
Element *el, int ithSide, int elType)
{
if (code.isLeafElement())
return;
return false;
bool value = false;
if (el->isLeaf()) {
el->setMark(1);
refineManager->refineMesh(el->getMesh());
refineManager->refineElement(el->getMesh(), el);
value = true;
}
int s1 = el->getSideOfChild(0, ithSide, elType);
int s2 = el->getSideOfChild(1, ithSide, elType);
if (s1 != -1) {
code.nextElement();
fitElementToMeshCode(refineManager, code,
el->getFirstChild(), s1, el->getChildType(elType));
value |= fitElementToMeshCode2(refineManager, code, el->getFirstChild(),
s1, el->getChildType(elType));
}
if (s2 != -1) {
code.nextElement();
fitElementToMeshCode(refineManager, code,
el->getSecondChild(), s2, el->getChildType(elType));
value |= fitElementToMeshCode2(refineManager, code, el->getSecondChild(),
s2, el->getChildType(elType));
}
return value;
}
}
......@@ -393,7 +393,9 @@ namespace AMDiS {
*/
virtual void getVertexDofs(FiniteElemSpace* feSpace,
int ith, int elType,
DofContainer& dofs, bool parentVertices = 0) const = 0;
DofContainer& dofs,
bool reverseMode,
bool parentVertices = false) const = 0;
/** \brief
* Traverses an edge/face of a given element (this includes also all children of
......@@ -574,11 +576,17 @@ namespace AMDiS {
friend class Mesh;
};
void fitElementToMeshCode(RefinementManager *refineManager,
bool fitElementToMeshCode(RefinementManager *refineManager,
MeshStructure &code,
Element *el,
int ithSide,
int elType);
bool fitElementToMeshCode2(RefinementManager *refineManager,
MeshStructure &code,
Element *el,
int ithSide,
int elType);
}
#endif // AMDIS_ELEMENT_H
......
......@@ -188,8 +188,9 @@ namespace AMDiS {
oss << "WARNING in " << file << ", line " << line << std::endl;
}
PRINT_LINE((*out), oss.str());
if (oss.str() != "")
PRINT_LINE((*out), oss.str());
old_line = line;
}
......@@ -283,6 +284,12 @@ namespace AMDiS {
return i * fac(i - 1);
}
void waitSec(int seconds)
{
clock_t endwait = clock () + seconds * CLOCKS_PER_SEC;
while (clock() < endwait) {}
}
std::string memSizeStr(int size)
{
std::string result;
......
......@@ -46,6 +46,7 @@
#include <stdio.h>
#include <functional>
#include <float.h>
#include <time.h>
#if HAVE_PARALLEL_DOMAIN_AMDIS
#include "mpi.h"
......@@ -92,6 +93,8 @@ namespace AMDiS {
/// Calculates factorial of i
int fac(int i);
void waitSec(int seconds);
/// Content comparision of two pointers. Used e.g. for std::find_if
template<typename T>
struct comparePtrContents : public std::binary_function<T*, T*, bool>
......@@ -314,7 +317,6 @@ namespace AMDiS {
*/
#define WAIT_REALLY Msg::wait(true)
#include <time.h>
#define TIME_USED(f,s) ((double)((s)-(f))/(double)CLOCKS_PER_SEC)
/** \brief
......@@ -443,12 +445,8 @@ namespace AMDiS {
GRD_PHI
};
#define MEMORY_MANAGED(className) ;
#define NEW new
#define DELETE delete
#define GET_MEMORY(typename, number) new typename[number]
#define FREE_MEMORY(ptr, typename, number) delete [] ptr
}
#endif // AMDIS_GLOBAL_H
......
#include "InteriorBoundary.h"
#include "FiniteElemSpace.h"
#include "BasisFunction.h"
#include "Serializer.h"
namespace AMDiS {
void BoundaryObject::setReverseMode(BoundaryObject &otherBound,
FiniteElemSpace *feSpace)
{
FUNCNAME("BoundaryObject::setReverseMode()");
bool otherMode = false;
const BasisFunction *basFcts = feSpace->getBasisFcts();
int nBasFcts = basFcts->getNumber();
std::vector<DegreeOfFreedom> localDofs0(nBasFcts), localDofs1(nBasFcts);
switch (feSpace->getMesh()->getDim()) {
case 2:
ERROR_EXIT("Not yet implemented!\n");
break;
case 3:
if (ithObj == 2 || ithObj == 3) {
basFcts->getLocalIndices(el, feSpace->getAdmin(), localDofs0);
basFcts->getLocalIndices(otherBound.el, feSpace->getAdmin(), localDofs1);
otherMode = (localDofs0[0] != localDofs1[0]);
}
break;
default:
ERROR_EXIT("This should not happen!\n");
}
otherBound.reverseMode = otherMode;
}
AtomicBoundary& InteriorBoundary::getNewAtomic(int rank)
{
boundary[rank].resize(boundary[rank].size() + 1);
return boundary[rank][boundary[rank].size() - 1];
}
void InteriorBoundary::serialize(std::ostream &out)
{
int mSize = boundary.size();
......@@ -22,16 +56,21 @@ namespace AMDiS {
AtomicBoundary &bound = (it->second)[i];
SerUtil::serialize(out, bound.rankObj.elIndex);
SerUtil::serialize(out, bound.rankObj.elType);
SerUtil::serialize(out, bound.rankObj.subObj);
SerUtil::serialize(out, bound.rankObj.ithObj);
SerUtil::serialize(out, bound.rankObj.reverseMode);
SerUtil::serialize(out, bound.neighObj.elIndex);
SerUtil::serialize(out, bound.neighObj.elType);
SerUtil::serialize(out, bound.neighObj.subObj);
SerUtil::serialize(out, bound.neighObj.ithObj);
SerUtil::serialize(out, bound.neighObj.reverseMode);
}
}
}
void InteriorBoundary::deserialize(std::istream &in,
std::map<int, Element*> &elIndexMap)
{
......@@ -48,12 +87,16 @@ namespace AMDiS {
AtomicBoundary &bound = boundary[rank][i];
SerUtil::deserialize(in, bound.rankObj.elIndex);
SerUtil::deserialize(in, bound.rankObj.elType);
SerUtil::deserialize(in, bound.rankObj.subObj);
SerUtil::deserialize(in, bound.rankObj.ithObj);
SerUtil::deserialize(in, bound.rankObj.reverseMode);
SerUtil::deserialize(in, bound.neighObj.elIndex);
SerUtil::deserialize(in, bound.neighObj.elType);
SerUtil::deserialize(in, bound.neighObj.subObj);
SerUtil::deserialize(in, bound.neighObj.ithObj);
SerUtil::deserialize(in, bound.neighObj.reverseMode);
bound.rankObj.el = elIndexMap[bound.rankObj.elIndex];
bound.neighObj.el = NULL;
......
......@@ -32,6 +32,9 @@ namespace AMDiS {
/// Defines the geometrical objects that forms the boundary;
struct BoundaryObject {
BoundaryObject()
: reverseMode(false)
{}
/// The macro element to which the boundary element corresponds to.
Element* el;
......@@ -58,6 +61,10 @@ namespace AMDiS {
* boundary.
*/
int ithObj;
bool reverseMode;
void setReverseMode(BoundaryObject &otherBound, FiniteElemSpace *feSpace);
};
/** \brief
......
......@@ -712,7 +712,7 @@ namespace AMDiS {
return &sortedVertex;
// edge
if ((dimOfPosition == 1) && (degree == 2))
if (dimOfPosition == 1 && degree == 2)
return &sortedEdgeDeg2;
int vertex[3];
......@@ -762,7 +762,7 @@ namespace AMDiS {
}
// center
if ((dimOfPosition == 3) && (degree == 4))
if (dimOfPosition == 3 && degree == 4)
return &sortedCenterDeg4;
ERROR_EXIT("should not be reached\n");
......@@ -953,16 +953,6 @@ namespace AMDiS {
return result;
}
void Lagrange::getLocalIndicesVec(const Element* el,
const DOFAdmin *admin,
Vector<DegreeOfFreedom> *indices) const
{
if (indices->getSize() < nBasFcts)
indices->resize(nBasFcts);
getLocalIndices(el, admin, &((*indices)[0]));
}
void Lagrange::getLocalDofPtrVec(const Element *el,
const DOFAdmin *admin,
std::vector<const DegreeOfFreedom*>& vec) const
......
......@@ -123,11 +123,6 @@ namespace AMDiS {
const DOFAdmin *admin,
DegreeOfFreedom *dofs) const;
///
void getLocalIndicesVec(const Element *el,
const DOFAdmin *admin,
Vector<DegreeOfFreedom> *vec) const;
void getLocalDofPtrVec(const Element *el,
const DOFAdmin *admin,
std::vector<const DegreeOfFreedom*>& vec) const;
......
......@@ -154,7 +154,9 @@ namespace AMDiS {
}
void getVertexDofs(FiniteElemSpace* feSpace, int ithEdge, int elType,
DofContainer& dofs, bool parentVertices = 0) const
DofContainer& dofs,
bool reverseMode,
bool parentVertices = false) const
{
FUNCNAME("Line::getVertexDofs()");
......
......@@ -28,7 +28,7 @@ namespace AMDiS {
MacroElement::~MacroElement()
{
if (element)
delete element;
delete element;
}
MacroElement& MacroElement::operator=(const MacroElement &el)
......
......@@ -262,7 +262,7 @@ namespace AMDiS {
me->setIndex(macroElements.size());
}
void Mesh::removeMacroElements(std::vector<MacroElement*>& macros,
void Mesh::removeMacroElements(std::set<MacroElement*>& macros,
const FiniteElemSpace *feSpace)
{
FUNCNAME("Mesh::removeMacroElement()");
......@@ -276,11 +276,13 @@ namespace AMDiS {
ElementDofIterator elDofIter(feSpace);
// Map that stores for each dof pointer (which may have a list of dofs)
// all macro element indices that own the dof.
// all macro element indices that own this dof.
DofElMap dofsOwner;
DofPosMap dofsPosIndex;
// Determine all dof owner macro elements.