Commit ceecc7c5 authored by Thomas Witkowski's avatar Thomas Witkowski

* Most changes due to correct deletion of meshes

parent d43a4c28
......@@ -58,7 +58,7 @@ endif
libamdis_la_SOURCES = \
$(PARALLEL_AMDIS_SOURCES) \
$(SOURCE_DIR)/MultiGridPreconWrapper.h $(SOURCE_DIR)/MultiGridPreconWrapper.cc \
$(SOURCE_DIR)/LagrangeInterpolRestrict.h $(SOURCE_DIR)/LagrangeInterpolRestrict.cc \
$(SOURCE_DIR)/LagrangeInterpolRestrict.h \
$(SOURCE_DIR)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \
$(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \
$(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \
......@@ -84,7 +84,8 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \
$(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \
$(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \
$(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.cc $(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh $(SOURCE_DIR)/CreatorMap.cc \
$(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/ElementFunction.h \
$(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \
$(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \
......
......@@ -81,7 +81,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/MultiGridPreconWrapper.h \
$(SOURCE_DIR)/MultiGridPreconWrapper.cc \
$(SOURCE_DIR)/LagrangeInterpolRestrict.h \
$(SOURCE_DIR)/LagrangeInterpolRestrict.cc \
$(SOURCE_DIR)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \
$(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \
$(SOURCE_DIR)/InterpolRestrictMatrix.h \
......@@ -113,8 +112,8 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/ElementPartition_ED.h \
$(SOURCE_DIR)/SurfacePartition_ED.h \
$(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.cc \
$(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh \
$(SOURCE_DIR)/CreatorMap.cc $(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/ElementFunction.h \
$(SOURCE_DIR)/ProblemInterpolScal.h \
$(SOURCE_DIR)/ProblemInterpolScal.cc \
......@@ -260,7 +259,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.lo
am_libamdis_la_OBJECTS = $(am__objects_1) \
libamdis_la-MultiGridPreconWrapper.lo \
libamdis_la-LagrangeInterpolRestrict.lo \
libamdis_la-InterpolRestrictMatrix.lo \
libamdis_la-DOFIndexed.lo libamdis_la-GNUPlotWriter.lo \
libamdis_la-StlVector.lo libamdis_la-V3Vector.lo \
......@@ -501,7 +499,7 @@ INCLUDES = $(AMDIS_INCLUDES) $(PARALLEL_INCLUDES)
libamdis_la_SOURCES = \
$(PARALLEL_AMDIS_SOURCES) \
$(SOURCE_DIR)/MultiGridPreconWrapper.h $(SOURCE_DIR)/MultiGridPreconWrapper.cc \
$(SOURCE_DIR)/LagrangeInterpolRestrict.h $(SOURCE_DIR)/LagrangeInterpolRestrict.cc \
$(SOURCE_DIR)/LagrangeInterpolRestrict.h \
$(SOURCE_DIR)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \
$(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \
$(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \
......@@ -527,7 +525,8 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \
$(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \
$(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \
$(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.cc $(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh $(SOURCE_DIR)/CreatorMap.cc \
$(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/ElementFunction.h \
$(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \
$(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \
......@@ -816,7 +815,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-JacobiSmoother.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Lagrange.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-LagrangeInterpolRestrict.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-LeafData.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Line.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MacroElement.Plo@am__quote@
......@@ -944,13 +942,6 @@ libamdis_la-MultiGridPreconWrapper.lo: $(SOURCE_DIR)/MultiGridPreconWrapper.cc
@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-MultiGridPreconWrapper.lo `test -f '$(SOURCE_DIR)/MultiGridPreconWrapper.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MultiGridPreconWrapper.cc
libamdis_la-LagrangeInterpolRestrict.lo: $(SOURCE_DIR)/LagrangeInterpolRestrict.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-LagrangeInterpolRestrict.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-LagrangeInterpolRestrict.Tpo" -c -o libamdis_la-LagrangeInterpolRestrict.lo `test -f '$(SOURCE_DIR)/LagrangeInterpolRestrict.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/LagrangeInterpolRestrict.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-LagrangeInterpolRestrict.Tpo" "$(DEPDIR)/libamdis_la-LagrangeInterpolRestrict.Plo"; else rm -f "$(DEPDIR)/libamdis_la-LagrangeInterpolRestrict.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/LagrangeInterpolRestrict.cc' object='libamdis_la-LagrangeInterpolRestrict.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-LagrangeInterpolRestrict.lo `test -f '$(SOURCE_DIR)/LagrangeInterpolRestrict.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/LagrangeInterpolRestrict.cc
libamdis_la-InterpolRestrictMatrix.lo: $(SOURCE_DIR)/InterpolRestrictMatrix.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-InterpolRestrictMatrix.lo -MD -MP -MF "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Tpo" -c -o libamdis_la-InterpolRestrictMatrix.lo `test -f '$(SOURCE_DIR)/InterpolRestrictMatrix.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/InterpolRestrictMatrix.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Tpo" "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Plo"; else rm -f "$(DEPDIR)/libamdis_la-InterpolRestrictMatrix.Tpo"; exit 1; fi
......
......@@ -85,7 +85,9 @@
#include "RefinementManager2d.h"
#include "RefinementManager3d.h"
#include "RobinBC.h"
#include "SmootherBase.h"
#include "SolutionDataStorage.h"
#include "SparseVector.h"
#include "SurfaceOperator.h"
#include "SurfaceQuadrature.h"
#include "SystemVector.h"
......
......@@ -19,41 +19,38 @@ namespace AMDiS {
void CoarseningManager2d::coarsenTriangle(Triangle *el)
{
FUNCNAME("CoarseningManager2d::coarseTriangle");
Triangle *child[2];
FUNCNAME("CoarseningManager2d::coarseTriangle()");
child[0] = dynamic_cast<Triangle*>(const_cast<Element*>( el->getChild(0)));
child[1] = dynamic_cast<Triangle*>(const_cast<Element*>( el->getChild(1)));
Triangle *child[2];
child[0] = dynamic_cast<Triangle*>(const_cast<Element*>(el->getChild(0)));
child[1] = dynamic_cast<Triangle*>(const_cast<Element*>(el->getChild(1)));
TEST_EXIT_DBG(child[0]->getMark() < 0 && child[1]->getMark() < 0)
("element %d with children[%d,%d] must not be coarsend!\n",
el->getIndex(), child[0]->getIndex(), child[1]->getIndex());
if (mesh->getNumberOfDOFs(EDGE))
{
/****************************************************************************/
/* remove dof from common edge of child[0] and child[1] */
/****************************************************************************/
mesh->freeDOF(const_cast<int*>( child[0]->getDOF(4)), EDGE);
}
if (mesh->getNumberOfDOFs(CENTER))
{
/****************************************************************************/
/* remove dof from the barycenters of child[0] and child[1] */
/****************************************************************************/
int node = mesh->getNode(CENTER);
mesh->freeDOF(const_cast<int*>( child[0]->getDOF(node)), CENTER);
mesh->freeDOF(const_cast<int*>( child[1]->getDOF(node)), CENTER);
}
if (mesh->getNumberOfDOFs(EDGE)) {
/****************************************************************************/
/* remove dof from common edge of child[0] and child[1] */
/****************************************************************************/
mesh->freeDOF(const_cast<int*>(child[0]->getDOF(4)), EDGE);
}
if (mesh->getNumberOfDOFs(CENTER)) {
/****************************************************************************/
/* remove dof from the barycenters of child[0] and child[1] */
/****************************************************************************/
int node = mesh->getNode(CENTER);
mesh->freeDOF(const_cast<int*>(child[0]->getDOF(node)), CENTER);
mesh->freeDOF(const_cast<int*>(child[1]->getDOF(node)), CENTER);
}
el->coarsenElementData(child[0], child[1]);
el->setFirstChild(NULL);
el->setSecondChild(NULL);
mesh->freeElement(child[0]);
mesh->freeElement(child[1]);
......@@ -72,8 +69,8 @@ namespace AMDiS {
/****************************************************************************/
void CoarseningManager2d::coarsenPatch(RCNeighbourList *coarsenList,
int n_neigh,
int bound)
int n_neigh,
int bound)
{
Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>( coarsenList->getElement(0)));
Triangle *neigh = dynamic_cast<Triangle*>(const_cast<Element*>( coarsenList->getElement(1)));
......@@ -195,9 +192,7 @@ namespace AMDiS {
if (coarse_list.doCoarsePatch(n_neigh)) {
int n_neigh_periodic;
DegreeOfFreedom *next_edge[2];
RCNeighbourList *periodicList;
while (edge[0] != NULL) {
......
......@@ -40,7 +40,7 @@ namespace AMDiS {
class CreatorInterface
{
public:
virtual ~CreatorInterface() {};
virtual ~CreatorInterface() {}
/** \brief
* Must be implemented by sub classes of CreatorInterface.
......@@ -51,14 +51,14 @@ namespace AMDiS {
/** \brief
* Can be implemented by sub classes.
*/
virtual void free(BaseClass *) {};
virtual void free(BaseClass *) {}
/** \brief
*
*/
virtual bool isNullCreator() {
return false;
};
}
};
/** \brief
......@@ -73,14 +73,14 @@ namespace AMDiS {
*/
BaseClass* create() {
return NULL;
};
}
/** \brief
*
*/
virtual bool isNullCreator() {
return true;
};
}
};
}
......
......@@ -261,5 +261,4 @@ namespace AMDiS {
creator = NEW ElementRegion_ED::Creator;
addCreator("ElementRegion_ED", creator);
}
}
......@@ -39,63 +39,66 @@ namespace AMDiS {
* to the map.
*/
template<typename BaseClass>
class CreatorMap
class CreatorMap
{
public:
/** \brief
* Adds a new creator together with the given key to the map.
*/
static void addCreator(std::string key, CreatorInterface<BaseClass>* creator)
{
public:
/** \brief
* Adds a new creator together with the given key to the map.
*/
static void addCreator(std::string key, CreatorInterface<BaseClass>* creator)
{
FUNCNAME("CreatorMap::addCreator()");
init();
TEST_EXIT(creatorMap[key] == NULL)
("there is already a creator for key %s\n",key.c_str());
creatorMap[key] = creator;
};
/** \brief
* Creates a object of the type corresponding to key.
*/
static CreatorInterface<BaseClass>* getCreator(std::string key) {
FUNCNAME("CreatorMap::getCreator()");
init();
CreatorInterface<BaseClass> *creator = creatorMap[key];
TEST_EXIT(creator)("no creator for key %s\n", key.c_str());
return creator;
};
static void addDefaultCreators();
protected:
/** \brief
* Constructor is protected because derived maps should be singleton.
*/
static void init() {
if(!initialized) {
initialized = true;
NullCreator<BaseClass> *nullCreator = new NullCreator<BaseClass>;
addCreator("no", nullCreator);
addCreator("0", nullCreator);
addDefaultCreators();
}
};
protected:
/** \brief
* STL map containing the pairs of keys and creators.
*/
static std::map< std::string, CreatorInterface<BaseClass>* > creatorMap;
static bool initialized;
};
FUNCNAME("CreatorMap::addCreator()");
init();
TEST_EXIT(creatorMap[key] == NULL)
("there is already a creator for key %s\n",key.c_str());
creatorMap[key] = creator;
}
/** \brief
* Creates a object of the type corresponding to key.
*/
static CreatorInterface<BaseClass>* getCreator(std::string key) {
FUNCNAME("CreatorMap::getCreator()");
init();
CreatorInterface<BaseClass> *creator = creatorMap[key];
TEST_EXIT(creator)("no creator for key %s\n", key.c_str());
return creator;
}
static void clear();
static void addDefaultCreators();
protected:
/** \brief
* Constructor is protected because derived maps should be singleton.
*/
static void init() {
if (!initialized) {
initialized = true;
NullCreator<BaseClass> *nullCreator = new NullCreator<BaseClass>;
addCreator("no", nullCreator);
addDefaultCreators();
}
}
protected:
/** \brief
* STL map containing the pairs of keys and creators.
*/
static std::map< std::string, CreatorInterface<BaseClass>* > creatorMap;
static bool initialized;
};
template<typename BaseClass>
std::map< std::string, CreatorInterface<BaseClass>* > CreatorMap<BaseClass>::creatorMap;
std::map< std::string, CreatorInterface<BaseClass>* > CreatorMap<BaseClass>::creatorMap;
template<typename BaseClass>
bool CreatorMap<BaseClass>::initialized = false;
bool CreatorMap<BaseClass>::initialized = false;
}
#include "CreatorMap.hh"
#endif
#include "MemoryManager.h"
#include <map>
namespace AMDiS {
template<typename BaseClass>
void CreatorMap<BaseClass>::clear()
{
typename std::map< std::string, CreatorInterface<BaseClass>* >::iterator it;
for (it = creatorMap.begin();
it != creatorMap.end();
++it) {
DELETE it->second;
}
}
}
......@@ -61,10 +61,15 @@ namespace AMDiS {
{
FUNCNAME("DOFMatrix::~DOFMatrix()");
matrix.clear();
if (rowFESpace && rowFESpace->getAdmin()) {
(const_cast<DOFAdmin*>(rowFESpace->getAdmin()))->removeDOFIndexed(this);
}
if (boundaryManager)
DELETE boundaryManager;
if (elementMatrix)
DELETE elementMatrix;
}
......
......@@ -7,18 +7,18 @@
namespace AMDiS {
std::map<DegreeOfFreedom*, bool> Element::deletedDOFs;
int Element::getRegion() const
{
ElementRegion_ED* red_;
if (!elementData)
return -1;
red_ = dynamic_cast<ElementRegion_ED*>(elementData->getElementData(ELEMENT_REGION));
ElementRegion_ED* red = dynamic_cast<ElementRegion_ED*>(elementData->getElementData(ELEMENT_REGION));
if (red_)
return red_->getRegion();
if (red) {
return red->getRegion();
}
return -1;
}
......@@ -35,12 +35,9 @@ namespace AMDiS {
Element::Element(Mesh *aMesh)
{
mesh = aMesh;
index = mesh ? mesh->getNextElementIndex() : -1;
child[0] = NULL;
child[1] = NULL;
newCoord = NULL;
elementData = NULL;
......@@ -53,7 +50,7 @@ namespace AMDiS {
// call destructor through Mesh::freeElement !!!
Element::~Element()
{
{
if (child[0]) {
DELETE child[0];
}
......@@ -64,6 +61,29 @@ namespace AMDiS {
if (newCoord) {
DELETE newCoord;
}
if (elementData) {
elementData->deleteDecorated();
DELETE elementData;
}
}
bool Element::deleteElementData(int typeID)
{
FUNCNAME("Element::deleteElementData()");
if (elementData) {
if (elementData->isOfType(typeID)) {
ElementData *tmp = elementData;
elementData = elementData->getDecorated();
DELETE tmp;
tmp = NULL;
return true;
} else {
return elementData->deleteDecorated(typeID);
}
}
return false;
}
void Element::deleteElementDOFs()
......@@ -81,22 +101,19 @@ namespace AMDiS {
if (ndof > 0) {
for (int i = 0; i < mesh->getGeo(position); i++) {
if (dof[j] != NULL) {
if (Mesh::serializedDOFs.count(dof[j][0]) == 0) {
// std::cout << "FREE INNER: " << ndof << std::endl;
if (dof[j]) {
if (deletedDOFs.count(dof[j]) == 0) {
deletedDOFs[dof[j]] = true;
FREE_MEMORY(dof[j], DegreeOfFreedom, ndof);
Mesh::serializedDOFs[dof[j][0]] = NULL;
}
}
}
j++;
}
}
}
// std::cout << "FREE OUTER: " << mesh->getNumberOfNodes() << std::endl;
FREE_MEMORY(dof, DegreeOfFreedom*, mesh->getNumberOfNodes());
if (child[0]) {
child[0]->deleteElementDOFs();
}
......@@ -108,14 +125,16 @@ namespace AMDiS {
Element* Element::cloneWithDOFs()
{
Element *el;
if (isLine()) {
el = NEW Line(mesh);
el = NEW Line(NULL);
} else if (isTriangle()) {
el = NEW Triangle(mesh);
el = NEW Triangle(NULL);
} else {
el = NEW Tetrahedron(mesh);
el = NEW Tetrahedron(NULL);
}
el->mesh = mesh;
el->index = index;
el->mark = mark;
if (newCoord) {
......@@ -123,9 +142,9 @@ namespace AMDiS {
*nc = *newCoord;
el->newCoord = nc;
}
/* =========== And here we clone the DOFs =========== */
el->dof = GET_MEMORY(DegreeOfFreedom*, mesh->getNumberOfNodes());
int dim = mesh->getDim();
......@@ -158,7 +177,7 @@ namespace AMDiS {
}
}
}
/* =========== And clone the children ============= */
if (child[0]) {
......
......@@ -464,7 +464,7 @@ namespace AMDiS {
/** \brief
* Coarsens Element's leaf data
*/
inline void coarsenElementData(Element* child1, Element* child2, int elType=0) {
inline void coarsenElementData(Element* child1, Element* child2, int elType = 0) {
ElementData *childData;
childData = child1->getElementData();
if (childData) {
......@@ -498,22 +498,9 @@ namespace AMDiS {
}
/** \brief
* kills \ref elementData
* Deletes the \ref elementData with a specific typeID.
*/
bool deleteElementData(int typeID) {
FUNCNAME("Element::deleteElementData()");
if (elementData) {
if (elementData->isOfType(typeID)) {
ElementData *tmp = elementData;
elementData = elementData->getDecorated();
DELETE tmp;
return true;
} else {
return elementData->deleteDecorated(typeID);
}
}
return false;
}
bool deleteElementData(int typeID);
/** \brief
* Returns whether element is refined at side side
......@@ -620,6 +607,12 @@ namespace AMDiS {
ElementData* elementData;
/** \brief
* This map is used for deletion of all DOFs of all elements of a mesh. Once
* a DOF-vector (all DOFS at a node, edge, etc.) is deleted, its address is
* added to this map to note not to delete it a second time.
*/
static std::map<DegreeOfFreedom*, bool> deletedDOFs;
friend class Mesh;
};
......
#include "MemoryManager.h"
#include "ElementData.h"
namespace AMDiS {
void ElementData::serialize(std::ostream& out) {
void ElementData::coarsenElementData(Element* parent,
Element* thisChild,
Element* otherChild,
int elTypeParent)
{
if (decorated_) {
decorated_->coarsenElementData(parent, thisChild, otherChild, elTypeParent);
delete decorated_;
decorated_ = NULL;
}
}
bool ElementData::deleteDecorated(int typeID)
{
if (decorated_) {
if (decorated_->isOfType(typeID)) {
ElementData *tmp = decorated_;
decorated_ = decorated_->decorated_;
delete tmp;
tmp = NULL;
return true;
} else {
return decorated_->deleteDecorated(typeID);
}
}
return false;
}
void ElementData::deleteDecorated()
{
if (decorated_) {
decorated_->deleteDecorated();
DELETE decorated_;
}
}
ElementData::~ElementData()
{
}
void ElementData::serialize(std::ostream& out)
{
std::string decoratedType;
if (decorated_) {
decoratedType = decorated_->getTypeName();
......@@ -13,7 +55,8 @@ namespace AMDiS {
}
}
void ElementData::deserialize(std::istream& in) {
void ElementData::deserialize(std::istream& in)
{
TEST_EXIT(decorated_ == NULL)
("there are already decorated element data\n");
std::string decoratedType;
......@@ -24,7 +67,7 @@ namespace AMDiS {
decorated_->deserialize(in);
} else {
decorated_ = NULL;
};