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)
find_package(PETSc REQUIRED)
include_directories(${PETSC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/include)
SET(PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectData.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
......
......@@ -77,7 +77,7 @@ ifeq ($(strip $(USE_PARALLEL_AMDIS)), 1)
endif
CPPFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS
INCLUDES += $(PETSC_INCLUDE)
INCLUDES += $(PETSC_CC_INCLUDES)
LIBS += $(PARMETIS_LIB) -lmpi $(PETSC_LIB)
LIBS += $(ZOLTAN_LIB)
else
......
......@@ -18,6 +18,7 @@
#include "ElementRegion_ED.h"
#include "Serializer.h"
#include "MeshStructure.h"
#include "BasisFunction.h"
namespace AMDiS {
......@@ -622,4 +623,15 @@ namespace AMDiS {
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 {
virtual int getChildType(int elType) const = 0;
/** \brief
* Traverses an edge/face of a given element (this includes also all children of
* the element having the same edge/face). All vertex dofs alonge this edge/face
* are assembled and put together to a list.
* Traverses a vertex/edge/face of a given element (this includes also all
* children of the element having the same edge/face). All DOFs on mesh
* 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] bound Defines the edge/face of the element on which
* all vertex dofs are assembled.
* \param[in] bound Defines the vertex/edge/face of the element on
* which all vertex dofs are assembled.
* \param[out] dofs List of dofs, where the result is stored.
*/
virtual void getVertexDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs) const = 0;
virtual void getNodeDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs) const = 0;
/** \brief
* Traverses an edge/face of a given element (this includes also all children of
* the element having the same edge/face). All non vertex dofs alonge this edge/face
* are assembled and put together to a list.
* Traverses a vertex/edge/face of a given element (this includes also all
* children of the element having the same edge/face). All DOFs belonging
* 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] bound Defines the edge/face of the element on which
* all non vertex dofs are assembled.
* \param[out] dofs All dofs are put to this dof list.
*/
virtual void getNonVertexDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs) const = 0;
virtual void getHigherOrderDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs) const = 0;
void getAllDofs(FiniteElemSpace* feSpace,
BoundaryObject bound,
DofContainer& dofs);
/** \} */
......
......@@ -173,15 +173,15 @@ namespace AMDiS {
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");
}
void getNonVertexDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const
void getHigherOrderDofs(FiniteElemSpace*, BoundaryObject, DofContainer&) const
{
FUNCNAME("Line::getNonVertexDofs()");
FUNCNAME("Line::getHigherOrderDofs()");
ERROR_EXIT("Not yet implemented!\n");
}
......
......@@ -12,6 +12,7 @@ PARALLEL_INCLUDES =
if USE_PARALLEL_DOMAIN_AMDIS
PARALLEL_AMDIS_SOURCES += \
parallel/CheckerPartitioner.cc \
parallel/ElementObjectData.cc \
parallel/MeshDistributor.cc \
parallel/MeshManipulation.cc \
......@@ -247,6 +248,7 @@ io/ValueWriter.h \
io/VtkWriter.h \
io/VtkWriter.hh \
itl/minres.hpp \
parallel/CheckerPartitioner.h \
parallel/ElementObjectData.h \
parallel/InteriorBoundary.h \
parallel/MeshDistributor.h \
......
......@@ -38,6 +38,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@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/MeshDistributor.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ parallel/MeshManipulation.cc \
......@@ -88,10 +89,11 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libamdis_la_LIBADD =
am__libamdis_la_SOURCES_DIST = parallel/ElementObjectData.cc \
parallel/MeshDistributor.cc parallel/MeshManipulation.cc \
parallel/MeshPartitioner.cc parallel/MpiHelper.cc \
parallel/ParallelDebug.cc parallel/ParallelProblemStatBase.cc \
am__libamdis_la_SOURCES_DIST = parallel/CheckerPartitioner.cc \
parallel/ElementObjectData.cc parallel/MeshDistributor.cc \
parallel/MeshManipulation.cc parallel/MeshPartitioner.cc \
parallel/MpiHelper.cc parallel/ParallelDebug.cc \
parallel/ParallelProblemStatBase.cc \
parallel/ParMetisPartitioner.cc parallel/PetscProblemStat.cc \
parallel/PetscSolver.cc parallel/StdMpi.cc \
parallel/ZoltanPartitioner.cc AdaptBase.cc AdaptInfo.cc \
......@@ -130,7 +132,8 @@ am__libamdis_la_SOURCES_DIST = parallel/ElementObjectData.cc \
io/ValueWriter.cc io/VtkWriter.cc parallel/InteriorBoundary.cc \
time/RosenbrockAdaptInstationary.cc time/RosenbrockMethod.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-MeshManipulation.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MeshPartitioner.lo \
......@@ -568,6 +571,7 @@ io/ValueWriter.h \
io/VtkWriter.h \
io/VtkWriter.hh \
itl/minres.hpp \
parallel/CheckerPartitioner.h \
parallel/ElementObjectData.h \
parallel/InteriorBoundary.h \
parallel/MeshDistributor.h \
......@@ -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-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-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-CoarseningManager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-CoarseningManager1d.Plo@am__quote@
......@@ -976,6 +981,13 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@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
@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
......
......@@ -77,11 +77,11 @@ namespace AMDiS {
const Flag Mesh::CALL_REVERSE_MODE = 0X8000L;
std::vector<DegreeOfFreedom> Mesh::dof_used;
vector<DegreeOfFreedom> Mesh::dof_used;
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),
dim(dimension),
nVertices(0),
......@@ -186,7 +186,7 @@ namespace AMDiS {
// mapIndex[i] is the index of the MacroElement element in the vector
// 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
// MacroElements objects.
......@@ -198,7 +198,7 @@ namespace AMDiS {
// Go through all MacroElements of mesh m, and create for every a new
// 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++) {
// Create new MacroElement.
......@@ -214,13 +214,13 @@ namespace AMDiS {
macroElements.push_back(el);
// 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
// connections.
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, insertCounter++) {
// Go through all neighbours.
......@@ -275,8 +275,8 @@ namespace AMDiS {
{
FUNCNAME("Mesh::removeMacroElement()");
typedef std::map<const DegreeOfFreedom*, std::set<MacroElement*> > DofElMap;
typedef std::map<const DegreeOfFreedom*, GeoIndex> DofPosMap;
typedef map<const DegreeOfFreedom*, std::set<MacroElement*> > DofElMap;
typedef map<const DegreeOfFreedom*, GeoIndex> DofPosMap;
TEST_EXIT(admin.size() == 1)("Not yet implemented for multiple admins!\n");
TEST_EXIT(admin[0])("There is something wrong!\n");
......@@ -305,12 +305,12 @@ namespace AMDiS {
// === 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
// macro element deque is than replaced by the new created one.
std::deque<MacroElement*> newMacroElements;
for (std::deque<MacroElement*>::iterator elIter = macroElements.begin();
deque<MacroElement*> newMacroElements;
for (deque<MacroElement*>::iterator elIter = macroElements.begin();
elIter != macroElements.end(); ++elIter) {
// 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
......@@ -416,7 +416,7 @@ namespace AMDiS {
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",
localAdmin->getName().c_str(), this->getName().c_str());
......@@ -479,7 +479,7 @@ namespace AMDiS {
compressAdmin->getHoleCount() < 1)
continue;
std::vector<int> newDofIndex(size);
vector<int> newDofIndex(size);
compressAdmin->compress(newDofIndex);
Flag fill_flag = (preserveCoarseDOFs ?
......@@ -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()");
......@@ -905,10 +905,12 @@ namespace AMDiS {
const FiniteElemSpace* feSpace,
WorldVector<double>& coords)
{
FUNCNAME("Mesh::getDofIndexCoords()");
DimVec<double>* baryCoords;
bool found = false;
TraverseStack stack;
std::vector<DegreeOfFreedom> dofVec(feSpace->getBasisFcts()->getNumber());
vector<DegreeOfFreedom> dofVec(feSpace->getBasisFcts()->getNumber());
ElInfo *elInfo = stack.traverseFirst(this, -1,
Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS);
......@@ -938,9 +940,11 @@ namespace AMDiS {
void Mesh::getDofIndexCoords(const FiniteElemSpace* feSpace,
DOFVector<WorldVector<double> >& coords)
{
FUNCNAME("Mesh::getDofIndexCoords()");
const BasisFunction* basFcts = feSpace->getBasisFcts();
int nBasFcts = basFcts->getNumber();
std::vector<DegreeOfFreedom> dofVec(nBasFcts);
vector<DegreeOfFreedom> dofVec(nBasFcts);
TraverseStack stack;
ElInfo *elInfo =
......@@ -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)
{
diam = w;
......@@ -970,7 +995,7 @@ namespace AMDiS {
}
void Mesh::serialize(std::ostream &out)
void Mesh::serialize(ostream &out)
{
serializedDOFs.clear();
......@@ -1022,7 +1047,7 @@ namespace AMDiS {
// === Write periodic associations. ===
int mapSize = periodicAssociations.size();
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) {
BoundaryType b = it->first;
......@@ -1046,7 +1071,7 @@ namespace AMDiS {
}
void Mesh::deserialize(std::istream &in)
void Mesh::deserialize(istream &in)
{
FUNCNAME("Mesh::deserialize()");
......@@ -1100,7 +1125,7 @@ namespace AMDiS {
}
SerUtil::deserialize(in, size);
std::vector< std::vector<int> > neighbourIndices(size);
vector< vector<int> > neighbourIndices(size);
deleteMeshStructure();
......@@ -1110,7 +1135,7 @@ namespace AMDiS {
// decomposition based parallelization. Therefore we create a temporary map
// 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.
std::map<int, int> elIndexVecIndex;
map<int, int> elIndexVecIndex;
macroElements.resize(size);
for (int i = 0; i < size; i++) {
......@@ -1177,9 +1202,9 @@ namespace AMDiS {
TEST_EXIT(admin.size() > 0)("No DOF admin defined!\n");
std::string macroFilename("");
std::string valueFilename("");
std::string periodicFilename("");
string macroFilename("");
string valueFilename("");
string periodicFilename("");
int check = 1;
GET_PARAMETER(0, name + "->macro file name", &macroFilename);
......@@ -1206,8 +1231,8 @@ namespace AMDiS {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void Mesh::checkParallelMacroFile(std::string &macroFilename,
std::string &periodicFilename,
void Mesh::checkParallelMacroFile(string &macroFilename,
string &periodicFilename,
int check)
{
FUNCNAME("Mesh::checkParallelMacroFile()");
......@@ -1260,7 +1285,8 @@ namespace AMDiS {
// => gr = log_2(nProcs * 10 / 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) {
int newElType = (elType + nParallelPreRefinements) % 3;
......@@ -1299,7 +1325,7 @@ namespace AMDiS {
// === If macro weights are explicitly given, we cannot change the mesh. ===
std::string macroWeightsFilename = "";
string macroWeightsFilename = "";
GET_PARAMETER(0, name + "->macro weights", &macroWeightsFilename);
if (macroWeightsFilename != "") {
ERROR_EXIT("Should not happen!\n");
......@@ -1315,12 +1341,14 @@ namespace AMDiS {
srand(time(NULL));
filenameRandomNumber = rand() % 1000000;
}
MPI::COMM_WORLD.Barrier();
MPI::COMM_WORLD.Bcast(&filenameRandomNumber, 1, MPI_INT, 0);
MPI::COMM_WORLD.Barrier();
std::stringstream newMacroFilename;
stringstream newMacroFilename;
newMacroFilename << macroFilename << "." << filenameRandomNumber << ".tmp";
std::stringstream newPeriodicFilename;
stringstream newPeriodicFilename;
newPeriodicFilename << periodicFilename << "." << filenameRandomNumber << ".tmp";
......@@ -1363,7 +1391,7 @@ namespace AMDiS {
else
globalRefinements -= nParallelPreRefinements;
std::stringstream oss;
stringstream oss;
oss << globalRefinements;
ADD_PARAMETER(0, name + "->global refinements", oss.str().c_str());
......@@ -1382,8 +1410,8 @@ namespace AMDiS {
bool Mesh::associated(DegreeOfFreedom dof1, DegreeOfFreedom dof2)
{
std::map<BoundaryType, VertexVector*>::iterator it;
std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
map<BoundaryType, VertexVector*>::iterator it;
map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
for (it = periodicAssociations.begin(); it != end; ++it)
if ((*(it->second))[dof1] == dof2)
return true;
......@@ -1394,9 +1422,9 @@ namespace AMDiS {
bool Mesh::indirectlyAssociated(DegreeOfFreedom dof1, DegreeOfFreedom dof2)
{
std::vector<DegreeOfFreedom> associatedToDOF1;
std::map<BoundaryType, VertexVector*>::iterator it;
std::map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
vector<DegreeOfFreedom> associatedToDOF1;
map<BoundaryType, VertexVector*>::iterator it;
map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
DegreeOfFreedom dof, assDOF;
associatedToDOF1.push_back(dof1);
......@@ -1444,7 +1472,7 @@ namespace AMDiS {
{
Element::deletedDOFs.clear();
for (std::deque<MacroElement*>::const_iterator it = macroElements.begin();
for (deque<MacroElement*>::const_iterator it = macroElements.begin();
it != macroElements.end(); ++it) {
(*it)->getElement()->deleteElementDOFs();
delete *it;
......
......@@ -50,6 +50,9 @@
namespace AMDiS {
using namespace std;
/** \ingroup Triangulation
* \brief
* A Mesh holds all information about a triangulation.
......@@ -58,7 +61,7 @@ namespace AMDiS {
{
public:
/// Creates a mesh with the given name of dimension dim
Mesh(std::string name, int dim);
Mesh(string name, int dim);
/// Destructor
virtual ~Mesh();
......@@ -83,7 +86,7 @@ namespace AMDiS {
}
/// Returns \ref name of the mesh
inline std::string getName() const
inline string getName() const
{
return name;
}
......@@ -197,7 +200,7 @@ namespace AMDiS {
* are needed at the different positions (see \ref DOFAdmin::nrDOF).
* A pointer to the created DOFAdmin is returned.
*/
const DOFAdmin* createDOFAdmin(std::string lname, DimVec<int> nDof);
const DOFAdmin* createDOFAdmin(string lname, DimVec<int> nDof);
/** \brief
* Returns the size of \ref admin which is the number of the DOFAdmins
......@@ -230,7 +233,7 @@ namespace AMDiS {
}
/// Returns an iterator to the begin of \ref macroElements
inline std::deque<MacroElement*>::iterator firstMacroElement()
inline deque<MacroElement*>::iterator firstMacroElement()
{
return macroElements.begin();
}
......@@ -242,13 +245,13 @@ namespace AMDiS {
}
/// Returns an iterator to the end of \ref macroElements
inline std::deque<MacroElement*>::iterator endOfMacroElements()
inline deque<MacroElement*>::iterator endOfMacroElements()
{
return macroElements.end();
}
/// Returns \ref macroElements, the list of all macro elements in the mesh.
std::deque<MacroElement*>& getMacroElements()
deque<MacroElement*>& getMacroElements()
{
return macroElements;
}
......@@ -260,7 +263,7 @@ namespace AMDiS {
*/
/// Sets \ref name of the mesh
inline void setName(std::string aName)
inline void setName(string aName)
{
name = aName;
}
......@@ -496,16 +499,25 @@ namespace AMDiS {
WorldVector<double>& coords);
/** \brief
* Traverse the whole mesh and stores to each DOF of the given finite element space
* the coordinates in a given DOFVector. Works in the same way as the function
* \ref getDofIndexCoords defined above.
* Traverse the whole mesh and stores to each DOF of the given finite
* element space the coordinates in a given DOFVector. Works in the same
* way as the function \ref getDofIndexCoords defined above.
*
* @param[in] feSpace The fe soace to be used for the search.
* @param[out] coords DOF vector that stores the coordinates to each dof.
* @param[in] feSpace The FE space to be used for the search.
* @param[out] coords DOF vector that stores the coordinates to each DOF.
*/
void getDofIndexCoords(const FiniteElemSpace* feSpace,
DOFVector<WorldVector<double> >& coords);
/** \brief
* Traverse the mesh and get all DOFs in this mesh for a given FE space.
*
* @param[in] feSpace The FE space to be used for collecting DOFs.
* @param[out] allDofs The set which is filled with all DOFs.
*/
void getAllDofs(FiniteElemSpace *feSpace,
std::set<const DegreeOfFreedom*>& allDofs);
/// Returns FILL_ANY_?D
inline static const Flag& getFillAnyFlag(int dim)
{
......@@ -526,10 +538,10 @@ namespace AMDiS {
}
/// Serialize the mesh to a file.
void serialize(std::ostream &out);
void serialize(ostream &out);
/// Deserialize a mesh from a file.
void deserialize(std::istream &in);
void deserialize(istream &in);
/// Returns \ref elementIndex and increments it by 1.
inline int getNextElementIndex()
......@@ -544,7 +556,7 @@ namespace AMDiS {
}
///
inline std::map<BoundaryType, VertexVector*>& getPeriodicAssociations()
inline map<BoundaryType, VertexVector*>& getPeriodicAssociations()
{
return periodicAssociations;
}
......@@ -707,8 +719,8 @@ namespace AMDiS {
* AMDiS macro mesh, the value must be 1 and 0
* otherwise.
*/
void checkParallelMacroFile(std::string &macroFilename,
std::string &periodicFilename,
void checkParallelMacroFile(string &macroFilename,
string &periodicFilename,
int check);
#endif
......@@ -717,7 +729,7 @@ namespace AMDiS {
static const int MAX_DOF;