Commit 36a3ffe1 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

First working repartitioning of parallel distributed mesh.

parent b3de56bb
...@@ -180,6 +180,7 @@ if(ENABLE_PARALLEL_DOMAIN) ...@@ -180,6 +180,7 @@ if(ENABLE_PARALLEL_DOMAIN)
SET(PARALLEL_DOMAIN_AMDIS_SRC SET(PARALLEL_DOMAIN_AMDIS_SRC
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc ${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc ${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
${SOURCE_DIR}/parallel/StdMpi.cc ${SOURCE_DIR}/parallel/StdMpi.cc
${SOURCE_DIR}/parallel/ParallelDebug.cc ${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/MpiHelper.cc ${SOURCE_DIR}/parallel/MpiHelper.cc
......
...@@ -18,6 +18,7 @@ if USE_PARALLEL_DOMAIN_AMDIS ...@@ -18,6 +18,7 @@ if USE_PARALLEL_DOMAIN_AMDIS
$(SOURCE_DIR)/parallel/StdMpi.h $(SOURCE_DIR)/parallel/StdMpi.cc \ $(SOURCE_DIR)/parallel/StdMpi.h $(SOURCE_DIR)/parallel/StdMpi.cc \
$(SOURCE_DIR)/parallel/ParMetisPartitioner.h $(SOURCE_DIR)/parallel/ParMetisPartitioner.cc \ $(SOURCE_DIR)/parallel/ParMetisPartitioner.h $(SOURCE_DIR)/parallel/ParMetisPartitioner.cc \
$(SOURCE_DIR)/parallel/MeshDistributor.h $(SOURCE_DIR)/parallel/MeshDistributor.cc \ $(SOURCE_DIR)/parallel/MeshDistributor.h $(SOURCE_DIR)/parallel/MeshDistributor.cc \
$(SOURCE_DIR)/parallel/MeshManipulation.h $(SOURCE_DIR)/parallel/MeshManipulation.cc \
$(SOURCE_DIR)/parallel/ParallelDebug.h $(SOURCE_DIR)/parallel/ParallelDebug.cc \ $(SOURCE_DIR)/parallel/ParallelDebug.h $(SOURCE_DIR)/parallel/ParallelDebug.cc \
$(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \ $(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \
$(SOURCE_DIR)/parallel/PetscSolver.h $(SOURCE_DIR)/parallel/PetscSolver.cc \ $(SOURCE_DIR)/parallel/PetscSolver.h $(SOURCE_DIR)/parallel/PetscSolver.cc \
......
...@@ -38,6 +38,7 @@ host_triplet = @host@ ...@@ -38,6 +38,7 @@ host_triplet = @host@
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/StdMpi.h $(SOURCE_DIR)/parallel/StdMpi.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/StdMpi.h $(SOURCE_DIR)/parallel/StdMpi.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParMetisPartitioner.h $(SOURCE_DIR)/parallel/ParMetisPartitioner.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParMetisPartitioner.h $(SOURCE_DIR)/parallel/ParMetisPartitioner.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/MeshDistributor.h $(SOURCE_DIR)/parallel/MeshDistributor.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/MeshDistributor.h $(SOURCE_DIR)/parallel/MeshDistributor.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/MeshManipulation.h $(SOURCE_DIR)/parallel/MeshManipulation.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParallelDebug.h $(SOURCE_DIR)/parallel/ParallelDebug.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParallelDebug.h $(SOURCE_DIR)/parallel/ParallelDebug.cc \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/PetscSolver.h $(SOURCE_DIR)/parallel/PetscSolver.cc \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ $(SOURCE_DIR)/parallel/PetscSolver.h $(SOURCE_DIR)/parallel/PetscSolver.cc \
...@@ -96,6 +97,8 @@ am__libamdis_la_SOURCES_DIST = $(SOURCE_DIR)/parallel/StdMpi.h \ ...@@ -96,6 +97,8 @@ am__libamdis_la_SOURCES_DIST = $(SOURCE_DIR)/parallel/StdMpi.h \
$(SOURCE_DIR)/parallel/ParMetisPartitioner.cc \ $(SOURCE_DIR)/parallel/ParMetisPartitioner.cc \
$(SOURCE_DIR)/parallel/MeshDistributor.h \ $(SOURCE_DIR)/parallel/MeshDistributor.h \
$(SOURCE_DIR)/parallel/MeshDistributor.cc \ $(SOURCE_DIR)/parallel/MeshDistributor.cc \
$(SOURCE_DIR)/parallel/MeshManipulation.h \
$(SOURCE_DIR)/parallel/MeshManipulation.cc \
$(SOURCE_DIR)/parallel/ParallelDebug.h \ $(SOURCE_DIR)/parallel/ParallelDebug.h \
$(SOURCE_DIR)/parallel/ParallelDebug.cc \ $(SOURCE_DIR)/parallel/ParallelDebug.cc \
$(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \ $(SOURCE_DIR)/parallel/ParallelProblemStatBase.h \
...@@ -260,6 +263,7 @@ am__libamdis_la_SOURCES_DIST = $(SOURCE_DIR)/parallel/StdMpi.h \ ...@@ -260,6 +263,7 @@ am__libamdis_la_SOURCES_DIST = $(SOURCE_DIR)/parallel/StdMpi.h \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__objects_1 = libamdis_la-StdMpi.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__objects_1 = libamdis_la-StdMpi.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-ParMetisPartitioner.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-ParallelDebug.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-ParallelDebug.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-PetscSolver.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-PetscSolver.lo \
@USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MpiHelper.lo \ @USE_PARALLEL_DOMAIN_AMDIS_TRUE@ libamdis_la-MpiHelper.lo \
...@@ -820,6 +824,7 @@ distclean-compile: ...@@ -820,6 +824,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Marker.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Marker.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Mesh.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-Mesh.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MeshDistributor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MeshDistributor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MeshManipulation.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MeshStructure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MeshStructure.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MpiHelper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-MpiHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-NonLinUpdater.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libamdis_la-NonLinUpdater.Plo@am__quote@
...@@ -926,6 +931,13 @@ libamdis_la-MeshDistributor.lo: $(SOURCE_DIR)/parallel/MeshDistributor.cc ...@@ -926,6 +931,13 @@ libamdis_la-MeshDistributor.lo: $(SOURCE_DIR)/parallel/MeshDistributor.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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-MeshDistributor.lo `test -f '$(SOURCE_DIR)/parallel/MeshDistributor.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/MeshDistributor.cc @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-MeshDistributor.lo `test -f '$(SOURCE_DIR)/parallel/MeshDistributor.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/MeshDistributor.cc
libamdis_la-MeshManipulation.lo: $(SOURCE_DIR)/parallel/MeshManipulation.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-MeshManipulation.lo -MD -MP -MF $(DEPDIR)/libamdis_la-MeshManipulation.Tpo -c -o libamdis_la-MeshManipulation.lo `test -f '$(SOURCE_DIR)/parallel/MeshManipulation.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/MeshManipulation.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libamdis_la-MeshManipulation.Tpo $(DEPDIR)/libamdis_la-MeshManipulation.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(SOURCE_DIR)/parallel/MeshManipulation.cc' object='libamdis_la-MeshManipulation.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -c -o libamdis_la-MeshManipulation.lo `test -f '$(SOURCE_DIR)/parallel/MeshManipulation.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/MeshManipulation.cc
libamdis_la-ParallelDebug.lo: $(SOURCE_DIR)/parallel/ParallelDebug.cc libamdis_la-ParallelDebug.lo: $(SOURCE_DIR)/parallel/ParallelDebug.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ParallelDebug.lo -MD -MP -MF $(DEPDIR)/libamdis_la-ParallelDebug.Tpo -c -o libamdis_la-ParallelDebug.lo `test -f '$(SOURCE_DIR)/parallel/ParallelDebug.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/ParallelDebug.cc @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libamdis_la_CXXFLAGS) $(CXXFLAGS) -MT libamdis_la-ParallelDebug.lo -MD -MP -MF $(DEPDIR)/libamdis_la-ParallelDebug.Tpo -c -o libamdis_la-ParallelDebug.lo `test -f '$(SOURCE_DIR)/parallel/ParallelDebug.cc' || echo '$(srcdir)/'`$(SOURCE_DIR)/parallel/ParallelDebug.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libamdis_la-ParallelDebug.Tpo $(DEPDIR)/libamdis_la-ParallelDebug.Plo @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libamdis_la-ParallelDebug.Tpo $(DEPDIR)/libamdis_la-ParallelDebug.Plo
......
...@@ -208,8 +208,8 @@ namespace AMDiS { ...@@ -208,8 +208,8 @@ namespace AMDiS {
DegreeOfFreedom vertexDOF; DegreeOfFreedom vertexDOF;
WorldVector<double> vertexCoords; WorldVector<double> vertexCoords;
MSG("ELEMENT: %d\n", elInfo->getElement()->getIndex()); // MSG("ELEMENT: %d\n", elInfo->getElement()->getIndex());
MSG("DOFs: %d %d %d\n", dof[0][0], dof[1][0], dof[2][0]); // MSG("DOFs: %d %d %d\n", dof[0][0], dof[1][0], dof[2][0]);
// create ElementInfo // create ElementInfo
ElementInfo elementInfo(dim); ElementInfo elementInfo(dim);
......
...@@ -198,107 +198,78 @@ namespace AMDiS { ...@@ -198,107 +198,78 @@ namespace AMDiS {
/* should be used only at the end of dof_compress()!!!!! */ /* should be used only at the end of dof_compress()!!!!! */
/****************************************************************************/ /****************************************************************************/
/* CHANGE_DOFS_1 changes old dofs to NEGATIVE new dofs */ void Element::newDofFct1(const DOFAdmin* admin)
#define CHANGE_DOFS_1(el) \
ldof = el->dof[n0 + i] + nd0; \
for (j = 0; j < nd; j++) { \
if ((k = ldof[j]) >= 0) { \
/* do it only once! (dofs are visited more than once) */ \
ldof[j] = - admin->getMesh()->newDOF[k] - 1; \
} }
/* CHANGE_DOFS_2 changes NEGATIVE new dofs to POSITIVE */
#define CHANGE_DOFS_2(el) \
ldof = el->dof[n0+i] + nd0; \
for (j = 0; j < nd; j++) { \
if ((k = ldof[j]) < 0) { \
/* do it only once! (dofs are visited more than once) */ \
ldof[j] = - k - 1; \
} }
void Element::newDOFFct1(const DOFAdmin* admin)
{ {
int j, k, n0, nd, nd0; int n0, nd, nd0;
DegreeOfFreedom *ldof;
int vertices = mesh->getGeo(VERTEX);
int edges = mesh->getGeo(EDGE);
int faces = mesh->getGeo(FACE);
if ((nd = admin->getNumberOfDofs(VERTEX))) { if ((nd = admin->getNumberOfDofs(VERTEX))) {
int vertices = mesh->getGeo(VERTEX);
nd0 = admin->getNumberOfPreDOFs(VERTEX); nd0 = admin->getNumberOfPreDOFs(VERTEX);
n0 = admin->getMesh()->getNode(VERTEX); n0 = admin->getMesh()->getNode(VERTEX);
for (int i = 0; i < vertices; i++) { for (int i = 0; i < vertices; i++)
CHANGE_DOFS_1(this); changeDofs1(admin, n0, nd0, nd, i);
}
} }
if (mesh->getDim() > 1) { if (mesh->getDim() > 1) {
if ((nd = admin->getNumberOfDofs(EDGE))) { if ((nd = admin->getNumberOfDofs(EDGE))) {
int edges = mesh->getGeo(EDGE);
nd0 = admin->getNumberOfPreDOFs(EDGE); nd0 = admin->getNumberOfPreDOFs(EDGE);
n0 = admin->getMesh()->getNode(EDGE); n0 = admin->getMesh()->getNode(EDGE);
for (int i = 0; i < edges; i++) { for (int i = 0; i < edges; i++)
CHANGE_DOFS_1(this); changeDofs1(admin, n0, nd0, nd, i);
}
} }
} }
if (mesh->getDim() == 3) { if (mesh->getDim() == 3) {
if ((nd = admin->getNumberOfDofs(FACE))) { if ((nd = admin->getNumberOfDofs(FACE))) {
int faces = mesh->getGeo(FACE);
nd0 = admin->getNumberOfPreDOFs(FACE); nd0 = admin->getNumberOfPreDOFs(FACE);
n0 = admin->getMesh()->getNode(FACE); n0 = admin->getMesh()->getNode(FACE);
for (int i = 0; i < faces; i++) { for (int i = 0; i < faces; i++)
CHANGE_DOFS_1(this); changeDofs1(admin, n0, nd0, nd, i);
}
} }
} }
if ((nd = admin->getNumberOfDofs(CENTER))) { if ((nd = admin->getNumberOfDofs(CENTER))) {
nd0 = admin->getNumberOfPreDOFs(CENTER); nd0 = admin->getNumberOfPreDOFs(CENTER);
n0 = admin->getMesh()->getNode(CENTER); n0 = admin->getMesh()->getNode(CENTER);
int i = 0; /* only one center */ changeDofs1(admin, n0, nd0, nd, 0);
CHANGE_DOFS_1(this);
} }
} }
void Element::newDOFFct2(const DOFAdmin* admin) void Element::newDofFct2(const DOFAdmin* admin)
{ {
int j, k, n0, nd0; int n0, nd0;
DegreeOfFreedom *ldof;
int vertices = mesh->getGeo(VERTEX);
int edges = mesh->getGeo(EDGE);
int faces = mesh->getGeo(FACE);
int nd = admin->getNumberOfDofs(VERTEX); int nd = admin->getNumberOfDofs(VERTEX);
if (nd) { if (nd) {
int vertices = mesh->getGeo(VERTEX);
nd0 = admin->getNumberOfPreDOFs(VERTEX); nd0 = admin->getNumberOfPreDOFs(VERTEX);
n0 = admin->getMesh()->getNode(VERTEX); n0 = admin->getMesh()->getNode(VERTEX);
for (int i = 0; i < vertices; i++) { for (int i = 0; i < vertices; i++)
CHANGE_DOFS_2(this); changeDofs2(n0, nd0, nd, i);
}
} }
if (mesh->getDim() > 1) { if (mesh->getDim() > 1) {
nd = admin->getNumberOfDofs(EDGE); nd = admin->getNumberOfDofs(EDGE);
if (nd) { if (nd) {
int edges = mesh->getGeo(EDGE);
nd0 = admin->getNumberOfPreDOFs(EDGE); nd0 = admin->getNumberOfPreDOFs(EDGE);
n0 = admin->getMesh()->getNode(EDGE); n0 = admin->getMesh()->getNode(EDGE);
for (int i = 0; i < edges; i++) { for (int i = 0; i < edges; i++)
CHANGE_DOFS_2(this); changeDofs2(n0, nd0, nd, i);
}
} }
} }
if (mesh->getDim() == 3) { if (mesh->getDim() == 3) {
nd = admin->getNumberOfDofs(FACE); nd = admin->getNumberOfDofs(FACE);
if (nd) { if (nd) {
int faces = mesh->getGeo(FACE);
nd0 = admin->getNumberOfPreDOFs(FACE); nd0 = admin->getNumberOfPreDOFs(FACE);
n0 = admin->getMesh()->getNode(FACE); n0 = admin->getMesh()->getNode(FACE);
for (int i = 0; i < faces; i++) { for (int i = 0; i < faces; i++)
CHANGE_DOFS_2(this); changeDofs2(n0, nd0, nd, i);
}
} }
} }
...@@ -307,13 +278,31 @@ namespace AMDiS { ...@@ -307,13 +278,31 @@ namespace AMDiS {
nd0 = admin->getNumberOfPreDOFs(CENTER); nd0 = admin->getNumberOfPreDOFs(CENTER);
n0 = admin->getMesh()->getNode(CENTER); n0 = admin->getMesh()->getNode(CENTER);
// only one center // only one center
int i = 0; changeDofs2(n0, nd0, nd, 0);
CHANGE_DOFS_2(this);
} }
} }
#undef CHANGE_DOFS_1
#undef CHANGE_DOFS_2 void Element::changeDofs1(const DOFAdmin* admin, int n0, int nd0, int nd, int pos)
{
DegreeOfFreedom *ldof = dof[n0 + pos] + nd0;
for (int j = 0; j < nd; j++) {
int k = ldof[j];
if (k >= 0)
ldof[j] = -admin->getMesh()->newDOF[k] - 1;
}
}
void Element::changeDofs2(int n0, int nd0, int nd, int pos)
{
DegreeOfFreedom *ldof = dof[n0 + pos] + nd0;
for (int j = 0; j < nd; j++) {
int k = ldof[j];
if (k < 0)
ldof[j] = -k - 1;
}
}
/****************************************************************************/ /****************************************************************************/
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#ifndef AMDIS_ELEMENT_H #ifndef AMDIS_ELEMENT_H
#define AMDIS_ELEMENT_H #define AMDIS_ELEMENT_H
#include "AMDiS_fwd.h"
#include "Global.h" #include "Global.h"
#include "RefinementManager.h" #include "RefinementManager.h"
#include "Serializable.h" #include "Serializable.h"
#include "ElementData.h" #include "ElementData.h"
#include "LeafData.h" #include "LeafData.h"
#include "AMDiS_fwd.h"
namespace AMDiS { namespace AMDiS {
...@@ -521,10 +521,16 @@ namespace AMDiS { ...@@ -521,10 +521,16 @@ namespace AMDiS {
} }
/// Used by friend class Mesh while dofCompress /// Used by friend class Mesh while dofCompress
void newDOFFct1(const DOFAdmin*); void newDofFct1(const DOFAdmin*);
/// Used by friend class Mesh while dofCompress /// Used by friend class Mesh while dofCompress
void newDOFFct2(const DOFAdmin*); void newDofFct2(const DOFAdmin*);
/// Changes old dofs to negative new dofs
void changeDofs1(const DOFAdmin* admin, int n0, int nd0, int nd, int pos);
/// Changes negative new dofs to positive
void changeDofs2(int n0, int nd0, int nd, int pos);
protected: protected:
/** \brief /** \brief
......
...@@ -472,13 +472,13 @@ namespace AMDiS { ...@@ -472,13 +472,13 @@ namespace AMDiS {
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(this, -1, fill_flag); ElInfo *elInfo = stack.traverseFirst(this, -1, fill_flag);
while (elInfo) { while (elInfo) {
elInfo->getElement()->newDOFFct1(compressAdmin); elInfo->getElement()->newDofFct1(compressAdmin);
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
elInfo = stack.traverseFirst(this, -1, fill_flag); elInfo = stack.traverseFirst(this, -1, fill_flag);
while (elInfo) { while (elInfo) {
elInfo->getElement()->newDOFFct2(compressAdmin); elInfo->getElement()->newDofFct2(compressAdmin);
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
...@@ -613,6 +613,7 @@ namespace AMDiS { ...@@ -613,6 +613,7 @@ namespace AMDiS {
} }
delete [] dof; delete [] dof;
dof = NULL;
} }
......
...@@ -880,8 +880,9 @@ namespace AMDiS { ...@@ -880,8 +880,9 @@ namespace AMDiS {
friend class MacroWriter; friend class MacroWriter;
friend class MacroElement; friend class MacroElement;
friend class Element; friend class Element;
friend void Element::newDOFFct1(const DOFAdmin*); friend void Element::newDofFct1(const DOFAdmin*);
friend void Element::newDOFFct2(const DOFAdmin*); friend void Element::newDofFct2(const DOFAdmin*);
friend void Element::changeDofs1(const DOFAdmin*, int, int, int, int);
}; };
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include "parallel/MeshDistributor.h" #include "parallel/MeshDistributor.h"
#include "parallel/MeshManipulation.h"
#include "parallel/ParallelDebug.h" #include "parallel/ParallelDebug.h"
#include "parallel/StdMpi.h" #include "parallel/StdMpi.h"
#include "parallel/ParMetisPartitioner.h" #include "parallel/ParMetisPartitioner.h"
...@@ -54,6 +55,7 @@ namespace AMDiS { ...@@ -54,6 +55,7 @@ namespace AMDiS {
rstart(0), rstart(0),
deserialized(false), deserialized(false),
writeSerializationFile(false), writeSerializationFile(false),
repartitioningAllowed(false),
lastMeshChangeIndex(0), lastMeshChangeIndex(0),
macroElementStructureConsisten(false) macroElementStructureConsisten(false)
{ {
...@@ -62,6 +64,10 @@ namespace AMDiS { ...@@ -62,6 +64,10 @@ namespace AMDiS {
mpiRank = MPI::COMM_WORLD.Get_rank(); mpiRank = MPI::COMM_WORLD.Get_rank();
mpiSize = MPI::COMM_WORLD.Get_size(); mpiSize = MPI::COMM_WORLD.Get_size();
mpiComm = MPI::COMM_WORLD; mpiComm = MPI::COMM_WORLD;
int tmp = 0;
GET_PARAMETER(0, name + "->repartitioning", "%d", &tmp);
repartitioningAllowed = (tmp > 0);
} }
...@@ -566,7 +572,8 @@ namespace AMDiS { ...@@ -566,7 +572,8 @@ namespace AMDiS {
// === The mesh has changed, so check if it is required to repartition the mesh. === // === The mesh has changed, so check if it is required to repartition the mesh. ===
repartitionMesh(); if (repartitioningAllowed)
repartitionMesh();
} }
...@@ -981,8 +988,6 @@ namespace AMDiS { ...@@ -981,8 +988,6 @@ namespace AMDiS {
if (repartitioning == 0) if (repartitioning == 0)
return; return;
return;
DOFVector<double> tmpa(feSpace, "tmp"); DOFVector<double> tmpa(feSpace, "tmp");
tmpa.set(mpiRank); tmpa.set(mpiRank);
VtkWriter::writeFile(tmpa, "before-repartition.vtu"); VtkWriter::writeFile(tmpa, "before-repartition.vtu");
...@@ -1040,8 +1045,6 @@ namespace AMDiS { ...@@ -1040,8 +1045,6 @@ namespace AMDiS {
for (std::set<MacroElement*>::iterator it = newMacroEl.begin(); for (std::set<MacroElement*>::iterator it = newMacroEl.begin();
it != newMacroEl.end(); ++it) { it != newMacroEl.end(); ++it) {
MacroElement *mel = *it; MacroElement *mel = *it;
// MSG("NEW MACRO EL: %d\n", mel->getIndex());
for (int i = 0; i < mesh->getGeo(NEIGH); i++) for (int i = 0; i < mesh->getGeo(NEIGH); i++)
mel->setNeighbour(i, NULL); mel->setNeighbour(i, NULL);
...@@ -1059,7 +1062,6 @@ namespace AMDiS { ...@@ -1059,7 +1062,6 @@ namespace AMDiS {
it != partitioner->getSendElements().end(); ++it) { it != partitioner->getSendElements().end(); ++it) {
for (std::vector<int>::iterator elIt = it->second.begin(); for (std::vector<int>::iterator elIt = it->second.begin();
elIt != it->second.end(); ++elIt) { elIt != it->second.end(); ++elIt) {
// MSG("MAKE EL-STRUC FOR EL %d TO RANK %d\n", *elIt, it->first);
MeshStructure elCode; MeshStructure elCode;
elCode.init(mesh, *elIt); elCode.init(mesh, *elIt);
sendCodes[it->first].push_back(elCode); sendCodes[it->first].push_back(elCode);
...@@ -1083,16 +1085,10 @@ namespace AMDiS { ...@@ -1083,16 +1085,10 @@ namespace AMDiS {
("Should not happen!\n"); ("Should not happen!\n");
for (std::vector<int>::iterator elIt = it->second.begin(); for (std::vector<int>::iterator elIt = it->second.begin();
elIt != it->second.end(); ++elIt) { elIt != it->second.end(); ++elIt)
// MSG("RECV EL-STRUC FOR EL %d FROM RANK %d\n", *elIt, it->first);
recvCodes[i++].fitMeshToStructure(mesh, refineManager, false, *elIt); recvCodes[i++].fitMeshToStructure(mesh, refineManager, false, *elIt);
}
} }
MSG("DAS IST FERTIG!\n");
// === Set correct neighbour information on macro elements. === // === Set correct neighbour information on macro elements. ===
...@@ -1120,120 +1116,24 @@ namespace AMDiS { ...@@ -1120,120 +1116,24 @@ namespace AMDiS {
elIt != it->second.end(); ++elIt) { elIt != it->second.end(); ++elIt) {
TEST_EXIT_DBG(elIndexMap.count(*elIt) == 1) TEST_EXIT_DBG(elIndexMap.count(*elIt) == 1)
("Could not find macro element %d\n", *elIt); ("Could not find macro element %d\n", *elIt);
// MSG("DELETE MACRO %d\n", (*elIt));
deleteMacroElements.insert(elIndexMap[*elIt]); deleteMacroElements.insert(elIndexMap[*elIt]);
} }
} }
// MSG("REMOVE MACRO ELEMENT!\n");
mesh->removeMacroElements(deleteMacroElements, feSpace); mesh->removeMacroElements(deleteMacroElements, feSpace);
// === Remove double DOFs. === // === Remove double DOFs. ===
std::map<int, MacroElement*> leafInMacroEl; MeshManipulation meshManipulation(mesh);
meshManipulation.deleteDoubleDofs(newMacroEl);
elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
leafInMacroEl[elInfo->getElement()->getIndex()] = elInfo->getMacroElement();
elInfo = stack.traverseNext(elInfo);
}
std::map<const DegreeOfFreedom*, const DegreeOfFreedom*> mapDelDofs;
elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH);
while (elInfo) {
Element *el = elInfo->getElement();
for (int i = 0; i < mesh->getGeo(NEIGH); i++) {
Element *neigh = elInfo->getNeighbour(i);
if (!neigh)
continue;
if (leafInMacroEl[el->getIndex()] !=
leafInMacroEl[neigh->getIndex()] &&
newMacroEl.count(leafInMacroEl[el->getIndex()]) == 0 &&
newMacroEl.count(leafInMacroEl[neigh->getIndex()]) == 1) {
// MSG("EL: %d NEIGH: %d\n", el->getIndex(), neigh->getIndex());