diff --git a/AMDiS/libtool b/AMDiS/libtool index 41ace2e6aa8dc61f34efef5d3ac31a4138c1ba01..fc099ac351441e7cd2294b8ad52735f35b20c990 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 p2d069: # 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 p2d069: # 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 p2d069: # 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/AdaptBase.h b/AMDiS/src/AdaptBase.h index 113d2e7530322fab74a82e291d3d5dbff32c4d9d..6af10cb8435a96a41fb038126e899d85888dd54d 100644 --- a/AMDiS/src/AdaptBase.h +++ b/AMDiS/src/AdaptBase.h @@ -54,37 +54,44 @@ namespace AMDiS { virtual int adapt() = 0; /// Returns \ref name - inline const std::string& getName() const { + inline const std::string& getName() const + { return name; } /// Returns \ref problemIteration_ - inline ProblemIterationInterface *getProblemIteration() { + inline ProblemIterationInterface *getProblemIteration() + { return problemIteration_; } /// - inline void setProblemIteration(ProblemIterationInterface *pii) { + inline void setProblemIteration(ProblemIterationInterface *pii) + { problemIteration_ = pii; } /// Returns \ref adaptInfo - inline AdaptInfo *getAdaptInfo() { + inline AdaptInfo *getAdaptInfo() + { return adaptInfo; } /// Returns \ref problemTime_ - inline ProblemTimeInterface *getProblemTime() { + inline ProblemTimeInterface *getProblemTime() + { return problemTime_; } /// - inline void setProblemTime(ProblemTimeInterface *pti) { + inline void setProblemTime(ProblemTimeInterface *pti) + { problemTime_ = pti; } /// Returns \ref initialAdaptInfo_ - inline AdaptInfo *getInitialAdaptInfo() { + inline AdaptInfo *getInitialAdaptInfo() + { return initialAdaptInfo_; } diff --git a/AMDiS/src/AdaptInfo.h b/AMDiS/src/AdaptInfo.h index ba60f84a8187555a6209d91be6618768896ed779..ec1674a71052db3178ea0470480c36e23134dd5e 100644 --- a/AMDiS/src/AdaptInfo.h +++ b/AMDiS/src/AdaptInfo.h @@ -191,7 +191,8 @@ namespace AMDiS { } /// Returns whether space tolerance is reached. - virtual bool spaceToleranceReached() { + virtual bool spaceToleranceReached() + { int size = scalContents.getSize(); for (int i = 0; i < size; i++) if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance)) @@ -201,7 +202,8 @@ namespace AMDiS { } /// Returns whether space tolerance of component i is reached. - virtual bool spaceToleranceReached(int i) { + virtual bool spaceToleranceReached(int i) + { if (!(scalContents[i]->est_sum < scalContents[i]->spaceTolerance)) return false; else @@ -209,7 +211,8 @@ namespace AMDiS { } /// Returns whether time tolerance is reached. - virtual bool timeToleranceReached() { + virtual bool timeToleranceReached() + { int size = scalContents.getSize(); for (int i = 0; i < size; i++) if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance)) @@ -219,7 +222,8 @@ namespace AMDiS { } /// Returns whether time tolerance of component i is reached. - virtual bool timeToleranceReached(int i) { + virtual bool timeToleranceReached(int i) + { if (!(scalContents[i]->est_t_sum < scalContents[i]->timeTolerance)) return false; else @@ -227,7 +231,8 @@ namespace AMDiS { } /// Returns whether time error is under its lower bound. - virtual bool timeErrorLow() { + virtual bool timeErrorLow() + { int size = scalContents.getSize(); for (int i = 0; i < size; i++) if (!(scalContents[i]->est_t_sum < scalContents[i]->timeErrLow)) @@ -237,164 +242,196 @@ namespace AMDiS { } /// Print debug information about time error and its bound. - void printTimeErrorLowInfo() { + void printTimeErrorLowInfo() + { for (int i = 0; i < scalContents.getSize(); i++) std::cout << " Time error estimate = " << scalContents[i]->est_t_sum << " Time error bound = " << scalContents[i]->timeErrLow << "\n"; } /// Returns \ref spaceIteration. - inline int getSpaceIteration() { + inline int getSpaceIteration() + { return spaceIteration; } /// Sets \ref spaceIteration. - inline void setSpaceIteration(int it) { + inline void setSpaceIteration(int it) + { spaceIteration = it; } /// Returns \ref maxSpaceIteration. - inline int getMaxSpaceIteration() { + inline int getMaxSpaceIteration() + { return maxSpaceIteration; } /// Sets \ref maxSpaceIteration. - inline void setMaxSpaceIteration(int it) { + inline void setMaxSpaceIteration(int it) + { maxSpaceIteration = it; } /// Increments \ref spaceIteration by 1; - inline void incSpaceIteration() { + inline void incSpaceIteration() + { spaceIteration++; } /// Sets \ref timestepIteration. - inline void setTimestepIteration(int it) { + inline void setTimestepIteration(int it) + { timestepIteration = it; } /// Returns \ref timestepIteration. - inline int getTimestepIteration() { + inline int getTimestepIteration() + { return timestepIteration; } /// Increments \ref timestepIteration by 1; - inline void incTimestepIteration() { + inline void incTimestepIteration() + { timestepIteration++; } /// Returns \ref maxTimestepIteration. - inline int getMaxTimestepIteration() { + inline int getMaxTimestepIteration() + { return maxTimestepIteration; } /// Sets \ref maxTimestepIteration. - inline void setMaxTimestepIteration(int it) { + inline void setMaxTimestepIteration(int it) + { maxTimestepIteration = it; } /// Sets \ref timeIteration. - inline void setTimeIteration(int it) { + inline void setTimeIteration(int it) + { timeIteration = it; } /// Returns \ref timeIteration. - inline int getTimeIteration() { + inline int getTimeIteration() + { return timeIteration; } /// Increments \ref timesIteration by 1; - inline void incTimeIteration() { + inline void incTimeIteration() + { timeIteration++; } /// Returns \ref maxTimeIteration. - inline int getMaxTimeIteration() { + inline int getMaxTimeIteration() + { return maxTimeIteration; } /// Sets \ref maxTimeIteration. - inline void setMaxTimeIteration(int it) { + inline void setMaxTimeIteration(int it) + { maxTimeIteration = it; } /// Returns \ref timestepNumber. - inline int getTimestepNumber() { + inline int getTimestepNumber() + { return timestepNumber; } /// Returns \ref nTimesteps. - inline int getNumberOfTimesteps() { + inline int getNumberOfTimesteps() + { return nTimesteps; } /// Increments \ref timestepNumber by 1; - inline void incTimestepNumber() { + inline void incTimestepNumber() + { timestepNumber++; } /// Sets \ref est_sum. - inline void setEstSum(double e, int index) { + inline void setEstSum(double e, int index) + { scalContents[index]->est_sum = e; } /// Sets \ref est_max. - inline void setEstMax(double e, int index) { + inline void setEstMax(double e, int index) + { scalContents[index]->est_max = e; } /// Sets \ref est_max. - inline void setTimeEstMax(double e, int index) { + inline void setTimeEstMax(double e, int index) + { scalContents[index]->est_t_max = e; } /// Sets \ref est_t_sum. - inline void setTimeEstSum(double e, int index) { + inline void setTimeEstSum(double e, int index) + { scalContents[index]->est_t_sum = e; } /// Returns \ref est_sum. - inline double getEstSum(int index) { + inline double getEstSum(int index) + { return scalContents[index]->est_sum; } /// Returns \ref est_t_sum. - inline double getEstTSum(int index) { + inline double getEstTSum(int index) + { return scalContents[index]->est_t_sum; } /// Returns \ref est_max. - inline double getEstMax(int index) { + inline double getEstMax(int index) + { return scalContents[index]->est_max; } /// Returns \ref est_max. - inline double getTimeEstMax(int index) { + inline double getTimeEstMax(int index) + { return scalContents[index]->est_t_max; } /// Returns \ref est_t_sum. - inline double getTimeEstSum(int index) { + inline double getTimeEstSum(int index) + { return scalContents[index]->est_t_sum; } /// Returns \ref spaceTolerance. - inline double getSpaceTolerance(int index) { + inline double getSpaceTolerance(int index) + { return scalContents[index]->spaceTolerance; } /// Sets \ref spaceTolerance. - inline void setSpaceTolerance(int index, double tol) { + inline void setSpaceTolerance(int index, double tol) + { scalContents[index]->spaceTolerance = tol; } /// Returns \ref timeTolerance. - inline double getTimeTolerance(int index) { + inline double getTimeTolerance(int index) + { return scalContents[index]->timeTolerance; } /// Sets \ref time - inline double setTime(double t) { + inline double setTime(double t) + { time = t; if (time > endTime) time = endTime; @@ -405,27 +442,27 @@ namespace AMDiS { } /// Gets \ref time - inline double getTime() { + inline double getTime() + { return time; } /// Gets \ref &time - inline double *getTimePtr() { + inline double *getTimePtr() + { return &time; } /// Sets \ref timestep - inline double setTimestep(double t) { + inline double setTimestep(double t) + { timestep = t; - if (timestep > maxTimestep) { + if (timestep > maxTimestep) timestep = maxTimestep; - } - if (timestep < minTimestep) { + if (timestep < minTimestep) timestep = minTimestep; - } - if (time + timestep > endTime) { + if (time + timestep > endTime) timestep = endTime - time; - } return timestep; } @@ -434,7 +471,8 @@ namespace AMDiS { * Returns true, if the end time is reached and no more timestep * computations must be done. */ - inline bool reachedEndTime() { + inline bool reachedEndTime() + { if (nTimesteps > 0) return !(timestepNumber < nTimesteps); @@ -442,132 +480,160 @@ namespace AMDiS { } /// Gets \ref timestep - inline double getTimestep() { + inline double getTimestep() + { return timestep; } /// Sets \ref minTimestep - inline void setMinTimestep(double t) { + inline void setMinTimestep(double t) + { minTimestep = t; } /// Gets \ref minTimestep - inline double getMinTimestep() { + inline double getMinTimestep() + { return minTimestep; } /// Sets \ref maxTimestep - inline void setMaxTimestep(double t) { + inline void setMaxTimestep(double t) + { maxTimestep = t; } /// Gets \ref maxTimestep - inline double getMaxTimestep() { + inline double getMaxTimestep() + { return maxTimestep; } /// Gets \ref ×tep - inline double *getTimestepPtr() { + inline double *getTimestepPtr() + { return ×tep; } /// Sets \ref startTime = time - inline void setStartTime(double time) { + inline void setStartTime(double time) + { startTime = time; } /// Sets \ref endTime = time - inline void setEndTime(double time) { + inline void setEndTime(double time) + { endTime = time; } /// Returns \ref startTime - inline double getStartTime() { + inline double getStartTime() + { return startTime; } /// Returns \ref endTime - inline double getEndTime() { + inline double getEndTime() + { return endTime; } /// Returns \ref timeErrLow. - inline double getTimeErrLow(int index) { + inline double getTimeErrLow(int index) + { return scalContents[index]->timeErrLow; } /// Returns whether coarsening is allowed or not. - inline bool isCoarseningAllowed(int index) { + inline bool isCoarseningAllowed(int index) + { return (scalContents[index]->coarsenAllowed == 1); } /// Returns whether coarsening is allowed or not. - inline bool isRefinementAllowed(int index) { + inline bool isRefinementAllowed(int index) + { return (scalContents[index]->refinementAllowed == 1); } /// - inline void allowRefinement(bool allow, int index) { + inline void allowRefinement(bool allow, int index) + { scalContents[index]->refinementAllowed = allow; } /// - inline void allowCoarsening(bool allow, int index) { + inline void allowCoarsening(bool allow, int index) + { scalContents[index]->coarsenAllowed = allow; } /// Returns \ref refineBisections - inline const int getRefineBisections(int index) const { + inline const int getRefineBisections(int index) const + { return scalContents[index]->refineBisections; } /// Returns \ref coarseBisections - inline const int getCoarseBisections(int index) const { + inline const int getCoarseBisections(int index) const + { return scalContents[index]->coarseBisections; } - inline int getSize() { + inline int getSize() + { return scalContents.getSize(); } - inline void setSolverIterations(int it) { + inline void setSolverIterations(int it) + { solverIterations = it; } - inline int getSolverIterations() { + inline int getSolverIterations() + { return solverIterations; } - inline void setMaxSolverIterations(int it) { + inline void setMaxSolverIterations(int it) + { maxSolverIterations = it; } - inline int getMaxSolverIterations() { + inline int getMaxSolverIterations() + { return maxSolverIterations; } - inline void setSolverTolerance(double tol) { + inline void setSolverTolerance(double tol) + { solverTolerance = tol; } - inline double getSolverTolerance() { + inline double getSolverTolerance() + { return solverTolerance; } - inline void setSolverResidual(double res) { + inline void setSolverResidual(double res) + { solverResidual = res; } - inline double getSolverResidual() { + inline double getSolverResidual() + { return solverResidual; } /// Returns true, if the adaptive procedure was deserialized from a file. - const bool isDeserialized() const { + const bool isDeserialized() const + { return isDeserialized_; } - inline void setIsDeserialized(bool b) { + inline void setIsDeserialized(bool b) + { isDeserialized_ = b; } diff --git a/AMDiS/src/Assembler.h b/AMDiS/src/Assembler.h index e7da738f49c577811130119b94f166dbaaa4d184..1d95440b5caea0d43c14b5c9febf0a160e4f80d5 100644 --- a/AMDiS/src/Assembler.h +++ b/AMDiS/src/Assembler.h @@ -86,37 +86,44 @@ namespace AMDiS { double factor = 1.0); /// Returns \ref rowFESpace. - inline const FiniteElemSpace* getRowFESpace() { + inline const FiniteElemSpace* getRowFESpace() + { return rowFESpace; } /// Returns \ref colFESpace. - inline const FiniteElemSpace* getColFESpace() { + inline const FiniteElemSpace* getColFESpace() + { return colFESpace; } /// Returns \ref nRow. - inline int getNRow() { + inline int getNRow() + { return nRow; } /// Returns \ref nCol. - inline int getNCol() { + inline int getNCol() + { return nCol; } /// Sets \ref rememberElMat. - inline void rememberElementMatrix(bool rem) { + inline void rememberElementMatrix(bool rem) + { rememberElMat = rem; } /// Sets \ref rememberElVec. - inline void rememberElementVector(bool rem) { + inline void rememberElementVector(bool rem) + { rememberElVec = rem; } /// Returns \ref zeroOrderAssembler. - inline ZeroOrderAssembler* getZeroOrderAssembler() { + inline ZeroOrderAssembler* getZeroOrderAssembler() + { return zeroOrderAssembler; } @@ -132,12 +139,14 @@ namespace AMDiS { } /// Returns \ref secondOrderAssembler. - inline SecondOrderAssembler* getSecondOrderAssembler() { + inline SecondOrderAssembler* getSecondOrderAssembler() + { return secondOrderAssembler; } /// Returns \ref operat; - inline Operator* getOperator() { + inline Operator* getOperator() + { return operat; } diff --git a/AMDiS/src/DOFAdmin.cc b/AMDiS/src/DOFAdmin.cc index 06ca719a1fd59c98a272f168b1831c158cd796c6..ff965f382b1eee91f5f529a8119d4dc8bb6e25b7 100755 --- a/AMDiS/src/DOFAdmin.cc +++ b/AMDiS/src/DOFAdmin.cc @@ -89,7 +89,8 @@ namespace AMDiS { ERROR_EXIT("TODO\n"); } - void DOFAdmin::freeDOFIndex(int dof) { + void DOFAdmin::freeDOFIndex(int dof) + { FUNCNAME("DOFAdmin::freeDOFIndex()"); TEST_EXIT_DBG(usedCount > 0)("no dofs in use\n"); @@ -130,19 +131,17 @@ namespace AMDiS { // search new hole int dfsize = static_cast<int>(dofFree.size()); int i = firstHole + 1; - for (; i < dfsize; i++) { - if (dofFree[i]) { + for (; i < dfsize; i++) + if (dofFree[i]) break; - } - } + firstHole = i; } else { // if there is no hole // enlarge dof-list enlargeDOFLists(0); TEST_EXIT_DBG(firstHole < static_cast<int>(dofFree.size())) ("no free entry after enlargeDOFLists\n"); - TEST_EXIT_DBG(dofFree[firstHole]) - ("no free bit at firstHole\n"); + TEST_EXIT_DBG(dofFree[firstHole])("no free bit at firstHole\n"); dofFree[firstHole] = false; dof = firstHole; firstHole++; @@ -180,14 +179,13 @@ namespace AMDiS { std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); - for (di = dofIndexedList.begin(); di != end; ++di) { - if ((*di)->getSize() < newval) { + for (di = dofIndexedList.begin(); di != end; ++di) + if ((*di)->getSize() < newval) (*di)->resize(newval); - } - } } - void DOFAdmin::addDOFIndexed(DOFIndexedBase* dofIndexed) { + void DOFAdmin::addDOFIndexed(DOFIndexedBase* dofIndexed) + { FUNCNAME("DOFAdmin::addDOFIndexed()"); TEST_EXIT(dofIndexed)("no dofIndexed\n"); @@ -310,13 +308,15 @@ namespace AMDiS { (*dc)->compressDOFContainer(n, new_dof); } - void DOFAdmin::setNumberOfDOFs(int i,int v) { + void DOFAdmin::setNumberOfDOFs(int i,int v) + { TEST_EXIT_DBG((0 <= i) && (4 > i))(""); nrDOF[i] = v; } - void DOFAdmin::setNumberOfPreDOFs(int i, int v) { + void DOFAdmin::setNumberOfPreDOFs(int i, int v) + { TEST_EXIT_DBG((0 <= i) && (4 > i))(""); nr0DOF[i] = v; @@ -402,9 +402,8 @@ namespace AMDiS { std::list<DOFIndexedBase*>::iterator di; std::list<DOFIndexedBase*>::iterator end = dofIndexedList.end(); - for (di = dofIndexedList.begin(); di != end; ++di) { + for (di = dofIndexedList.begin(); di != end; ++di) (*di)->resize(size); - } } } diff --git a/AMDiS/src/DOFAdmin.h b/AMDiS/src/DOFAdmin.h index 86f38c919e5d712ee027cdc64e87c71ecc3d2308..ebae4d01ba48286e9a6e81cbaee70efe8d8e4309 100644 --- a/AMDiS/src/DOFAdmin.h +++ b/AMDiS/src/DOFAdmin.h @@ -191,6 +191,12 @@ namespace AMDiS { return dofFree[i]; } + /// Sets a DOF to be free or not. + inline void setDOFFree(int i, bool b) + { + dofFree[i] = b; + } + /** \} */ /** \name setting methods diff --git a/AMDiS/src/DataCollector.cc b/AMDiS/src/DataCollector.cc index 30feb017933554036e886ac0c05b7a34b37ec655..78cc4c534272cde59d1816d245f3fa46a7c17730 100644 --- a/AMDiS/src/DataCollector.cc +++ b/AMDiS/src/DataCollector.cc @@ -7,12 +7,16 @@ namespace AMDiS { - DataCollector::DataCollector(const FiniteElemSpace *feSpace, - DOFVector<double> *values, - int level, - Flag traverseFlag, - bool (*writeElem)(ElInfo*)) - : writeElem_(writeElem) + DataCollector::DataCollector(const FiniteElemSpace *fe, + DOFVector<double> *val, + int l, + Flag flag, + bool (*writeElemFct)(ElInfo*)) + : values(val), + level(l), + traverseFlag(flag), + feSpace(fe), + writeElem(writeElemFct) { FUNCNAME("DataCollector::DataCollector()"); @@ -20,55 +24,50 @@ namespace AMDiS { TEST_EXIT(values)("no value Vector\n"); // === get mesh === - mesh_ = feSpace->getMesh(); + mesh = feSpace->getMesh(); // === get admin === - localAdmin_ = const_cast<DOFAdmin*>(feSpace->getAdmin()); + localAdmin = const_cast<DOFAdmin*>(feSpace->getAdmin()); // === create vertex info vector === - vertexInfos_ = new DOFVector< std::list<VertexInfo> >(feSpace, "vertex infos"); + vertexInfos = new DOFVector< std::list<VertexInfo> >(feSpace, "vertex infos"); - interpPointInd_ = new DOFVector<int>(feSpace, "interpolation point indices"); - interpPointCoords_ = new DOFVector< std::list<WorldVector<double> > >(feSpace, "interpolation point coordinates"); - dofCoords_ = new DOFVector< std::list<WorldVector<double> > >(feSpace, "dof coords"); + interpPointInd = new DOFVector<int>(feSpace, "interpolation point indices"); + interpPointCoords = new DOFVector< std::list<WorldVector<double> > >(feSpace, "interpolation point coordinates"); + dofCoord = new DOFVector< std::list<WorldVector<double> > >(feSpace, "dof coords"); - dim_ = mesh_->getDim(); + dim = mesh->getDim(); - nPreDofs_ = localAdmin_->getNumberOfPreDOFs(VERTEX); - nVertices_ = 0; - nElements_ = 0; - nInterpPoints_ = 0; - nConnections_ = 0; + nPreDofs = localAdmin->getNumberOfPreDOFs(VERTEX); + nVertices = 0; + nElements = 0; + nInterpPoints = 0; + nConnection = 0; - feSpace_ = feSpace; - values_ = values; - level_ = level; - traverseFlag_ = traverseFlag; - - elementDataCollected_ = false; - valueDataCollected_ = false; - periodicDataCollected_ = false; + elementDataCollected = false; + valueDataCollected = false; + periodicDataCollected = false; vertexCoords = new WorldVector<double>; } DataCollector::~DataCollector() { - delete vertexInfos_; - delete interpPointInd_; - delete interpPointCoords_; - delete dofCoords_; + delete vertexInfos; + delete interpPointInd; + delete interpPointCoords; + delete dofCoord; delete vertexCoords; } void DataCollector::fillAllData() { - if (!elementDataCollected_) + if (!elementDataCollected) startCollectingElementData(); - if (!periodicDataCollected_) + if (!periodicDataCollected) startCollectingPeriodicData(); - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); } @@ -76,67 +75,67 @@ namespace AMDiS { { FUNCNAME("DataCollector::startCollectingElementData()"); - Flag flag = traverseFlag_; + Flag flag = traverseFlag; flag |= Mesh::FILL_NEIGH | Mesh::FILL_COORDS | Mesh::FILL_OPP_COORDS | Mesh::FILL_BOUND; - elements_.resize(0, dim_); + elements.resize(0, dim); TraverseStack stack; // Traverse elements to create continuous element indices - ElInfo *elInfo = stack.traverseFirst(mesh_, level_, flag); + ElInfo *elInfo = stack.traverseFirst(mesh, level, flag); while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) - outputIndices_[elInfo->getElement()->getIndex()] = nElements_++; + if (!writeElem || writeElem(elInfo)) + outputIndices[elInfo->getElement()->getIndex()] = nElements++; elInfo = stack.traverseNext(elInfo); } // Traverse elements to create element information - elInfo = stack.traverseFirst(mesh_, level_, flag); + elInfo = stack.traverseFirst(mesh, level, flag); while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) + if (!writeElem || writeElem(elInfo)) addElementData(elInfo); elInfo = stack.traverseNext(elInfo); } - elementDataCollected_ = true; + elementDataCollected = true; } void DataCollector::startCollectingValueData() { FUNCNAME("DataCollector::startCollectingValueData()"); - DOFVector<int>::Iterator intPointIt(interpPointInd_, USED_DOFS); + DOFVector<int>::Iterator intPointIt(interpPointInd, USED_DOFS); for (intPointIt.reset(); !intPointIt.end(); ++intPointIt) (*intPointIt) = -1; - interpPoints_.clear(); + interpPoints.clear(); - basisFcts_ = const_cast<BasisFunction*>(feSpace_->getBasisFcts()); - nBasisFcts_ = basisFcts_->getNumber(); - localDOFs_ = new DegreeOfFreedom[nBasisFcts_]; + basisFcts = const_cast<BasisFunction*>(feSpace->getBasisFcts()); + nBasisFcts = basisFcts->getNumber(); + localDOFs = new DegreeOfFreedom[nBasisFcts]; TraverseStack stack; // Traverse elements to add value information and to mark // interpolation points. - ElInfo *elInfo = stack.traverseFirst(mesh_, level_, - traverseFlag_ | Mesh::FILL_COORDS); + ElInfo *elInfo = stack.traverseFirst(mesh, level, + traverseFlag | Mesh::FILL_COORDS); while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) + if (!writeElem || writeElem(elInfo)) addValueData(elInfo); elInfo = stack.traverseNext(elInfo); } // If there are interpolation points, add them to the corresponding // data array. - if (nInterpPoints_ > 0) { + if (nInterpPoints > 0) { // Remove all interpolation marks and, instead, set to each // interpolation point its continous index starting from 0. int i = 0; @@ -145,61 +144,61 @@ namespace AMDiS { *intPointIt = i++; // Traverse elements to create interpolation values. - elInfo = stack.traverseFirst(mesh_, level_, traverseFlag_ | Mesh::FILL_COORDS); + elInfo = stack.traverseFirst(mesh, level, traverseFlag | Mesh::FILL_COORDS); while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) + if (!writeElem || writeElem(elInfo)) addInterpData(elInfo); elInfo = stack.traverseNext(elInfo); } } - delete [] localDOFs_; - valueDataCollected_ = true; + delete [] localDOFs; + valueDataCollected = true; } void DataCollector::startCollectingPeriodicData() { FUNCNAME("DataCollector::startCollectingPeriodicData()"); - periodicConnections_.clear(); + periodicConnections.clear(); TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh_, level_, traverseFlag_); + ElInfo *elInfo = stack.traverseFirst(mesh, level, traverseFlag); while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) { + if (!writeElem || writeElem(elInfo)) { LeafDataPeriodic *ldp = dynamic_cast<LeafDataPeriodic*> (elInfo->getElement()-> getElementData()-> getElementData(PERIODIC)); if (ldp) { - nConnections_ += dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().size(); + nConnection += dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().size(); } - periodicConnections_.push_back(DimVec<bool>(dim_, DEFAULT_VALUE, false)); + periodicConnections.push_back(DimVec<bool>(dim, DEFAULT_VALUE, false)); } elInfo = stack.traverseNext(elInfo); } - nConnections_ /= 2; + nConnection /= 2; - periodicInfos_.clear(); + periodicInfos.clear(); - Flag flag = traverseFlag_; + Flag flag = traverseFlag; flag |= Mesh::FILL_COORDS | Mesh::FILL_OPP_COORDS| Mesh::FILL_NEIGH | Mesh::FILL_BOUND; - elInfo = stack.traverseFirst(mesh_, level_, flag); + elInfo = stack.traverseFirst(mesh, level, flag); while (elInfo) { - if (!writeElem_ || writeElem_(elInfo)) + if (!writeElem || writeElem(elInfo)) addPeriodicData(elInfo); elInfo = stack.traverseNext(elInfo); } - periodicDataCollected_ = true; + periodicDataCollected = true; } void DataCollector::addElementData(ElInfo* elInfo) @@ -211,7 +210,7 @@ namespace AMDiS { WorldVector<double> vertexCoords; // create ElementInfo - ElementInfo elementInfo(dim_); + ElementInfo elementInfo(dim); // read element region ElementData *ed = elInfo->getElement()->getElementData(ELEMENT_REGION); @@ -232,31 +231,31 @@ namespace AMDiS { } // for all vertices - for (int i = 0; i < dim_ + 1; i++) { + for (int i = 0; i < dim + 1; i++) { // get coords of this vertex vertexCoords = elInfo->getCoord(i); // get dof index of this vertex - vertexDOF = dof[i][nPreDofs_]; + vertexDOF = dof[i][nPreDofs]; // search for coords at this dof std::list<VertexInfo>::iterator it = - find((*vertexInfos_)[vertexDOF].begin(), - (*vertexInfos_)[vertexDOF].end(), + find((*vertexInfos)[vertexDOF].begin(), + (*vertexInfos)[vertexDOF].end(), vertexCoords); // coords not yet in list? - if (it == (*vertexInfos_)[vertexDOF].end()) { + if (it == (*vertexInfos)[vertexDOF].end()) { // create new vertex info and increment number of vertices - VertexInfo newVertexInfo = {vertexCoords, nVertices_}; + VertexInfo newVertexInfo = {vertexCoords, nVertices}; // add new vertex info to list - (*vertexInfos_)[vertexDOF].push_front(newVertexInfo); + (*vertexInfos)[vertexDOF].push_front(newVertexInfo); // set iterator to new vertex info - it = (*vertexInfos_)[vertexDOF].begin(); + it = (*vertexInfos)[vertexDOF].begin(); - nVertices_++; + nVertices++; } // fill element info @@ -265,68 +264,68 @@ namespace AMDiS { elementInfo.projection[i] = elInfo->getProjection(i); elementInfo.neighbour[i] = elInfo->getNeighbour(i) ? - outputIndices_[elInfo->getNeighbour(i)->getIndex()] : + outputIndices[elInfo->getNeighbour(i)->getIndex()] : -1; } - if (dim_ == 3) + if (dim == 3) elementInfo.type = (dynamic_cast<ElInfo3d*>(elInfo)->getType()); // remember element info - elements_.push_back(elementInfo); + elements.push_back(elementInfo); } void DataCollector::addValueData(ElInfo *elInfo) { FUNCNAME("DataCollector::addValueData()"); - basisFcts_->getLocalIndices(elInfo->getElement(), localAdmin_, localDOFs_); + basisFcts->getLocalIndices(elInfo->getElement(), localAdmin, localDOFs); // First, traverse all DOFs at the vertices of the element, determine - // their coordinates and add them to the corresponding entry in dofCoords_. - for (int i = 0; i < mesh_->getGeo(VERTEX); i++) { - DegreeOfFreedom dofi = localDOFs_[i]; + // their coordinates and add them to the corresponding entry in dofCoords. + for (int i = 0; i < mesh->getGeo(VERTEX); i++) { + DegreeOfFreedom dofi = localDOFs[i]; - (*interpPointInd_)[dofi] = -2; // mark as vertex + (*interpPointInd)[dofi] = -2; // mark as vertex // get coords of this vertex *vertexCoords = elInfo->getCoord(i); // search for coords at this dof std::list<WorldVector<double> >::iterator it = - find((*dofCoords_)[dofi].begin(), - (*dofCoords_)[dofi].end(), + find((*dofCoord)[dofi].begin(), + (*dofCoord)[dofi].end(), *vertexCoords); // coords not yet in list? - if (it == (*dofCoords_)[dofi].end()) { + if (it == (*dofCoord)[dofi].end()) { // add new coords to list - (*dofCoords_)[dofi].push_back(*vertexCoords); + (*dofCoord)[dofi].push_back(*vertexCoords); } } // Then, traverse all interpolation DOFs of the element, determine // their coordinates and add them to the corresponding entry in - // interpPointCoords_. - for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts_; i++) { - DegreeOfFreedom dofi = localDOFs_[i]; + // interpPointCoords. + for (int i = mesh->getGeo(VERTEX); i < nBasisFcts; i++) { + DegreeOfFreedom dofi = localDOFs[i]; - elInfo->coordToWorld(*basisFcts_->getCoords(i), *vertexCoords); + elInfo->coordToWorld(*basisFcts->getCoords(i), *vertexCoords); - if ((*interpPointInd_)[dofi] == -1) { + if ((*interpPointInd)[dofi] == -1) { // mark as interpolation point - (*interpPointInd_)[dofi] = -3; + (*interpPointInd)[dofi] = -3; // search for interpolation point coordinates, and insert them to the // dof-entry, if not contained in the list std::list<WorldVector<double> >::iterator it = - find((*interpPointCoords_)[dofi].begin(), - (*interpPointCoords_)[dofi].end(), + find((*interpPointCoords)[dofi].begin(), + (*interpPointCoords)[dofi].end(), *vertexCoords); - if (it == (*interpPointCoords_)[dofi].end()) { - (*interpPointCoords_)[dofi].push_back(*vertexCoords); - nInterpPoints_++; + if (it == (*interpPointCoords)[dofi].end()) { + (*interpPointCoords)[dofi].push_back(*vertexCoords); + nInterpPoints++; } } } @@ -336,13 +335,13 @@ namespace AMDiS { { FUNCNAME("DataCollector::addInterpData()"); - basisFcts_->getLocalIndices(elInfo->getElement(), localAdmin_, localDOFs_); + basisFcts->getLocalIndices(elInfo->getElement(), localAdmin, localDOFs); std::vector<int> elemInterpPoints(0); - for (int i = mesh_->getGeo(VERTEX); i < nBasisFcts_; i++) - elemInterpPoints.push_back((*interpPointInd_)[localDOFs_[i]]); + for (int i = mesh->getGeo(VERTEX); i < nBasisFcts; i++) + elemInterpPoints.push_back((*interpPointInd)[localDOFs[i]]); - interpPoints_.push_back(elemInterpPoints); + interpPoints.push_back(elemInterpPoints); } void DataCollector::addPeriodicData(ElInfo *elInfo) @@ -361,12 +360,12 @@ namespace AMDiS { it != dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().end(); ++it) { - int outputIndex = outputIndices_[elInfo->getElement()->getIndex()]; - int neighIndex = outputIndices_[elInfo-> + int outputIndex = outputIndices[elInfo->getElement()->getIndex()]; + int neighIndex = outputIndices[elInfo-> getNeighbour(it->elementSide)-> getIndex()]; - if (!periodicConnections_[outputIndex][it->elementSide]) { + if (!periodicConnections[outputIndex][it->elementSide]) { PeriodicInfo periodicInfo; periodicInfo.mode = it->periodicMode; @@ -375,31 +374,31 @@ namespace AMDiS { periodicInfo.neighIndex = neighIndex; periodicInfo.vertexMap.clear(); - periodicConnections_[outputIndex][it->elementSide] = true; - periodicConnections_ + periodicConnections[outputIndex][it->elementSide] = true; + periodicConnections [neighIndex][elInfo->getOppVertex(it->elementSide)] = true; - for (int i = 0; i < dim_; i++) { - int index1 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim_ - 1, dim_), + for (int i = 0; i < dim; i++) { + int index1 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim), it->elementSide, i); - int dof1 = elInfo->getElement()->getDOF(index1, nPreDofs_); + int dof1 = elInfo->getElement()->getDOF(index1, nPreDofs); - for (int j = 0; j < dim_; j++) { - int index2 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim_ - 1, dim_), + for (int j = 0; j < dim; j++) { + int index2 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim), elInfo->getOppVertex(it->elementSide), j); - int dof2 = elInfo->getNeighbour(it->elementSide)->getDOF(index2, nPreDofs_); + int dof2 = elInfo->getNeighbour(it->elementSide)->getDOF(index2, nPreDofs); - if ((dof1 == dof2) || (mesh_->associated(dof1, dof2))) { + if ((dof1 == dof2) || (mesh->associated(dof1, dof2))) { periodicInfo.vertexMap[index1] = index2; break; } } } - periodicInfos_.push_back(periodicInfo); + periodicInfos.push_back(periodicInfo); } } } @@ -407,107 +406,107 @@ namespace AMDiS { std::list<ElementInfo>* DataCollector::getElementInfos() { - if (!elementDataCollected_) + if (!elementDataCollected) startCollectingElementData(); - return &elements_; + return &elements; } DOFVector< std::list<VertexInfo> >* DataCollector::getVertexInfos() { - if (!elementDataCollected_) + if (!elementDataCollected) startCollectingElementData(); - return vertexInfos_; + return vertexInfos; } std::list<PeriodicInfo>* DataCollector::getPeriodicInfos() { - if (!periodicDataCollected_) + if (!periodicDataCollected) startCollectingPeriodicData(); - return &periodicInfos_; + return &periodicInfos; } int DataCollector::getNumberVertices() { - if (!elementDataCollected_) + if (!elementDataCollected) startCollectingElementData(); - return nVertices_; + return nVertices; } int DataCollector::getNumberElements() { - if (!elementDataCollected_) + if (!elementDataCollected) startCollectingElementData(); - return nElements_; + return nElements; } int DataCollector::getNumberInterpPoints() { - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); - return nInterpPoints_; + return nInterpPoints; } int DataCollector::getNumberConnections() { - if (!periodicDataCollected_) + if (!periodicDataCollected) startCollectingPeriodicData(); - return nConnections_; + return nConnection; } const FiniteElemSpace* DataCollector::getFeSpace() { - return feSpace_; + return feSpace; } Mesh* DataCollector::getMesh() { - return mesh_; + return mesh; } DOFVector<double>* DataCollector::getValues() { - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); - return values_; + return values; } DOFVector< std::list<WorldVector<double> > >* DataCollector::getDofCoords() { - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); - return dofCoords_; + return dofCoord; } DOFVector<int>* DataCollector::getInterpPointInd() { - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); - return interpPointInd_; + return interpPointInd; } DOFVector< std::list<WorldVector<double> > >* DataCollector::getInterpPointCoords() { - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); - return interpPointCoords_; + return interpPointCoords; } std::vector< std::vector<int> >* DataCollector::getInterpPoints() { - if (!valueDataCollected_) + if (!valueDataCollected) startCollectingValueData(); - return &interpPoints_; + return &interpPoints; } } diff --git a/AMDiS/src/DataCollector.h b/AMDiS/src/DataCollector.h index 572343255bfdf10164c91d50d97103e305749175..11a9270cbd4e672207379812c22cd710a2d0ef58 100644 --- a/AMDiS/src/DataCollector.h +++ b/AMDiS/src/DataCollector.h @@ -95,8 +95,9 @@ namespace AMDiS { /// Returns the mesh of the problem. Mesh* getMesh(); - void setMesh(Mesh *mesh) { - mesh_ = mesh; + void setMesh(Mesh *m) + { + mesh = m; } protected: @@ -122,94 +123,94 @@ namespace AMDiS { void addPeriodicData(ElInfo *elInfo); /// Vector with vertex values - DOFVector<double> *values_; + DOFVector<double> *values; /// Level information for traversing the mesh. - int level_; + int level; /// Flags for traversing the mesh. - Flag traverseFlag_; + Flag traverseFlag; /// - const FiniteElemSpace *feSpace_; + const FiniteElemSpace *feSpace; /// Mesh that should be written - Mesh *mesh_; + Mesh *mesh; /// DOFAdmin of values - DOFAdmin *localAdmin_; + DOFAdmin *localAdmin; /// vertex pre-dofs - int nPreDofs_; + int nPreDofs; /// Number of vertices. - int nVertices_; + int nVertices; /// Number of elements. - int nElements_; + int nElements; /// Total number of interpolation points. - int nInterpPoints_; + int nInterpPoints; /// Number of connections in periodic problems. - int nConnections_; + int nConnection; /// Dimension of \ref mesh - int dim_; + int dim; /// Maps internal element indices to global output indices. - std::map<int, int> outputIndices_; + std::map<int, int> outputIndices; /// Global interpolation point indexing - DOFVector<int> *interpPointInd_; + DOFVector<int> *interpPointInd; /// Stores for each simplex the interpolation points. - std::vector< std::vector<int> > interpPoints_; + std::vector< std::vector<int> > interpPoints; /** \brief * Stores for each DOF a list of its coordinates. If there are now periodic * boundaries than there is also only one coordinate per DOF. */ - DOFVector< std::list<WorldVector<double> > > *interpPointCoords_; + DOFVector< std::list<WorldVector<double> > > *interpPointCoords; /// list of coords for each dof - DOFVector< std::list<WorldVector<double> > > *dofCoords_; + DOFVector< std::list<WorldVector<double> > > *dofCoord; /// List that stores an ElementInfo for each element. - std::list<ElementInfo> elements_; + std::list<ElementInfo> elements; /// List stat stores information about all periodics. - std::list<PeriodicInfo> periodicInfos_; + std::list<PeriodicInfo> periodicInfos; /// Stores a list of vertex infos for each dof. - DOFVector< std::list<VertexInfo> > *vertexInfos_; + DOFVector< std::list<VertexInfo> > *vertexInfos; /** \brief * periodicConnections[i][j] stores whether the connection at side j of * the element with output index i has already been written. */ - std::vector<DimVec<bool> > periodicConnections_; + std::vector<DimVec<bool> > periodicConnections; /// Stores if element data was collected before. - bool elementDataCollected_; + bool elementDataCollected; /// Stores if value data was collected before. - bool valueDataCollected_; + bool valueDataCollected; /// Stores if periodic data was collected before. - bool periodicDataCollected_; + bool periodicDataCollected; /// Pointer to a function which decides whether an element is considered. - bool (*writeElem_)(ElInfo*); + bool (*writeElem)(ElInfo*); /// Temporary variable used in functions addValueData() and addInterpData(). - DegreeOfFreedom *localDOFs_; + DegreeOfFreedom *localDOFs; /// Temporary variable used in functions addValueData() and addInterpData(). - BasisFunction *basisFcts_; + BasisFunction *basisFcts; /// Temporary variable used in functions addValueData() and addInterpData(). - int nBasisFcts_; + int nBasisFcts; /// Temporary variable used in function \ref addValueData. WorldVector<double> *vertexCoords; diff --git a/AMDiS/src/FiniteElemSpace.h b/AMDiS/src/FiniteElemSpace.h index 243d59a89fa408cf6e87ae15fe4bcbe74edb8d26..e27e99ab8187f07a97d4f524ea9123c563a3330b 100644 --- a/AMDiS/src/FiniteElemSpace.h +++ b/AMDiS/src/FiniteElemSpace.h @@ -32,13 +32,6 @@ namespace AMDiS { - class DOFAdmin; - class BasisFunction; - class Mesh; - - template<typename T> class DOFVector; - template<typename T> class DimVec; - /** \ingroup FEMSpace * \brief * A FiniteElemSpace is a triple of a DOFAdmin and a set of BasisFunction on a mesh. @@ -61,27 +54,32 @@ namespace AMDiS { FiniteElemSpace& operator=(const FiniteElemSpace& feSpace); /// Returns \ref name. - inline std::string getName() const { + inline std::string getName() const + { return name; } /// Returns \ref admin. - inline DOFAdmin* getAdmin() const { + inline DOFAdmin* getAdmin() const + { return admin; } /// Set a new DOF admin. - inline void setAdmin(DOFAdmin* a) { + inline void setAdmin(DOFAdmin* a) + { admin = a; } /// Returns \ref basFcts - inline const BasisFunction* getBasisFcts() const { + inline const BasisFunction* getBasisFcts() const + { return basFcts; } /// Returns \ref mesh - inline Mesh* getMesh() const { + inline Mesh* getMesh() const + { return mesh; } diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index db16edd4a19a1f5afc38a03180775cc8dc7c71b3..c804268c77b3fa756fbb6dd9e0ff72220669d197 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -393,146 +393,9 @@ namespace AMDiS { ("admin %s is already associated to mesh %s\n", localAdmin->getName().c_str(), this->getName().c_str()); - // ===== adding dofs to already existing elements ============================ - + // if this will be required, see the untested code in revision < 224 TEST_EXIT(!initialized)("Adding DOFAdmins to initilized meshes does not work yet!\n"); - if (initialized) { - static bool pnd_1d_0[2] = {true, true}; - static bool pnd_1d_1[1] = {false}; - static bool pnd_2d_0[3] = {true, true, true}; - static bool pnd_2d_1[3] = {true, true, false}; - static bool pnd_2d_2[1] = {false}; - static bool pnd_3d_0[4] = {true, true, true, true}; - static bool pnd_3d_1[6] = {false, true, true, true, true, true}; - static bool pnd_3d_2[4] = {true, true, false, false}; - static bool pnd_3d_3[1] = {false}; - static bool *pnd_1d[2] = {pnd_1d_0, pnd_1d_1}; - static bool *pnd_2d[3] = {pnd_2d_0, pnd_2d_1, pnd_2d_2}; - static bool *pnd_3d[4] = {pnd_3d_0, pnd_3d_1, pnd_3d_2, pnd_3d_3}; - static bool **parentNeedsDOF[4] = {NULL, pnd_1d, pnd_2d, pnd_3d}; - - - std::list<struct delmem> delList; - std::map< std::set<DegreeOfFreedom>, DegreeOfFreedom*> dofPtrMap; - const DOFAdmin *vertexAdmin = getVertexAdmin(); - int vertexAdminPreDOFs = vertexAdmin->getNumberOfPreDOFs(VERTEX); - - // finding necessary node number for new admin - - int newNNode = 0; - GeoIndex geoIndex; - - for (int d = 0; d < dim + 1; d++) { - geoIndex = INDEX_OF_DIM(d, dim); - - if (localAdmin->getNumberOfDOFs(geoIndex)>0||nDOF[geoIndex]>0) - newNNode+=getGeo(geoIndex); - } - - bool extendNodes = (newNNode>nNodeEl); - nNodeEl = newNNode; - - TraverseStack stack; - ElInfo *elInfo = NULL; - - elInfo = stack.traverseFirst(this, -1, CALL_EVERY_EL_PREORDER); - while(elInfo) { - Element *element = elInfo->getElement(); - DegreeOfFreedom *newDOF, **oldDOF, **dof = - const_cast<DegreeOfFreedom**>(element->getDOF()); - - int index = 0; - - if (extendNodes) { - oldDOF=dof; - element->setDOFPtrs(); - dof=const_cast<DegreeOfFreedom**>(element->getDOF()); - int index=0,oldIndex=0; - for (int d = 0; d < dim+1; d++) { - geoIndex = INDEX_OF_DIM(d, dim); - if (nDOF[geoIndex]>0) { - for(int i=0;i<getGeo(geoIndex);++i) - dof[index++]=oldDOF[oldIndex++]; - } - else { - if (localAdmin->getNumberOfDOFs(geoIndex)>0) - index+=getGeo(geoIndex); - } - } - - FREE_MEMORY(oldDOF, DegreeOfFreedom*, oldNNodes); - - TEST_EXIT_DBG(index == nNodeEl)("ERROR: Number of entered nodes %f != number of nodes %f\n",index,nNodeEl); - - } - - - index=0; - - // allocate new memory at elements - for(int d = 0; d < dim+1; d++) { - geoIndex = INDEX_OF_DIM(d, dim); - - int numberOfDOFs = localAdmin->getNumberOfDOFs(geoIndex); - int numberOfPreDOFs = nDOF[geoIndex]; - - if (numberOfDOFs>0||numberOfPreDOFs>0) { - - // for all vertices/edges/... - for(int i = 0; i < getGeo(geoIndex); i++, index++) { - std::set<DegreeOfFreedom> dofSet; - for(int j = 0; j < d+1; j++) { - dofSet.insert(dof[element->getVertexOfPosition(geoIndex, i, j)][vertexAdminPreDOFs]); - } - - if(element->isLeaf() || parentNeedsDOF[dim][d][i]) { - if(dofPtrMap[dofSet] == NULL) { - if(localAdmin->getNumberOfDOFs(geoIndex)) { - newDOF = GET_MEMORY(DegreeOfFreedom, numberOfPreDOFs + numberOfDOFs); - // copy old dofs to new memory and free old memory - if(dof[index]) { - for(int j = 0; j < numberOfPreDOFs; j++) { - newDOF[j] = dof[index][j]; - } - // FREE_MEMORY(dof[index], DegreeOfFreedom, numberOfPreDOFs); - // Do not free memory. The information has to be used to identify the part in other elements. - // The memory is only marked for freeing. - struct delmem fm; - fm.ptr=dof[index]; - fm.len=numberOfPreDOFs; - delList.push_back(fm); - } - for(int j = 0; j < numberOfDOFs; j++) { - newDOF[numberOfPreDOFs + j] = localAdmin->getDOFIndex(); - } - dof[index] = newDOF; - } - dofPtrMap[dofSet] = dof[index]; - } else { - dof[index] = dofPtrMap[dofSet]; - } - } - } - } - } - elInfo = stack.traverseNext(elInfo); - } - - // now free the old dof memory: - - std::list<struct delmem>::iterator it=delList.begin(); - - while(it!=delList.end()) { - FREE_MEMORY((*it).ptr, DegreeOfFreedom, (*it).len); - it++; - } - - delList.clear(); - - } - - admin.push_back(localAdmin); nDOFEl = 0; diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h index 263d838abd6cd8d3292ffd78126e8a7de7a19a72..c6020f0c04b0c6920e612acbf50ecbf18a1a919b 100644 --- a/AMDiS/src/Mesh.h +++ b/AMDiS/src/Mesh.h @@ -87,87 +87,104 @@ namespace AMDiS { * Returns geometric information about this mesh. With GeoIndex p it is * specifiedm which information is requested. */ - inline int getGeo(GeoIndex p) const { + inline int getGeo(GeoIndex p) const + { return Global::getGeo(p, dim); } /// Returns \ref name of the mesh - inline const std::string& getName() const { + inline const std::string& getName() const + { return name; } /// Returns \ref dim of the mesh - inline int getDim() const { + inline int getDim() const \ + { return dim; } /// Returns \ref nDOFEl of the mesh - inline const int getNumberOfAllDOFs() const { + inline const int getNumberOfAllDOFs() const + { return nDOFEl; } /// Returns \ref nNodeEl of the mesh - inline const int getNumberOfNodes() const { + inline const int getNumberOfNodes() const + { return nNodeEl; } /// Returns \ref nVertices of the mesh - inline const int getNumberOfVertices() const { + inline const int getNumberOfVertices() const + { return nVertices; } /// Returns \ref nEdges of the mesh - inline const int getNumberOfEdges() const { + inline const int getNumberOfEdges() const + { return nEdges; } /// Returns \ref nFaces of the mesh - inline const int getNumberOfFaces() const { + inline const int getNumberOfFaces() const + { return nFaces; } /// Returns \ref nLeaves of the mesh - inline const int getNumberOfLeaves() const { + inline const int getNumberOfLeaves() const + { return nLeaves; } /// Returns \ref nElements of the mesh - inline const int getNumberOfElements() const { + inline const int getNumberOfElements() const + { return nElements; } /// Returns \ref maxEdgeNeigh of the mesh - inline const int getMaxEdgeNeigh() const { + inline const int getMaxEdgeNeigh() const + { return maxEdgeNeigh; } /// Returns \ref parametric of the mesh - inline Parametric *getParametric() const { + inline Parametric *getParametric() const + { return parametric; } /// Returns \ref diam of the mesh - inline const WorldVector<double>& getDiameter() const { + inline const WorldVector<double>& getDiameter() const + { return diam; } /// Returns nDOF[i] of the mesh - inline const int getNumberOfDOFs(int i) const { + inline const int getNumberOfDOFs(int i) const + { return nDOF[i]; } /// Returns \ref elementPrototype of the mesh - inline Element* getElementPrototype() { + inline Element* getElementPrototype() + { return elementPrototype; } /// Returns \ref leafDataPrototype of the mesh - inline ElementData* getElementDataPrototype() { + inline ElementData* getElementDataPrototype() + { return elementDataPrototype; } /// Returns node[i] of the mesh - inline int getNode(int i) const { + inline int getNode(int i) const + { return node[i]; } @@ -180,7 +197,8 @@ namespace AMDiS { DegreeOfFreedom *getDOF(GeoIndex position); /// Returns *(\ref admin[i]) of the mesh - inline const DOFAdmin& getDOFAdmin(int i) const { + inline const DOFAdmin& getDOFAdmin(int i) const + { return *(admin[i]); } @@ -195,7 +213,8 @@ namespace AMDiS { * Returns the size of \ref admin which is the number of the DOFAdmins * belonging to this mesh */ - const int getNumberOfDOFAdmin() const { + const int getNumberOfDOFAdmin() const + { return admin.size(); } @@ -203,7 +222,8 @@ namespace AMDiS { * Returns the size of \ref macroElements which is the number of * of macro elements of this mesh */ - const int getNumberOfMacros() const { + const int getNumberOfMacros() const + { return macroElements.size(); } @@ -214,22 +234,26 @@ namespace AMDiS { DegreeOfFreedom **createDOFPtrs(); /// Returns \ref preserveCoarseDOFs of the mesh - inline bool queryCoarseDOFs() const { + inline bool queryCoarseDOFs() const + { return preserveCoarseDOFs; } /// Returns an iterator to the begin of \ref macroElements - inline std::deque<MacroElement*>::iterator firstMacroElement() { + inline std::deque<MacroElement*>::iterator firstMacroElement() + { return macroElements.begin(); } /// Returns macroElements[i]. - inline MacroElement *getMacroElement(int i) { + inline MacroElement *getMacroElement(int i) + { return macroElements[i]; } /// Returns an iterator to the end of \ref macroElements - inline std::deque<MacroElement*>::iterator endOfMacroElements() { + inline std::deque<MacroElement*>::iterator endOfMacroElements() + { return macroElements.end(); } @@ -240,57 +264,68 @@ namespace AMDiS { */ /// Sets \ref name of the mesh - inline void setName(const std::string& aName) { + inline void setName(const std::string& aName) + { name = aName; } /// Sets \ref nVertices of the mesh - inline void setNumberOfVertices(int n) { + inline void setNumberOfVertices(int n) + { nVertices = n; } /// Sets \ref nFaces of the mesh - inline void setNumberOfFaces(int n) { + inline void setNumberOfFaces(int n) + { nFaces = n; } /// Increments \ref nVertices by inc - inline void incrementNumberOfVertices(int inc) { + inline void incrementNumberOfVertices(int inc) + { nVertices += inc; } /// Sets \ref nEdges of the mesh - inline void setNumberOfEdges(int n) { + inline void setNumberOfEdges(int n) + { nEdges = n; } /// Increments \ref nEdges by inc - inline void incrementNumberOfEdges(int inc) { + inline void incrementNumberOfEdges(int inc) + { nEdges += inc; } /// Increments \ref nFaces by inc - inline void incrementNumberOfFaces(int inc) { + inline void incrementNumberOfFaces(int inc) + { nFaces += inc; } /// Sets \ref nLeaves of the mesh - inline void setNumberOfLeaves(int n) { + inline void setNumberOfLeaves(int n) + { nLeaves = n; } /// Increments \ref nLeaves by inc - inline void incrementNumberOfLeaves(int inc) { + inline void incrementNumberOfLeaves(int inc) + { nLeaves += inc; } /// Sets \ref nElements of the mesh - inline void setNumberOfElements(int n) { + inline void setNumberOfElements(int n) + { nElements = n; } /// Increments \ref nElements by inc - inline void incrementNumberOfElements(int inc) { + inline void incrementNumberOfElements(int inc) + { nElements += inc; } @@ -301,37 +336,44 @@ namespace AMDiS { void setDiameter(int i, double d); /// Sets \ref preserveCoarseDOFs = true - inline void retainCoarseDOFs() { + inline void retainCoarseDOFs() + { preserveCoarseDOFs = true; } /// Sets \ref preserveCoarseDOFs = b - inline void setPreserveCoarseDOFs(bool b) { + inline void setPreserveCoarseDOFs(bool b) + { preserveCoarseDOFs = b; } /// Sets \ref preserveCoarseDOFs = false - inline void noCoarseDOFs() { + inline void noCoarseDOFs() + { preserveCoarseDOFs = false; } /// Sets \ref elementPrototype of the mesh - inline void setElementPrototype(Element* prototype) { + inline void setElementPrototype(Element* prototype) + { elementPrototype = prototype; } /// Sets \ref elementDataPrototype of the mesh - inline void setElementDataPrototype(ElementData* prototype) { + inline void setElementDataPrototype(ElementData* prototype) + { elementDataPrototype = prototype; } /// - inline void setParametric(Parametric *param) { + inline void setParametric(Parametric *param) + { parametric = param; } /// - inline void setMaxEdgeNeigh(int m) { + inline void setMaxEdgeNeigh(int m) + { maxEdgeNeigh = m; } @@ -374,7 +416,8 @@ namespace AMDiS { void updateNumberOfLeaves(); /// Clears \ref macroElements - inline void clearMacroElements() { + inline void clearMacroElements() + { macroElements.clear(); } @@ -443,7 +486,8 @@ namespace AMDiS { /// Returns FILL_ANY_?D - inline static const Flag& getFillAnyFlag(int dim) { + inline static const Flag& getFillAnyFlag(int dim) + { switch (dim) { case 1: return FILL_ANY_1D; @@ -467,17 +511,20 @@ namespace AMDiS { void deserialize(std::istream &in); /// Returns \ref elementIndex and increments it by 1. - inline int getNextElementIndex() { + inline int getNextElementIndex() + { return elementIndex++; } /// Returns \ref initialized. - inline bool isInitialized() { + inline bool isInitialized() + { return initialized; } /// - inline std::map<BoundaryType, VertexVector*>& getPeriodicAssociations() { + inline std::map<BoundaryType, VertexVector*>& getPeriodicAssociations() + { return periodicAssociations; } @@ -488,7 +535,8 @@ namespace AMDiS { bool indirectlyAssociated(DegreeOfFreedom dof1, DegreeOfFreedom dof2); /// Returns \macroFileInfo - inline MacroInfo* getMacroFileInfo() { + inline MacroInfo* getMacroFileInfo() + { return macroFileInfo; } diff --git a/AMDiS/src/ParallelDomainProblem.cc b/AMDiS/src/ParallelDomainProblem.cc index 1fc7f69d51502b65a43ccee8c396108ca02b90e0..5dd470c79df08f49d58a87348979ccdb90d44506 100644 --- a/AMDiS/src/ParallelDomainProblem.cc +++ b/AMDiS/src/ParallelDomainProblem.cc @@ -176,8 +176,13 @@ namespace AMDiS { for (std::map<const DegreeOfFreedom*, int>::iterator it = boundaryDofs.begin(); it != boundaryDofs.end(); ++it) { + if (it->second == mpiRank) { + // If the boundary dof is a rank dof, it must be send to other ranks. + + // old global index int oldDofIndex = (it->first)[0]; + // search for new dof index in ranks partition for this boundary dof int newDofIndex = 0; for (int i = 0; i < static_cast<int>(rankDofs.size()); i++) { if (rankDofs[i] == it->first) { @@ -186,13 +191,18 @@ namespace AMDiS { } } + // Search for all ranks that have this dof too. for (std::set<int>::iterator itRanks = partitionDofs[it->first].begin(); itRanks != partitionDofs[it->first].end(); ++itRanks) { - if (*itRanks != mpiRank) + if (*itRanks != mpiRank) { sendNewDofs[*itRanks][oldDofIndex] = newDofIndex; + sendDofs[*itRanks].push_back(newDofIndex); + } } } else { + // If the boundary dof is not a rank dof, its new dof index, and later + // also the dof values, must be received from another rank. recvNewDofs[it->second].push_back((it->first)[0]); } } @@ -230,6 +240,15 @@ namespace AMDiS { mpiComm.Barrier(); + + /// === Reset all DOFAdmins of the mesh. === + + int nAdmins = mesh->getNumberOfDOFAdmin(); + for (int i = 0; i < nAdmins; i++) + for (int j = 0; j < mesh->getDOFAdmin(i).getSize(); j++) + const_cast<DOFAdmin&>(mesh->getDOFAdmin(i)).setDOFFree(j, true); + + /// === Change dof indices at boundary from other ranks. === i = 0; @@ -242,7 +261,15 @@ namespace AMDiS { dofIt != boundaryDofs.end(); ++dofIt) { if ((dofIt->first)[0] == recvBuffers[i][j * 2]) { - const_cast<DegreeOfFreedom*>(dofIt->first)[0] = recvBuffers[i][j * 2 + 1]; + int newDof = recvBuffers[i][j * 2 + 1]; + + recvDofs[recvIt->first].push_back(newDof); + + const_cast<DegreeOfFreedom*>(dofIt->first)[0] = newDof; + + for (int k = 0; k < nAdmins; k++) + const_cast<DOFAdmin&>(mesh->getDOFAdmin(k)).setDOFFree(newDof, false); + break; } } @@ -260,8 +287,13 @@ namespace AMDiS { /// === Change dof indices for rank partition. === - for (int i = 0; i < static_cast<int>(rankDofs.size()); i++) - const_cast<DegreeOfFreedom*>(rankDofs[i])[0] = rstart + i; + for (int i = 0; i < static_cast<int>(rankDofs.size()); i++) { + const_cast<DegreeOfFreedom*>(rankDofs[i])[0] = rstart + i; + + for (int k = 0; k < nAdmins; k++) + const_cast<DOFAdmin&>(mesh->getDOFAdmin(k)).setDOFFree(rstart + i, false); + + } /// === Create petsc matrix. === int ierr; @@ -341,15 +373,62 @@ namespace AMDiS { DOFVector<double>::Iterator dofIt(vec, USED_DOFS); int counter = 0; for (dofIt.reset(); !dofIt.end(); ++dofIt) - *vec = vecPointer[counter++]; + *dofIt = vecPointer[counter++]; VecRestoreArray(petscSolVec, &vecPointer); - std::stringstream oss; - oss << "test" << MPI::COMM_WORLD.Get_rank() << ".vtu"; - VtkWriter::writeFile(vec, oss.str()); + std::vector<double*> sendBuffers(sendDofs.size()); + std::vector<double*> recvBuffers(recvDofs.size()); + + int i = 0; + for (std::map<int, std::vector<DegreeOfFreedom> >::iterator sendIt = sendDofs.begin(); + sendIt != sendDofs.end(); + ++sendIt, i++) { + sendBuffers[i] = new double[sendIt->second.size()]; + + for (int j = 0; j < sendIt->second.size(); j++) + sendBuffers[i][j] = (*vec)[(sendIt->second)[j]]; + + mpiComm.Isend(sendBuffers[i], sendIt->second.size(), MPI_DOUBLE, sendIt->first, 0); + } + + i = 0; + for (std::map<int, std::vector<DegreeOfFreedom> >::iterator recvIt = recvDofs.begin(); + recvIt != recvDofs.end(); + ++recvIt, i++) { + recvBuffers[i] = new double[recvIt->second.size()]; + + mpiComm.Irecv(recvBuffers[i], recvIt->second.size(), MPI_DOUBLE, recvIt->first, 0); + } + + + mpiComm.Barrier(); + + i = 0; + for (std::map<int, std::vector<DegreeOfFreedom> >::iterator recvIt = recvDofs.begin(); + recvIt != recvDofs.end(); + ++recvIt, i++) { + for (int j = 0; j < recvIt->second.size(); j++) { + if (MPI::COMM_WORLD.Get_rank() == 0) + std::cout << (recvIt->second)[j] << " = " << recvBuffers[i][j] << std::endl; + + (*vec)[(recvIt->second)[j]] = recvBuffers[i][j]; + } + + delete [] recvBuffers[i]; + } + + for (int i = 0; i < sendBuffers.size(); i++) + delete [] sendBuffers[i]; - std::cout << "USED SIZE = " << vec->getUsedSize() << std::endl; + std::cout << "TEST" << std::endl; + + if (MPI::COMM_WORLD.Get_rank() == 0) { + DOFVector<double>::Iterator it(vec, USED_DOFS); + for (it.reset(); !it.end(); ++it) { + std::cout << it.getDOFIndex() << " = " << *it << std::endl; + } + } } double ParallelDomainProblemBase::setElemWeights(AdaptInfo *adaptInfo) diff --git a/AMDiS/src/ParallelDomainProblem.h b/AMDiS/src/ParallelDomainProblem.h index c5ad751db8a08bcd433ec77eec8856445e43cb48..9704091d7a1cf610302f925c94beb2a6938b7559 100644 --- a/AMDiS/src/ParallelDomainProblem.h +++ b/AMDiS/src/ParallelDomainProblem.h @@ -74,32 +74,38 @@ namespace AMDiS { virtual void transferInitialSolution(AdaptInfo *adaptInfo) {} - virtual void beginIteration(AdaptInfo *adaptInfo) { + virtual void beginIteration(AdaptInfo *adaptInfo) + { iterationIF->beginIteration(adaptInfo); } - virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) { + virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) + { ERROR_EXIT("Not implemented!\n"); return 0; } - virtual void endIteration(AdaptInfo *adaptInfo) { + virtual void endIteration(AdaptInfo *adaptInfo) + { iterationIF->endIteration(adaptInfo); } virtual int getNumProblems() {} - inline virtual const std::string& getName() { + inline virtual const std::string& getName() + { return name; } /// Returns pointer to \ref applicationOrdering. - AO* getApplicationOrdering() { + AO* getApplicationOrdering() + { return &applicationOrdering; } /// Returns \ref nRankDOFs, the number of DOFs in the rank mesh. - int getNumberRankDOFs() { + int getNumberRankDOFs() + { return nRankDOFs; } @@ -182,6 +188,18 @@ namespace AMDiS { InteriorBoundary interiorBoundary; std::map<const DegreeOfFreedom*, int> boundaryDofs; + + /** \brief + * This map contains for each rank the list of dofs the current rank must send + * to exchange solution dofs at the interior boundaries. + */ + std::map<int, std::vector<DegreeOfFreedom> > sendDofs; + + /** \brief + * This map contains for each rank the list of dofs from which the current rank + * must receive solution values of dofs at the interior boundaries. + */ + std::map<int, std::vector<DegreeOfFreedom> > recvDofs; }; class ParallelDomainProblemScal : public ParallelDomainProblemBase diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index 6ba4a3cece89edea9dd8ce25baf5e6837993d5d0..7b779fda29ac7de81f0c838ef818c08395c5684d 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -144,12 +144,14 @@ namespace AMDiS { bool assembleVector = true); /// Returns number of managed problems - virtual int getNumProblems() { + virtual int getNumProblems() + { return 1; } /// Implementation of ProblemStatBase::getNumComponents() - virtual int getNumComponents() { + virtual int getNumComponents() + { return 1; } @@ -157,7 +159,8 @@ namespace AMDiS { * Returns the problem with the given number. If only one problem * is managed by this master problem, the number hasn't to be given. */ - virtual ProblemStatBase *getProblem(int number = 0) { + virtual ProblemStatBase *getProblem(int number = 0) + { return this; } @@ -211,62 +214,74 @@ namespace AMDiS { */ /// Returns \ref solution. - inline DOFVector<double>* getSolution() { + inline DOFVector<double>* getSolution() + { return solution; } /// Returns \ref rhs. - inline DOFVector<double>* getRHS() { + inline DOFVector<double>* getRHS() + { return rhs; } /// Returns \ref systemMatrix. - inline DOFMatrix *getSystemMatrix() { + inline DOFMatrix *getSystemMatrix() + { return systemMatrix; } /// Returns \ref mesh - inline Mesh* getMesh() { + inline Mesh* getMesh() + { return mesh; } /// Returns \ref feSpace. - inline FiniteElemSpace* getFESpace() { + inline FiniteElemSpace* getFESpace() + { return feSpace; } /// Returns \ref estimator_. - inline Estimator* getEstimator() { + inline Estimator* getEstimator() + { return estimator; } /// Returns \ref refinementManager. - inline RefinementManager* getRefinementManager() { + inline RefinementManager* getRefinementManager() + { return refinementManager; } /// Returns \ref solver. - inline OEMSolver* getSolver() { + inline OEMSolver* getSolver() + { return solver; } /// Returns \ref marker_. - inline Marker *getMarker() { + inline Marker *getMarker() + { return marker; } /// Returns \ref name. - virtual inline const std::string& getName() { + virtual inline const std::string& getName() + { return name; } /// Returns \ref useGetBound. - inline bool getBoundUsed() { + inline bool getBoundUsed() + { return useGetBound; } /// - inline CoarseningManager *getCoarseningManager() { + inline CoarseningManager *getCoarseningManager() + { return coarseningManager; } @@ -280,22 +295,26 @@ namespace AMDiS { void setMeshFromProblemVec(ProblemVec* pv, int i = 0); /// Sets \ref feSpace. - inline void setFESpace(FiniteElemSpace* fe) { + inline void setFESpace(FiniteElemSpace* fe) + { feSpace = fe; } /// Sets \ref estimator_. - inline void setEstimator(Estimator* est) { + inline void setEstimator(Estimator* est) + { estimator = est; } /// Sets \ref solver. - inline void setSolver(OEMSolver* sol) { + inline void setSolver(OEMSolver* sol) + { solver = sol; } /// Sets \ref marker. - inline void setMarker(Marker *m) { + inline void setMarker(Marker *m) + { marker = m; } @@ -309,7 +328,8 @@ namespace AMDiS { /// deserialization virtual void deserialize(std::istream &in); - std::vector<FileWriterInterface*> getFileWriterList() { + std::vector<FileWriterInterface*> getFileWriterList() + { return fileWriters; } diff --git a/AMDiS/src/ProblemVec.h b/AMDiS/src/ProblemVec.h index 2f8e932e2fa6c78e43a49dfc0370c6fca5733b80..4f7f3e5d30736506b0a07b4fac21aee4c5e3dd76 100644 --- a/AMDiS/src/ProblemVec.h +++ b/AMDiS/src/ProblemVec.h @@ -172,12 +172,14 @@ namespace AMDiS { virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION); /// Returns number of managed problems - virtual int getNumProblems() { + virtual int getNumProblems() + { return 1; } /// Implementation of ProblemStatBase::getNumComponents() - virtual int getNumComponents() { + virtual int getNumComponents() + { return nComponents; } @@ -185,7 +187,8 @@ namespace AMDiS { * Returns the problem with the given number. If only one problem * is managed by this master problem, the number hasn't to be given. */ - virtual ProblemStatBase *getProblem(int number = 0) { + virtual ProblemStatBase *getProblem(int number = 0) + { return this; } @@ -224,7 +227,8 @@ namespace AMDiS { virtual void addPeriodicBC(BoundaryType type, int row, int col); /// Implementation of ProblemStatBase::allowFirstRefinement(). - inline void allowFirstRefinement() { + inline void allowFirstRefinement() + { allowFirstRef = true; } @@ -261,27 +265,32 @@ namespace AMDiS { */ /// Returns \ref solution. - inline SystemVector* getSolution() { + inline SystemVector* getSolution() + { return solution; } /// Returns \ref rhs. - inline SystemVector* getRHS() { + inline SystemVector* getRHS() + { return rhs; } /// Returns \ref systemMatrix. - inline Matrix<DOFMatrix*> *getSystemMatrix() { + inline Matrix<DOFMatrix*> *getSystemMatrix() + { return systemMatrix; } /// Returns a pointer to the corresponding DOFMatrix. - inline DOFMatrix* getSystemMatrix(int row, int col) { + inline DOFMatrix* getSystemMatrix(int row, int col) + { return (*systemMatrix)[row][col]; } /// Returns mesh of given component - inline Mesh* getMesh(int comp) { + inline Mesh* getMesh(int comp) + { FUNCNAME("ProblemVec::getMesh()"); TEST_EXIT(comp < static_cast<int>(componentMeshes.size()) && comp >= 0) ("invalid component number\n"); @@ -289,12 +298,14 @@ namespace AMDiS { } /// Returns \ref meshes - inline std::vector<Mesh*> getMeshes() { + inline std::vector<Mesh*> getMeshes() + { return meshes; } /// Returns \ref feSpace_. - inline FiniteElemSpace* getFESpace(int comp) { + inline FiniteElemSpace* getFESpace(int comp) + { FUNCNAME("ProblemVec::getFESpace()"); TEST_EXIT(comp < static_cast<int>(componentSpaces.size()) && comp >= 0) ("invalid component number\n"); @@ -302,57 +313,68 @@ namespace AMDiS { } /// Returns \ref feSpaces. - inline std::vector<FiniteElemSpace*> getFESpaces() { + inline std::vector<FiniteElemSpace*> getFESpaces() + { return feSpaces; } /// Returns \ref componentSpaces; - inline std::vector<FiniteElemSpace*> getComponentFESpaces() { + inline std::vector<FiniteElemSpace*> getComponentFESpaces() + { return componentSpaces; } /// Returns \ref estimator. - inline std::vector<Estimator*> getEstimator() { + inline std::vector<Estimator*> getEstimator() + { return estimator; } /// Returns \ref estimator. - inline Estimator* getEstimator(int comp) { + inline Estimator* getEstimator(int comp) + { return estimator[comp]; } /// Returns \ref refinementManager. - inline RefinementManager* getRefinementManager(int comp) { + inline RefinementManager* getRefinementManager(int comp) + { return refinementManager; } /// Returns \ref refinementManager. - inline CoarseningManager* getCoarseningManager(int comp) { + inline CoarseningManager* getCoarseningManager(int comp) + { return coarseningManager; } /// Returns \ref solver. - inline OEMSolver* getSolver() { + inline OEMSolver* getSolver() + { return solver; } /// Returns \ref marker. - inline Marker *getMarker(int comp) { + inline Marker *getMarker(int comp) + { return marker[comp]; } /// Returns \ref marker. - inline std::vector<Marker*> getMarker() { + inline std::vector<Marker*> getMarker() + { return marker; } /// Returns the name of the problem - inline virtual const std::string& getName() { + inline virtual const std::string& getName() + { return name; } /// Returns \ref useGetBound. - inline bool getBoundUsed() { + inline bool getBoundUsed() + { return useGetBound; } @@ -363,48 +385,57 @@ namespace AMDiS { */ /// Sets \ref estimator. - inline void setEstimator(std::vector<Estimator*> est) { + inline void setEstimator(std::vector<Estimator*> est) + { estimator = est; } /// Sets the FE space for the given component. - inline void setFESpace(FiniteElemSpace *feSpace, int comp) { + inline void setFESpace(FiniteElemSpace *feSpace, int comp) + { feSpaces[comp] = feSpace; } /// Sets \ref estimator. - inline void setEstimator(Estimator* est, int comp) { + inline void setEstimator(Estimator* est, int comp) + { estimator[comp] = est; } /// Sets \ref marker. - inline void setMarker(Marker* mark, int comp) { + inline void setMarker(Marker* mark, int comp) + { marker[comp] = mark; } /// Sets \ref solver. - inline void setSolver(OEMSolver* sol) { + inline void setSolver(OEMSolver* sol) + { solver = sol; } /// - inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) { + inline void setAssembleMatrixOnlyOnce(int i, int j, bool value = true) + { assembleMatrixOnlyOnce[i][j] = value; } /// void setExactSolutionFct(AbstractFunction<double, WorldVector<double> > *fct, - int component) { + int component) + { exactSolutionFcts[component] = fct; } /// - AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int component) { + AbstractFunction<double, WorldVector<double> > *getExactSolutionFct(int component) + { return exactSolutionFcts[component]; } /// - void setComputeExactError(bool v) { + void setComputeExactError(bool v) + { computeExactError = v; } @@ -424,7 +455,8 @@ namespace AMDiS { /// Returns \ref fileWriters. - std::vector<FileWriterInterface*>& getFileWriterList() { + std::vector<FileWriterInterface*>& getFileWriterList() + { return fileWriters; }