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 ...@@ -58,7 +58,7 @@ endif
libamdis_la_SOURCES = \ libamdis_la_SOURCES = \
$(PARALLEL_AMDIS_SOURCES) \ $(PARALLEL_AMDIS_SOURCES) \
$(SOURCE_DIR)/MultiGridPreconWrapper.h $(SOURCE_DIR)/MultiGridPreconWrapper.cc \ $(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)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \
$(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \ $(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \
$(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \ $(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \
...@@ -84,7 +84,8 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \ ...@@ -84,7 +84,8 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \
$(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \ $(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \
$(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \ $(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \
$(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \ $(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)/ElementFunction.h \
$(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \ $(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \
$(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \ $(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \
......
...@@ -81,7 +81,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ ...@@ -81,7 +81,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/MultiGridPreconWrapper.h \ $(SOURCE_DIR)/MultiGridPreconWrapper.h \
$(SOURCE_DIR)/MultiGridPreconWrapper.cc \ $(SOURCE_DIR)/MultiGridPreconWrapper.cc \
$(SOURCE_DIR)/LagrangeInterpolRestrict.h \ $(SOURCE_DIR)/LagrangeInterpolRestrict.h \
$(SOURCE_DIR)/LagrangeInterpolRestrict.cc \
$(SOURCE_DIR)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \ $(SOURCE_DIR)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \
$(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \ $(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \
$(SOURCE_DIR)/InterpolRestrictMatrix.h \ $(SOURCE_DIR)/InterpolRestrictMatrix.h \
...@@ -113,8 +112,8 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ ...@@ -113,8 +112,8 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
$(SOURCE_DIR)/ElementPartition_ED.h \ $(SOURCE_DIR)/ElementPartition_ED.h \
$(SOURCE_DIR)/SurfacePartition_ED.h \ $(SOURCE_DIR)/SurfacePartition_ED.h \
$(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \ $(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \
$(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.cc \ $(SOURCE_DIR)/CreatorMap.h $(SOURCE_DIR)/CreatorMap.hh \
$(SOURCE_DIR)/CreatorInterface.h \ $(SOURCE_DIR)/CreatorMap.cc $(SOURCE_DIR)/CreatorInterface.h \
$(SOURCE_DIR)/ElementFunction.h \ $(SOURCE_DIR)/ElementFunction.h \
$(SOURCE_DIR)/ProblemInterpolScal.h \ $(SOURCE_DIR)/ProblemInterpolScal.h \
$(SOURCE_DIR)/ProblemInterpolScal.cc \ $(SOURCE_DIR)/ProblemInterpolScal.cc \
...@@ -260,7 +259,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \ ...@@ -260,7 +259,6 @@ am__libamdis_la_SOURCES_DIST = $(PARALLEL_DIR)/ConditionalEstimator.h \
@USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.lo @USE_PARALLEL_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.lo
am_libamdis_la_OBJECTS = $(am__objects_1) \ am_libamdis_la_OBJECTS = $(am__objects_1) \
libamdis_la-MultiGridPreconWrapper.lo \ libamdis_la-MultiGridPreconWrapper.lo \
libamdis_la-LagrangeInterpolRestrict.lo \
libamdis_la-InterpolRestrictMatrix.lo \ libamdis_la-InterpolRestrictMatrix.lo \
libamdis_la-DOFIndexed.lo libamdis_la-GNUPlotWriter.lo \ libamdis_la-DOFIndexed.lo libamdis_la-GNUPlotWriter.lo \
libamdis_la-StlVector.lo libamdis_la-V3Vector.lo \ libamdis_la-StlVector.lo libamdis_la-V3Vector.lo \
...@@ -501,7 +499,7 @@ INCLUDES = $(AMDIS_INCLUDES) $(PARALLEL_INCLUDES) ...@@ -501,7 +499,7 @@ INCLUDES = $(AMDIS_INCLUDES) $(PARALLEL_INCLUDES)
libamdis_la_SOURCES = \ libamdis_la_SOURCES = \
$(PARALLEL_AMDIS_SOURCES) \ $(PARALLEL_AMDIS_SOURCES) \
$(SOURCE_DIR)/MultiGridPreconWrapper.h $(SOURCE_DIR)/MultiGridPreconWrapper.cc \ $(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)/BiCGStab.h $(SOURCE_DIR)/BiCGStab.hh \
$(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \ $(SOURCE_DIR)/BiCGStab2.h $(SOURCE_DIR)/BiCGStab2.hh \
$(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \ $(SOURCE_DIR)/InterpolRestrictMatrix.h $(SOURCE_DIR)/InterpolRestrictMatrix.cc \
...@@ -527,7 +525,8 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \ ...@@ -527,7 +525,8 @@ $(SOURCE_DIR)/ProblemVec.h $(SOURCE_DIR)/ProblemVec.cc \
$(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \ $(SOURCE_DIR)/DualTraverse.h $(SOURCE_DIR)/DualTraverse.cc \
$(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \ $(SOURCE_DIR)/ElementPartition_ED.h $(SOURCE_DIR)/SurfacePartition_ED.h \
$(SOURCE_DIR)/ElementData.h $(SOURCE_DIR)/ElementData.cc \ $(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)/ElementFunction.h \
$(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \ $(SOURCE_DIR)/ProblemInterpolScal.h $(SOURCE_DIR)/ProblemInterpolScal.cc \
$(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \ $(SOURCE_DIR)/ProblemInterpolVec.h $(SOURCE_DIR)/ProblemInterpolVec.cc \
...@@ -816,7 +815,6 @@ distclean-compile: ...@@ -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-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-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-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-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-Line.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MacroElement.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 ...@@ -944,13 +942,6 @@ libamdis_la-MultiGridPreconWrapper.lo: $(SOURCE_DIR)/MultiGridPreconWrapper.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @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-MultiGridPreconWrapper.lo `test -f '$(SOURCE_DIR)/MultiGridPreconWrapper.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/MultiGridPreconWrapper.cc @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 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@ 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 @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 @@ ...@@ -85,7 +85,9 @@
#include "RefinementManager2d.h" #include "RefinementManager2d.h"
#include "RefinementManager3d.h" #include "RefinementManager3d.h"
#include "RobinBC.h" #include "RobinBC.h"
#include "SmootherBase.h"
#include "SolutionDataStorage.h" #include "SolutionDataStorage.h"
#include "SparseVector.h"
#include "SurfaceOperator.h" #include "SurfaceOperator.h"
#include "SurfaceQuadrature.h" #include "SurfaceQuadrature.h"
#include "SystemVector.h" #include "SystemVector.h"
......
...@@ -19,41 +19,38 @@ namespace AMDiS { ...@@ -19,41 +19,38 @@ namespace AMDiS {
void CoarseningManager2d::coarsenTriangle(Triangle *el) void CoarseningManager2d::coarsenTriangle(Triangle *el)
{ {
FUNCNAME("CoarseningManager2d::coarseTriangle"); FUNCNAME("CoarseningManager2d::coarseTriangle()");
Triangle *child[2];
child[0] = dynamic_cast<Triangle*>(const_cast<Element*>( el->getChild(0))); Triangle *child[2];
child[1] = dynamic_cast<Triangle*>(const_cast<Element*>( el->getChild(1))); 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) TEST_EXIT_DBG(child[0]->getMark() < 0 && child[1]->getMark() < 0)
("element %d with children[%d,%d] must not be coarsend!\n", ("element %d with children[%d,%d] must not be coarsend!\n",
el->getIndex(), child[0]->getIndex(), child[1]->getIndex()); el->getIndex(), child[0]->getIndex(), child[1]->getIndex());
if (mesh->getNumberOfDOFs(EDGE)) if (mesh->getNumberOfDOFs(EDGE)) {
{ /****************************************************************************/
/****************************************************************************/ /* remove dof from common edge of child[0] and child[1] */
/* remove dof from common edge of child[0] and child[1] */ /****************************************************************************/
/****************************************************************************/ mesh->freeDOF(const_cast<int*>(child[0]->getDOF(4)), EDGE);
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(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->coarsenElementData(child[0], child[1]);
el->setFirstChild(NULL); el->setFirstChild(NULL);
el->setSecondChild(NULL); el->setSecondChild(NULL);
mesh->freeElement(child[0]); mesh->freeElement(child[0]);
mesh->freeElement(child[1]); mesh->freeElement(child[1]);
...@@ -72,8 +69,8 @@ namespace AMDiS { ...@@ -72,8 +69,8 @@ namespace AMDiS {
/****************************************************************************/ /****************************************************************************/
void CoarseningManager2d::coarsenPatch(RCNeighbourList *coarsenList, void CoarseningManager2d::coarsenPatch(RCNeighbourList *coarsenList,
int n_neigh, int n_neigh,
int bound) int bound)
{ {
Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>( coarsenList->getElement(0))); Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>( coarsenList->getElement(0)));
Triangle *neigh = dynamic_cast<Triangle*>(const_cast<Element*>( coarsenList->getElement(1))); Triangle *neigh = dynamic_cast<Triangle*>(const_cast<Element*>( coarsenList->getElement(1)));
...@@ -195,9 +192,7 @@ namespace AMDiS { ...@@ -195,9 +192,7 @@ namespace AMDiS {
if (coarse_list.doCoarsePatch(n_neigh)) { if (coarse_list.doCoarsePatch(n_neigh)) {
int n_neigh_periodic; int n_neigh_periodic;
DegreeOfFreedom *next_edge[2]; DegreeOfFreedom *next_edge[2];
RCNeighbourList *periodicList; RCNeighbourList *periodicList;
while (edge[0] != NULL) { while (edge[0] != NULL) {
......
...@@ -40,7 +40,7 @@ namespace AMDiS { ...@@ -40,7 +40,7 @@ namespace AMDiS {
class CreatorInterface class CreatorInterface
{ {
public: public:
virtual ~CreatorInterface() {}; virtual ~CreatorInterface() {}
/** \brief /** \brief
* Must be implemented by sub classes of CreatorInterface. * Must be implemented by sub classes of CreatorInterface.
...@@ -51,14 +51,14 @@ namespace AMDiS { ...@@ -51,14 +51,14 @@ namespace AMDiS {
/** \brief /** \brief
* Can be implemented by sub classes. * Can be implemented by sub classes.
*/ */
virtual void free(BaseClass *) {}; virtual void free(BaseClass *) {}
/** \brief /** \brief
* *
*/ */
virtual bool isNullCreator() { virtual bool isNullCreator() {
return false; return false;
}; }
}; };
/** \brief /** \brief
...@@ -73,14 +73,14 @@ namespace AMDiS { ...@@ -73,14 +73,14 @@ namespace AMDiS {
*/ */
BaseClass* create() { BaseClass* create() {
return NULL; return NULL;
}; }
/** \brief /** \brief
* *
*/ */
virtual bool isNullCreator() { virtual bool isNullCreator() {
return true; return true;
}; }
}; };
} }
......
...@@ -261,5 +261,4 @@ namespace AMDiS { ...@@ -261,5 +261,4 @@ namespace AMDiS {
creator = NEW ElementRegion_ED::Creator; creator = NEW ElementRegion_ED::Creator;
addCreator("ElementRegion_ED", creator); addCreator("ElementRegion_ED", creator);
} }
} }
...@@ -39,63 +39,66 @@ namespace AMDiS { ...@@ -39,63 +39,66 @@ namespace AMDiS {
* to the map. * to the map.
*/ */
template<typename BaseClass> 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: FUNCNAME("CreatorMap::addCreator()");
/** \brief init();
* Adds a new creator together with the given key to the map. TEST_EXIT(creatorMap[key] == NULL)
*/ ("there is already a creator for key %s\n",key.c_str());
static void addCreator(std::string key, CreatorInterface<BaseClass>* creator) creatorMap[key] = creator;
{ }
FUNCNAME("CreatorMap::addCreator()");
init(); /** \brief
TEST_EXIT(creatorMap[key] == NULL) * Creates a object of the type corresponding to key.
("there is already a creator for key %s\n",key.c_str()); */
creatorMap[key] = creator; static CreatorInterface<BaseClass>* getCreator(std::string key) {
}; FUNCNAME("CreatorMap::getCreator()");
init();
/** \brief CreatorInterface<BaseClass> *creator = creatorMap[key];
* Creates a object of the type corresponding to key. TEST_EXIT(creator)("no creator for key %s\n", key.c_str());
*/ return creator;
static CreatorInterface<BaseClass>* getCreator(std::string key) { }
FUNCNAME("CreatorMap::getCreator()");
init(); static void clear();
CreatorInterface<BaseClass> *creator = creatorMap[key];
TEST_EXIT(creator)("no creator for key %s\n", key.c_str()); static void addDefaultCreators();
return creator;
}; protected:
/** \brief
static void addDefaultCreators(); * Constructor is protected because derived maps should be singleton.
*/
protected: static void init() {
/** \brief if (!initialized) {
* Constructor is protected because derived maps should be singleton. initialized = true;
*/ NullCreator<BaseClass> *nullCreator = new NullCreator<BaseClass>;
static void init() { addCreator("no", nullCreator);
if(!initialized) { addDefaultCreators();
initialized = true; }
NullCreator<BaseClass> *nullCreator = new NullCreator<BaseClass>; }
addCreator("no", nullCreator);
addCreator("0", nullCreator); protected:
addDefaultCreators(); /** \brief
} * STL map containing the pairs of keys and creators.
}; */
static std::map< std::string, CreatorInterface<BaseClass>* > creatorMap;
protected:
/** \brief static bool initialized;
* STL map containing the pairs of keys and creators. };
*/
static std::map< std::string, CreatorInterface<BaseClass>* > creatorMap;
static bool initialized;
};
template<typename BaseClass> template<typename BaseClass>
std::map< std::string, CreatorInterface<BaseClass>* > CreatorMap<BaseClass>::creatorMap; std::map< std::string, CreatorInterface<BaseClass>* > CreatorMap<BaseClass>::creatorMap;
template<typename BaseClass> template<typename BaseClass>
bool CreatorMap<BaseClass>::initialized = false; bool CreatorMap<BaseClass>::initialized = false;
} }
#include "CreatorMap.hh"
#endif #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 { ...@@ -61,10 +61,15 @@ namespace AMDiS {
{ {
FUNCNAME("DOFMatrix::~DOFMatrix()"); FUNCNAME("DOFMatrix::~DOFMatrix()");
matrix.clear();
if (rowFESpace && rowFESpace->getAdmin()) { if (rowFESpace && rowFESpace->getAdmin()) {
(const_cast<DOFAdmin*>(rowFESpace->getAdmin()))->removeDOFIndexed(this); (const_cast<DOFAdmin*>(rowFESpace->getAdmin()))->removeDOFIndexed(this);
} }
if (boundaryManager)
DELETE boundaryManager;
if (elementMatrix) if (elementMatrix)
DELETE elementMatrix; DELETE elementMatrix;
} }
......
...@@ -7,18 +7,18 @@ ...@@ -7,18 +7,18 @@
namespace AMDiS { namespace AMDiS {
std::map<DegreeOfFreedom*, bool> Element::deletedDOFs;
int Element::getRegion() const int Element::getRegion() const
{ {
ElementRegion_ED* red_;
if (!elementData) if (!elementData)
return -1; return -1;
red_ = dynamic_cast<ElementRegion_ED*>(elementData->getElementData(ELEMENT_REGION)); ElementRegion_ED* red = dynamic_cast<ElementRegion_ED*>(elementData->getElementData(ELEMENT_REGION));
if (red_) if (red) {
return red_->getRegion(); return red->getRegion();
}
return -1; return -1;
} }
...@@ -35,12 +35,9 @@ namespace AMDiS { ...@@ -35,12 +35,9 @@ namespace AMDiS {
Element::Element(Mesh *aMesh) Element::Element(Mesh *aMesh)
{ {
mesh = aMesh; mesh = aMesh;
index = mesh ? mesh->getNextElementIndex() : -1; index = mesh ? mesh->getNextElementIndex() : -1;
child[0] = NULL; child[0] = NULL;
child[1] = NULL; child[1] = NULL;
newCoord = NULL; newCoord = NULL;
elementData = NULL; elementData = NULL;
...@@ -53,7 +50,7 @@ namespace AMDiS { ...@@ -53,7 +50,7 @@ namespace AMDiS {
// call destructor through Mesh::freeElement !!! // call destructor through Mesh::freeElement !!!
Element::~Element() Element::~Element()
{ {
if (child[0]) { if (child[0]) {
DELETE child[0]; DELETE child[0];
} }
...@@ -64,6 +61,29 @@ namespace AMDiS { ...@@ -64,6 +61,29 @@ namespace AMDiS {
if (newCoord) { if (newCoord) {
DELETE 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() void Element::deleteElementDOFs()
...@@ -81,22 +101,19 @@ namespace AMDiS { ...@@ -81,22 +101,19 @@ namespace AMDiS {
if (ndof > 0) { if (ndof > 0) {
for (int i = 0; i < mesh->getGeo(position); i++) { for (int i = 0; i < mesh->getGeo(position); i++) {
if (dof[j] != NULL) { if (dof[j]) {
if (Mesh::serializedDOFs.count(dof[j][0]) == 0) { if (deletedDOFs.count(dof[j]) == 0) {
// std::cout << "FREE INNER: " << ndof << std::endl; deletedDOFs[dof[j]] = true;
FREE_MEMORY(dof[j], DegreeOfFreedom, ndof); FREE_MEMORY(dof[j], DegreeOfFreedom, ndof);