Commit 0addc7a4 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Code refactoring to make the implementation of mesh repartitioning easier.

parent 913de2db
...@@ -51,32 +51,32 @@ build_old_libs=yes ...@@ -51,32 +51,32 @@ build_old_libs=yes
pic_mode=default pic_mode=default
# Whether or not to optimize for fast installation. # Whether or not to optimize for fast installation.
fast_install=yes fast_install=needless
# The host system. # The host system.
host_alias= host_alias=
host=i686-redhat-linux-gnu host=x86_64-unknown-linux-gnu
host_os=linux-gnu host_os=linux-gnu
# The build system. # The build system.
build_alias= build_alias=
build=i686-redhat-linux-gnu build=x86_64-unknown-linux-gnu
build_os=linux-gnu build_os=linux-gnu
# A sed program that does not truncate output. # A sed program that does not truncate output.
SED="/bin/sed" SED="/usr/bin/sed"
# Sed that helps us avoid accidentally triggering echo(1) options like -n. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="$SED -e 1s/^X//" Xsed="$SED -e 1s/^X//"
# A grep program that handles long lines. # A grep program that handles long lines.
GREP="/bin/grep" GREP="/usr/bin/grep"
# An ERE matcher. # An ERE matcher.
EGREP="/bin/grep -E" EGREP="/usr/bin/grep -E"
# A literal string matcher. # A literal string matcher.
FGREP="/bin/grep -F" FGREP="/usr/bin/grep -F"
# A BSD- or MS-compatible name lister. # A BSD- or MS-compatible name lister.
NM="/usr/bin/nm -B" NM="/usr/bin/nm -B"
...@@ -85,7 +85,7 @@ NM="/usr/bin/nm -B" ...@@ -85,7 +85,7 @@ NM="/usr/bin/nm -B"
LN_S="ln -s" LN_S="ln -s"
# What is the maximum length of a command? # What is the maximum length of a command?
max_cmd_len=98304 max_cmd_len=1572864
# Object file suffix (normally "o"). # Object file suffix (normally "o").
objext=o objext=o
...@@ -128,7 +128,7 @@ old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" ...@@ -128,7 +128,7 @@ old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
old_postuninstall_cmds="" old_postuninstall_cmds=""
# A C compiler. # A C compiler.
LTCC="gcc" LTCC="/usr/lib64/mpi/gcc/openmpi//bin/mpicc"
# LTCC compiler flags. # LTCC compiler flags.
LTCFLAGS="-g -O2" LTCFLAGS="-g -O2"
...@@ -204,7 +204,7 @@ runpath_var=LD_RUN_PATH ...@@ -204,7 +204,7 @@ runpath_var=LD_RUN_PATH
shlibpath_var=LD_LIBRARY_PATH shlibpath_var=LD_LIBRARY_PATH
# Is shlibpath searched before the hard-coded library search path? # Is shlibpath searched before the hard-coded library search path?
shlibpath_overrides_runpath=no shlibpath_overrides_runpath=yes
# Format of library name prefix. # Format of library name prefix.
libname_spec="lib\$name" libname_spec="lib\$name"
...@@ -233,10 +233,10 @@ finish_eval="" ...@@ -233,10 +233,10 @@ finish_eval=""
hardcode_into_libs=yes hardcode_into_libs=yes
# Compile-time system search path for libraries. # Compile-time system search path for libraries.
sys_lib_search_path_spec="/u/backofen/adds/local/lib /usr/lib/gcc/i386-redhat-linux/4.1.2 /usr/lib /lib" sys_lib_search_path_spec="/usr/lib64/gcc/x86_64-suse-linux/4.5 /usr/lib64 /lib64 /usr/x86_64-suse-linux/lib"
# Run-time system search path for libraries. # Run-time system search path for libraries.
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/mysql /usr/lib/octave-3.0.1 /usr/lib/qt-3.3/lib /usr/lib/qt4/lib /usr/lib/xulrunner-1.9.2 " sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/lib64/Xaw3d /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/lib/Xaw3d /usr/x86_64-suse-linux/lib /usr/local/lib /opt/kde3/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /opt/kde3/lib64 /usr/lib64/graphviz /usr/lib64/graphviz/sharp /usr/lib64/graphviz/java /usr/lib64/graphviz/perl /usr/lib64/graphviz/php /usr/lib64/graphviz/ocaml /usr/lib64/graphviz/python /usr/lib64/graphviz/lua /usr/lib64/graphviz/tcl /usr/lib64/graphviz/guile /usr/lib64/graphviz/ruby /usr/lib64/octave-3.2.4 "
# Whether dlopen is supported. # Whether dlopen is supported.
dlopen_support=unknown dlopen_support=unknown
...@@ -253,13 +253,13 @@ striplib="strip --strip-unneeded" ...@@ -253,13 +253,13 @@ striplib="strip --strip-unneeded"
# The linker used to build libraries. # The linker used to build libraries.
LD="/usr/bin/ld" LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
# Commands used to build an old-style archive. # Commands used to build an old-style archive.
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
# A language specific compiler. # A language specific compiler.
CC="gcc" CC="/usr/lib64/mpi/gcc/openmpi//bin/mpicc"
# Is the compiler the GNU compiler? # Is the compiler the GNU compiler?
with_gcc=yes with_gcc=yes
...@@ -274,7 +274,7 @@ wl="-Wl," ...@@ -274,7 +274,7 @@ wl="-Wl,"
pic_flag=" -fPIC -DPIC" pic_flag=" -fPIC -DPIC"
# Compiler flag to prevent dynamic linking. # Compiler flag to prevent dynamic linking.
link_static_flag="-static" link_static_flag=""
# Does compiler simultaneously support -c and -o options? # Does compiler simultaneously support -c and -o options?
compiler_c_o="yes" compiler_c_o="yes"
...@@ -8908,13 +8908,13 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ...@@ -8908,13 +8908,13 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
# ### BEGIN LIBTOOL TAG CONFIG: CXX # ### BEGIN LIBTOOL TAG CONFIG: CXX
# The linker used to build libraries. # The linker used to build libraries.
LD="/usr/bin/ld" LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
# Commands used to build an old-style archive. # Commands used to build an old-style archive.
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
# A language specific compiler. # A language specific compiler.
CC="g++" CC="/usr/lib64/mpi/gcc/openmpi//bin/mpicxx"
# Is the compiler the GNU compiler? # Is the compiler the GNU compiler?
with_gcc=yes with_gcc=yes
...@@ -8929,7 +8929,7 @@ wl="-Wl," ...@@ -8929,7 +8929,7 @@ wl="-Wl,"
pic_flag=" -fPIC -DPIC" pic_flag=" -fPIC -DPIC"
# Compiler flag to prevent dynamic linking. # Compiler flag to prevent dynamic linking.
link_static_flag="-static" link_static_flag=""
# Does compiler simultaneously support -c and -o options? # Does compiler simultaneously support -c and -o options?
compiler_c_o="yes" compiler_c_o="yes"
...@@ -9039,17 +9039,17 @@ file_list_spec="" ...@@ -9039,17 +9039,17 @@ file_list_spec=""
hardcode_action=immediate hardcode_action=immediate
# The directories searched by this compiler when creating a shared library. # The directories searched by this compiler when creating a shared library.
compiler_lib_search_dirs="/u/backofen/adds/local/lib /usr/lib/gcc/i386-redhat-linux/4.1.2 /usr/lib/gcc/i386-redhat-linux/4.1.2 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../.." compiler_lib_search_dirs="/usr/lib64/mpi/gcc/openmpi/lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 /lib/../lib64 /usr/lib/../lib64 /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib /usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
# Dependencies to place before and after the objects being linked to # Dependencies to place before and after the objects being linked to
# create a shared library. # create a shared library.
predep_objects="/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbeginS.o" predep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.5/crtbeginS.o"
postdep_objects="/usr/lib/gcc/i386-redhat-linux/4.1.2/crtendS.o /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o" postdep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.5/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64/crtn.o"
predeps="" predeps=""
postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" postdeps="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s"
# The library search path used internally by the compiler when linking # The library search path used internally by the compiler when linking
# a shared library. # a shared library.
compiler_lib_search_path="-L/u/backofen/adds/local/lib -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.." compiler_lib_search_path="-L/usr/lib64/mpi/gcc/openmpi/lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.5/../../.."
# ### END LIBTOOL TAG CONFIG: CXX # ### END LIBTOOL TAG CONFIG: CXX
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include "OperatorTerm.h" #include "OperatorTerm.h"
#include "Parameters.h" #include "Parameters.h"
#include "Parametric.h" #include "Parametric.h"
#include "PartitionElementData.h"
#include "PeriodicMap.h" #include "PeriodicMap.h"
#include "PeriodicBC.h" #include "PeriodicBC.h"
#include "PngWriter.h" #include "PngWriter.h"
......
...@@ -51,7 +51,7 @@ namespace AMDiS { ...@@ -51,7 +51,7 @@ namespace AMDiS {
MeshStructure elementStructure; MeshStructure elementStructure;
elementStructure.init(structureCode, codeSize); elementStructure.init(structureCode, codeSize);
elementStructure.fitMeshToStructure(mesh, refManager, false, elementStructure.fitMeshToStructure(mesh, refManager,
false, elIndex, ignoreFinerMesh); false, elIndex, ignoreFinerMesh);
uint32_t nValuesPerVector = 0; uint32_t nValuesPerVector = 0;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "LeafData.h" #include "LeafData.h"
#include "SurfaceRegion_ED.h" #include "SurfaceRegion_ED.h"
#include "ElementRegion_ED.h" #include "ElementRegion_ED.h"
#include "PartitionElementData.h"
#include "DOFMatrix.h" #include "DOFMatrix.h"
#include "UmfPackSolver.h" #include "UmfPackSolver.h"
#include "time/RosenbrockMethod.h" #include "time/RosenbrockMethod.h"
...@@ -120,9 +119,6 @@ namespace AMDiS { ...@@ -120,9 +119,6 @@ namespace AMDiS {
creator = new ElementRegion_ED::Creator; creator = new ElementRegion_ED::Creator;
addCreator("ElementRegion_ED", creator); addCreator("ElementRegion_ED", creator);
creator = new PartitionElementData::Creator;
addCreator("PartitionElementData", creator);
} }
......
#include "ElementData.h" #include "ElementData.h"
#include "PartitionElementData.h"
namespace AMDiS { namespace AMDiS {
void ElementData::coarsenElementData(Element* parent, void ElementData::coarsenElementData(Element* parent,
...@@ -8,13 +8,6 @@ namespace AMDiS { ...@@ -8,13 +8,6 @@ namespace AMDiS {
int elTypeParent) int elTypeParent)
{ {
if (decorated) { if (decorated) {
PartitionElementData* ped = NULL;
ped = dynamic_cast<PartitionElementData*>(thisChild->getElementData(PARTITION_ED));
ped = NULL;
ped = dynamic_cast<PartitionElementData*>(otherChild->getElementData(PARTITION_ED));
ped = NULL;
ped = dynamic_cast<PartitionElementData*> (parent->getElementData(PARTITION_ED));
decorated->coarsenElementData(parent, thisChild, otherChild, elTypeParent); decorated->coarsenElementData(parent, thisChild, otherChild, elTypeParent);
delete decorated; delete decorated;
decorated = NULL; decorated = NULL;
......
#include "MeshStructure.h" #include "MeshStructure.h"
#include "MeshStructure_ED.h" #include "MeshStructure_ED.h"
#include "PartitionElementData.h"
#include "Mesh.h" #include "Mesh.h"
#include "Element.h" #include "Element.h"
#include "Traverse.h" #include "Traverse.h"
...@@ -226,7 +225,6 @@ namespace AMDiS { ...@@ -226,7 +225,6 @@ namespace AMDiS {
void MeshStructure::fitMeshToStructure(Mesh *mesh, void MeshStructure::fitMeshToStructure(Mesh *mesh,
RefinementManager *manager, RefinementManager *manager,
bool checkPartition,
bool debugMode, bool debugMode,
int macroElIndex, int macroElIndex,
bool ignoreFinerMesh) bool ignoreFinerMesh)
...@@ -267,23 +265,9 @@ namespace AMDiS { ...@@ -267,23 +265,9 @@ namespace AMDiS {
cont = skipBranch(structure); cont = skipBranch(structure);
structure->commit(); structure->commit();
bool decorate = true; MeshStructure_ED *elData = new MeshStructure_ED(element->getElementData());
if (checkPartition) { elData->setStructure(structure);
PartitionElementData *partitionData = dynamic_cast<PartitionElementData*> element->setElementData(elData);
(element->getElementData(PARTITION_ED));
TEST_EXIT_DBG(partitionData)("no partition element data\n");
PartitionStatus status = partitionData->getPartitionStatus();
if (debugMode == false && (status == OUT || status == UNDEFINED))
decorate = false;
}
if (decorate) {
MeshStructure_ED *elData = new MeshStructure_ED(element->getElementData());
elData->setStructure(structure);
element->setElementData(elData);
} else {
delete structure;
}
} else { } else {
cont = nextElement(); cont = nextElement();
} }
......
...@@ -109,7 +109,6 @@ namespace AMDiS { ...@@ -109,7 +109,6 @@ namespace AMDiS {
*/ */
void fitMeshToStructure(Mesh *mesh, void fitMeshToStructure(Mesh *mesh,
RefinementManager *manager, RefinementManager *manager,
bool checkPartition = false,
bool debugMode = false, bool debugMode = false,
int macroElIndex = -1, int macroElIndex = -1,
bool ignoreFinerMesh = false); bool ignoreFinerMesh = false);
......
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == TU Dresden ==
// == ==
// == Institut fr Wissenschaftliches Rechnen ==
// == Zellescher Weg 12-14 ==
// == 01069 Dresden ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == https://gforge.zih.tu-dresden.de/projects/amdis/ ==
// == ==
// ============================================================================
/** \file PartitionElementData.h */
#ifndef AMDIS_PARTITIONELEMENTDATA_H
#define AMDIS_PARTITIONELEMENTDATA_H
#include "Element.h"
#include "ElementData.h"
#include "FixVec.h"
#include "Serializer.h"
namespace AMDiS {
const int PARTITION_ED = 7;
enum PartitionStatus {
UNDEFINED = -1,
IN = 0,
OVERLAP = 1,
OUT = 2
};
class PartitionElementData : public ElementData
{
public:
inline bool isOfType(int typeID) const
{
if (typeID == PARTITION_ED)
return true;
return false;
}
class Creator : public CreatorInterface<ElementData>
{
public:
ElementData* create()
{
return new PartitionElementData;
}
};
PartitionElementData(ElementData *decorated = NULL)
: ElementData(decorated),
status(UNDEFINED),
level(0)
{}
~PartitionElementData()
{}
bool refineElementData(Element* parent,
Element* child1,
Element* child2,
int elType)
{
ElementData::refineElementData(parent, child1, child2, elType);
PartitionElementData *child1Data =
new PartitionElementData(child1->getElementData());
PartitionElementData *child2Data =
new PartitionElementData(child2->getElementData());
child1Data->setPartitionStatus(status);
child2Data->setPartitionStatus(status);
child1Data->setLevel(level + 1);
child2Data->setLevel(level + 1);
child1->setElementData(child1Data);
child2->setElementData(child2Data);
return false;
}
ElementData *clone() const
{
PartitionElementData *newObj = new PartitionElementData;
newObj->decorated = ElementData::clone();
return newObj;
}
inline std::string getTypeName() const
{
return "PartitionElementData";
}
inline const int getTypeID() const
{
return PARTITION_ED;
}
void serialize(std::ostream& out)
{
ElementData::serialize(out);
SerUtil::serialize(out, status);
SerUtil::serialize(out, level);
}
void deserialize(std::istream& in)
{
ElementData::deserialize(in);
SerUtil::deserialize(in, status);
SerUtil::deserialize(in, level);
}
inline void setPartitionStatus(PartitionStatus s)
{
status = s;
}
inline PartitionStatus getPartitionStatus()
{
return status;
}
inline void setLevel(int l)
{
level = l;
}
inline int getLevel()
{
return level;
}
void descend(Element *element)
{
if (!element->isLeaf()) {
Element *child0 = element->getChild(0);
Element *child1 = element->getChild(1);
// get partition data
PartitionElementData *child0Data = dynamic_cast<PartitionElementData*>
(child0->getElementData(PARTITION_ED));
PartitionElementData *child1Data = dynamic_cast<PartitionElementData*>
(child1->getElementData(PARTITION_ED));
TEST_EXIT(child0Data && child1Data)("no partition data\n");
child0Data->setPartitionStatus(this->getPartitionStatus());
child1Data->setPartitionStatus(this->getPartitionStatus());
child0Data->descend(child0);
child1Data->descend(child1);
}
}
protected:
PartitionStatus status;
int level;
};
}
#endif
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "ElInfo.h" #include "ElInfo.h"
#include "Element.h" #include "Element.h"
#include "MacroElement.h" #include "MacroElement.h"
#include "PartitionElementData.h"
#include "DOFMatrix.h" #include "DOFMatrix.h"
#include "DOFVector.h" #include "DOFVector.h"
#include "SystemVector.h" #include "SystemVector.h"
...@@ -112,7 +111,6 @@ namespace AMDiS { ...@@ -112,7 +111,6 @@ namespace AMDiS {
MSG("Skip write part mesh!\n"); MSG("Skip write part mesh!\n");
} }
} }
ParallelDebug::testAllElements(*this);
#endif #endif
...@@ -145,6 +143,7 @@ namespace AMDiS { ...@@ -145,6 +143,7 @@ namespace AMDiS {
#if (DEBUG != 0) #if (DEBUG != 0)
MSG("AMDiS runs in debug mode, so make some test ...\n"); MSG("AMDiS runs in debug mode, so make some test ...\n");
ParallelDebug::testAllElements(*this);
debug::testSortedDofs(mesh, elMap); debug::testSortedDofs(mesh, elMap);
ParallelDebug::testInteriorBoundary(*this); ParallelDebug::testInteriorBoundary(*this);
ParallelDebug::testCommonDofs(*this, true); ParallelDebug::testCommonDofs(*this, true);
...@@ -944,7 +943,7 @@ namespace AMDiS { ...@@ -944,7 +943,7 @@ namespace AMDiS {
partitioner->partition(&elemWeights, INITIAL); partitioner->partition(&elemWeights, INITIAL);
} else { } else {
oldPartitionVec = partitionVec; oldPartitionVec = partitionVec;
partitioner->partition(&elemWeights, ADAPTIVE_REPART, 100.0 /*0.000001*/); partitioner->partition(&elemWeights, ADAPTIVE_REPART, 1000.0);
} }
partitioner->fillCoarsePartitionVec(&partitionVec); partitioner->fillCoarsePartitionVec(&partitionVec);
...@@ -1003,6 +1002,10 @@ namespace AMDiS { ...@@ -1003,6 +1002,10 @@ namespace AMDiS {
partitioner->useLocalGlobalDofMap(&mapLocalGlobalDofs); partitioner->useLocalGlobalDofMap(&mapLocalGlobalDofs);
partitionMesh(); partitionMesh();
#if (DEBUG != 0)
ParallelDebug::testAllElements(*this);
#endif
MSG("DONE\n"); MSG("DONE\n");
} }
...@@ -1412,13 +1415,9 @@ namespace AMDiS { ...@@ -1412,13 +1415,9 @@ namespace AMDiS {
std::set<MacroElement*> macrosToRemove; std::set<MacroElement*> macrosToRemove;
for (std::deque<MacroElement*>::iterator it = mesh->firstMacroElement(); for (std::deque<MacroElement*>::iterator it = mesh->firstMacroElement();
it != mesh->endOfMacroElements(); it != mesh->endOfMacroElements();
++it) { ++it)
PartitionElementData *partitionData = if (partitioner->getElementInRank()[(*it)->getIndex()] == false)
dynamic_cast<PartitionElementData*> macrosToRemove.insert(*it);
((*it)->getElement()->getElementData(PARTITION_ED));
if (partitionData->getPartitionStatus() != IN)
macrosToRemove.insert(*it);
}
mesh->removeMacroElements(macrosToRemove, feSpace); mesh->removeMacroElements(macrosToRemove, feSpace);
}