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

Work on some general PETSc solver.

parent 849f5ff5
...@@ -197,6 +197,7 @@ if(ENABLE_PARALLEL_DOMAIN) ...@@ -197,6 +197,7 @@ if(ENABLE_PARALLEL_DOMAIN)
find_package(PETSc REQUIRED) find_package(PETSc REQUIRED)
include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include) include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
SET(PARALLEL_DOMAIN_AMDIS_SRC SET(PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectData.cc ${SOURCE_DIR}/parallel/ElementObjectData.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc ${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc ${SOURCE_DIR}/parallel/MeshManipulation.cc
......
...@@ -77,7 +77,7 @@ ifeq ($(strip $(USE_PARALLEL_AMDIS)), 1) ...@@ -77,7 +77,7 @@ ifeq ($(strip $(USE_PARALLEL_AMDIS)), 1)
endif endif
CPPFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS CPPFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS
INCLUDES += $(PETSC_INCLUDE) INCLUDES += $(PETSC_CC_INCLUDES)
LIBS += $(PARMETIS_LIB) -lmpi $(PETSC_LIB) LIBS += $(PARMETIS_LIB) -lmpi $(PETSC_LIB)
LIBS += $(ZOLTAN_LIB) LIBS += $(ZOLTAN_LIB)
else else
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "ElementRegion_ED.h" #include "ElementRegion_ED.h"
#include "Serializer.h" #include "Serializer.h"
#include "MeshStructure.h" #include "MeshStructure.h"
#include "BasisFunction.h"
namespace AMDiS { namespace AMDiS {
...@@ -622,4 +623,15 @@ namespace AMDiS { ...@@ -622,4 +623,15 @@ namespace AMDiS {
file.close(); file.close();
} }
void Element::getAllDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs)
{
getNodeDofs(feSpace, bound, dofs);
if (feSpace->getBasisFcts()->getDegree() > 1)
getHigherOrderDofs(feSpace, bound, dofs);
}
} }
...@@ -411,32 +411,38 @@ namespace AMDiS { ...@@ -411,32 +411,38 @@ namespace AMDiS {
virtual int getChildType(int elType) const = 0; virtual int getChildType(int elType) const = 0;
/** \brief /** \brief
* Traverses an edge/face of a given element (this includes also all children of * Traverses a vertex/edge/face of a given element (this includes also all
* the element having the same edge/face). All vertex dofs alonge this edge/face * children of the element having the same edge/face). All DOFs on mesh
* are assembled and put together to a list. * nodes alonge this vertex/edge/face are assembled and put together to
* a list.
* *
* \param[in] feSpace FE space which is used to get the dofs. * \param[in] feSpace FE space which is used to get the dofs.
* \param[in] bound Defines the edge/face of the element on which * \param[in] bound Defines the vertex/edge/face of the element on
* all vertex dofs are assembled. * which all vertex dofs are assembled.
* \param[out] dofs List of dofs, where the result is stored. * \param[out] dofs List of dofs, where the result is stored.
*/ */
virtual void getVertexDofs(FiniteElemSpace* feSpace, virtual void getNodeDofs(FiniteElemSpace* feSpace,
BoundaryObject bound, BoundaryObject bound,
DofContainer& dofs) const = 0; DofContainer& dofs) const = 0;
/** \brief /** \brief
* Traverses an edge/face of a given element (this includes also all children of * Traverses a vertex/edge/face of a given element (this includes also all
* the element having the same edge/face). All non vertex dofs alonge this edge/face * children of the element having the same edge/face). All DOFs belonging
* are assembled and put together to a list. * to higher order basis functions alonge this vertex/edge/face are
* assembled and put together to a list.
* *
* \param[in] feSpace FE space which is used to get the dofs. * \param[in] feSpace FE space which is used to get the dofs.
* \param[in] bound Defines the edge/face of the element on which * \param[in] bound Defines the edge/face of the element on which
* all non vertex dofs are assembled. * all non vertex dofs are assembled.
* \param[out] dofs All dofs are put to this dof list. * \param[out] dofs All dofs are put to this dof list.
*/ */
virtual void getNonVertexDofs(FiniteElemSpace* feSpace, virtual void getHigherOrderDofs(FiniteElemSpace* feSpace,
BoundaryObject bound, BoundaryObject bound,
DofContainer& dofs) const = 0; DofContainer& dofs) const = 0;
void getAllDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs);
/** \} */ /** \} */
......
...@@ -173,15 +173,15 @@ namespace AMDiS { ...@@ -173,15 +173,15 @@ namespace AMDiS {
return "Line"; return "Line";
} }
void getVertexDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const void getNodeDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const
{ {
FUNCNAME("Line::getVertexDofs()"); FUNCNAME("Line::getNodeDofs()");
ERROR_EXIT("Not yet implemented!\n"); ERROR_EXIT("Not yet implemented!\n");
} }
void getNonVertexDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const void getHigherOrderDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const
{ {
FUNCNAME("Line::getNonVertexDofs()"); FUNCNAME("Line::getHigherOrderDofs()");
ERROR_EXIT("Not yet implemented!\n"); ERROR_EXIT("Not yet implemented!\n");
} }
......
...@@ -12,6 +12,7 @@ PARALLEL_INCLUDES = ...@@ -12,6 +12,7 @@ PARALLEL_INCLUDES =
if USE_PARALLEL_DOMAIN_AMDIS if USE_PARALLEL_DOMAIN_AMDIS
PARALLEL_AMDIS_SOURCES += \ PARALLEL_AMDIS_SOURCES += \
parallel/CheckerPartitioner.cc \
parallel/ElementObjectData.cc \ parallel/ElementObjectData.cc \
parallel/MeshDistributor.cc \ parallel/MeshDistributor.cc \
parallel/MeshManipulation.cc \ parallel/MeshManipulation.cc \
...@@ -247,6 +248,7 @@ io/ValueWriter.h \ ...@@ -247,6 +248,7 @@ io/ValueWriter.h \
io/VtkWriter.h \ io/VtkWriter.h \
io/VtkWriter.hh \ io/VtkWriter.hh \
itl/minres.hpp \ itl/minres.hpp \
parallel/CheckerPartitioner.h \
parallel/ElementObjectData.h \ parallel/ElementObjectData.h \
parallel/InteriorBoundary.h \ parallel/InteriorBoundary.h \
parallel/MeshDistributor.h \ parallel/MeshDistributor.h \
......
...@@ -38,6 +38,7 @@ POST_UNINSTALL = : ...@@ -38,6 +38,7 @@ POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_1 = \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_1 = \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/CheckerPartitioner.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/ElementObjectData.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/ElementObjectData.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/MeshDistributor.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/MeshDistributor.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/MeshManipulation.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/MeshManipulation.cc \
...@@ -88,10 +89,11 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" ...@@ -88,10 +89,11 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
libamdis_la_LIBADD = libamdis_la_LIBADD =
am__libamdis_la_SOURCES_DIST = parallel/ElementObjectData.cc \ am__libamdis_la_SOURCES_DIST = parallel/CheckerPartitioner.cc \
parallel/MeshDistributor.cc parallel/MeshManipulation.cc \ parallel/ElementObjectData.cc parallel/MeshDistributor.cc \
parallel/MeshPartitioner.cc parallel/MpiHelper.cc \ parallel/MeshManipulation.cc parallel/MeshPartitioner.cc \
parallel/ParallelDebug.cc parallel/ParallelProblemStatBase.cc \ parallel/MpiHelper.cc parallel/ParallelDebug.cc \
parallel/ParallelProblemStatBase.cc \
parallel/ParMetisPartitioner.cc parallel/PetscProblemStat.cc \ parallel/ParMetisPartitioner.cc parallel/PetscProblemStat.cc \
parallel/PetscSolver.cc parallel/StdMpi.cc \ parallel/PetscSolver.cc parallel/StdMpi.cc \
parallel/ZoltanPartitioner.cc AdaptBase.cc AdaptInfo.cc \ parallel/ZoltanPartitioner.cc AdaptBase.cc AdaptInfo.cc \
...@@ -130,7 +132,8 @@ am__libamdis_la_SOURCES_DIST = parallel/ElementObjectData.cc \ ...@@ -130,7 +132,8 @@ am__libamdis_la_SOURCES_DIST = parallel/ElementObjectData.cc \
io/ValueWriter.cc io/VtkWriter.cc parallel/InteriorBoundary.cc \ io/ValueWriter.cc io/VtkWriter.cc parallel/InteriorBoundary.cc \
time/RosenbrockAdaptInstationary.cc time/RosenbrockMethod.cc \ time/RosenbrockAdaptInstationary.cc time/RosenbrockMethod.cc \
time/RosenbrockStationary.cc time/RosenbrockStationary.cc
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__objects_1 = libamdis_la-ElementObjectData.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__objects_1 = libamdis_la-CheckerPartitioner.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-ElementObjectData.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshDistributor.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshDistributor.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshManipulation.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshManipulation.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshPartitioner.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshPartitioner.lo \
...@@ -568,6 +571,7 @@ io/ValueWriter.h \ ...@@ -568,6 +571,7 @@ io/ValueWriter.h \
io/VtkWriter.h \ io/VtkWriter.h \
io/VtkWriter.hh \ io/VtkWriter.hh \
itl/minres.hpp \ itl/minres.hpp \
parallel/CheckerPartitioner.h \
parallel/ElementObjectData.h \ parallel/ElementObjectData.h \
parallel/InteriorBoundary.h \ parallel/InteriorBoundary.h \
parallel/MeshDistributor.h \ parallel/MeshDistributor.h \
...@@ -822,6 +826,7 @@ distclean-compile: ...@@ -822,6 +826,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-BasisFunction.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-BasisFunction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Boundary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Boundary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-BoundaryManager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-BoundaryManager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CheckerPartitioner.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Cholesky.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Cholesky.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager1d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager1d.Plo@am__quote@
...@@ -976,6 +981,13 @@ distclean-compile: ...@@ -976,6 +981,13 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
libamdis_la-CheckerPartitioner.lo: parallel/CheckerPartitioner.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-CheckerPartitioner.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-CheckerPartitioner.Tpo" -c -o libamdis_la-CheckerPartitioner.lo `test -f 'parallel/CheckerPartitioner.cc' || echo '$(srcdir)/'`parallel/CheckerPartitioner.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-CheckerPartitioner.Tpo" "$(DEPDIR)/libamdis_la-CheckerPartitioner.Plo"; else rm -f "$(DEPDIR)/libamdis_la-CheckerPartitioner.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parallel/CheckerPartitioner.cc' object='libamdis_la-CheckerPartitioner.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-CheckerPartitioner.lo `test -f 'parallel/CheckerPartitioner.cc' || echo '$(srcdir)/'`parallel/CheckerPartitioner.cc
libamdis_la-ElementObjectData.lo: parallel/ElementObjectData.cc libamdis_la-ElementObjectData.lo: parallel/ElementObjectData.cc
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ElementObjectData.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-ElementObjectData.Tpo" -c -o libamdis_la-ElementObjectData.lo `test -f 'parallel/ElementObjectData.cc' || echo '$(srcdir)/'`parallel/ElementObjectData.cc; \ @am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ElementObjectData.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-ElementObjectData.Tpo" -c -o libamdis_la-ElementObjectData.lo `test -f 'parallel/ElementObjectData.cc' || echo '$(srcdir)/'`parallel/ElementObjectData.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-ElementObjectData.Tpo" "$(DEPDIR)/libamdis_la-ElementObjectData.Plo"; else rm -f "$(DEPDIR)/libamdis_la-ElementObjectData.Tpo"; exit 1; fi @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-ElementObjectData.Tpo" "$(DEPDIR)/libamdis_la-ElementObjectData.Plo"; else rm -f "$(DEPDIR)/libamdis_la-ElementObjectData.Tpo"; exit 1; fi
......
...@@ -77,11 +77,11 @@ namespace AMDiS { ...@@ -77,11 +77,11 @@ namespace AMDiS {
const Flag Mesh::CALL_REVERSE_MODE = 0X8000L; const Flag Mesh::CALL_REVERSE_MODE = 0X8000L;
std::vector<DegreeOfFreedom> Mesh::dof_used; vector<DegreeOfFreedom> Mesh::dof_used;
const int Mesh::MAX_DOF = 100; const int Mesh::MAX_DOF = 100;
std::map<std::pair<DegreeOfFreedom, int>, DegreeOfFreedom*> Mesh::serializedDOFs; map<pair<DegreeOfFreedom, int>, DegreeOfFreedom*> Mesh::serializedDOFs;
Mesh::Mesh(std::string aName, int dimension) Mesh::Mesh(string aName, int dimension)
: name(aName), : name(aName),
dim(dimension), dim(dimension),
nVertices(0), nVertices(0),
...@@ -186,7 +186,7 @@ namespace AMDiS { ...@@ -186,7 +186,7 @@ namespace AMDiS {
// mapIndex[i] is the index of the MacroElement element in the vector // mapIndex[i] is the index of the MacroElement element in the vector
// macroElements, for which holds: element->getIndex() = i // macroElements, for which holds: element->getIndex() = i
std::map<int, int> mapIndex; map<int, int> mapIndex;
// We use this map for coping the DOFs of the Elements within the // We use this map for coping the DOFs of the Elements within the
// MacroElements objects. // MacroElements objects.
...@@ -198,7 +198,7 @@ namespace AMDiS { ...@@ -198,7 +198,7 @@ namespace AMDiS {
// Go through all MacroElements of mesh m, and create for every a new // Go through all MacroElements of mesh m, and create for every a new
// MacroElement in this mesh. // MacroElement in this mesh.
for (std::deque<MacroElement*>::const_iterator it = m.macroElements.begin(); for (deque<MacroElement*>::const_iterator it = m.macroElements.begin();
it != m.macroElements.end(); ++it, insertCounter++) { it != m.macroElements.end(); ++it, insertCounter++) {
// Create new MacroElement. // Create new MacroElement.
...@@ -214,13 +214,13 @@ namespace AMDiS { ...@@ -214,13 +214,13 @@ namespace AMDiS {
macroElements.push_back(el); macroElements.push_back(el);
// Update the index map. // Update the index map.
mapIndex.insert(std::pair<int, int>(el->getIndex(), insertCounter)); mapIndex.insert(pair<int, int>(el->getIndex(), insertCounter));
} }
// Now we have to go through all the new MacroElements, and update the neighbour // Now we have to go through all the new MacroElements, and update the neighbour
// connections. // connections.
insertCounter = 0; insertCounter = 0;
for (std::deque<MacroElement*>::const_iterator it = m.macroElements.begin(); for (deque<MacroElement*>::const_iterator it = m.macroElements.begin();
it != m.macroElements.end(); it != m.macroElements.end();
++it, insertCounter++) { ++it, insertCounter++) {
// Go through all neighbours. // Go through all neighbours.
...@@ -275,8 +275,8 @@ namespace AMDiS { ...@@ -275,8 +275,8 @@ namespace AMDiS {
{ {
FUNCNAME("Mesh::removeMacroElement()"); FUNCNAME("Mesh::removeMacroElement()");
typedef std::map<const DegreeOfFreedom*, std::set<MacroElement*> > DofElMap; typedef map<const DegreeOfFreedom*, std::set<MacroElement*> > DofElMap;
typedef std::map<const DegreeOfFreedom*, GeoIndex> DofPosMap; typedef map<const DegreeOfFreedom*, GeoIndex> DofPosMap;
TEST_EXIT(admin.size() == 1)("Not yet implemented for multiple admins!\n"); TEST_EXIT(admin.size() == 1)("Not yet implemented for multiple admins!\n");
TEST_EXIT(admin[0])("There is something wrong!\n"); TEST_EXIT(admin[0])("There is something wrong!\n");
...@@ -305,12 +305,12 @@ namespace AMDiS { ...@@ -305,12 +305,12 @@ namespace AMDiS {
// === Remove macro elements from mesh macro element list. === // === Remove macro elements from mesh macro element list. ===
// Removing arbitrary elements from an std::deque is very slow. Therefore, we // Removing arbitrary elements from an deque is very slow. Therefore, we
// create a new deque with all macro elements that should not be deleted. The // create a new deque with all macro elements that should not be deleted. The
// macro element deque is than replaced by the new created one. // macro element deque is than replaced by the new created one.
std::deque<MacroElement*> newMacroElements; deque<MacroElement*> newMacroElements;
for (std::deque<MacroElement*>::iterator elIter = macroElements.begin(); for (deque<MacroElement*>::iterator elIter = macroElements.begin();
elIter != macroElements.end(); ++elIter) { elIter != macroElements.end(); ++elIter) {
// If the current mesh macro element should not be deleted, i.e., it is not a // If the current mesh macro element should not be deleted, i.e., it is not a
// member of the list of macro elements to be deleted, is is inserted to the new // member of the list of macro elements to be deleted, is is inserted to the new
...@@ -416,7 +416,7 @@ namespace AMDiS { ...@@ -416,7 +416,7 @@ namespace AMDiS {
localAdmin->setMesh(this); localAdmin->setMesh(this);
TEST_EXIT(std::find(admin.begin(), admin.end(), localAdmin) == admin.end()) TEST_EXIT(find(admin.begin(), admin.end(), localAdmin) == admin.end())
("admin %s is already associated to mesh %s\n", ("admin %s is already associated to mesh %s\n",
localAdmin->getName().c_str(), this->getName().c_str()); localAdmin->getName().c_str(), this->getName().c_str());
...@@ -479,7 +479,7 @@ namespace AMDiS { ...@@ -479,7 +479,7 @@ namespace AMDiS {
compressAdmin->getHoleCount() < 1) compressAdmin->getHoleCount() < 1)
continue; continue;
std::vector<int> newDofIndex(size); vector<int> newDofIndex(size);
compressAdmin->compress(newDofIndex); compressAdmin->compress(newDofIndex);
Flag fill_flag = (preserveCoarseDOFs ? Flag fill_flag = (preserveCoarseDOFs ?
...@@ -559,7 +559,7 @@ namespace AMDiS { ...@@ -559,7 +559,7 @@ namespace AMDiS {
} }
const DOFAdmin *Mesh::createDOFAdmin(std::string lname, DimVec<int> lnDof) const DOFAdmin *Mesh::createDOFAdmin(string lname, DimVec<int> lnDof)
{ {
FUNCNAME("Mesh::createDOFAdmin()"); FUNCNAME("Mesh::createDOFAdmin()");
...@@ -905,10 +905,12 @@ namespace AMDiS { ...@@ -905,10 +905,12 @@ namespace AMDiS {
const FiniteElemSpace* feSpace, const FiniteElemSpace* feSpace,
WorldVector<double>& coords) WorldVector<double>& coords)
{ {
FUNCNAME("Mesh::getDofIndexCoords()");
DimVec<double>* baryCoords; DimVec<double>* baryCoords;
bool found = false; bool found = false;
TraverseStack stack; TraverseStack stack;
std::vector<DegreeOfFreedom> dofVec(feSpace->getBasisFcts()->getNumber()); vector<DegreeOfFreedom> dofVec(feSpace->getBasisFcts()->getNumber());
ElInfo *elInfo = stack.traverseFirst(this, -1, ElInfo *elInfo = stack.traverseFirst(this, -1,
Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS);
...@@ -938,9 +940,11 @@ namespace AMDiS { ...@@ -938,9 +940,11 @@ namespace AMDiS {
void Mesh::getDofIndexCoords(const FiniteElemSpace* feSpace, void Mesh::getDofIndexCoords(const FiniteElemSpace* feSpace,
DOFVector<WorldVector<double> >& coords) DOFVector<WorldVector<double> >& coords)
{ {
FUNCNAME("Mesh::getDofIndexCoords()");
const BasisFunction* basFcts = feSpace->getBasisFcts(); const BasisFunction* basFcts = feSpace->getBasisFcts();
int nBasFcts = basFcts->getNumber(); int nBasFcts = basFcts->getNumber();
std::vector<DegreeOfFreedom> dofVec(nBasFcts); vector<DegreeOfFreedom> dofVec(nBasFcts);
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = ElInfo *elInfo =
...@@ -958,6 +962,27 @@ namespace AMDiS { ...@@ -958,6 +962,27 @@ namespace AMDiS {
} }
void Mesh::getAllDofs(FiniteElemSpace *feSpace,
std::set<const DegreeOfFreedom*>& allDofs)
{
FUNCNAME("Mesh::getAllDofs()");
ElementDofIterator elDofIt(feSpace);
allDofs.clear();
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(this, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
elDofIt.reset(elInfo->getElement());
do {
allDofs.insert(elDofIt.getDofPtr());
} while(elDofIt.next());
elInfo = stack.traverseNext(elInfo);
}
}
void Mesh::setDiameter(const WorldVector<double>& w) void Mesh::setDiameter(const WorldVector<double>& w)
{ {
diam = w; diam = w;
...@@ -970,7 +995,7 @@ namespace AMDiS { ...@@ -970,7 +995,7 @@ namespace AMDiS {
} }
void Mesh::serialize(std::ostream &out) void Mesh::serialize(ostream &out)
{ {
serializedDOFs.clear(); serializedDOFs.clear();
...@@ -1022,7 +1047,7 @@ namespace AMDiS { ...@@ -1022,7 +1047,7 @@ namespace AMDiS {
// === Write periodic associations. === // === Write periodic associations. ===
int mapSize = periodicAssociations.size(); int mapSize = periodicAssociations.size();
SerUtil::serialize(out, mapSize); SerUtil::serialize(out, mapSize);
for (std::map<BoundaryType, VertexVector*>::iterator it = periodicAssociations.begin(); for (map<BoundaryType, VertexVector*>::iterator it = periodicAssociations.begin();
it != periodicAssociations.end(); ++it) { it != periodicAssociations.end(); ++it) {
BoundaryType b = it->first; BoundaryType b = it->first;
...@@ -1046,7 +1071,7 @@ namespace AMDiS { ...@@ -1046,7 +1071,7 @@ namespace AMDiS {
} }
void Mesh::deserialize(std::istream &in) void Mesh::deserialize(istream &in)
{ {
FUNCNAME("Mesh::deserialize()"); FUNCNAME("Mesh::deserialize()");
...@@ -1100,7 +1125,7 @@ namespace AMDiS { ...@@ -1100,7 +1125,7 @@ namespace AMDiS {
} }
SerUtil::deserialize(in, size); SerUtil::deserialize(in, size);
std::vector< std::vector<int> > neighbourIndices(size); vector< vector<int> > neighbourIndices(size);
deleteMeshStructure(); deleteMeshStructure();
...@@ -1110,7 +1135,7 @@ namespace AMDiS { ...@@ -1110,7 +1135,7 @@ namespace AMDiS {
// decomposition based parallelization. Therefore we create a temporary map // decomposition based parallelization. Therefore we create a temporary map
// from macro element indices to the continous index of \ref macroElements. This // from macro element indices to the continous index of \ref macroElements. This
// will be used later to find the correct neighbours of the macro elements. // will be used later to find the correct neighbours of the macro elements.
std::map<int, int> elIndexVecIndex; map<int, int> elIndexVecIndex;
macroElements.resize(size); macroElements.resize(size);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
...@@ -1177,9 +1202,9 @@ namespace AMDiS { ...@@ -1177,9 +1202,9 @@ namespace AMDiS {
TEST_EXIT(admin.size() > 0)("No DOF admin defined!\n"); TEST_EXIT(admin.size() > 0)("No DOF admin defined!\n");
std::string macroFilename(""); string macroFilename("");
std::string valueFilename(""); string valueFilename("");
std::string periodicFilename(""); string periodicFilename("");
int check = 1; int check = 1;
GET_PARAMETER(0, name + "->macro file name", &macroFilename); GET_PARAMETER(0, name + "->macro file name", &macroFilename);
...@@ -1206,8 +1231,8 @@ namespace AMDiS { ...@@ -1206,8 +1231,8 @@ namespace AMDiS {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void Mesh::checkParallelMacroFile(std::string &macroFilename, void Mesh::checkParallelMacroFile(string &macroFilename,
std::string &periodicFilename, string &periodicFilename,
int check) int check)
{ {
FUNCNAME("Mesh::checkParallelMacroFile()"); FUNCNAME("Mesh::checkParallelMacroFile()");
...@@ -1260,7 +1285,8 @@ namespace AMDiS { ...@@ -1260,7 +1285,8 @@ namespace AMDiS {
// => gr = log_2(nProcs * 10 / nMacroElements) // => gr = log_2(nProcs * 10 / nMacroElements)
double scale = 10.0 * MPI::COMM_WORLD.Get_size() / nMacroElements; double scale = 10.0 * MPI::COMM_WORLD.Get_size() / nMacroElements;
nParallelPreRefinements = static_cast<int>(std::max(0.0, ceil(log(scale) / log(2)))); nParallelPreRefinements =
static_cast<int>(std::max(0.0, ceil(log(scale) / log(2))));
if (dim == 3) { if (dim == 3) {
int newElType = (elType + nParallelPreRefinements) % 3; int newElType = (elType + nParallelPreRefinements) % 3;
...@@ -1299,7 +1325,7 @@ namespace AMDiS { ...@@ -1299,7 +1325,7 @@ namespace AMDiS {
// === If macro weights are explicitly given, we cannot change the mesh. === // === If macro weights are explicitly given, we cannot change the mesh. ===
std::string macroWeightsFilename = ""; string macroWeightsFilename = "";
GET_PARAMETER(0, name + "->macro weights", &macroWeightsFilename); GET_PARAMETER(0, name + "->macro weights", &macroWeightsFilename);
if (macroWeightsFilename != "") { if (macroWeightsFilename != "") {
ERROR_EXIT("Should not happen!\n"); ERROR_EXIT("Should not happen!\n");
...@@ -1315,12 +1341,14 @@ namespace AMDiS { ...@@ -1315,12 +1341,14 @@ namespace AMDiS {
srand(time(NULL)); srand(time(NULL));
filenameRandomNumber = rand() % 1000000;