diff --git a/AMDiS/libtool b/AMDiS/libtool index 41ace2e6aa8dc61f34efef5d3ac31a4138c1ba01..d6ae6aec3bdfe931f7738cb747117b7a8a279992 100755 --- a/AMDiS/libtool +++ b/AMDiS/libtool @@ -30,10 +30,10 @@ # the same distribution terms that you use for the rest of that program. # 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. -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 # if CDPATH is set. @@ -44,7 +44,7 @@ available_tags=" CXX F77" # ### BEGIN LIBTOOL CONFIG -# Libtool was configured on host NWRW15: +# Libtool was configured on host deimos102: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -66,12 +66,12 @@ fast_install=yes # The host system. host_alias= -host=i686-pc-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-pc-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # An echo program that does not interpret backslashes. @@ -82,13 +82,13 @@ AR="ar" AR_FLAGS="cru" # A C compiler. -LTCC="gcc" +LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" # LTCC compiler flags. LTCFLAGS="-g -O2" # A language-specific compiler. -CC="gcc" +CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" # Is the compiler the GNU C compiler? with_gcc=yes @@ -97,7 +97,7 @@ with_gcc=yes EGREP="grep -E" # 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. LN_S="ln -s" @@ -171,7 +171,7 @@ dlopen_self=unknown dlopen_self_static=unknown # Compiler flag to prevent dynamic linking. -link_static_flag="-static" +link_static_flag="" # Compiler flag to turn off builtin functions. no_builtin_flag=" -fno-builtin" @@ -325,10 +325,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /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=" /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/ /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 -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/octave-2.9.9 /usr/lib/qt-3.3/lib " +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_srcfile_path="" @@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # End: # ### BEGIN LIBTOOL TAG CONFIG: CXX -# Libtool was configured on host NWRW15: +# Libtool was configured on host deimos102: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -6782,12 +6782,12 @@ fast_install=yes # The host system. host_alias= -host=i686-pc-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-pc-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # An echo program that does not interpret backslashes. @@ -6798,13 +6798,13 @@ AR="ar" AR_FLAGS="cru" # A C compiler. -LTCC="gcc" +LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" # LTCC compiler flags. LTCFLAGS="-g -O2" # A language-specific compiler. -CC="g++" +CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpiCC" # Is the compiler the GNU C compiler? with_gcc=yes @@ -6813,7 +6813,7 @@ with_gcc=yes EGREP="grep -E" # 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. LN_S="ln -s" @@ -6887,7 +6887,7 @@ dlopen_self=unknown dlopen_self_static=unknown # Compiler flag to prevent dynamic linking. -link_static_flag="-static" +link_static_flag="" # Compiler flag to turn off builtin functions. no_builtin_flag=" -fno-builtin" @@ -6942,11 +6942,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to 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.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 # 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 # shared library. @@ -6954,11 +6954,11 @@ predeps="" # Dependencies to place after the objects being linked to create a # shared library. -postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" +postdeps="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -libverbs -lrt -lnuma -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s" # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path="-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 -L/licsoft/libraries/openmpi/1.2.6/64bit/lib -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/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. deplibs_check_method="pass_all" @@ -7038,10 +7038,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /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=" /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/ /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 -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/octave-2.9.9 /usr/lib/qt-3.3/lib " +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_srcfile_path="" @@ -7065,7 +7065,7 @@ include_expsyms="" # ### BEGIN LIBTOOL TAG CONFIG: F77 -# Libtool was configured on host NWRW15: +# Libtool was configured on host deimos102: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7087,12 +7087,12 @@ fast_install=yes # The host system. host_alias= -host=i686-pc-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-pc-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # An echo program that does not interpret backslashes. @@ -7103,7 +7103,7 @@ AR="ar" AR_FLAGS="cru" # A C compiler. -LTCC="gcc" +LTCC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" # LTCC compiler flags. LTCFLAGS="-g -O2" @@ -7112,13 +7112,13 @@ LTCFLAGS="-g -O2" CC="g77" # Is the compiler the GNU C compiler? -with_gcc=yes +with_gcc= # An ERE matcher. EGREP="grep -E" # 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. LN_S="ln -s" @@ -7346,10 +7346,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /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=" /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 -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/octave-2.9.9 /usr/lib/qt-3.3/lib " +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_srcfile_path="" diff --git a/AMDiS/src/ConditionalEstimator.cc b/AMDiS/src/ConditionalEstimator.cc index bc7997f69161dd5d4c11b33fd036c1dd37d535a1..2a17b00edce984e7270893464323be49b44ca1a4 100644 --- a/AMDiS/src/ConditionalEstimator.cc +++ b/AMDiS/src/ConditionalEstimator.cc @@ -30,9 +30,7 @@ namespace AMDiS { TEST_EXIT_DBG(elData)("no partition data on leaf element %d (rank %d)\n", elInfo->getElement()->getIndex(), MPI::COMM_WORLD.Get_rank()); - - PartitionStatus status = elData->getPartitionStatus(); - + //if(status == IN || status == OVERLAP) { decoratedEstimator_->estimateElement(elInfo); //} else { @@ -45,7 +43,6 @@ namespace AMDiS { while(elInfo) { PartitionElementData *elData = dynamic_cast<PartitionElementData*> (elInfo->getElement()->getElementData(PARTITION_ED)); - PartitionStatus status = elData->getPartitionStatus(); //if(status == IN) { elementCount_++; partition_sum += elInfo->getElement()->getEstimation(row_); diff --git a/AMDiS/src/ElementDofIterator.h b/AMDiS/src/ElementDofIterator.h index a09e1f305089d4d9c9d78735e69feadd204a0f4f..a64cee19461fac956af00d7fb9e95d3dd082fedc 100644 --- a/AMDiS/src/ElementDofIterator.h +++ b/AMDiS/src/ElementDofIterator.h @@ -34,7 +34,7 @@ namespace AMDiS { * * Should be used in the following way: * - * ElementDofIterator elDofIter(admin); + * ElementDofIterator elDofIter(feSpace); * elDofIter.reset(el); * do { * elDofIter.getDOF(); diff --git a/AMDiS/src/Global.cc b/AMDiS/src/Global.cc index 11923f5582b0d3f7aeaab7f15b5371ad473e5c49..cd4bdec5c68192a88e626428da23a7664d6b7cef 100644 --- a/AMDiS/src/Global.cc +++ b/AMDiS/src/Global.cc @@ -1,3 +1,7 @@ +#include <stdarg.h> +#include <stdio.h> +#include <sstream> + #include "Global.h" #include "Parameters.h" #include "Element.h" @@ -5,10 +9,6 @@ #include "Triangle.h" #include "Tetrahedron.h" - -#include <stdarg.h> -#include <stdio.h> - namespace AMDiS { const char *funcName = NULL; @@ -36,7 +36,6 @@ namespace AMDiS { MSG("wait for <enter> ..."); fgets(line, 9, stdin); } - return; } void Msg::change_out(std::ostream *fp) @@ -53,33 +52,7 @@ namespace AMDiS { } else { ERROR("file pointer is pointer to nil;\n"); ERROR("use previous stream for errors furthermore\n"); - } - - return; - } - - void Msg::open_file(const char *filename, OPENMODE type) - { - FUNCNAME("Msg::open_file()"); - std::ofstream *fp; - - - if (filename && (fp = new std::ofstream(filename, type))) { - if (out && *out != std::cout && *out != std::cerr) { - dynamic_cast< std::ofstream*>(out)->close(); - delete out; - } - - out = fp; - } else { - if (filename) - ERROR("can not open %s;\n", filename); - else - ERROR("no filename specified;\n"); - - ERROR("use previous stream for messages furthermore\n"); - } - return; + } } void Msg::change_error_out(std::ofstream *fp) @@ -97,8 +70,6 @@ namespace AMDiS { ERROR("file pointer is pointer to nil;\n"); ERROR("use previous stream for errors furthermore\n"); } - - return; } void Msg::open_error_file(const char *filename, OPENMODE type) @@ -120,34 +91,6 @@ namespace AMDiS { ERROR("no filename specified;\n"); ERROR("use previous stream for errors furthermore\n"); } - - return; - } - - const char *generate_filename(const char * path, const char * fn, int ntime) - { - static char name[256]; - char *cp; - - if (path == NULL || path[0] == '\0') { - sprintf(name, "./%s", fn); - } else { - const char* ccp = path; - while (*ccp) - ccp++; - ccp--; - if (*ccp == '/') - sprintf(name, "%s%s", path, fn); - else - sprintf(name, "%s/%s", path, fn); - } - cp = name; - while (*cp) - cp++; - sprintf(cp, "%d", 100000 + ntime); - if (ntime < 100000) *cp = '0'; - - return(const_cast<const char *>(name)); } void Msg::print_funcname(const char *funcName) @@ -156,36 +99,37 @@ namespace AMDiS { out = &std::cout; if (funcName && oldFuncName != funcName) { - (*out)<< funcName << ":" << std::endl; + PRINT_LINE((*out), funcName << ":" << std::endl); } else if (!funcName) { - (*out)<<"*unknown function*" << std::endl; + PRINT_LINE((*out), "*unknown function*" << std::endl); } - (*out) << " "; + PRINT_LINE((*out), " "); + oldFuncName = funcName; } - void Msg::print_error_funcname(const char *funcName, - const char *file, - int line) + void Msg::print_error_funcname(const char *funcName, const char *file, int line) { static int old_line = -1; if (!error) error = &std::cerr; - if (funcName && oldFuncName != funcName) { - (*error)<<funcName<< ": "; - } + std::stringstream oss; + + if (funcName && oldFuncName != funcName) + oss << funcName << ": "; else if (!funcName) { if (line-old_line > 5) - (*error) << "*unknown function*"; + oss << "*unknown function*"; } if (oldFuncName != funcName) { - (*error) << "ERROR in " << file << ", line " << line << "\n"; + oss << "ERROR in " << file << ", line " << line << std::endl;; oldFuncName = funcName; } else if (line - old_line > 5) - (*error) << "ERROR in " << file << ", line " << line << "\n"; + oss << "ERROR in " << file << ", line " << line << "\n" << std::endl; + PRINT_LINE((*error), oss.str()); old_line = line; } @@ -199,7 +143,7 @@ namespace AMDiS { va_start(arg, format); vsprintf(buff, format, arg); - (*error)<<buff; + PRINT_LINE((*error), buff); va_end(arg); exit(1); @@ -216,10 +160,8 @@ namespace AMDiS { va_start(arg, format); vsprintf(buff, format, arg); - (*error)<<buff; + PRINT_LINE((*error), buff); va_end(arg); - - return; } void Msg::print_warn_funcname(const char *funcName, @@ -231,17 +173,22 @@ namespace AMDiS { if (!out) out = &std::cout; + std::stringstream oss; + if (funcName && oldFuncName != funcName) { - (*out) << funcName << ": "; - } - else if (!funcName){ - (*out) << "*unknown function*"; + oss << funcName << ": "; + } else if (!funcName) { + oss << "*unknown function*"; } + if (oldFuncName != funcName) { - (*out) << "WARNING in " << file << ", line " << line << "\n"; + oss << "WARNING in " << file << ", line " << line << std::endl; oldFuncName = funcName; - } else if (line - old_line > 5) - (*out) << "WARNING in " << file << ", line " << line << "\n"; + } else if (line - old_line > 5) { + oss << "WARNING in " << file << ", line " << line << std::endl; + } + + PRINT_LINE((*out), oss.str()); old_line = line; } @@ -256,10 +203,8 @@ namespace AMDiS { va_start(arg, format); vsprintf(buff, format, arg); - (*out)<<buff; + PRINT_LINE((*out), buff); va_end(arg); - - return; } @@ -273,7 +218,7 @@ namespace AMDiS { va_start(arg, format); vsprintf(buff, format, arg); - (*out) << buff; + PRINT_LINE((*out), buff); va_end(arg); } @@ -295,9 +240,8 @@ namespace AMDiS { geoIndexTable.resize(4); for (int i = 0; i < 4; i++) { geoIndexTable[i].resize(geoTableSize); - for (int j = 0; j < geoTableSize; j++) { - geoIndexTable[i][j] = 0; - } + for (int j = 0; j < geoTableSize; j++) + geoIndexTable[i][j] = 0; } geoIndexTable[0][PARTS - MINPART] = 1; diff --git a/AMDiS/src/Global.h b/AMDiS/src/Global.h index 6256f13a595cb04371daa8efe0e02b365961c68a..f30401efc9c784ac9a7d0a4b3b0498de6a84a020 100644 --- a/AMDiS/src/Global.h +++ b/AMDiS/src/Global.h @@ -47,6 +47,10 @@ #include <functional> #include <float.h> +#if HAVE_PARALLEL_DOMAIN_AMDIS +#include "mpi.h" +#endif + #include "AMDiS_fwd.h" namespace AMDiS { @@ -76,6 +80,12 @@ namespace AMDiS { /// returns the dimension of GeoIndex ind for dimension dim #define DIM_OF_INDEX(ind, dim) ((static_cast<int>(ind) == 0) ? dim : static_cast<int>(ind) - 1) +#if HAVE_PARALLEL_DOMAIN_AMDIS +#define PRINT_LINE(stream, line) stream << "[" << MPI::COMM_WORLD.Get_rank() << "]" << line +#else +#define PRINT_LINE(stream, line) stream << line +#endif + /// Calculates factorial of i int fac(int i); @@ -172,20 +182,12 @@ namespace AMDiS { /// Changes the message stream static void change_out(std::ostream*); - /// Creates a filestream and sets the message stream to this filestream - static void open_file(const char *filename, OPENMODE); - /// Changes the error stream static void change_error_out(std::ofstream *fp); /// Creates a filestream and sets the error stream to this filestream static void open_error_file(const char *filename, OPENMODE); - /// Generates a filename from path, file and ntime - static const char *generate_filename(const char *path, - const char *file, - int ntime); - /// Sets \ref msgInfo static void setMsgInfo(int info) { diff --git a/AMDiS/src/ParallelDomainBase.cc b/AMDiS/src/ParallelDomainBase.cc index 8229af0ec2fc7d7d61b3b30060b273f7b5c973d7..c77f2bb7a2097346bcb8d8fb5f1dc99400ab1ae5 100644 --- a/AMDiS/src/ParallelDomainBase.cc +++ b/AMDiS/src/ParallelDomainBase.cc @@ -244,6 +244,13 @@ namespace AMDiS { for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); icursor != icend; ++icursor) if (value(*icursor) != 0.0) { + if (mpiRank == 0 && r == 0) + std::cout << "C = " << col(*icursor) + << " = " << mapLocalGlobalDOFs[col(*icursor)] + << " = " << mapLocalGlobalDOFs[col(*icursor)] * dispMult + dispAddCol + << " -> " << value(*icursor) + << std::endl; + cols.push_back(mapLocalGlobalDOFs[col(*icursor)] * dispMult + dispAddCol); values.push_back(value(*icursor)); } @@ -251,6 +258,7 @@ namespace AMDiS { MatSetValues(petscMatrix, 1, &r, cols.size(), &(cols[0]), &(values[0]), ADD_VALUES); } + std::cout << "==========" << std::endl; } @@ -338,7 +346,7 @@ namespace AMDiS { icend = end<nz>(cursor); icursor != icend; ++icursor) { if (value(*icursor) != 0.0) { int c = mapLocalGlobalDOFs[col(*icursor)] * nComponents + j; - + if (c >= rstart * nComponents && c < rstart * nComponents + nRankRows) d_nnz[r]++; @@ -475,13 +483,9 @@ namespace AMDiS { i++; } - INFO(info, 8)("Fill petsc matrix 1 needed %.5f seconds\n", TIME_USED(first, clock())); - MatCreateMPIAIJ(PETSC_COMM_WORLD, nRankRows, nRankRows, nOverallRows, nOverallRows, 0, d_nnz, 0, o_nnz, &petscMatrix); - INFO(info, 8)("Fill petsc matrix 2 needed %.5f seconds\n", TIME_USED(first, clock())); - #if (DEBUG != 0) int a, b; MatGetOwnershipRange(petscMatrix, &a, &b); @@ -498,13 +502,9 @@ namespace AMDiS { if ((*mat)[i][j]) setDofMatrix((*mat)[i][j], nComponents, i, j); - INFO(info, 8)("Fill petsc matrix 3 needed %.5f seconds\n", TIME_USED(first, clock())); - MatAssemblyBegin(petscMatrix, MAT_FINAL_ASSEMBLY); MatAssemblyEnd(petscMatrix, MAT_FINAL_ASSEMBLY); - INFO(info, 8)("Fill petsc matrix 4 needed %.5f seconds\n", TIME_USED(first, clock())); - for (int i = 0; i < nComponents; i++) setDofVector(vec->getDOFVector(i), nComponents, i); @@ -589,7 +589,7 @@ namespace AMDiS { } - void ParallelDomainBase::solvePetscMatrix(SystemVector *vec) + void ParallelDomainBase::solvePetscMatrix(SystemVector &vec) { FUNCNAME("ParallelDomainBase::solvePetscMatrix()"); @@ -610,14 +610,38 @@ namespace AMDiS { VecGetArray(petscSolVec, &vecPointer); for (int i = 0; i < nComponents; i++) { - DOFVector<double> *dofvec = vec->getDOFVector(i); - for (int j = 0; j < nRankDOFs; j++) + DOFVector<double> *dofvec = vec.getDOFVector(i); + for (int j = 0; j < nRankDOFs; j++) { + if (i == 0 && mapLocalToDofIndex[j] == 0) + std::cout << "ZUGRIFF AUF: " << j * nComponents + i << std::endl; + (*dofvec)[mapLocalToDofIndex[j]] = vecPointer[j * nComponents + i]; + } } + if (mpiRank == 0) + std::cout << "RESULT = " << (*(vec.getDOFVector(0)))[0] << std::endl; + VecRestoreArray(petscSolVec, &vecPointer); + synchVectors(vec); + int iterations = 0; + KSPGetIterationNumber(solver, &iterations); + MSG(" Number of iterations: %d\n", iterations); + + double norm = 0.0; + MatMult(petscMatrix, petscSolVec, petscTmpVec); + VecAXPY(petscTmpVec, -1.0, petscRhsVec); + VecNorm(petscTmpVec, NORM_2, &norm); + MSG(" Residual norm: %e\n", norm); + + MatDestroy(petscMatrix); + KSPDestroy(solver); + } + + void ParallelDomainBase::synchVectors(SystemVector &vec) + { std::vector<double*> sendBuffers(sendDofs.size()); std::vector<double*> recvBuffers(recvDofs.size()); @@ -632,7 +656,7 @@ namespace AMDiS { int counter = 0; for (int j = 0; j < nComponents; j++) { - DOFVector<double> *dofvec = vec->getDOFVector(j); + DOFVector<double> *dofvec = vec.getDOFVector(j); for (int k = 0; k < nSendDOFs; k++) sendBuffers[i][counter++] = (*dofvec)[*((sendIt->second)[k])]; } @@ -661,7 +685,7 @@ namespace AMDiS { int counter = 0; for (int j = 0; j < nComponents; j++) { - DOFVector<double> *dofvec = vec->getDOFVector(j); + DOFVector<double> *dofvec = vec.getDOFVector(j); for (int k = 0; k < nRecvDOFs; k++) (*dofvec)[*(recvIt->second)[k]] = recvBuffers[i][counter++]; } @@ -671,19 +695,6 @@ namespace AMDiS { for (int i = 0; i < static_cast<int>(sendBuffers.size()); i++) delete [] sendBuffers[i]; - - int iterations = 0; - KSPGetIterationNumber(solver, &iterations); - MSG(" Number of iterations: %d\n", iterations); - - double norm = 0.0; - MatMult(petscMatrix, petscSolVec, petscTmpVec); - VecAXPY(petscTmpVec, -1.0, petscRhsVec); - VecNorm(petscTmpVec, NORM_2, &norm); - MSG(" Residual norm: %e\n", norm); - - MatDestroy(petscMatrix); - KSPDestroy(solver); } @@ -992,6 +1003,22 @@ namespace AMDiS { sendDofs.clear(); recvDofs.clear(); + +#if 0 + StlMpi stlMpi(mpiComm); + stlMpi.prepareCommunication(false); + std::map< + + for (std::map<int, DofIndexMap >::iterator sendIt = sendNewDofs.begin(); + sendIt != sendNewDofs.end(); ++sendIt, i++) + stlMpi.send(it->second, it->first); + + for (std::map<int, int>::iterator recvIt = recvNewDofs.begin(); + recvIt != recvNewDofs.end(); ++recvIt, i++) + stlMpi.recv(it->first, it->second * 2); + + stlMpi.startCommunication(); +#endif MPI::Request request[sendNewDofs.size() + recvNewDofs.size()]; int requestCounter = 0; diff --git a/AMDiS/src/ParallelDomainBase.h b/AMDiS/src/ParallelDomainBase.h index a4a0b4b838abe31eb1420971422ddf2895692504..3ab82d43579347e3f54aa6d5b11e14670e37fb5f 100644 --- a/AMDiS/src/ParallelDomainBase.h +++ b/AMDiS/src/ParallelDomainBase.h @@ -127,7 +127,7 @@ namespace AMDiS { } virtual void solveInitialProblem(AdaptInfo *adaptInfo) - { + { if (timeIF) timeIF->solveInitialProblem(adaptInfo); } @@ -174,7 +174,7 @@ namespace AMDiS { void solvePetscMatrix(DOFVector<double> *vec); - void solvePetscMatrix(SystemVector *vec); + void solvePetscMatrix(SystemVector &vec); virtual ProblemStatBase *getProblem(int number = 0) { @@ -279,6 +279,18 @@ namespace AMDiS { */ void writePartitioningMesh(std::string filename); + /** \brief + * This function must be used if the values of a SystemVector must be synchronised + * over all ranks. That means, that each rank sends the values of the DOFs, which + * are owned by the rank and lie on an interior bounday, to all other ranks also + * having this DOF. + * + * This function must be used, for example, after the lineary system is solved, or + * after the SystemVector is set by some user defined functions, e.g., initial + * solution functions. + */ + void synchVectors(SystemVector &vec); + inline void orderDOFs(const DegreeOfFreedom* dof1, const DegreeOfFreedom* dof2, const DegreeOfFreedom* dof3, diff --git a/AMDiS/src/ParallelDomainVec.cc b/AMDiS/src/ParallelDomainVec.cc index 5416c468df63f2c78bae75529b3a6e1696f71ffd..cd5d47ca7bb490a9089d87c8274781d643d1dd0f 100644 --- a/AMDiS/src/ParallelDomainVec.cc +++ b/AMDiS/src/ParallelDomainVec.cc @@ -57,7 +57,7 @@ namespace AMDiS { clock_t first = clock(); fillPetscMatrix(probVec->getSystemMatrix(), probVec->getRHS()); - solvePetscMatrix(probVec->getSolution()); + solvePetscMatrix(*(probVec->getSolution())); #ifdef _OPENMP INFO(info, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n", diff --git a/AMDiS/src/ParallelDomainVec.h b/AMDiS/src/ParallelDomainVec.h index 9c6638ce4a44e7eb3aa5f19981dd26b940a58b17..d4e44614f9649c951385fb53d7b966d2c6f56537 100644 --- a/AMDiS/src/ParallelDomainVec.h +++ b/AMDiS/src/ParallelDomainVec.h @@ -23,6 +23,7 @@ #define AMDIS_PARALLELDOMAINVEC_H #include "ParallelDomainBase.h" +#include "ProblemVec.h" namespace AMDiS { @@ -35,6 +36,13 @@ namespace AMDiS { void initParallelization(AdaptInfo *adaptInfo); + virtual void solveInitialProblem(AdaptInfo *adaptInfo) + { + ParallelDomainBase::solveInitialProblem(adaptInfo); + + synchVectors(*(probVec->getSolution())); + } + protected: /// Starts the solution of the linear system using Petsc. void solve(); diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 4ebe67e867741fde0396eab6509747553e169f2e..a64f7ef2b4cf9c552ab5e49e2b9d9357c1020351 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -776,6 +776,11 @@ namespace AMDiS { createPrecon(); + if (MPI::COMM_WORLD.Get_rank() == 0) + writeDbgMatrix("test0.mat"); + + exit(0); + INFO(info, 8)("fillin of assembled matrix: %d\n", nnz); #ifdef _OPENMP @@ -1322,6 +1327,7 @@ namespace AMDiS { solution->deserialize(in); } + void ProblemVec::computeError(AdaptInfo *adaptInfo) { FUNCNAME("ProblemVec::computeError()"); @@ -1377,5 +1383,173 @@ namespace AMDiS { delete sol; } } + + + void ProblemVec::createDofToCoordMap(DofToCoord &dofMap) + { + const BasisFunction *basisFcts = componentSpaces[0]->getBasisFcts(); + WorldVector<double> coords; + ElementDofIterator elDofIter(componentSpaces[0]); + + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(componentMeshes[0], -1, + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); + while (elInfo) { + elDofIter.reset(elInfo->getElement()); + int i = 0; + do { + DimVec<double> *baryCoord = basisFcts->getCoords(i); + elInfo->coordToWorld(*baryCoord, coords); + i++; + dofMap[elDofIter.getDof()] = coords; + } while (elDofIter.next()); + + elInfo = stack.traverseNext(elInfo); + } + } + + + void ProblemVec::createCoordToDofMap(CoordToDof &dofMap) + { + const BasisFunction *basisFcts = componentSpaces[0]->getBasisFcts(); + WorldVector<double> coords; + ElementDofIterator elDofIter(componentSpaces[0]); + + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(componentMeshes[0], -1, + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); + while (elInfo) { + elDofIter.reset(elInfo->getElement()); + int i = 0; + do { + DimVec<double> *baryCoord = basisFcts->getCoords(i); + elInfo->coordToWorld(*baryCoord, coords); + i++; + dofMap[coords] = elDofIter.getDof(); + } while (elDofIter.next()); + + elInfo = stack.traverseNext(elInfo); + } + } + + + + void ProblemVec::writeDbgMatrix(std::string filename) + { + FUNCNAME("ProblemVec::writeDbMatrix()"); + + using mtl::tag::major; using mtl::tag::nz; using mtl::begin; using mtl::end; + namespace traits = mtl::traits; + typedef DOFMatrix::base_matrix_type Matrix; + typedef traits::range_generator<major, Matrix>::type cursor_type; + typedef traits::range_generator<nz, cursor_type>::type icursor_type; + + DofToCoord dofToCoords; + createDofToCoordMap(dofToCoords); + + std::ofstream out(filename.c_str()); + out << dofToCoords.size() << std::endl; + + int dimOfWorld = Global::getGeo(WORLD); + for (DofToCoord::iterator it = dofToCoords.begin(); it != dofToCoords.end(); ++it) { + out << it->first << std::endl; + for (int j = 0; j < dimOfWorld; j++) + out << (it->second)[j] << std::endl; + } + + for (int i = 0; i < nComponents; i++) { + for (int j = 0; j < nComponents; j++) { + DOFMatrix *dofmatrix = (*systemMatrix)[i][j]; + + if (!dofmatrix) + continue; + + Matrix& matrix = dofmatrix->getBaseMatrix(); + int nnz = matrix.nnz(); + int testNnz = 0; + + out << nnz << std::endl; + + traits::row<Matrix>::type row(matrix); + traits::col<Matrix>::type col(matrix); + traits::const_value<Matrix>::type value(matrix); + + for (cursor_type cursor = begin<major>(matrix), cend = end<major>(matrix); cursor != cend; ++cursor) { + for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); icursor != icend; ++icursor) { + out << row(*icursor) << " " + << col(*icursor) << " " + << value(*icursor) << std::endl; + testNnz++; + } + } + + TEST_EXIT(testNnz == nnz)("NNZ does not fit together!\n"); + } + } + + out.close(); + } + + + void ProblemVec::readAndCompareDbgMatrix(std::string filename) + { + using mtl::tag::major; using mtl::tag::nz; using mtl::begin; using mtl::end; + namespace traits = mtl::traits; + typedef DOFMatrix::base_matrix_type Matrix; + typedef traits::range_generator<major, Matrix>::type cursor_type; + typedef traits::range_generator<nz, cursor_type>::type icursor_type; + + CoordToDof coordToDof; + createCoordToDofMap(coordToDof); + + DofToCoord dofToCoord; + WorldVector<double> coords; + DegreeOfFreedom dof; + int dimOfWorld = Global::getGeo(WORLD); + + std::ifstream in(filename.c_str()); + int nReadDofs; + in >> nReadDofs; + for (int i = 0; i < nReadDofs; i++) { + in >> dof; + for (int j = 0; j < dimOfWorld; j++) + in >> coords[j]; + dofToCoord[dof] = coords; + } + + for (int i = 0; i < nComponents; i++) { + for (int j = 0; j < nComponents; j++) { + DOFMatrix *dofmatrix = (*systemMatrix)[i][j]; + + if (!dofmatrix) + continue; + + int readNnz; + in >> readNnz; + + for (int k = 0; k < readNnz; k++) { + DegreeOfFreedom row, col; + double value; + + in >> row; + in >> col; + in >> value; + + WorldVector<double> rowCoords = dofToCoord[row]; + WorldVector<double> colCoords = dofToCoord[col]; + + if (coordToDof.find(rowCoords) == coordToDof.end()) + std::cout << "CANNOT FIND" << std::endl; + + if (coordToDof.find(colCoords) == coordToDof.end()) + std::cout << "CANNOT FIND" << std::endl; + + } + } + } + + + in.close(); + } } diff --git a/AMDiS/src/ProblemVec.h b/AMDiS/src/ProblemVec.h index 3ff24293f4c99c5b89c3edc37380a7d45a7b352a..f4081696cb560013c91cd743d2d0c9cda57dd0e3 100644 --- a/AMDiS/src/ProblemVec.h +++ b/AMDiS/src/ProblemVec.h @@ -40,6 +40,13 @@ namespace AMDiS { class ProblemVec : public ProblemStatBase, public StandardProblemIteration { + private: + // Defines a mapping type from dof indices to world coordinates. + typedef std::map<DegreeOfFreedom, WorldVector<double> > DofToCoord; + + // Defines a mapping type from dof indices to world coordinates. + typedef std::map<WorldVector<double>, DegreeOfFreedom> CoordToDof; + public: /// Constructor ProblemVec(std::string nameStr, @@ -473,6 +480,35 @@ namespace AMDiS { */ void computeError(AdaptInfo *adaptInfo); + /** \brief + * Create from the current problem a map from dof indices to world coordinates. + * This function is used by the debugging function \ref writeDbgMatrix and \ref + * readAndCompareDbgMatrix. + */ + void createDofToCoordMap(DofToCoord &dofMap); + + /** \brief + * Create from the current problem a map from world coordinates of all dofs to + * the corresponding dof indices. This function is used by the debugging function + * \ref writeDbgMatrix and \ref readAndCompareDbgMatrix. + */ + void createCoordToDofMap(CoordToDof &dofMap); + + /** \brief + * This function writes the system matrix and the system vector to a file + * for debugging. The entries of both, the matrix and the vector, are not + * indicated by the dof indices, but by the world coordinates of the dofs. + * This makes it possible to compare dof matrices, where the dof indices + * are different, e.g., when using domain decomposition parallelization. + */ + void writeDbgMatrix(std::string filename); + + /** \brief + * Reads a file, that was created using the function \ref writeDbgMatrix, and + * compares the date with the system matrix of this problem. + */ + void readAndCompareDbgMatrix(std::string filename); + protected: /// Name of this problem.