From d5c8e677c8c15f282c0dbefa833082531444725c Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Tue, 21 Apr 2009 11:25:23 +0000 Subject: [PATCH] Changes for parallelization --- AMDiS/libtool | 70 ++++++------ AMDiS/src/CoarseningManager.h | 10 -- AMDiS/src/DOFAdmin.h | 173 ++++++++--------------------- AMDiS/src/ElementFileWriter.cc | 6 +- AMDiS/src/MacroReader.cc | 169 ++++++++++++++-------------- AMDiS/src/MacroReader.h | 59 +++------- AMDiS/src/Mesh.cc | 45 ++------ AMDiS/src/Mesh.h | 10 -- AMDiS/src/ParallelDomainProblem.cc | 14 ++- AMDiS/src/ProblemNonLin.cc | 27 +++-- AMDiS/src/ProblemScal.cc | 65 +++++------ AMDiS/src/ProblemScal.h | 22 ++-- 12 files changed, 257 insertions(+), 413 deletions(-) diff --git a/AMDiS/libtool b/AMDiS/libtool index 3b667337..54b3e258 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 p2s118: # 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,25 +82,25 @@ 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 -gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` +gcc_dir=`gcc -print-file-name=. | /usr/bin/sed 's,/\.$,,'` gcc_ver=`gcc -dumpversion` # 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" @@ -174,7 +174,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" @@ -328,10 +328,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=`echo " /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/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +sys_lib_search_path_spec=`echo "/lib64 /usr/lib64 /usr/local/lib64" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # 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="/lib64 /usr/lib64 /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="" @@ -6763,7 +6763,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 p2s118: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -6785,12 +6785,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. @@ -6801,25 +6801,25 @@ 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 -gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` +gcc_dir=`gcc -print-file-name=. | /usr/bin/sed 's,/\.$,,'` gcc_ver=`gcc -dumpversion` # 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" @@ -6893,7 +6893,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" @@ -6948,11 +6948,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=`echo "/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbeginS.o" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +predep_objects=`echo "/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" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=`echo "/usr/lib/gcc/i386-redhat-linux/4.1.2/crtendS.o /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +postdep_objects=`echo "/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" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place before the objects being linked to create a # shared library. @@ -6960,11 +6960,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=`echo "-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/../../.." | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +compiler_lib_search_path=`echo "-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/../../.." | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" @@ -7044,10 +7044,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=`echo " /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/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +sys_lib_search_path_spec=`echo "/lib64 /usr/lib64 /usr/local/lib64" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # 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="/lib64 /usr/lib64 /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="" @@ -7071,7 +7071,7 @@ include_expsyms="" # ### BEGIN LIBTOOL TAG CONFIG: F77 -# Libtool was configured on host NWRW15: +# Libtool was configured on host p2s118: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7093,12 +7093,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. @@ -7109,7 +7109,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" @@ -7118,16 +7118,16 @@ LTCFLAGS="-g -O2" CC="g77" # Is the compiler the GNU C compiler? -with_gcc=yes +with_gcc= -gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` +gcc_dir=`gcc -print-file-name=. | /usr/bin/sed 's,/\.$,,'` gcc_ver=`gcc -dumpversion` # 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" @@ -7355,10 +7355,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=`echo " /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/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +sys_lib_search_path_spec=`echo "/lib64 /usr/lib64 /usr/local/lib64" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # 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="/lib64 /usr/lib64 /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/CoarseningManager.h b/AMDiS/src/CoarseningManager.h index 6c91164e..4e88dcf9 100644 --- a/AMDiS/src/CoarseningManager.h +++ b/AMDiS/src/CoarseningManager.h @@ -74,16 +74,6 @@ namespace AMDiS { */ inline Mesh* getMesh() { return mesh; }; - // /** \brief - // * Coarsens a single Element by decrement its mark and then coarsen - // * the mesh. - // */ - // void coarsenElement(Element *element) { - // FUNCNAME("CoarseninManager::coarseElement"); - // element->decrementMark(); - // coarsenMesh(); - // }; - /** \brief * Tries to coarsen every element of mesh at least mark times. First * all elements are marked for coarsening and then coarsenMesh will diff --git a/AMDiS/src/DOFAdmin.h b/AMDiS/src/DOFAdmin.h index fb91a520..440fc321 100644 --- a/AMDiS/src/DOFAdmin.h +++ b/AMDiS/src/DOFAdmin.h @@ -62,24 +62,16 @@ namespace AMDiS { DOFAdmin(); - /** \brief - * constructor - */ + /// Constructor DOFAdmin(Mesh* m); - /** \brief - * constructor - */ + /// Constructor DOFAdmin(Mesh* m, std::string aName); - /** \brief - * copy constructor - */ + /// Copy constructor DOFAdmin(const DOFAdmin&); - /** \brief - * destructor - */ + /// Destructor ~DOFAdmin(); /** \brief @@ -88,19 +80,13 @@ namespace AMDiS { */ void enlargeDOFLists(int minsize); - /** \brief - * assignment operator - */ + /// assignment operator DOFAdmin& operator=(const DOFAdmin&); - /** \brief - * Compares two DOFAdmins by their names. - */ + /// Compares two DOFAdmins by their names. bool operator==(const DOFAdmin&) const; - /** \brief - * Compares two DOFAdmins by their names. - */ + /// Compares two DOFAdmins by their names. inline bool operator!=(const DOFAdmin& ad) const { return !(ad==*this); } @@ -111,19 +97,13 @@ namespace AMDiS { */ void addDOFIndexed(DOFIndexedBase* dofIndexed); - /** \brief - * Adds a DOFContainer object to the DOFAdmin. - */ + /// Adds a DOFContainer object to the DOFAdmin. void addDOFContainer(DOFContainer* dofContainer); - /** \brief - * Removes the given DOFIndexedBase object from DOFAdmin. - */ + /// Removes the given DOFIndexedBase object from DOFAdmin. void removeDOFIndexed(DOFIndexedBase* dofIndexed); - /** \brief - * Removes the given DOFContainer object from DOFAdmin. - */ + /// Removes the given DOFContainer object from DOFAdmin. void removeDOFContainer(DOFContainer* dofContainer); /** \brief @@ -135,16 +115,12 @@ namespace AMDiS { */ void compress(std::vector<DegreeOfFreedom> &new_dof); - /** \brief - * Returns an iterator to the begin of \ref dofIndexedList - */ + /// Returns an iterator to the begin of \ref dofIndexedList std::list<DOFIndexedBase*>::iterator beginDOFIndexed() { return dofIndexedList.begin(); } - /** \brief - * Returns an iterator to the end of \ref dofIndexedList - */ + /// Returns an iterator to the end of \ref dofIndexedList std::list<DOFIndexedBase*>::iterator endDOFIndexed() { return dofIndexedList.end(); } @@ -153,87 +129,62 @@ namespace AMDiS { * \{ */ - /** \brief - * Returns \ref sizeUsed. - */ + /// Returns \ref sizeUsed. inline const int getUsedSize() const { return sizeUsed; } - /** \brief - * Returns \ref size - */ + /// Returns \ref size inline const int getSize() const { return size; } - /** \brief - * Returns \ref usedCount - */ + /// Returns \ref usedCount inline const int getUsedDOFs() const { return usedCount; } - /** \brief - * Returns \ref holeCount - */ + /// Returns \ref holeCount inline const int getHoleCount() const { return holeCount; } - /** \brief - * Returns \ref name - */ + /// Returns \ref name inline const std::string& getName() const { return name; } - /** \brief - * Returns \ref nrDOF[i], i.e., the number of dofs for the - * position i. - */ + /// Returns \ref nrDOF[i], i.e., the number of dofs for the position i. inline const int getNumberOfDOFs(int i) const { return nrDOF[i]; } - /** \brief - * Returns \ref nrDOF - */ + /// Returns \ref nrDOF inline const DimVec<int>& getNumberOfDOFs() const { return nrDOF; } - /** \brief - * Returns \ref nr0DOF[i] - */ + /// Returns \ref nr0DOF[i] inline const int getNumberOfPreDOFs(int i) const { return nr0DOF[i]; } - /** \brief - * Returns \ref nr0DOF - */ + /// Returns \ref nr0DOF inline const DimVec<int>& getNumberOfPreDOFs() const { return nr0DOF; } - /** \brief - * Returns \ref mesh - */ + /// Returns \ref mesh inline const Mesh* getMesh() const { return mesh; } - /** \brief - * Returns \ref dofFree, the array denoting DOFs to be either free or used. - */ + /// Returns \ref dofFree, the array denoting DOFs to be either free or used. inline const std::vector<bool>& getDOFFree() const { return dofFree; } - /** \brief - * Returns if the given DOF is free. - */ + /// Returns if the given DOF is free. inline const bool isDOFFree(int i) const { return dofFree[i]; } @@ -244,26 +195,18 @@ namespace AMDiS { * \{ */ - /** \brief - * Sets \ref nrDOF[i] = v - */ + /// Sets \ref nrDOF[i] = v void setNumberOfDOFs(int i, int v); - /** \brief - * Sets \ref nr0DOF[i] = v - */ + /// Sets \ref nr0DOF[i] = v void setNumberOfPreDOFs(int i, int v); - /** \brief - * Sets \ref name = n - */ + /// Sets \ref name = n inline void setName(const std::string& n) { name = n; } - /** \brief - * Sets \ref mesh = m - */ + /// Sets \ref mesh = m inline void setMesh(Mesh* m) { mesh = m; } @@ -273,9 +216,7 @@ namespace AMDiS { /** \} */ protected: - /** \brief - * initializes this DOFAdmin - */ + /// Initializes this DOFAdmin void init(); /** \brief @@ -284,9 +225,7 @@ namespace AMDiS { */ int getDOFIndex(); - /** \brief - * Frees index dof. Used by Mesh::getDOF() - */ + /// Frees index dof. Used by Mesh::getDOF() void freeDOFIndex(int dof); /// @@ -296,70 +235,46 @@ namespace AMDiS { void deserialize(std::istream &in); protected: - /** \brief - * name of this DOFAdmin - */ + /// name of this DOFAdmin std::string name; - /** \brief - * the mesh this DOFAdmin belongs to - */ + /// the mesh this DOFAdmin belongs to Mesh *mesh; - /** \brief - * the dofFree vector stores for each index whether it is used or not - */ + /// The dofFree vector stores for each index whether it is used or not std::vector<bool> dofFree; - /** \brief - * index of the first free value in \ref dofFree - */ + /// index of the first free value in \ref dofFree int firstHole; - /** \brief - * allocated size of managed vectors and matrices - */ + /// allocated size of managed vectors and matrices int size; - /** \brief - * number of used dof indices - */ + /// number of used dof indices int usedCount; - /** \brief - * number of FREED dof indices (NOT size-sizeUsed) - */ + /// number of FREED dof indices (NOT size-sizeUsed) int holeCount; - /** \brief - * > max. index of a used entry - */ + /// > max. index of a used entry int sizeUsed; /** \brief - * Number of dofs for each position, i.e., vertex, - * edge, ..., center, for this DOFAdmin. + * Number of dofs for each position, i.e., vertex, edge, ..., center, + * for this DOFAdmin. */ DimVec<int> nrDOF; - /** \brief - * dofs from previous DOFAdmins - */ + /// Dofs from previous DOFAdmins DimVec<int> nr0DOF; - /** \brief - * list of all managed DOFIndexed objects. - */ + /// List of all managed DOFIndexed objects. std::list<DOFIndexedBase*> dofIndexedList; - /** \brief - * list of all managed DOFContainer objects - */ + /// List of all managed DOFContainer objects std::list<DOFContainer*> dofContainerList; - /** \brief - * size increment used by \ref enlargeDOFLists. - */ + /// Size increment used by \ref enlargeDOFLists. static const int sizeIncrement; friend class DOFIteratorBase; diff --git a/AMDiS/src/ElementFileWriter.cc b/AMDiS/src/ElementFileWriter.cc index a0b1a169..35884163 100644 --- a/AMDiS/src/ElementFileWriter.cc +++ b/AMDiS/src/ElementFileWriter.cc @@ -107,7 +107,7 @@ namespace AMDiS { FUNCNAME("ElementFileWriter::writeTecPlotValues()"); std::ofstream fout(filename.c_str()); - TEST_EXIT(fout)("Could not open file %s !\n", filename); + TEST_EXIT(fout)("Could not open file %s !\n", filename.c_str()); fout.setf(std::ios::scientific,std::ios::floatfield); int dim = mesh->getDim(); @@ -187,7 +187,7 @@ namespace AMDiS { FUNCNAME("ElementFileWriter::writeMeshDatValues()"); std::ofstream fout(filename.c_str()); - TEST_EXIT(fout)("Could not open file %s !\n", filename); + TEST_EXIT(fout)("Could not open file %s !\n", filename.c_str()); int dim = mesh->getDim(); double val; @@ -286,7 +286,7 @@ namespace AMDiS { FUNCNAME("ElementFileWriter::writeVtkValues()"); std::ofstream fout(filename.c_str()); - TEST_EXIT(fout)("Could not open file %s !\n", filename); + TEST_EXIT(fout)("Could not open file %s !\n", filename.c_str()); int dim = mesh->getDim(); int vertices = mesh->getGeo(VERTEX); diff --git a/AMDiS/src/MacroReader.cc b/AMDiS/src/MacroReader.cc index 2409b0ec..b002a7b4 100644 --- a/AMDiS/src/MacroReader.cc +++ b/AMDiS/src/MacroReader.cc @@ -1870,10 +1870,8 @@ namespace AMDiS { fill_flag |= Mesh::FILL_NEIGH; - for (mesh->iadmin = 0; - mesh->iadmin < static_cast<int>(mesh->admin.size()); - mesh->iadmin++) { - localAdmin = mesh->admin[mesh->iadmin]; + for (int iadmin = 0; iadmin < static_cast<int>(mesh->admin.size()); iadmin++) { + localAdmin = mesh->admin[iadmin]; if (localAdmin->getSize() > 0) { if (static_cast<int>(mesh->dof_used.size()) < localAdmin->getSize()) { @@ -1883,38 +1881,40 @@ namespace AMDiS { mesh->dof_used[i] = 0; nused = nfree = 0; + + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(mesh, -1, fill_flag | Mesh::FILL_ADD_ALL); + while (elInfo) { + basicDOFCheckFct(elInfo, mesh, iadmin); + elInfo = stack.traverseNext(elInfo); + } - Mesh::traversePtr = mesh; - error_detected += mesh->traverse(-1, - fill_flag | Mesh::FILL_ADD_ALL, - basicDOFCheckFct); - - DOFIteratorBase it(localAdmin, USED_DOFS); - for(it.reset(); !it.end(); ++it) { - nused++; - if (!mesh->dof_used[it.getDOFIndex()]) { - error_detected++; - MSG("dof[%d] not used??\n",it.getDOFIndex()); - } + DOFIteratorBase it(localAdmin, USED_DOFS); + for (it.reset(); !it.end(); ++it) { + nused++; + if (!mesh->dof_used[it.getDOFIndex()]) { + error_detected++; + MSG("dof[%d] not used??\n",it.getDOFIndex()); } - - DOFIteratorBase freeIt(localAdmin, FREE_DOFS); - for(freeIt.reset(); !freeIt.end(); ++freeIt) { - nfree++; - if(mesh->dof_used[freeIt.getDOFIndex()]) { - error_detected++; - MSG("dof[%d] used??\n",freeIt.getDOFIndex()); - } + } + + DOFIteratorBase freeIt(localAdmin, FREE_DOFS); + for (freeIt.reset(); !freeIt.end(); ++freeIt) { + nfree++; + if(mesh->dof_used[freeIt.getDOFIndex()]) { + error_detected++; + MSG("dof[%d] used??\n",freeIt.getDOFIndex()); } - - TEST(nused + nfree == localAdmin->getSize()) - ("nused = %d, nfree = %d, admin.size = %d ????\n", - nused, nfree, localAdmin->getSize()); - TEST(nused == localAdmin->getUsedDOFs()) - ("nused = %d, admin.used_count = %d ?????\n", - nused, localAdmin->getUsedDOFs()); } + + TEST(nused + nfree == localAdmin->getSize()) + ("nused = %d, nfree = %d, admin.size = %d ????\n", + nused, nfree, localAdmin->getSize()); + TEST(nused == localAdmin->getUsedDOFs()) + ("nused = %d, admin.used_count = %d ?????\n", + nused, localAdmin->getUsedDOFs()); } + } if (!error_detected) { MSG("checking done; no error detected\n"); @@ -1930,10 +1930,11 @@ namespace AMDiS { int MacroReader::basicCheckFct(ElInfo* elinfo) { - FUNCNAME("MacroReader::basicCheckFct"); - int i, j, k, opp_v; - Element *el = elinfo->getElement(); - const Element *neig; + FUNCNAME("MacroReader::basicCheckFct()"); + + int j, k, opp_v; + Element *el = elinfo->getElement(); + const Element *neig; int error_detected=0; Mesh* mesh = Mesh::traversePtr; @@ -1942,79 +1943,75 @@ namespace AMDiS { elinfo->testFlag(Mesh::FILL_NEIGH); - for (i = 0; i < mesh->getGeo(NEIGH); i++) - { - if ((neig = elinfo->getNeighbour(i))) - { - if(elinfo->getBoundary(i) > 0) { // < 0 => periodic boundary + for (int i = 0; i < mesh->getGeo(NEIGH); i++) { + if ((neig = elinfo->getNeighbour(i))) { + if(elinfo->getBoundary(i) > 0) { // < 0 => periodic boundary + if (!error_detected) + MSG("error detected!!!\n"); + error_detected++; + MSG("interior (*boundary)[%d] non NULL on element = %d\n", + i, el->getIndex()); + } + + opp_v = elinfo->getOppVertex(i); + if(opp_v < 0 || opp_v >= mesh->getGeo(NEIGH)) { + if (!error_detected) + MSG("error detected!!!\n"); + error_detected++; + MSG("opp_v = %d\n", opp_v); + } + + if(elinfo->getBoundary(i) > 0) { // < 0 => periodic boundary + if(dim == 1) { + if(el->getDOF(i) != neig->getDOF(opp_v)) { if (!error_detected) MSG("error detected!!!\n"); error_detected++; - MSG("interior (*boundary)[%d] non NULL on element = %d\n", - i, el->getIndex()); + MSG("neighbour error\n"); } - - opp_v = elinfo->getOppVertex(i); - if(opp_v < 0 || opp_v >= mesh->getGeo(NEIGH)) - { + } else { + for (j = 1; j < mesh->getGeo(VERTEX); j++) { + for (k = 1; k < mesh->getGeo(VERTEX); k++) + if (el->getDOF((i+j) % mesh->getGeo(VERTEX)) == + neig->getDOF((opp_v+k) % mesh->getGeo(VERTEX))) + break; + + if (k >= mesh->getGeo(VERTEX)) { if (!error_detected) MSG("error detected!!!\n"); error_detected++; - MSG("opp_v = %d\n", opp_v); - } - - if(elinfo->getBoundary(i) > 0) { // < 0 => periodic boundary - if(dim == 1) { - if(el->getDOF(i) != neig->getDOF(opp_v)) { - if (!error_detected) - MSG("error detected!!!\n"); - error_detected++; - MSG("neighbour error\n"); - } - } else { - for (j = 1; j < mesh->getGeo(VERTEX); j++) { - for (k = 1; k < mesh->getGeo(VERTEX); k++) - if (el->getDOF((i+j) % mesh->getGeo(VERTEX)) == - neig->getDOF((opp_v+k) % mesh->getGeo(VERTEX))) - break; - - if (k >= mesh->getGeo(VERTEX)) { - if (!error_detected) - MSG("error detected!!!\n"); - error_detected++; - MSG("dof %d of el %d at face %d isn't dof of neigh %d at face %d\n", - el->getDOF((i+j) % 3,0), el->getIndex(), i, neig->getIndex(), - opp_v); - } - } - } + MSG("dof %d of el %d at face %d isn't dof of neigh %d at face %d\n", + el->getDOF((i+j) % 3,0), el->getIndex(), i, neig->getIndex(), + opp_v); + } } - } else { - if (elinfo->getBoundary(i) == INTERIOR) { - if (!error_detected) - MSG("error detected!!!\n"); - error_detected++; - MSG("(*boundary)[%d] on domains boundary is NULL on element = %d\n", - i, el->getIndex()); } } + } else { + if (elinfo->getBoundary(i) == INTERIOR) { + if (!error_detected) + MSG("error detected!!!\n"); + error_detected++; + MSG("(*boundary)[%d] on domains boundary is NULL on element = %d\n", + i, el->getIndex()); + } } + } return error_detected; } - int MacroReader::basicDOFCheckFct(ElInfo* elinfo) + void MacroReader::basicDOFCheckFct(ElInfo* elinfo, Mesh *mesh, int iadmin) { FUNCNAME("MacroReader::basicDOFCheckFct()"); - Mesh* mesh = Mesh::traversePtr; Element* el = elinfo->getElement(); - const DOFAdmin& admin = mesh->getDOFAdmin(mesh->iadmin); + const DOFAdmin& admin = mesh->getDOFAdmin(iadmin); const Element *neig; const DegreeOfFreedom *dof; if (0 == mesh->dof_used.size()) - return 0; + return; int ndof = admin.getNumberOfDOFs(VERTEX); if (ndof) { @@ -2140,8 +2137,6 @@ namespace AMDiS { mesh->dof_used[jdof]++; } } - - return 0; } int MacroReader::basicNodeFct(ElInfo* elinfo) diff --git a/AMDiS/src/MacroReader.h b/AMDiS/src/MacroReader.h index f52ea898..e2b58f35 100644 --- a/AMDiS/src/MacroReader.h +++ b/AMDiS/src/MacroReader.h @@ -36,10 +36,6 @@ namespace AMDiS { /** \defgroup Input Input module */ - // =========================================================================== - // ===== class MacroReader =================================================== - // =========================================================================== - /** \ingroup Input * * \brief @@ -49,9 +45,7 @@ namespace AMDiS { class MacroReader { public: - /** \brief - * Creates a Mesh by reading the macro file with the given filename - */ + /// Creates a Mesh by reading the macro file with the given filename. static MacroInfo* readMacro(const char *filename, Mesh* mesh, const char *periodicFile, @@ -59,6 +53,7 @@ namespace AMDiS { protected: static void computeNeighbours(Mesh *mesh); + static void boundaryDOFs(Mesh *mesh); static void umb(int *ele, Mesh *mesh, @@ -93,19 +88,15 @@ namespace AMDiS { static void checkMesh(Mesh *mesh); - static int basicCheckFct(ElInfo* e); + static int basicCheckFct(ElInfo* elInfo); - static int basicDOFCheckFct(ElInfo* e); + static void basicDOFCheckFct(ElInfo* elInfo, Mesh *mesh, int iadmin); - static int basicNodeFct(ElInfo* e); + static int basicNodeFct(ElInfo* elInfo); friend class MacroInfo; }; - // ========================================================================== - // ===== class MacroInfo ==================================================== - // ========================================================================== - /** \ingroup Input * \brief * Used for reading a macro triangulation @@ -115,45 +106,29 @@ namespace AMDiS { public: MEMORY_MANAGED(MacroInfo); - /** \brief - * Pointer to the Mesh - */ + /// Pointer to the Mesh Mesh *mesh; - /** \brief - * list of macro elements - */ + /// list of macro elements std::deque<MacroElement*> mel; - /** \brief - * vector of all vertex dofs - */ + /// vector of all vertex dofs DegreeOfFreedom **dof; - /** \brief - * coords[j][k]: kth coordinate of global vertex j - */ + /// coords[j][k]: kth coordinate of global vertex j WorldVector<double> *coords; - /** \brief - * mel_vertex[i][k]: global index of kth vertex of element i - */ + /// mel_vertex[i][k]: global index of kth vertex of element i int **mel_vertex; - /** \brief - * true, if neighbour information is in macro file - */ + /// true, if neighbour information is in macro file bool neigh_set; - /** \brief - * true, if boundary information is in macro file - */ + /// true, if boundary information is in macro file bool bound_set; public: - /** \brief - * Fills MacroInfo structure and some pointers in mesh - */ + /// Fills MacroInfo structure and some pointers in mesh void fill(Mesh *mesh, int ne, int nv); /** \brief @@ -163,9 +138,7 @@ namespace AMDiS { */ void readAMDiSMacro(const char *filename, Mesh* mesh); - /** \brief - * Frees memory of MacroInfo - */ + /// Frees memory of MacroInfo void clear(int ne, int nv); /** \brief @@ -177,9 +150,7 @@ namespace AMDiS { void fillBoundaryInfo(Mesh *mesh); protected: - /** \brief - * Reads indices from macro file - */ + /// Reads indices from macro file int read_indices(FILE *file, DimVec<int> &id); }; } diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index a0ad13f8..47d38e13 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -63,7 +63,6 @@ namespace AMDiS { DOFAdmin* Mesh::compressAdmin = NULL; Mesh* Mesh::traversePtr = NULL; - int Mesh::iadmin = 0; std::vector<DegreeOfFreedom> Mesh::dof_used; const int Mesh::MAX_DOF = 100; std::map<DegreeOfFreedom, DegreeOfFreedom*> Mesh::serializedDOFs; @@ -285,8 +284,7 @@ namespace AMDiS { for (int i = 0; i < 3; i++) dofsOwner[el->getDOF(i)].insert(*macroIt); } - - + // Remove all the given macro elements. for (std::vector<MacroElement*>::iterator macroIt = macros.begin(); macroIt != macros.end(); @@ -330,8 +328,9 @@ namespace AMDiS { dofsIt != dofsOwner.end(); ++dofsIt) { std::set<MacroElement*>::iterator mIt = dofsIt->second.find(*macroIt); - if (mIt != dofsIt->second.end()) + if (mIt != dofsIt->second.end()) { dofsIt->second.erase(mIt); + } } // And remove the macro element from memory @@ -345,7 +344,7 @@ namespace AMDiS { dofsIt != dofsOwner.end(); ++dofsIt) { if (dofsIt->second.size() == 0) { - dofsOwner.erase(dofsIt++); + freeDOF(const_cast<DegreeOfFreedom*>(dofsIt->first), VERTEX); } else { nRemainDofs++; } @@ -354,27 +353,6 @@ namespace AMDiS { nVertices = nRemainDofs; } - void Mesh::createContinuousDofOrdering(FiniteElemSpace *feSpace, unsigned int addC) - { - FUNCNAME("Mesh::createContinuousDofOrdering()"); - - const BasisFunction* basisFcts = feSpace->getBasisFcts(); - - TEST_EXIT(dim == 2)("Not yet implemented!\n"); - TEST_EXIT(basisFcts->getNumber() == 3)("Not yet implemented!\n"); - - std::set<DegreeOfFreedom*> dofs; - - TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(this, -1, Mesh::CALL_LEAF_EL); - while (elInfo) { - for (int i = 0; i < 3; i++) { - dofs.insert(const_cast<DegreeOfFreedom*>(elInfo->getElement()->getDOF(i))); - } - elInfo = stack.traverseNext(elInfo); - } - } - int Mesh::traverse(int level, Flag flag, int (*el_fct)(ElInfo*)) { FUNCNAME("Mesh::traverse()"); @@ -467,23 +445,18 @@ namespace AMDiS { } } - - /****************************************************************************/ - /* dofCompress: remove holes in dof vectors */ - /****************************************************************************/ - void Mesh::dofCompress() { FUNCNAME("Mesh::dofCompress()"); - int size; Flag fill_flag; - for (iadmin = 0; iadmin < static_cast<int>(admin.size()); iadmin++) { + for (int iadmin = 0; iadmin < static_cast<int>(admin.size()); iadmin++) { compressAdmin = admin[iadmin]; TEST_EXIT_DBG(compressAdmin)("no admin[%d] in mesh\n", iadmin); - if ((size = compressAdmin->getSize()) < 1) + int size = compressAdmin->getSize(); + if (size < 1) continue; if (compressAdmin->getUsedDOFs() < 1) @@ -502,8 +475,8 @@ namespace AMDiS { fill_flag = Mesh::CALL_LEAF_EL | Mesh::FILL_NOTHING; } - traverse( -1, fill_flag, newDOFFct1); - traverse( -1, fill_flag, newDOFFct2); + traverse(-1, fill_flag, newDOFFct1); + traverse(-1, fill_flag, newDOFFct2); newDOF.resize(0); } diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h index 4854b733..abfcd50f 100644 --- a/AMDiS/src/Mesh.h +++ b/AMDiS/src/Mesh.h @@ -406,13 +406,6 @@ namespace AMDiS { */ void removeMacroElements(std::vector<MacroElement*>& macros); - /* \brief - * Creates new numbers for all dofs such that the set of dof numbers is a - * continuous interval of natural numbers starting with 0. The constatnt addC - * may be added to the numbers. - */ - void createContinuousDofOrdering(FiniteElemSpace *feSpace, unsigned int addC = 0); - /// Frees the array of DOF pointers (see \ref createDOFPtrs) void freeDOFPtrs(DegreeOfFreedom **ptrs); @@ -705,9 +698,6 @@ namespace AMDiS { */ static Mesh* traversePtr; - /// Used by compress- and check functions. Number of the current DOFAdmin - static int iadmin; - /// Used by check functions static std::vector<DegreeOfFreedom> dof_used; diff --git a/AMDiS/src/ParallelDomainProblem.cc b/AMDiS/src/ParallelDomainProblem.cc index 0aa12250..473bc60f 100644 --- a/AMDiS/src/ParallelDomainProblem.cc +++ b/AMDiS/src/ParallelDomainProblem.cc @@ -45,7 +45,6 @@ namespace AMDiS { // and now partition the mesh partitionMesh(adaptInfo); - std::vector<int> rankDofs; std::map<int, std::set<int> > partitionDofs; TraverseStack stack; @@ -69,7 +68,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - + std::vector<int> rankDofs; for (std::map<int, std::set<int> >::iterator it = partitionDofs.begin(); it != partitionDofs.end(); ++it) { @@ -97,6 +96,13 @@ namespace AMDiS { } } + if (mpiRank == 1) { + std::cout << "RANKS dofs = "; + for (int i = 0; i < rankDofs.size(); i++) + std::cout << rankDofs[i] << " "; + std::cout << std::endl; + } + // === Remove all macro elements that are not part of the rank partition. === std::vector<MacroElement*> macrosToRemove; @@ -131,10 +137,8 @@ namespace AMDiS { lOrder[i] = rstart + i; } - mesh->createContinuousDofOrdering(feSpace, rstart); - AOCreateBasic(PETSC_COMM_WORLD, nRankDOFs, gOrder, lOrder, &applicationOrdering); - + free(gOrder); free(lOrder); } diff --git a/AMDiS/src/ProblemNonLin.cc b/AMDiS/src/ProblemNonLin.cc index e24fca17..2c0e672a 100644 --- a/AMDiS/src/ProblemNonLin.cc +++ b/AMDiS/src/ProblemNonLin.cc @@ -9,7 +9,8 @@ namespace AMDiS { void ProblemNonLinScal::initialize(Flag initFlag, ProblemScal *adoptProblem /*= NULL*/, - Flag adoptFlag /*= INIT_NOTHING*/) { + Flag adoptFlag /*= INIT_NOTHING*/) + { ProblemScal::initialize(initFlag, adoptProblem, adoptFlag); @@ -52,7 +53,8 @@ namespace AMDiS { WARNING("no nonlinear solver created\n"); } - void ProblemNonLinScal::createNonLinSolver() { + void ProblemNonLinScal::createNonLinSolver() + { // create non-linear solver std::string nonLinSolverType("no"); @@ -65,19 +67,21 @@ namespace AMDiS { nonLinSolverCreator->setName(name + "->nonlin solver"); nonLinSolverCreator->setNonLinUpdater(updater_); nonLinSolver_ = nonLinSolverCreator->create(); - nonLinSolver_->setVectorCreator(NEW DOFVector<double>::Creator(feSpace_)); + nonLinSolver_->setVectorCreator(NEW DOFVector<double>::Creator(feSpace)); } - void ProblemNonLinScal::solve(AdaptInfo *adaptInfo) { + void ProblemNonLinScal::solve(AdaptInfo *adaptInfo) + { TEST_EXIT(nonLinSolver_)("no non-linear solver!\n"); int iter = nonLinSolver_->solve(matVec, solution, rhs, leftPrecon, rightPrecon); adaptInfo->setSolverIterations(iter); } - void ProblemNonLinScal::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) { - feSpace_->getMesh()->dofCompress(); - MSG("%d DOFs for %s\n", feSpace_->getAdmin()->getUsedSize(), feSpace_->getName().c_str()); + void ProblemNonLinScal::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) + { + feSpace->getMesh()->dofCompress(); + MSG("%d DOFs for %s\n", feSpace->getAdmin()->getUsedSize(), feSpace->getName().c_str()); TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(mesh, -1, @@ -97,7 +101,8 @@ namespace AMDiS { void ProblemNonLinVec::initialize(Flag initFlag, ProblemVec *adoptProblem /*= NULL*/, - Flag adoptFlag /*= INIT_NOTHING*/) { + Flag adoptFlag /*= INIT_NOTHING*/) + { ProblemVec::initialize(initFlag, adoptProblem, adoptFlag); // === create Updater === @@ -138,7 +143,8 @@ namespace AMDiS { WARNING("no nonlinear solver created\n"); } - void ProblemNonLinVec::createNonLinSolver() { + void ProblemNonLinVec::createNonLinSolver() + { // create non-linear solver std::string nonLinSolverType("no"); @@ -157,7 +163,8 @@ namespace AMDiS { } - void ProblemNonLinVec::solve(AdaptInfo *adaptInfo) { + void ProblemNonLinVec::solve(AdaptInfo *adaptInfo) + { TEST_EXIT(nonLinSolver_)("no non-linear solver!\n"); nonLinSolver_->solve(matVec, solution, rhs, leftPrecon, rightPrecon); } diff --git a/AMDiS/src/ProblemScal.cc b/AMDiS/src/ProblemScal.cc index ba622f8d..760ccf38 100644 --- a/AMDiS/src/ProblemScal.cc +++ b/AMDiS/src/ProblemScal.cc @@ -86,7 +86,7 @@ namespace AMDiS { void ProblemScal::addDirichletBC(BoundaryType type, AbstractFunction<double, WorldVector<double> >* b) { - DirichletBC *dirichlet = new DirichletBC(type, b, feSpace_); + DirichletBC *dirichlet = new DirichletBC(type, b, feSpace); if (systemMatrix) systemMatrix->getBoundaryManager()->addBoundaryCondition(dirichlet); if (rhs) @@ -111,7 +111,7 @@ namespace AMDiS { AbstractFunction<double, WorldVector<double> > *n, AbstractFunction<double, WorldVector<double> > *r) { - RobinBC *robin = new RobinBC(type, n, r, feSpace_); + RobinBC *robin = new RobinBC(type, n, r, feSpace); if (rhs) rhs->getBoundaryManager()->addBoundaryCondition(robin); if (systemMatrix) @@ -121,7 +121,7 @@ namespace AMDiS { void ProblemScal::addNeumannBC(BoundaryType type, AbstractFunction<double, WorldVector<double> > *n) { - NeumannBC *neumann = new NeumannBC(type, n, feSpace_); + NeumannBC *neumann = new NeumannBC(type, n, feSpace); if (rhs) rhs->getBoundaryManager()->addBoundaryCondition(neumann); } @@ -130,7 +130,7 @@ namespace AMDiS { DOFVector<double> *n, DOFVector<double> *r) { - RobinBC *robin = new RobinBC(type, n, r, feSpace_); + RobinBC *robin = new RobinBC(type, n, r, feSpace); if (rhs) rhs->getBoundaryManager()->addBoundaryCondition(robin); if (systemMatrix) @@ -139,7 +139,7 @@ namespace AMDiS { void ProblemScal::addPeriodicBC(BoundaryType type) { - PeriodicBC *periodic = new PeriodicBC(type, feSpace_); + PeriodicBC *periodic = new PeriodicBC(type, feSpace); if (systemMatrix) systemMatrix->getBoundaryManager()->addBoundaryCondition(periodic); @@ -148,10 +148,9 @@ namespace AMDiS { } #ifdef HAVE_PARALLEL_AMDIS - void ProblemScal::useApplicationOrdering(AO *ao, int nDofs) + void ProblemScal::useApplicationOrdering(AO *ao) { applicationOrdering = ao; - nRankDOFs = nDofs; systemMatrix->useApplicationOrdering(ao); rhs->useApplicationOrdering(ao); } @@ -165,7 +164,7 @@ namespace AMDiS { // === create problems mesh === std::string meshName(""); - GET_PARAMETER(0, name + "->info", "%d", &info_); + GET_PARAMETER(0, name + "->info", "%d", &info); GET_PARAMETER(0, name + "->mesh", &meshName); TEST_EXIT(meshName != "")("no mesh name specified\n"); @@ -248,11 +247,11 @@ namespace AMDiS { int iter = solver->solve(matVec, solution, rhs, leftPrecon, rightPrecon); #ifdef _OPENMP - INFO(info_, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n", + INFO(info, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n", TIME_USED(first, clock()), omp_get_wtime() - wtime); #else - INFO(info_, 8)("solution of discrete system needed %.5f seconds\n", + INFO(info, 8)("solution of discrete system needed %.5f seconds\n", TIME_USED(first, clock())); #endif @@ -293,7 +292,7 @@ namespace AMDiS { WARNING("no mesh created\n"); // === create fespace === - if (feSpace_) { + if (feSpace) { WARNING("feSpace already created\n"); } else { if (initFlag.isSet(INIT_FE_SPACE) || @@ -302,12 +301,12 @@ namespace AMDiS { } if (adoptProblem && (adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM))) { - TEST_EXIT(!feSpace_)("feSpace already created"); - feSpace_ = dynamic_cast<ProblemScal*>(adoptProblem)->getFESpace(); + TEST_EXIT(!feSpace)("feSpace already created"); + feSpace = dynamic_cast<ProblemScal*>(adoptProblem)->getFESpace(); } } - if (!feSpace_) + if (!feSpace) WARNING("no feSpace created\n"); // === create system === @@ -436,7 +435,7 @@ namespace AMDiS { // create finite element space int degree = 1; GET_PARAMETER(0, name + "->polynomial degree" ,"%d", °ree); - feSpace_ = FiniteElemSpace::provideFESpace(NULL, + feSpace = FiniteElemSpace::provideFESpace(NULL, Lagrange::getLagrange(mesh->getDim(), degree), mesh, name + "->feSpace"); @@ -452,9 +451,9 @@ namespace AMDiS { void ProblemScal::createMatricesAndVectors() { // === create vectors and system matrix === - systemMatrix = NEW DOFMatrix(feSpace_, feSpace_, "system matrix"); - rhs = NEW DOFVector<double>(feSpace_, "rhs"); - solution = NEW DOFVector<double>(feSpace_, "solution"); + systemMatrix = NEW DOFMatrix(feSpace, feSpace, "system matrix"); + rhs = NEW DOFVector<double>(feSpace, "rhs"); + solution = NEW DOFVector<double>(feSpace, "solution"); solution->setCoarsenOperation(COARSE_INTERPOL); solution->set(0.0); /* initialize u_h ! */ @@ -510,7 +509,7 @@ namespace AMDiS { } // === create vector creator === - solver->setVectorCreator(new DOFVector<double>::Creator(feSpace_)); + solver->setVectorCreator(new DOFVector<double>::Creator(feSpace)); } @@ -560,7 +559,7 @@ namespace AMDiS { if (estimator) { clock_t first = clock(); estimator->estimate(adaptInfo->getTimestep()); - INFO(info_,8)("estimation of the error needed %.5f seconds\n", + INFO(info,8)("estimation of the error needed %.5f seconds\n", TIME_USED(first,clock())); adaptInfo->setEstSum(estimator->getErrorSum(), 0); @@ -586,15 +585,12 @@ namespace AMDiS { clock_t first = clock(); +#ifndef HAVE_PARALLEL_AMDIS mesh->dofCompress(); +#endif MSG("%d DOFs for %s\n", -#ifdef HAVE_PARALLEL_AMDIS - nRankDOFs, -#else - feSpace_->getAdmin()->getUsedSize(), -#endif - feSpace_->getName().c_str()); + feSpace->getAdmin()->getUsedDOFs(), feSpace->getName().c_str()); Flag assembleFlag = flag | @@ -621,8 +617,8 @@ namespace AMDiS { while (elInfo) { if (useGetBound) { - bound = GET_MEMORY(BoundaryType, feSpace_->getBasisFcts()->getNumber()); - feSpace_->getBasisFcts()->getBound(elInfo, bound); + bound = GET_MEMORY(BoundaryType, feSpace->getBasisFcts()->getNumber()); + feSpace->getBasisFcts()->getBound(elInfo, bound); } else { bound = NULL; } @@ -631,7 +627,7 @@ namespace AMDiS { rhs->assemble(1.0, elInfo, bound); if (useGetBound) { - FREE_MEMORY(bound, BoundaryType, feSpace_->getBasisFcts()->getNumber()); + FREE_MEMORY(bound, BoundaryType, feSpace->getBasisFcts()->getNumber()); } if (systemMatrix->getBoundaryManager()) @@ -652,8 +648,15 @@ namespace AMDiS { if (solution->getBoundaryManager()) solution->getBoundaryManager()->exitVector(solution); - INFO(info_, 8)("buildAfterCoarsen needed %.5f seconds\n", - TIME_USED(first,clock())); + INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", TIME_USED(first,clock())); + +#ifdef HAVE_PARALLEL_AMDIS +// PetscErrorCode ierr; +// Mat A; + +// ierr = MatCreate(PETSC_COMM_WORLD, &A); CHKERRQ(ierr); +#endif + } void ProblemScal::writeResidualMesh(AdaptInfo *adaptInfo, const std::string name) diff --git a/AMDiS/src/ProblemScal.h b/AMDiS/src/ProblemScal.h index f574fdbf..3b6cd776 100644 --- a/AMDiS/src/ProblemScal.h +++ b/AMDiS/src/ProblemScal.h @@ -64,7 +64,7 @@ namespace AMDiS { ProblemIterationInterface *problemIteration = NULL) : StandardProblemIteration(this), name(nameStr), - feSpace_(NULL), + feSpace(NULL), mesh(NULL), marker(NULL), estimator(NULL), @@ -80,9 +80,8 @@ namespace AMDiS { coarseningManager(NULL), #ifdef HAVE_PARALLEL_AMDIS applicationOrdering(NULL), - nRankDOFs(0), #endif - info_(10) + info(10) {} /// Destructor @@ -224,7 +223,7 @@ namespace AMDiS { #ifdef HAVE_PARALLEL_AMDIS /// Sets the petsc application ordering object to map dof indices. - void useApplicationOrdering(AO *ao, int nDofs); + void useApplicationOrdering(AO *ao); #endif // ===== getting-methods ====================================================== @@ -253,9 +252,9 @@ namespace AMDiS { return mesh; } - /// Returns \ref feSpace_. + /// Returns \ref feSpace. inline FiniteElemSpace* getFESpace() { - return feSpace_; + return feSpace; } /// Returns \ref estimator_. @@ -314,9 +313,9 @@ namespace AMDiS { /// Sets \ref mesh void setMeshFromProblemVec(ProblemVec* pv, int i = 0); - /// Sets \ref feSpace_. + /// Sets \ref feSpace. inline void setFESpace(FiniteElemSpace* fe) { - feSpace_ = fe; + feSpace = fe; } /// Sets \ref estimator_. @@ -363,7 +362,7 @@ namespace AMDiS { std::string name; /// FiniteElemSpace of this problem. - FiniteElemSpace *feSpace_; + FiniteElemSpace *feSpace; /// Mesh of this problem. Mesh *mesh; @@ -418,13 +417,10 @@ namespace AMDiS { #ifdef HAVE_PARALLEL_AMDIS /// Petsc application ordering to map dof indices. AO *applicationOrdering; - - /// Number of DOFs in the rank partition. - int nRankDOFs; #endif /// Info level. - int info_; + int info; }; -- GitLab