Commit 8a0c0bba authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

And added reading mesh structure files.

parent 4a915c97
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# 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="/bin/sed -e 1s/^X//" Xsed="/usr/bin/sed -e 1s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout # The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set. # if CDPATH is set.
...@@ -44,7 +44,7 @@ available_tags=" CXX F77" ...@@ -44,7 +44,7 @@ available_tags=" CXX F77"
# ### BEGIN LIBTOOL CONFIG # ### BEGIN LIBTOOL CONFIG
# Libtool was configured on host NWRW15: # Libtool was configured on host deimos103:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -66,12 +66,12 @@ fast_install=yes ...@@ -66,12 +66,12 @@ fast_install=yes
# The host system. # The host system.
host_alias= host_alias=
host=i686-pc-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-pc-linux-gnu build=x86_64-unknown-linux-gnu
build_os=linux-gnu build_os=linux-gnu
# An echo program that does not interpret backslashes. # An echo program that does not interpret backslashes.
...@@ -97,7 +97,7 @@ with_gcc=yes ...@@ -97,7 +97,7 @@ with_gcc=yes
EGREP="grep -E" EGREP="grep -E"
# 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"
# Whether we need hard or soft links. # Whether we need hard or soft links.
LN_S="ln -s" LN_S="ln -s"
...@@ -325,10 +325,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM ...@@ -325,10 +325,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs=unknown link_all_deplibs=unknown
# Compile-time system search path for libraries # Compile-time system search path for libraries
sys_lib_search_path_spec=" /u/witkowski/local/lib/i386-redhat-linux/4.1.2/ /u/witkowski/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/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../ /lib/i386-redhat-linux/4.1.2/ /lib/ /usr/lib/i386-redhat-linux/4.1.2/ /usr/lib/" sys_lib_search_path_spec=" /fastfs/wir/local/lib/x86_64-suse-linux/4.1.2/ /fastfs/wir/local/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/ /usr/lib/gcc/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/ /lib/x86_64-suse-linux/4.1.2/ /lib/../lib64/ /usr/lib/x86_64-suse-linux/4.1.2/ /usr/lib/../lib64/ /fastfs/wir/local/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../ /lib/ /usr/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/octave-2.9.9 /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/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale3.0/lib/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2/libso "
# Fix the shell variable $srcfile for the compiler. # Fix the shell variable $srcfile for the compiler.
fix_srcfile_path="" fix_srcfile_path=""
...@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` ...@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
# End: # End:
# ### BEGIN LIBTOOL TAG CONFIG: CXX # ### BEGIN LIBTOOL TAG CONFIG: CXX
# Libtool was configured on host NWRW15: # Libtool was configured on host deimos103:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -6782,12 +6782,12 @@ fast_install=yes ...@@ -6782,12 +6782,12 @@ fast_install=yes
# The host system. # The host system.
host_alias= host_alias=
host=i686-pc-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-pc-linux-gnu build=x86_64-unknown-linux-gnu
build_os=linux-gnu build_os=linux-gnu
# An echo program that does not interpret backslashes. # An echo program that does not interpret backslashes.
...@@ -6813,7 +6813,7 @@ with_gcc=yes ...@@ -6813,7 +6813,7 @@ with_gcc=yes
EGREP="grep -E" EGREP="grep -E"
# 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"
# Whether we need hard or soft links. # Whether we need hard or soft links.
LN_S="ln -s" LN_S="ln -s"
...@@ -6942,11 +6942,11 @@ striplib="strip --strip-unneeded" ...@@ -6942,11 +6942,11 @@ striplib="strip --strip-unneeded"
# Dependencies to place before the objects being linked to create a # Dependencies to place before the objects being linked to create a
# shared library. # 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.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbeginS.o"
# Dependencies to place after the objects being linked to create a # Dependencies to place after the objects being linked to create a
# shared library. # shared library.
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.1.2/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o"
# Dependencies to place before the objects being linked to create a # Dependencies to place before the objects being linked to create a
# shared library. # shared library.
...@@ -6958,7 +6958,7 @@ postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" ...@@ -6958,7 +6958,7 @@ postdeps="-lstdc++ -lm -lgcc_s -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/witkowski/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/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/fastfs/wir/local/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.."
# Method to check whether dependent libraries are shared objects. # Method to check whether dependent libraries are shared objects.
deplibs_check_method="pass_all" deplibs_check_method="pass_all"
...@@ -7038,10 +7038,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM ...@@ -7038,10 +7038,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs=unknown link_all_deplibs=unknown
# Compile-time system search path for libraries # Compile-time system search path for libraries
sys_lib_search_path_spec=" /u/witkowski/local/lib/i386-redhat-linux/4.1.2/ /u/witkowski/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/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../i386-redhat-linux/4.1.2/ /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../ /lib/i386-redhat-linux/4.1.2/ /lib/ /usr/lib/i386-redhat-linux/4.1.2/ /usr/lib/" sys_lib_search_path_spec=" /fastfs/wir/local/lib/x86_64-suse-linux/4.1.2/ /fastfs/wir/local/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/ /usr/lib/gcc/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/ /lib/x86_64-suse-linux/4.1.2/ /lib/../lib64/ /usr/lib/x86_64-suse-linux/4.1.2/ /usr/lib/../lib64/ /fastfs/wir/local/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../ /lib/ /usr/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/octave-2.9.9 /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/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale3.0/lib/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2/libso "
# Fix the shell variable $srcfile for the compiler. # Fix the shell variable $srcfile for the compiler.
fix_srcfile_path="" fix_srcfile_path=""
...@@ -7065,7 +7065,7 @@ include_expsyms="" ...@@ -7065,7 +7065,7 @@ include_expsyms=""
# ### BEGIN LIBTOOL TAG CONFIG: F77 # ### BEGIN LIBTOOL TAG CONFIG: F77
# Libtool was configured on host NWRW15: # Libtool was configured on host deimos103:
# Shell to use when invoking shell scripts. # Shell to use when invoking shell scripts.
SHELL="/bin/sh" SHELL="/bin/sh"
...@@ -7087,12 +7087,12 @@ fast_install=yes ...@@ -7087,12 +7087,12 @@ fast_install=yes
# The host system. # The host system.
host_alias= host_alias=
host=i686-pc-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-pc-linux-gnu build=x86_64-unknown-linux-gnu
build_os=linux-gnu build_os=linux-gnu
# An echo program that does not interpret backslashes. # An echo program that does not interpret backslashes.
...@@ -7112,13 +7112,13 @@ LTCFLAGS="-g -O2" ...@@ -7112,13 +7112,13 @@ LTCFLAGS="-g -O2"
CC="g77" CC="g77"
# Is the compiler the GNU C compiler? # Is the compiler the GNU C compiler?
with_gcc=yes with_gcc=
# An ERE matcher. # An ERE matcher.
EGREP="grep -E" EGREP="grep -E"
# 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"
# Whether we need hard or soft links. # Whether we need hard or soft links.
LN_S="ln -s" LN_S="ln -s"
...@@ -7346,10 +7346,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM ...@@ -7346,10 +7346,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs=unknown link_all_deplibs=unknown
# Compile-time system search path for libraries # Compile-time system search path for libraries
sys_lib_search_path_spec=" /u/witkowski/local/lib/i386-redhat-linux/3.4.6/ /u/witkowski/local/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../i386-redhat-linux/3.4.6/ /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../ /lib/i386-redhat-linux/3.4.6/ /lib/ /usr/lib/i386-redhat-linux/3.4.6/ /usr/lib/" sys_lib_search_path_spec=" /fastfs/wir/local/lib/x86_64-suse-linux/3.3.5/ /fastfs/wir/local/lib/ /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/ /usr/lib/gcc/x86_64-suse-linux/3.3.5/ /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/3.3.5/ /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../x86_64-suse-linux/3.3.5/ /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../ /lib/x86_64-suse-linux/3.3.5/ /lib/ /usr/lib/x86_64-suse-linux/3.3.5/ /usr/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/octave-2.9.9 /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/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale3.0/lib/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2/libso "
# Fix the shell variable $srcfile for the compiler. # Fix the shell variable $srcfile for the compiler.
fix_srcfile_path="" fix_srcfile_path=""
......
...@@ -383,13 +383,27 @@ namespace AMDiS { ...@@ -383,13 +383,27 @@ namespace AMDiS {
out.open(filename.c_str()); out.open(filename.c_str());
DOFIterator<double> it(&vec, USED_DOFS); DOFIterator<double> it(&vec, USED_DOFS);
int counter = 1;
for (it.reset(); !it.end(); ++it) for (it.reset(); !it.end(); ++it)
out << counter++ << " " << *it << "\n"; out << *it << "\n";
out.close(); out.close();
} }
void writeMatlabVector(SystemVector &vec, std::string filename)
{
std::ofstream out;
out.open(filename.c_str());
for (int i = 0; i < vec.getSize(); i++) {
DOFIterator<double> it(vec.getDOFVector(i), USED_DOFS);
for (it.reset(); !it.end(); ++it)
out << *it << "\n";
}
out.close();
}
void writeCoordsFile(const FiniteElemSpace* feSpace, std::string filename) void writeCoordsFile(const FiniteElemSpace* feSpace, std::string filename)
{ {
......
...@@ -129,6 +129,8 @@ namespace AMDiS { ...@@ -129,6 +129,8 @@ namespace AMDiS {
*/ */
void writeMatlabVector(DOFVector<double> &vec, std::string filename); void writeMatlabVector(DOFVector<double> &vec, std::string filename);
void writeMatlabVector(SystemVector &vec, std::string filename);
void writeCoordsFile(const FiniteElemSpace *feSpace, std::string filename); void writeCoordsFile(const FiniteElemSpace *feSpace, std::string filename);
/** \brief /** \brief
......
...@@ -226,7 +226,8 @@ namespace AMDiS { ...@@ -226,7 +226,8 @@ namespace AMDiS {
void MeshStructure::fitMeshToStructure(Mesh *mesh, void MeshStructure::fitMeshToStructure(Mesh *mesh,
RefinementManager *manager, RefinementManager *manager,
bool checkPartition, bool checkPartition,
bool debugMode) bool debugMode,
int macroElIndex)
{ {
FUNCNAME("MeshStructure::fitMeshToStructure()"); FUNCNAME("MeshStructure::fitMeshToStructure()");
...@@ -237,12 +238,18 @@ namespace AMDiS { ...@@ -237,12 +238,18 @@ namespace AMDiS {
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
while (elInfo) { while (elInfo) {
TEST_EXIT(cont)("unexpected structure code end!\n"); if (macroElIndex >= 0 &&
elInfo->getMacroElement()->getElement()->getIndex() != macroElIndex) {
elInfo = stack.traverseNext(elInfo);
continue;
}
Element *element = elInfo->getElement(); Element *element = elInfo->getElement();
TEST_EXIT(cont)("unexpected structure code end!\n");
if (isLeafElement()) { if (isLeafElement()) {
TEST_EXIT_DBG(element->isLeaf())("mesh finer than code\n"); TEST_EXIT(element->isLeaf())("mesh finer than code\n");
} }
if (element->isLeaf() && !isLeafElement()) { if (element->isLeaf() && !isLeafElement()) {
...@@ -281,6 +288,12 @@ namespace AMDiS { ...@@ -281,6 +288,12 @@ namespace AMDiS {
finished = true; finished = true;
elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) { while (elInfo) {
if (macroElIndex >= 0 &&
elInfo->getMacroElement()->getElement()->getIndex() != macroElIndex) {
elInfo = stack.traverseNext(elInfo);
continue;
}
Element *element = elInfo->getElement(); Element *element = elInfo->getElement();
if (element->getElementData(MESH_STRUCTURE) != NULL) { if (element->getElementData(MESH_STRUCTURE) != NULL) {
element->setMark(1); element->setMark(1);
...@@ -317,7 +330,7 @@ namespace AMDiS { ...@@ -317,7 +330,7 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
file << nMacroElements; file.write(reinterpret_cast<char*>(&nMacroElements), sizeof(nMacroElements));
elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER);
while (elInfo) { while (elInfo) {
...@@ -344,13 +357,54 @@ namespace AMDiS { ...@@ -344,13 +357,54 @@ namespace AMDiS {
} }
void MeshStructure::readMeshFile(Mesh *mesh,
RefinementManager *refManager,
std::string filename)
{
FUNCNAME("MeshStructure::readMeshFile()");
std::ifstream file;
file.open(filename.c_str(), std::ios::in | std::ios::binary);
int nMacroElements = -1;
file.read(reinterpret_cast<char*>(&nMacroElements), sizeof(nMacroElements));
for (int i = 0; i < nMacroElements; i++) {
int macroElIndex = -1;
int codeSize = 0;
code.clear();
file.read(reinterpret_cast<char*>(&macroElIndex), sizeof(macroElIndex));
file.read(reinterpret_cast<char*>(&nElements), sizeof(nElements));
file.read(reinterpret_cast<char*>(&codeSize), sizeof(codeSize));
for (int j = 0; j < codeSize; j++) {
unsigned long int readCode = 0;
file.read(reinterpret_cast<char*>(&readCode), sizeof(readCode));
code.push_back(readCode);
}
TEST_EXIT_DBG(macroElIndex >= 0)("Should not happen!\n");
reset();
fitMeshToStructure(mesh, refManager, false, false, macroElIndex);
}
file.close();
}
void MeshStructure::writeMacroElement(std::ofstream& file, int macroElIndex) void MeshStructure::writeMacroElement(std::ofstream& file, int macroElIndex)
{ {
file << macroElIndex; unsigned int size = code.size();
file << nElements;
file << code.size(); file.write(reinterpret_cast<char*>(&macroElIndex), sizeof(macroElIndex));
file.write(reinterpret_cast<char*>(&nElements), sizeof(nElements));
file.write(reinterpret_cast<char*>(&size), sizeof(size));
for (unsigned int i = 0; i < code.size(); i++) for (unsigned int i = 0; i < code.size(); i++)
file << code[i]; file.write(reinterpret_cast<char*>(&(code[i])), sizeof(code[i]));
} }
} }
...@@ -98,14 +98,20 @@ namespace AMDiS { ...@@ -98,14 +98,20 @@ namespace AMDiS {
/** \brief /** \brief
* Fits a given mesh to the mesh structure code. * Fits a given mesh to the mesh structure code.
* *
* \param debugMode In debugMode, the whole mesh is fitted to the mesh structure * \param debugMode In debugMode, the whole mesh is fitted to the mesh structure
* code. Otherwise, the mesh is fitted only on the partition * code. Otherwise, the mesh is fitted only on the partition
* of the current process. * of the current process.
* \param macroElIndex If the mesh structure code represents only one macro
* element, this can be denoted here by its index. In this
* case, only the corresponding macro element will be fitted
* to the code. Otherwise, this variable is negative and the
* whole mesh will be adapted.
*/ */
void fitMeshToStructure(Mesh *mesh, void fitMeshToStructure(Mesh *mesh,
RefinementManager *manager, RefinementManager *manager,
bool checkPartition = false, bool checkPartition = false,
bool debugMode = false); bool debugMode = false,
int macroElIndex = -1);
/// Prints the mesh structure code. /// Prints the mesh structure code.
void print() void print()
...@@ -158,6 +164,8 @@ namespace AMDiS { ...@@ -158,6 +164,8 @@ namespace AMDiS {
void writeMeshFile(Mesh *mesh, std::string filename); void writeMeshFile(Mesh *mesh, std::string filename);
void readMeshFile(Mesh *mesh, RefinementManager *refManager, std::string filename);
protected: protected:
/// Insert a new element to the structure code. Is used by the init function. /// Insert a new element to the structure code. Is used by the init function.
void insertElement(bool isLeaf); void insertElement(bool isLeaf);
......
...@@ -30,14 +30,16 @@ namespace AMDiS { ...@@ -30,14 +30,16 @@ namespace AMDiS {
class ProblemImplicitBase class ProblemImplicitBase
{ {
public: public:
virtual ~ProblemImplicitBase() {}
virtual bool createImplicitMesh() = 0; virtual bool createImplicitMesh() = 0;
virtual DOFVector< double >* getSignedDistance(int im = 0, int m = 0) = 0; virtual DOFVector<double>* getSignedDistance(int im = 0, int m = 0) = 0;
virtual DOFVector< double >* getPhi1(int im = 0, int m = 0) = 0; virtual DOFVector<double>* getPhi1(int im = 0, int m = 0) = 0;
virtual DOFVector< double >* getPhi2(int im = 0, int m = 0) = 0; virtual DOFVector<double>* getPhi2(int im = 0, int m = 0) = 0;
virtual DOFVector< double >* getLevelset(int im = 0, int m = 0) = 0; virtual DOFVector<double>* getLevelset(int im = 0, int m = 0) = 0;
protected: protected:
void readDofVec(std::istream& , DOFVector<double>* , Mesh* ); void readDofVec(std::istream& , DOFVector<double>* , Mesh*);
void readR(std::istream& , double , Mesh* , int implMesh = 0, int comp = 0); void readR(std::istream& , double , Mesh* , int implMesh = 0, int comp = 0);
void readPhi1(std::istream& , double , Mesh* , int implMesh = 0, int comp = 0); void readPhi1(std::istream& , double , Mesh* , int implMesh = 0, int comp = 0);
void readPhi2(std::istream& , double , Mesh* , int implMesh = 0, int comp = 0); void readPhi2(std::istream& , double , Mesh* , int implMesh = 0, int comp = 0);
...@@ -77,30 +79,30 @@ namespace AMDiS { ...@@ -77,30 +79,30 @@ namespace AMDiS {
virtual void createMesh(); virtual void createMesh();
virtual void initialize(Flag initFlag, ProblemScal *adoptProblem = NULL, virtual void initialize(Flag initFlag, ProblemScal *adoptProblem = NULL,
Flag adoptFlag = INIT_NOTHING); Flag adoptFlag = INIT_NOTHING);
DOFVector< double >* getSignedDistance(int im = 0 , int m = 0); DOFVector<double>* getSignedDistance(int im = 0 , int m = 0);
DOFVector< double >* getPhi1(int im = 0, int m = 0); DOFVector<double>* getPhi1(int im = 0, int m = 0);
DOFVector< double >* getPhi2(int im = 0, int m = 0); DOFVector<double>* getPhi2(int im = 0, int m = 0);
DOFVector< double >* getLevelset(int im = 0, int m = 0); DOFVector<double>* getLevelset(int im = 0, int m = 0);
protected: protected:
/// DOFVector for a signed distance /// DOFVector for a signed distance
std::vector< DOFVector< double >* > r; std::vector<DOFVector<double>*> r;
/// DOFVector for the phasefield function 0.5*(1-tanh(3*r/eps)) /// DOFVector for the phasefield function 0.5*(1-tanh(3*r/eps))
std::vector< DOFVector< double >* > phi1; std::vector<DOFVector<double>*> phi1;
/// DOFVector for the phasefield function 0.5*(1+tanh(3*r/eps)) /// DOFVector for the phasefield function 0.5*(1+tanh(3*r/eps))
std::vector< DOFVector< double >* > phi2; std::vector<DOFVector<double>*> phi2;
/// DOFVector for the levelset function /// DOFVector for the levelset function
/// (levelSet(x): x \in \Omega: 1, x \not \in Omega: -1, x \in \Gamma: 0) /// (levelSet(x): x \in \Omega: 1, x \not \in Omega: -1, x \in \Gamma: 0)
std::vector< DOFVector< double >* > levelSet; std::vector<DOFVector<double>*> levelSet;
bool readImplMesh; bool readImplMesh;
bool isImplicitMesh(int comp = 0) { return readImplMesh; } bool isImplicitMesh(int comp = 0) { return readImplMesh; }
bool createImplicitMesh( std::string path, int comp ); bool createImplicitMesh(std::string path, int comp);
}; };
class ProblemImplicitVec : public ProblemVec, public ProblemImplicitBase class ProblemImplicitVec : public ProblemVec, public ProblemImplicitBase
...@@ -120,27 +122,27 @@ namespace AMDiS { ...@@ -120,27 +122,27 @@ namespace AMDiS {
virtual bool createImplicitMesh(); virtual bool createImplicitMesh();
virtual void initialize(Flag initFlag, ProblemScal* adoptProblem=NULL, virtual void initialize(Flag initFlag, ProblemScal* adoptProblem=NULL,
Flag adoptFlag = INIT_NOTHING); Flag adoptFlag = INIT_NOTHING);
DOFVector< double >* getSignedDistance(int im = 0, int m = 0) ; DOFVector<double>* getSignedDistance(int im = 0, int m = 0) ;
DOFVector< double >* getPhi1(int im = 0, int m = 0) ; DOFVector<double>* getPhi1(int im = 0, int m = 0) ;
DOFVector< double >* getPhi2(int im = 0, int m = 0) ; DOFVector<double>* getPhi2(int im = 0, int m = 0) ;
DOFVector< double >* getLevelset(int im = 0, int m = 0) ; DOFVector<double>* getLevelset(int im = 0, int m = 0) ;
protected: protected:
bool createImplicitMesh(int p); bool createImplicitMesh(int p);
bool createImplicitMesh(std::string, int, int); bool createImplicitMesh(std::string, int, int);
/// DOFVector for a signed distance /// DOFVector for a signed distance
std::vector< std::vector< DOFVector< double >* > > r; std::vector< std::vector<DOFVector<double>*> > r;
/// DOFVector for the phasefield function 0.5*(1-tanh(3*r/eps)) /// DOFVector for the phasefield function 0.5*(1-tanh(3*r/eps))
std::vector< std::vector< DOFVector< double >* > > phi1; std::vector< std::vector<DOFVector<double>*> > phi1;
/// DOFVector for the phasefield function 0.5*(1+tanh(3*r/eps)) /// DOFVector for the phasefield function 0.5*(1+tanh(3*r/eps))
std::vector< std::vector< DOFVector< double >* > > phi2