diff --git a/AMDiS/libtool b/AMDiS/libtool index db01bc59718f48797b60d36d16c9ae7d8fd0eab2..d7d46fa16043de35ba4e42e0d263f41d76c822b1 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 p2d079: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -66,12 +66,12 @@ fast_install=yes # The host system. host_alias= -host=i686-redhat-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-redhat-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="" @@ -7266,7 +7266,7 @@ disable_libs=static # End: # ### BEGIN LIBTOOL TAG CONFIG: CXX -# Libtool was configured on host NWRW15: +# Libtool was configured on host p2d079: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7288,12 +7288,12 @@ fast_install=yes # The host system. host_alias= -host=i686-redhat-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-redhat-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # An echo program that does not interpret backslashes. @@ -7304,25 +7304,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" @@ -7396,7 +7396,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" @@ -7451,11 +7451,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. @@ -7463,11 +7463,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" @@ -7547,10 +7547,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="" @@ -7574,7 +7574,7 @@ include_expsyms="" # ### BEGIN LIBTOOL TAG CONFIG: F77 -# Libtool was configured on host NWRW15: +# Libtool was configured on host p2d079: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7596,12 +7596,12 @@ fast_install=yes # The host system. host_alias= -host=i686-redhat-linux-gnu +host=x86_64-unknown-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=i686-redhat-linux-gnu +build=x86_64-unknown-linux-gnu build_os=linux-gnu # An echo program that does not interpret backslashes. @@ -7612,7 +7612,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" @@ -7621,16 +7621,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" @@ -7858,10 +7858,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/AMDiS.h b/AMDiS/src/AMDiS.h index 8cc5dd6989d73f0e71b8558ef5349b8714a5e35e..8f8dd829db72d65d559a0821c6cd1a7303cbf9dd 100644 --- a/AMDiS/src/AMDiS.h +++ b/AMDiS/src/AMDiS.h @@ -66,6 +66,7 @@ #include "Operator.h" #include "Parameters.h" #include "Parametric.h" +#include "PartitionElementData.h" #include "PeriodicMap.h" #include "PeriodicBC.h" #include "Preconditioner.h" diff --git a/AMDiS/src/Element.cc b/AMDiS/src/Element.cc index 069e0c7131d82953700ed23f805c51614db31e35..57d5e53ff299e75003f68726254714db7b604fd7 100644 --- a/AMDiS/src/Element.cc +++ b/AMDiS/src/Element.cc @@ -41,6 +41,7 @@ namespace AMDiS { newCoord = NULL; elementData = NULL; mark = 0; + hidden = false; if (mesh) { setDOFPtrs(); @@ -138,6 +139,7 @@ namespace AMDiS { el->mesh = mesh; el->index = index; el->mark = mark; + el->hidden = hidden; if (newCoord) { WorldVector<double> *nc = NEW WorldVector<double>(); *nc = *newCoord; @@ -420,6 +422,9 @@ namespace AMDiS { // write mark out.write(reinterpret_cast<const char*>(&mark), sizeof(signed char)); + // write hidden flag + out.write(reinterpret_cast<const char*>(&hidden), sizeof(hidden)); + // write newCoord if (newCoord) { out << "WorldVector\n"; @@ -498,9 +503,12 @@ namespace AMDiS { // read index in.read(reinterpret_cast<char*>(&index), sizeof(int)); - // write mark + // read mark in.read(reinterpret_cast<char*>(&mark), sizeof(signed char)); + // read hidden + in.read(reinterpret_cast<char*>(&hidden), sizeof(bool)); + // read newCoord in >> typeName; in.get(); diff --git a/AMDiS/src/Element.h b/AMDiS/src/Element.h index 5a050181f7c52ba98d011931fa21b5fc43b393cb..c2bf1d84cf01631f7093a9b35f61bcf1c0828170 100644 --- a/AMDiS/src/Element.h +++ b/AMDiS/src/Element.h @@ -81,26 +81,20 @@ namespace AMDiS { class Element : public Serializable { private: - /** \brief - * private standard constructor because an Element must know his Mesh - */ + /// private standard constructor because an Element must know his Mesh Element() {} + public: - /** \brief - * constructs an Element which belongs to Mesh - */ + /// constructs an Element which belongs to Mesh Element(Mesh *); - /** \brief - * copy constructor - */ + /// copy constructor Element(const Element& old); - /** \brief - * destructor - */ + /// destructor virtual ~Element(); + /// void deleteElementDOFs(); /** \brief @@ -115,23 +109,17 @@ namespace AMDiS { * \{ */ - /** \brief - * Returns \ref child[0] - */ + /// Returns \ref child[0] inline Element* getFirstChild() const { return child[0]; } - /** \brief - * Returns \ref child[1] - */ + /// Returns \ref child[1] inline Element* getSecondChild() const { return child[1]; } - /** \brief - * Returns \ref child[i], i=0,1 - */ + /// Returns \ref child[i], i=0,1 inline Element* getChild(int i) const { TEST_EXIT_DBG(i==0 || i==1)("i must be 0 or 1\n"); return child[i]; @@ -145,30 +133,22 @@ namespace AMDiS { return (child[0] == NULL); } - /** \brief - * Returns \ref dof[i][j] which is the j-th DOF of the i-th node of Element. - */ + /// Returns \ref dof[i][j] which is the j-th DOF of the i-th node of Element. const DegreeOfFreedom getDOF(int i, int j) const { return dof[i][j]; } - /** \brief - * Returns \ref dof[i] which is a pointer to the DOFs of the i-th node. - */ + /// Returns \ref dof[i] which is a pointer to the DOFs of the i-th node. const DegreeOfFreedom* getDOF(int i) const { return dof[i]; } - /** \brief - * Returns a pointer to the DOFs of this Element - */ + /// Returns a pointer to the DOFs of this Element const DegreeOfFreedom** getDOF() const { return const_cast<const DegreeOfFreedom**>(dof); } - /** \brief - * Returns \ref mesh of Element - */ + /// Returns \ref mesh of Element inline Mesh* getMesh() const { return mesh; } @@ -206,14 +186,10 @@ namespace AMDiS { return 0.0; } - /** \brief - * Returns region of element if defined, -1 else. - */ + /// Returns region of element if defined, -1 else. int getRegion() const; - /** \brief - * Returns local vertex number of the j-th vertex of the i-th edge - */ + /// Returns local vertex number of the j-th vertex of the i-th edge virtual int getVertexOfEdge(int i, int j) const = 0; /** \brief @@ -224,24 +200,16 @@ namespace AMDiS { int positionIndex, int vertexIndex) const = 0; - /** \brief - * - */ + /// virtual int getPositionOfVertex(int side, int vertex) const = 0; - /** \brief - * - */ + /// virtual int getEdgeOfFace(int face, int edge) const = 0; - /** \brief - * Returns the number of parts of type i in this element - */ + /// Returns the number of parts of type i in this element virtual int getGeo(GeoIndex i) const = 0; - /** \brief - * Returns Element's \ref mark - */ + /// Returns Element's \ref mark inline const signed char getMark() const { return mark; } @@ -262,6 +230,16 @@ namespace AMDiS { return newCoord; } + /// Returns \ref hidden, i.e., if the element is visible for mesh traverses. + inline bool isHidden() { + return hidden; + } + + /// Sets \ref hidden, i.e., wether the element is hidden for mesh traverses or not. + inline void setHidden(bool b) { + hidden = b; + } + /** \} */ // ===== setting methods ====================================================== @@ -270,23 +248,17 @@ namespace AMDiS { * \{ */ - /** \brief - * Sets \ref child[0] - */ + /// Sets \ref child[0] virtual void setFirstChild(Element *aChild) { child[0] = aChild; } - /** \brief - * Sets \ref child[1] - */ + /// Sets \ref child[1] virtual void setSecondChild(Element *aChild) { child[1] = aChild; } - /** \brief - * Sets \ref elementData of Element - */ + /// Sets \ref elementData of Element void setElementData(ElementData* ed) { elementData = ed; } @@ -299,16 +271,12 @@ namespace AMDiS { newCoord = coord; } - /** \brief - * Sets \ref mesh. - */ + /// Sets \ref mesh. inline void setMesh(Mesh *m) { mesh = m; } - /** \brief - * Sets the pointer to the DOFs of the i-th node of Element - */ + /// Sets the pointer to the DOFs of the i-th node of Element DegreeOfFreedom* setDOF(int pos, DegreeOfFreedom* p) { dof[pos] = p; return dof[pos]; @@ -350,24 +318,18 @@ namespace AMDiS { } } - /** \brief - * Sets Elements \ref mark = mark + 1; - */ + /// Sets Elements \ref mark = mark + 1; inline void incrementMark() { mark++; } - /** \brief - * Sets Elements \ref mark = mark - 1; - */ + /// Sets Elements \ref mark = mark - 1; inline void decrementMark() { if (0 < mark) mark--; } - /** \brief - * Sets Element's \ref mark - */ + /// Sets Element's \ref mark inline void setMark(signed char m) { mark = m; } @@ -409,33 +371,23 @@ namespace AMDiS { */ virtual int getVertexOfParent(int childnr, int vertexnr, int elType = 0) const = 0; - /** \brief - * Returns whether Element is a Line - */ + /// Returns whether Element is a Line virtual bool isLine() const = 0; - /** \brief - * Returns whether Element is a Triangle - */ + /// Returns whether Element is a Triangle virtual bool isTriangle() const = 0; - /** \brief - * Returns whether Element is a Tetrahedron - */ + /// Returns whether Element is a Tetrahedron virtual bool isTetrahedron() const = 0; - /** \brief - * Returns whether Element has sideElem as one of its sides. - */ + /// Returns whether Element has sideElem as one of its sides. virtual bool hasSide(Element *sideElem) const = 0; /** \} */ // ===== other public methods ================================================= - /** \brief - * assignment operator - */ + /// assignment operator Element& operator=(const Element& el); /** \brief @@ -444,9 +396,7 @@ namespace AMDiS { */ int oppVertex(FixVec<DegreeOfFreedom*, DIMEN> pdof) const; - /** \brief - * Refines Element's leaf data - */ + /// Refines Element's leaf data inline void refineElementData(Element* child1, Element* child2, int elType = 0) { if (elementData) { bool remove = elementData->refineElementData(this, child1, child2, elType); @@ -458,9 +408,7 @@ namespace AMDiS { } } - /** \brief - * Coarsens Element's leaf data - */ + /// Coarsens Element's leaf data inline void coarsenElementData(Element* child1, Element* child2, int elType = 0) { ElementData *childData; childData = child1->getElementData(); @@ -477,16 +425,12 @@ namespace AMDiS { } } - /** \brief - * Returns pointer to \ref elementData - */ + /// Returns pointer to \ref elementData inline ElementData* getElementData() const { return elementData; } - /** \brief - * - */ + /// inline ElementData* getElementData(int typeID) const { if (elementData) { return elementData->getElementData(typeID); @@ -494,9 +438,7 @@ namespace AMDiS { return NULL; } - /** \brief - * Deletes the \ref elementData with a specific typeID. - */ + /// Deletes the \ref elementData with a specific typeID. bool deleteElementData(int typeID); /** \brief @@ -508,48 +450,36 @@ namespace AMDiS { bool isRefinedAtSide(int side, Element *el1, Element *el2, unsigned char elementTyp = 255); - /** \brief - * Returns whether Element's \ref newCoord is set - */ + /// Returns whether Element's \ref newCoord is set inline bool isNewCoordSet() const { return (newCoord != NULL); } - /** \brief - * Frees memory for \ref newCoord - */ + /// Frees memory for \ref newCoord void eraseNewCoord(); - - // ===== Serializable implementation ===== - + + /// Serialize the element to a file. void serialize(std::ostream &out); + /// Deserialize an element from a file. void deserialize(std::istream &in); int calcMemoryUsage(); // ===== protected methods ==================================================== protected: - /** \brief - * Sets Element's \ref dof pointer. Used by friend class Mesh. - */ + /// Sets Element's \ref dof pointer. Used by friend class Mesh. void setDOFPtrs(); - /** \brief - * Sets Element's \ref index. Used by friend class Mesh. - */ + /// Sets Element's \ref index. Used by friend class Mesh. inline void setIndex(int i) { index = i; } - /** \brief - * Used by friend class Mesh while dofCompress - */ + /// Used by friend class Mesh while dofCompress void newDOFFct1(const DOFAdmin*); - /** \brief - * Used by friend class Mesh while dofCompress - */ + /// Used by friend class Mesh while dofCompress void newDOFFct2(const DOFAdmin*); protected: @@ -593,16 +523,17 @@ namespace AMDiS { */ WorldVector<double> *newCoord; - /** \brief - * Pointer to the Mesh this element belongs to - */ + /// Pointer to the Mesh this element belongs to Mesh* mesh; - /** \brief - * Pointer to Element's leaf data - */ + /// Pointer to Element's leaf data ElementData* elementData; + /* \brief + * If true, this element (and therefor also all it's children) is hidden for + * all mesh traverses. If the value is set to false, it may be traversed. + */ + bool hidden; /** \brief * This map is used for deletion of all DOFs of all elements of a mesh. Once diff --git a/AMDiS/src/ElementFileWriter.cc b/AMDiS/src/ElementFileWriter.cc index 68b14e76a2b274705eb483a85d4bd4af012f24ab..a0b1a169fd6df1de9f70c1d5e80a107ebe3236a7 100644 --- a/AMDiS/src/ElementFileWriter.cc +++ b/AMDiS/src/ElementFileWriter.cc @@ -296,7 +296,7 @@ namespace AMDiS { fout << "<?xml version=\"1.0\"?>" << std::endl; fout << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << std::endl; fout << " <UnstructuredGrid>" << std::endl; - fout << " <Piece NumberOfPoints=\"" << (dim + 1) * mesh->getNumberOfLeaves() + fout << " <Piece NumberOfPoints=\"" << (dim + 1) * nElements << "\" NumberOfCells=\"" << nElements << "\">" << std::endl; fout << " <Points>" << std::endl; fout << " <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">" << std::endl; @@ -307,8 +307,7 @@ namespace AMDiS { ElInfo *elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_LEAF_EL | - Mesh::FILL_COORDS); + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); while (elInfo) { // Write coordinates of all element vertices. @@ -373,8 +372,7 @@ namespace AMDiS { elInfo = stack.traverseFirst(mesh, -1, - Mesh::CALL_LEAF_EL | - Mesh::FILL_COORDS); + Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); int vc = 0; while (elInfo) { // Get element value. diff --git a/AMDiS/src/MacroElement.h b/AMDiS/src/MacroElement.h index 584ed99680d02ca61f685831cbd1a621da0abf45..fbe77f60ea019c90d3cdfc6a6981cb2fcf42384b 100644 --- a/AMDiS/src/MacroElement.h +++ b/AMDiS/src/MacroElement.h @@ -55,16 +55,13 @@ namespace AMDiS { public: MEMORY_MANAGED(MacroElement); - /** \brief - * Creates a new MacroElement. The mesh is needed only to get the dimension - */ + /// Creates a new MacroElement. The mesh is needed only to get the dimension MacroElement(int dim); - /** \brief - * Destructor. - */ + /// Destructor. virtual ~MacroElement(); + /// MacroElement& operator=(const MacroElement &el); // ===== getting methods ====================================================== @@ -73,65 +70,47 @@ namespace AMDiS { * \{ */ - /** \brief - * Returns \ref index. - */ + /// Returns \ref index. inline int getIndex() const { return index; } - /** \brief - * Returns ref projection[i]. - */ + /// Returns ref projection[i]. inline Projection *getProjection(int i) const { return projection[i]; } - /** \brief - * Returns \ref el - */ + /// Returns \ref el inline Element* getElement() const { return element; } - /** \brief - * Returns the i-th neighbour of this MacroElement \ref neighbour[i] - */ + /// Returns the i-th neighbour of this MacroElement \ref neighbour[i] inline MacroElement* getNeighbour(int i) const { return neighbour[i]; } - /** \brief - * Returns the i-th opp-vertex of this MacroElement \ref oppVertex[i] - */ + /// Returns the i-th opp-vertex of this MacroElement \ref oppVertex[i] inline char getOppVertex(int i) const { return oppVertex[i]; } - /** \brief - * Returns \ref coord[i] - */ + /// Returns \ref coord[i] inline WorldVector<double>& getCoord(int i) { return coord[i]; } - /** \brief - * Returns \ref coord - */ + /// Returns \ref coord inline FixVec<WorldVector<double>, VERTEX>& getCoord() { return coord; } - /** \brief - * Returns \ref boundary[i] - */ + /// Returns \ref boundary[i] inline BoundaryType getBoundary(int i) const { return boundary[i]; } - /** \brief - * Returns \ref elType - */ + /// Returns \ref elType inline unsigned char getElType() const { return elType; } @@ -144,16 +123,12 @@ namespace AMDiS { * \{ */ - /** \brief - * Sets \ref index - */ + /// Sets \ref index inline void setIndex(int n) { index = n ; } - /** \brief - * Sets \ref element if not yet set. - */ + /// Sets \ref element if not yet set. inline void setElement(Element* element_) { if (!element) { element = element_; @@ -163,107 +138,83 @@ namespace AMDiS { } } - /** \brief - * Sets \ref elType - */ + /// Sets \ref elType inline void setElType(unsigned char typ) { elType = typ; } - /** \brief - * Sets \ref projection[i] = p. - */ + /// Sets \ref projection[i] = p. inline void setProjection(int i, Projection *p) { projection[i] = p; } - /** \brief - * Sets the i-th Neighbour to n - */ + /// Sets the i-th Neighbour to n inline void setNeighbour(int i, MacroElement *n) { neighbour[i] = n; } - /** \brief - * Sets the i-th opp vertex to c - */ + /// Sets the i-th opp vertex to c inline void setOppVertex(int i, char c) { oppVertex[i] = c; } - /** \brief - * Sets \ref boundary[i] to b - */ + /// Sets \ref boundary[i] to b inline void setBoundary(int i, BoundaryType b) { boundary[i] = b; } + /// inline void setCoord(int i, const WorldVector<double> c) { coord[i] = c; } /** \} */ - // ===== Serializable implementation ===== + /// Writes the macro element to a file. void serialize(std::ostream &out); + /// Reads a macro element from a file. void deserialize(std::istream &in); + /// inline void writeNeighboursTo(std::vector<int> *indices) { deserializedNeighbourIndices_ = indices; } + /// int calcMemoryUsage(); protected: - /** \brief - * Element of this MacroElement. - */ + /// Element of this MacroElement. Element *element; - /** \brief - * Coordinates of the vertices. - */ + /// Coordinates of the vertices. FixVec<WorldVector<double>, VERTEX> coord; - /** \brief - * Boundary type of each boundary part (face/edge/vertex) - */ + /// Boundary type of each boundary part (face/edge/vertex) FixVec<BoundaryType, BOUNDARY> boundary; - /** \brief - * Boundary projection to curved boundaries or element projections. - */ + /// Boundary projection to curved boundaries or element projections. FixVec<Projection*, PROJECTION> projection; - /** \brief - * Pointers to all neighbours of this MacroElement - */ + /// Pointers to all neighbours of this MacroElement FixVec<MacroElement*, NEIGH> neighbour; - /** \brief - * opp vertices of this MacroElement - */ + /// opp vertices of this MacroElement FixVec<char, NEIGH> oppVertex; - /** \brief - * index of this MacroElement - */ + /// index of this MacroElement int index; - /** \brief - * Element type of the MacroElement - */ + /// Element type of the MacroElement unsigned char elType; - /** \brief - * - */ + /// std::vector<int> *deserializedNeighbourIndices_; - // friend classes + friend class MacroInfo; friend class MacroReader; friend class ElInfo1d; diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 5f7031808a39eaddf51f48176dce9768ad4a6fdc..44f81033db6a367fa40615fc6a5752b0a52ae8a8 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -250,13 +250,24 @@ namespace AMDiS { return *this; } + void Mesh::updateNumberOfLeaves() + { + nLeaves = 0; + + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(this, -1, Mesh::CALL_LEAF_EL); + while (elInfo) { + nLeaves++; + elInfo = stack.traverseNext(elInfo); + } + } + void Mesh::addMacroElement(MacroElement* m) { macroElements.push_back(m); m->setIndex(macroElements.size()); } - int Mesh::traverse(int level, Flag flag, - int (*el_fct)(ElInfo*)) + int Mesh::traverse(int level, Flag flag, int (*el_fct)(ElInfo*)) { FUNCNAME("Mesh::traverse()"); diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h index 1141f24b74b4b99c273c46e0bb89c602dbafce71..d107be226e2014ac1785367cd4a224c46011a286 100644 --- a/AMDiS/src/Mesh.h +++ b/AMDiS/src/Mesh.h @@ -369,7 +369,6 @@ namespace AMDiS { } /** \} */ - // ========================================================================== /// Creates a new Element by cloning \ref elementPrototype Element* createNewElement(Element *parent = NULL); @@ -404,6 +403,9 @@ namespace AMDiS { const Flag fillFlag, int (*elFct)(ElInfo*)); + /// Recalculates the number of leave elements. + void updateNumberOfLeaves(); + /// Clears \ref macroElements inline void clearMacroElements() { macroElements.clear(); diff --git a/AMDiS/src/ParMetisPartitioner.cc b/AMDiS/src/ParMetisPartitioner.cc index fab2df9916fe6f0cdd63a774af1ac0c6b85af5b9..93ea6ab4bf5a7ece3148392bfa5d18851cd25fab 100644 --- a/AMDiS/src/ParMetisPartitioner.cc +++ b/AMDiS/src/ParMetisPartitioner.cc @@ -141,10 +141,10 @@ namespace AMDiS { FREE_MEMORY(elem_p2a, int, nElements); } - ParMetisGraph::ParMetisGraph(ParMetisMesh *parMetisMesh, + ParMetisGraph::ParMetisGraph(ParMetisMesh *parMesh, MPI::Comm *comm, int ncommonnodes) - : parMetisMesh_(parMetisMesh) + : parMetisMesh(parMesh) { int numflag = 0; @@ -153,9 +153,9 @@ namespace AMDiS { MPI_Comm tmpComm = MPI_Comm(*comm); - ParMETIS_V3_Mesh2Dual(parMetisMesh_->getElementDist(), - parMetisMesh_->getElementPtr(), - parMetisMesh_->getElementInd(), + ParMETIS_V3_Mesh2Dual(parMetisMesh->getElementDist(), + parMetisMesh->getElementPtr(), + parMetisMesh->getElementInd(), &numflag, &ncommonnodes, &xadj, @@ -223,15 +223,15 @@ namespace AMDiS { ElInfo *elInfo; // === create parmetis mesh === - if (parMetisMesh_) - DELETE parMetisMesh_; - parMetisMesh_ = NEW ParMetisMesh(mesh_, mpiComm); + if (parMetisMesh) + DELETE parMetisMesh; + parMetisMesh = NEW ParMetisMesh(mesh_, mpiComm); - int numElements = parMetisMesh_->getNumElements(); + int nElements = parMetisMesh->getNumElements(); // === create weight array === - int *wgts = elemWeights ? GET_MEMORY(int, numElements) : NULL; - float *floatWgts = elemWeights ? GET_MEMORY(float, numElements) : NULL; + int *wgts = elemWeights ? GET_MEMORY(int, nElements) : NULL; + float *floatWgts = elemWeights ? GET_MEMORY(float, nElements) : NULL; float maxWgt = 0.0; float *ptr_floatWgts = floatWgts; @@ -264,7 +264,7 @@ namespace AMDiS { maxWgt = tmp; // === create dual graph === - ParMetisGraph parMetisGraph(parMetisMesh_, mpiComm); + ParMetisGraph parMetisGraph(parMetisMesh, mpiComm); // === partitioning of dual graph === int wgtflag = elemWeights ? 2 : 0; // weights at vertices only! @@ -275,7 +275,7 @@ namespace AMDiS { float ubvec = 1.05; int options[3] = {0, 0, 0}; // default options int edgecut = -1; - int *part = GET_MEMORY(int, numElements); + int *part = GET_MEMORY(int, nElements); if (elemWeights) { for (int i = 0; i < mpiSize; i++) { @@ -284,7 +284,7 @@ namespace AMDiS { } float scale = 10000 / maxWgt; - for (int i = 0; i < numElements; i++) { + for (int i = 0; i < nElements; i++) { // scale wgts wgts[i] = static_cast<int>(floatWgts[i] * scale); } @@ -294,7 +294,7 @@ namespace AMDiS { switch(mode) { case INITIAL: - ParMETIS_V3_PartKway(parMetisMesh_->getElementDist(), + ParMETIS_V3_PartKway(parMetisMesh->getElementDist(), parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), wgts, @@ -312,11 +312,11 @@ namespace AMDiS { break; case ADAPTIVE_REPART: { - int *vsize = GET_MEMORY(int, numElements); - for (int i = 0; i < numElements; i++) { + int *vsize = GET_MEMORY(int, nElements); + for (int i = 0; i < nElements; i++) { vsize[i] = 1; } - ParMETIS_V3_AdaptiveRepart(parMetisMesh_->getElementDist(), + ParMETIS_V3_AdaptiveRepart(parMetisMesh->getElementDist(), parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), wgts, @@ -333,11 +333,11 @@ namespace AMDiS { &edgecut, part, &tmpComm); - FREE_MEMORY(vsize, int, numElements); + FREE_MEMORY(vsize, int, nElements); } break; case REFINE_PART: - ParMETIS_V3_RefineKway(parMetisMesh_->getElementDist(), + ParMETIS_V3_RefineKway(parMetisMesh->getElementDist(), parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), wgts, @@ -361,12 +361,12 @@ namespace AMDiS { distributePartitioning(part); if (floatWgts) - FREE_MEMORY(floatWgts, float, numElements); + FREE_MEMORY(floatWgts, float, nElements); if (wgts) - FREE_MEMORY(wgts, int, numElements); + FREE_MEMORY(wgts, int, nElements); if (tpwgts) FREE_MEMORY(tpwgts, float, mpiSize); - FREE_MEMORY(part, int, numElements); + FREE_MEMORY(part, int, nElements); } void ParMetisPartitioner::fillCoarsePartitionVec(std::map<int, int> *partitionVec) @@ -376,68 +376,67 @@ namespace AMDiS { partitionVec->clear(); // update ParMETIS mesh to new partitioning - if (!parMetisMesh_) - parMetisMesh_ = NEW ParMetisMesh(mesh_, mpiComm); + if (!parMetisMesh) + parMetisMesh = NEW ParMetisMesh(mesh_, mpiComm); int mpiRank = mpiComm->Get_rank(); int mpiSize = mpiComm->Get_size(); - int *numPartitionElements = GET_MEMORY(int, mpiSize); - int *elmdist = parMetisMesh_->getElementDist(); + int *nPartitionElements = GET_MEMORY(int, mpiSize); + int *elmdist = parMetisMesh->getElementDist(); for (int i = 0; i < mpiSize; i++) { - numPartitionElements[i] = elmdist[i + 1] - elmdist[i]; + nPartitionElements[i] = elmdist[i + 1] - elmdist[i]; } // === count number of elements === - int numElements = 0; - int localElements = parMetisMesh_->getNumElements(); - mpiComm->Allreduce(&localElements, &numElements, 1, MPI_INT, MPI_SUM); + int nElements = 0; + int localElements = parMetisMesh->getNumElements(); + mpiComm->Allreduce(&localElements, &nElements, 1, MPI_INT, MPI_SUM); - int *partitionElements = GET_MEMORY(int, numElements); + int *partitionElements = GET_MEMORY(int, nElements); // distribute partition elements - mpiComm->Allgatherv(parMetisMesh_->getAMDiSIndices(), - numPartitionElements[mpiRank], + mpiComm->Allgatherv(parMetisMesh->getAMDiSIndices(), + nPartitionElements[mpiRank], MPI_INT, partitionElements, - numPartitionElements, + nPartitionElements, elmdist, MPI_INT); // fill partitionVec for (int i = 0; i < mpiSize; i++) { - for (int j = 0; j < numPartitionElements[i]; j++) { + for (int j = 0; j < nPartitionElements[i]; j++) { (*partitionVec)[partitionElements[elmdist[i] + j]] = i; } } - FREE_MEMORY(partitionElements, int, numElements); - FREE_MEMORY(numPartitionElements, int, mpiSize); + FREE_MEMORY(partitionElements, int, nElements); + FREE_MEMORY(nPartitionElements, int, mpiSize); } void ParMetisPartitioner::distributePartitioning(int *part) { int mpiSize = mpiComm->Get_size(); int mpiRank = mpiComm->Get_rank(); - int numElements = parMetisMesh_->getNumElements(); + int nElements = parMetisMesh->getNumElements(); - // count elements per partition in this rank - int *numPartitionElements = GET_MEMORY(int, mpiSize); + // nPartitionElements[i] is the number of elements for the i-th partition + int *nPartitionElements = GET_MEMORY(int, mpiSize); for (int i = 0; i < mpiSize; i++) - numPartitionElements[i] = 0; - for (int i = 0; i < numElements; i++) { - numPartitionElements[part[i]]++; + nPartitionElements[i] = 0; + for (int i = 0; i < nElements; i++) { + nPartitionElements[part[i]]++; } // collect number of partition elements from all ranks for this rank - int *numRankElements = GET_MEMORY(int, mpiSize); - mpiComm->Alltoall(numPartitionElements, 1, MPI_INT, - numRankElements, 1, MPI_INT); + int *nRankElements = GET_MEMORY(int, mpiSize); + mpiComm->Alltoall(nPartitionElements, 1, MPI_INT, + nRankElements, 1, MPI_INT); // sum up partition elements over all ranks int *sumPartitionElements = GET_MEMORY(int, mpiSize); - - mpiComm->Allreduce(numPartitionElements, sumPartitionElements, mpiSize, + mpiComm->Allreduce(nPartitionElements, sumPartitionElements, mpiSize, MPI_INT, MPI_SUM); @@ -445,19 +444,19 @@ namespace AMDiS { int *bufferOffset = GET_MEMORY(int, mpiSize); bufferOffset[0] = 0; for (int i = 1; i < mpiSize; i++) { - bufferOffset[i] = bufferOffset[i - 1] + numPartitionElements[i - 1]; + bufferOffset[i] = bufferOffset[i - 1] + nPartitionElements[i - 1]; } - int *partitionElements = GET_MEMORY(int, numElements); + int *partitionElements = GET_MEMORY(int, nElements); int **partitionPtr = GET_MEMORY(int*, mpiSize); for (int i = 0; i < mpiSize; i++) { partitionPtr[i] = partitionElements + bufferOffset[i]; } - for (int i = 0; i < numElements; i++) { + for (int i = 0; i < nElements; i++) { int partition = part[i]; - int amdisIndex = parMetisMesh_->getAMDiSIndex(i); + int amdisIndex = parMetisMesh->getAMDiSIndex(i); *(partitionPtr[partition]) = amdisIndex; ++(partitionPtr[partition]); } @@ -467,26 +466,25 @@ namespace AMDiS { int *recvBufferOffset = GET_MEMORY(int, mpiSize); recvBufferOffset[0] = 0; for (int i = 1; i < mpiSize; i++) { - recvBufferOffset[i] = recvBufferOffset[i - 1] + numRankElements[i - 1]; + recvBufferOffset[i] = recvBufferOffset[i - 1] + nRankElements[i - 1]; } mpiComm->Alltoallv(partitionElements, - numPartitionElements, + nPartitionElements, bufferOffset, MPI_INT, rankElements, - numRankElements, + nRankElements, recvBufferOffset, MPI_INT); - // === partition AMDiS mesh === - - // write data in stl map + // Create map which stores for each element index on ther partitioning level + // if the element is in the partition of this rank. std::map<int, bool> elementInPartition; for (int i = 0; i < mpiSize; i++) { int *rankStart = rankElements + recvBufferOffset[i]; - int *rankEnd = rankStart + numRankElements[i]; + int *rankEnd = rankStart + nRankElements[i]; for (int *rankPtr = rankStart; rankPtr < rankEnd; ++rankPtr) { elementInPartition[*rankPtr] = true; } @@ -514,14 +512,14 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - DELETE parMetisMesh_; - parMetisMesh_ = NULL; + DELETE parMetisMesh; + parMetisMesh = NULL; FREE_MEMORY(rankElements, int, sumPartitionElements[mpiRank]); - FREE_MEMORY(numPartitionElements, int, mpiSize); - FREE_MEMORY(numRankElements, int, mpiSize); + FREE_MEMORY(nPartitionElements, int, mpiSize); + FREE_MEMORY(nRankElements, int, mpiSize); FREE_MEMORY(sumPartitionElements, int, mpiSize); - FREE_MEMORY(partitionElements, int, numElements); + FREE_MEMORY(partitionElements, int, nElements); FREE_MEMORY(partitionPtr, int*, mpiSize); FREE_MEMORY(bufferOffset, int, mpiSize); FREE_MEMORY(recvBufferOffset, int, mpiSize); diff --git a/AMDiS/src/ParMetisPartitioner.h b/AMDiS/src/ParMetisPartitioner.h index 58758b08ceda52252dccbd605769d1cd0471c974..d0c985808e07c80ade0c28cdda15b532dae020ab 100644 --- a/AMDiS/src/ParMetisPartitioner.h +++ b/AMDiS/src/ParMetisPartitioner.h @@ -146,7 +146,7 @@ namespace AMDiS { } protected: - ParMetisMesh *parMetisMesh_; + ParMetisMesh *parMetisMesh; int *xadj; @@ -160,13 +160,17 @@ namespace AMDiS { ParMetisPartitioner(Mesh *mesh, MPI::Comm *comm) : mesh_(mesh), mpiComm(comm), - parMetisMesh_(NULL) + parMetisMesh(NULL) {} void partition(std::map<int, double> *elemWeights, PartitionMode mode = INITIAL, float itr = 1000000.0); + /* \brief + * Creates a map which stores for each element on partitioning level the + * rank the element corresponds to. + */ void fillCoarsePartitionVec(std::map<int, int> *partitionVec); void fillLeafPartitionVec(std::map<int, int> *coarseVec, @@ -190,7 +194,7 @@ namespace AMDiS { MPI::Comm *mpiComm; - ParMetisMesh *parMetisMesh_; + ParMetisMesh *parMetisMesh; }; } diff --git a/AMDiS/src/ParallelProblem.cc b/AMDiS/src/ParallelProblem.cc index 69d93c7d31cd9c14c62e9afc387726677ee07e41..75b96b79498a38f1cc9969c6f340303bcb7a0590 100644 --- a/AMDiS/src/ParallelProblem.cc +++ b/AMDiS/src/ParallelProblem.cc @@ -329,6 +329,7 @@ namespace AMDiS { void ParallelProblem::partitionMesh(AdaptInfo *adaptInfo) { static bool initial = true; + if (initial) { initial = false; partitioner->fillCoarsePartitionVec(&oldPartitionVec); @@ -344,10 +345,8 @@ namespace AMDiS { void ParallelProblem::refineOverlap(AdaptInfo *adaptInfo) { int dim = mesh->getDim(); - bool finished = (localCoarseGridLevel_ == 0); - //for(j = globalCoarseGridLevel_; j < localCoarseGridLevel_; j++) { while (!finished) { std::map<DegreeOfFreedom, int> inOut; // 1: in, 2: out, 3: border dof @@ -357,7 +356,8 @@ namespace AMDiS { while (elInfo) { Element *element = elInfo->getElement(); PartitionElementData *partitionData = - dynamic_cast<PartitionElementData*>(elInfo->getElement()->getElementData(PARTITION_ED)); + dynamic_cast<PartitionElementData*>(elInfo->getElement()-> + getElementData(PARTITION_ED)); const DegreeOfFreedom **dofs = element->getDOF(); @@ -427,7 +427,8 @@ namespace AMDiS { ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); while (elInfo) { PartitionElementData *partitionData = - dynamic_cast<PartitionElementData*>(elInfo->getElement()->getElementData(PARTITION_ED)); + dynamic_cast<PartitionElementData*>(elInfo->getElement()-> + getElementData(PARTITION_ED)); int refinements = globalCoarseGridLevel_ - partitionData->getLevel(); elInfo->getElement()->setMark(max(0, refinements)); elInfo = stack.traverseNext(elInfo); @@ -439,17 +440,16 @@ namespace AMDiS { void ParallelProblem::coarsenOutOfPartition(AdaptInfo *adaptInfo) { Flag meshCoarsened = 1; - while(meshCoarsened.getFlags() != 0) { + while (meshCoarsened.getFlags() != 0) { TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); - while(elInfo) { + while (elInfo) { Element *element = elInfo->getElement(); PartitionElementData *partitionData = dynamic_cast<PartitionElementData*> (element->getElementData(PARTITION_ED)); - if(partitionData->getPartitionStatus() == OUT) { + if (partitionData->getPartitionStatus() == OUT) { int mark = min(0, -partitionData->getLevel() + globalCoarseGridLevel_); - //int mark = -partitionData->getLevel(); element->setMark(mark); } elInfo = stack.traverseNext(elInfo); @@ -1354,10 +1354,31 @@ namespace AMDiS { // create an initial partitioning of the mesh partitioner->createPartitionData(); - // set the element weights, which are 1 at the very first begin. + // set the element weights, which are 1 at the very first begin setElemWeights(adaptInfo); + // and now partition the mesh partitionMesh(adaptInfo); + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); + int nLeaves = 0; + while (elInfo) { + Element *element = elInfo->getElement(); + PartitionElementData *partitionData = + dynamic_cast<PartitionElementData*> + (element->getElementData(PARTITION_ED)); + if (partitionData->getPartitionStatus() != IN) { + element->setHidden(true); + } else { + nLeaves++; + } + + elInfo = stack.traverseNext(elInfo); + } + + mesh->setNumberOfLeaves(nLeaves); + +#if 0 globalRefineOutOfPartition(adaptInfo); refineOverlap(adaptInfo); @@ -1405,6 +1426,8 @@ namespace AMDiS { std::string(number) + "_"); (*fwIt)->setTraverseProperties(-1, 0, elementInPartition); } + +#endif } } diff --git a/AMDiS/src/ParallelProblem.h b/AMDiS/src/ParallelProblem.h index 581b09cbfe31baf7471921449dd5ba2dbddb0c79..39aa008f84d71dc3e06fa152f5a6e84058ffef22 100644 --- a/AMDiS/src/ParallelProblem.h +++ b/AMDiS/src/ParallelProblem.h @@ -397,7 +397,7 @@ namespace AMDiS { * */ double maxLowerTH_; - } + }; // ========================================================================= // ===== class ParallelProblemScal ========================================= diff --git a/AMDiS/src/Traverse.cc b/AMDiS/src/Traverse.cc index d5b5f68b28b13964ef0f4b16df857bd28831c9d4..dd555b35d6decae532178398251dbb0198dde847 100644 --- a/AMDiS/src/Traverse.cc +++ b/AMDiS/src/Traverse.cc @@ -30,18 +30,16 @@ namespace AMDiS { for (int i = 0; i < stack_size; i++) elinfo_stack[i]->setFillFlag(fill_flag & FILL_ANY); - elinfo_stack[0]->setMesh(mesh); elinfo_stack[1]->setMesh(mesh); - if (fill_flag.isSet(Mesh::CALL_LEAF_EL_LEVEL)) { - TEST_EXIT_DBG(level >= 0)("invalid level: %d\n", level); - } + if (fill_flag.isSet(Mesh::CALL_LEAF_EL_LEVEL)) + TEST_EXIT_DBG(level >= 0)("invalid level: %d\n", level); traverse_mel = NULL; stack_used = 0; - return(traverseNext(NULL)); + return traverseNext(NULL); } ElInfo* TraverseStack::traverseNext(ElInfo* elinfo_old) @@ -57,8 +55,7 @@ namespace AMDiS { elinfo_old = parametric->removeParametricInfo(elinfo_old); TEST_EXIT_DBG(elinfo_old == elinfo_stack[stack_used])("invalid old elinfo\n"); - } - else { + } else { TEST_EXIT_DBG(elinfo_old == NULL)("invalid old elinfo != nil\n"); } @@ -89,210 +86,10 @@ namespace AMDiS { elinfo->fillDetGrdLambda(); } - return(elinfo); + return elinfo; } - - /****************************************************************************/ - /* common (static) traversal routines for 2d and 3d */ - /* to be #included in traverse_r.c */ - /****************************************************************************/ - - /* traverse hierarchical mesh, call el_fct() for each/some element */ - - /****************************************************************************/ - /* recursive_traverse: */ - /* ------------------- */ - /* recursively traverse the mesh hierarchy tree */ - /* call the routine traverse_info->el_fct(el_info) with */ - /* - all tree leaves */ - /* - all tree leaves at a special level */ - /* - all tree elements in pre-/in-/post-order */ - /* depending on the traverse_info->level variable */ - /****************************************************************************/ - int Traverse::recursive(ElInfoStack *elInfoStack) - { - FUNCNAME("Traverse::recursive()"); - - ElInfo *elinfo = elInfoStack->getCurrentElement(); - - Element *el = elinfo->getElement(); - int mg_level, sum = 0; - Parametric *parametric = mesh->getParametric(); - ElInfo::traverseId[omp_get_thread_num()] = id; - - if (flag.isSet(Mesh::CALL_LEAF_EL)) { - if (el->getFirstChild()) { - ElInfo* elinfo_new = elInfoStack->getNextElement(); - elinfo_new->fillElInfo(0, elinfo); - sum += recursive(elInfoStack); - elinfo_new->fillElInfo(1, elinfo); - sum += recursive(elInfoStack); - elInfoStack->getBackElement(); - } else { - if (el_fct != NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - } - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - - if (flag.isSet(Mesh::CALL_LEAF_EL_LEVEL)) { - if (el->getFirstChild()) { - if ((elinfo->getLevel() >= level)) { - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - ElInfo* elinfo_new = elInfoStack->getNextElement(); - elinfo_new->fillElInfo(0, elinfo); - sum += recursive(elInfoStack); - elinfo->fillElInfo(1, elinfo); - sum += recursive(elInfoStack); - elInfoStack->getBackElement(); - } else { - if ((elinfo->getLevel() == level) && (el_fct!=NULL)) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - } - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - - if (flag.isSet(Mesh::CALL_EL_LEVEL)) { - if (elinfo->getLevel() == level) { - if (NULL != el_fct) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - } else { - if (elinfo->getLevel() > level){ - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } else if (el->getFirstChild()) { - ElInfo* elinfo_new = elInfoStack->getNextElement(); - elinfo_new->fillElInfo(0, elinfo); - sum += recursive(elInfoStack); - elinfo_new->fillElInfo(1, elinfo); - sum += recursive(elInfoStack); - elInfoStack->getBackElement(); - } - } - - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - - if (flag.isSet(Mesh::CALL_MG_LEVEL)) { - - mg_level = (elinfo->getLevel() + mesh->getDim() - 1) / mesh->getDim(); - - if (mg_level > level) { - return 0; - } - - if (!(el->getFirstChild())) { - if (el_fct != NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - - if ((mg_level == level) && ((elinfo->getLevel() % mesh->getDim()) == 0)) { - if (el_fct != NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - - ElInfo* elinfo_new = elInfoStack->getNextElement(); - - elinfo_new->fillElInfo(0, elinfo); - sum += recursive(elInfoStack); - - elinfo_new->fillElInfo(1, elinfo); - sum += recursive(elInfoStack); - - elInfoStack->getBackElement(); - - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - - if (flag.isSet(Mesh::CALL_EVERY_EL_PREORDER)) { - if (el_fct != NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - } - - if (el->getFirstChild()) { - ElInfo* elinfo_new = elInfoStack->getNextElement(); - - elinfo_new->fillElInfo(0, elinfo); - sum += recursive(elInfoStack); - - if (flag.isSet(Mesh::CALL_EVERY_EL_INORDER)) - if (el_fct!=NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - elinfo_new->fillElInfo(1, elinfo); - sum += recursive(elInfoStack); - - elInfoStack->getBackElement(); - } else { - if (flag.isSet(Mesh::CALL_EVERY_EL_INORDER)) - if (el_fct != NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - } - - if (flag.isSet(Mesh::CALL_EVERY_EL_POSTORDER)) - if (el_fct != NULL) { - if (parametric) - elinfo = parametric->addParametricInfo(elinfo); - elinfo->fillDetGrdLambda(); - sum += el_fct(elinfo); - if (parametric) - elinfo = parametric->removeParametricInfo(elinfo); - } - - return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; - } - void TraverseStack::enlargeTraverseStack() { FUNCNAME("TraverseStack::enlargeTraverseStack()"); @@ -336,8 +133,12 @@ namespace AMDiS { if (stack_used == 0) { /* first call */ currentMacro = traverse_mesh->firstMacroElement(); - while (((*currentMacro)->getIndex() % maxThreads_ != myThreadId_) && - (currentMacro != traverse_mesh->endOfMacroElements())) { + // Search for the first macro element that corresponds to the current thread + // and that is not hidden. So increment as long as one of this conditions does + // not hold and the current macro element is not the last one. + while (((*currentMacro)->getIndex() % maxThreads_ != myThreadId_ || + (*currentMacro)->getElement()->isHidden()) && + currentMacro != traverse_mesh->endOfMacroElements()) { currentMacro++; } @@ -352,7 +153,7 @@ namespace AMDiS { el = elinfo_stack[stack_used]->getElement(); if ((el == NULL) || (el->getFirstChild() == NULL)) { - return (elinfo_stack[stack_used]); + return elinfo_stack[stack_used]; } } else { el = elinfo_stack[stack_used]->getElement(); @@ -366,10 +167,13 @@ namespace AMDiS { /* goto next macro element */ if (stack_used < 1) { + // Again, search for the next macro element that corresponds to the current + // thread and that is not hidden. do { currentMacro++; - } while ((currentMacro != traverse_mesh->endOfMacroElements()) && - ((*currentMacro)->getIndex() % maxThreads_ != myThreadId_)); + } while (currentMacro != traverse_mesh->endOfMacroElements() && + ((*currentMacro)->getIndex() % maxThreads_ != myThreadId_ || + (*currentMacro)->getElement()->isHidden())); if (currentMacro == traverse_mesh->endOfMacroElements()) { return NULL; @@ -392,17 +196,57 @@ namespace AMDiS { if (stack_used >= stack_size - 1) enlargeTraverseStack(); - int i = info_stack[stack_used]; - el = const_cast<Element*>(((i == 0) ? el->getFirstChild() : el->getSecondChild())); + + int visitedChildren = info_stack[stack_used]; + if (visitedChildren == 0) { + // No children of this element have been visited. + + if (el->getFirstChild()->isHidden()) { + // The first child is hidden, so omit it. + info_stack[stack_used]++; + visitedChildren++; + + // And check the second child. + if (el->getSecondChild()->isHidden()) { + // Also the second child is hidden, so omit it too and start the + // traverse procedure again to go up into the stack. + + info_stack[stack_used]++; + + return traverseLeafElement(); + } else { + // Only the first child is hidden, so go down on the second one. + el = const_cast<Element*>(el->getSecondChild()); + } + } else { + // The first child is not hidden, so go down on it. + el = const_cast<Element*>(el->getFirstChild()); + } + + } else { + // The first child has been visited before, so check the second one. + if (el->getSecondChild()->isHidden()) { + // The second one is hidden, so omit it and start the traverse + // procedure again to go up into the stack; + info_stack[stack_used]++; + + return traverseLeafElement(); + } else { + // The secod child is not hidden, so go down on it. + el = const_cast<Element*>(el->getSecondChild()); + } + } + + info_stack[stack_used]++; - elinfo_stack[stack_used + 1]->fillElInfo(i, elinfo_stack[stack_used]); + elinfo_stack[stack_used + 1]->fillElInfo(visitedChildren, + elinfo_stack[stack_used]); + info_stack[stack_used + 1] = 0; stack_used++; TEST_EXIT_DBG(stack_used < stack_size) ("stack_size=%d too small, level=(%d,%d)\n", - stack_size, elinfo_stack[stack_used]->getLevel()); - - info_stack[stack_used] = 0; + stack_size, elinfo_stack[stack_used]->getLevel()); } return elinfo_stack[stack_used]; @@ -1034,7 +878,7 @@ namespace AMDiS { sav_neighbour, sav_index, sav_el); MSG(" got element %d at %8X with opp_vertex %d neigh %d\n", elinfo->getElement()->getIndex(), elinfo->getElement(), opp_vertex, - elinfo->getNeighbour(opp_vertex)?elinfo->getNeighbour(opp_vertex)->getIndex():-1); + elinfo->getNeighbour(opp_vertex)?elinfo->getNeighbour(opp_vertex)->getIndex() : -1); TEST_EXIT_DBG(elinfo->getNeighbour(opp_vertex) == old_elinfo->getElement()) ("didn't succeed !?!?!?"); } @@ -1081,7 +925,209 @@ namespace AMDiS { for (int i = 1; i <= levelDif; i++) { upperElInfo->getSubElementCoords(coords, - elinfo_stack[stack_used - levelDif + i]->getIChild()); + elinfo_stack[stack_used - levelDif + i]-> + getIChild()); + } + } + + + /****************************************************************************/ + /* common (static) traversal routines for 2d and 3d */ + /* to be #included in traverse_r.c */ + /****************************************************************************/ + + /* traverse hierarchical mesh, call el_fct() for each/some element */ + + /****************************************************************************/ + /* recursive_traverse: */ + /* ------------------- */ + /* recursively traverse the mesh hierarchy tree */ + /* call the routine traverse_info->el_fct(el_info) with */ + /* - all tree leaves */ + /* - all tree leaves at a special level */ + /* - all tree elements in pre-/in-/post-order */ + /* depending on the traverse_info->level variable */ + /****************************************************************************/ + int Traverse::recursive(ElInfoStack *elInfoStack) + { + FUNCNAME("Traverse::recursive()"); + + ElInfo *elinfo = elInfoStack->getCurrentElement(); + + Element *el = elinfo->getElement(); + int mg_level, sum = 0; + Parametric *parametric = mesh->getParametric(); + ElInfo::traverseId[omp_get_thread_num()] = id; + + if (flag.isSet(Mesh::CALL_LEAF_EL)) { + if (el->getFirstChild()) { + ElInfo* elinfo_new = elInfoStack->getNextElement(); + elinfo_new->fillElInfo(0, elinfo); + sum += recursive(elInfoStack); + elinfo_new->fillElInfo(1, elinfo); + sum += recursive(elInfoStack); + elInfoStack->getBackElement(); + } else { + if (el_fct != NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + } + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + + if (flag.isSet(Mesh::CALL_LEAF_EL_LEVEL)) { + if (el->getFirstChild()) { + if ((elinfo->getLevel() >= level)) { + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + ElInfo* elinfo_new = elInfoStack->getNextElement(); + elinfo_new->fillElInfo(0, elinfo); + sum += recursive(elInfoStack); + elinfo->fillElInfo(1, elinfo); + sum += recursive(elInfoStack); + elInfoStack->getBackElement(); + } else { + if ((elinfo->getLevel() == level) && (el_fct!=NULL)) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + } + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + + if (flag.isSet(Mesh::CALL_EL_LEVEL)) { + if (elinfo->getLevel() == level) { + if (NULL != el_fct) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + } else { + if (elinfo->getLevel() > level){ + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } else if (el->getFirstChild()) { + ElInfo* elinfo_new = elInfoStack->getNextElement(); + elinfo_new->fillElInfo(0, elinfo); + sum += recursive(elInfoStack); + elinfo_new->fillElInfo(1, elinfo); + sum += recursive(elInfoStack); + elInfoStack->getBackElement(); + } + } + + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + + if (flag.isSet(Mesh::CALL_MG_LEVEL)) { + + mg_level = (elinfo->getLevel() + mesh->getDim() - 1) / mesh->getDim(); + + if (mg_level > level) { + return 0; + } + + if (!(el->getFirstChild())) { + if (el_fct != NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + + if ((mg_level == level) && ((elinfo->getLevel() % mesh->getDim()) == 0)) { + if (el_fct != NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + + ElInfo* elinfo_new = elInfoStack->getNextElement(); + + elinfo_new->fillElInfo(0, elinfo); + sum += recursive(elInfoStack); + + elinfo_new->fillElInfo(1, elinfo); + sum += recursive(elInfoStack); + + elInfoStack->getBackElement(); + + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; + } + + if (flag.isSet(Mesh::CALL_EVERY_EL_PREORDER)) { + if (el_fct != NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } } + + if (el->getFirstChild()) { + ElInfo* elinfo_new = elInfoStack->getNextElement(); + + elinfo_new->fillElInfo(0, elinfo); + sum += recursive(elInfoStack); + + if (flag.isSet(Mesh::CALL_EVERY_EL_INORDER)) + if (el_fct!=NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + elinfo_new->fillElInfo(1, elinfo); + sum += recursive(elInfoStack); + + elInfoStack->getBackElement(); + } else { + if (flag.isSet(Mesh::CALL_EVERY_EL_INORDER)) + if (el_fct != NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + } + + if (flag.isSet(Mesh::CALL_EVERY_EL_POSTORDER)) + if (el_fct != NULL) { + if (parametric) + elinfo = parametric->addParametricInfo(elinfo); + elinfo->fillDetGrdLambda(); + sum += el_fct(elinfo); + if (parametric) + elinfo = parametric->removeParametricInfo(elinfo); + } + + return (flag.isSet(Mesh::FILL_ADD_ALL)) ? sum : 0; } + } diff --git a/AMDiS/src/Traverse.h b/AMDiS/src/Traverse.h index 7c15c2aa2d87f380f7640e00aa24197204f8440a..23fa73d5b6da2df9a399402b34194c556d7faebb 100644 --- a/AMDiS/src/Traverse.h +++ b/AMDiS/src/Traverse.h @@ -108,63 +108,44 @@ namespace AMDiS { */ ElInfo* traverseNext(ElInfo* elinfo_old); - /** \brief - * Returns the neighbour-th neighbour of elInfoOld - */ + /// Returns the neighbour-th neighbour of elInfoOld ElInfo* traverseNeighbour(ElInfo* elInfoOld, int neighbour); - /** \brief - * Returns the neighbour-th neighbour of elInfoOld - */ + /// Returns the neighbour-th neighbour of elInfoOld ElInfo* traverseNeighbour3d(ElInfo* elInfoOld, int neighbour); - /** \brief - * Returns the neighbour-th neighbour of elInfoOld - */ + /// Returns the neighbour-th neighbour of elInfoOld ElInfo* traverseNeighbour2d(ElInfo* elInfoOld, int neighbour); - /** \brief - * Not yet implemented - */ + /// Not yet implemented ElInfo* traverseMultiGridLevel(); - /** \brief - * Preorder traversal of all elements - */ + /// Preorder traversal of all elements ElInfo* traverseEveryElementPreorder(); - /** \brief - * Inorder traversal of all elements - */ + /// Inorder traversal of all elements ElInfo* traverseEveryElementInorder(); - /** \brief - * Postorder traversal of all elements - */ + /// Postorder traversal of all elements ElInfo* traverseEveryElementPostorder(); - /** \brief - * Only for 3d: Calls update of all ElInfo3d onjects in \ref elinfo_stack - */ + /// Only for 3d: Calls update of all ElInfo3d onjects in \ref elinfo_stack void update(); - void getCoordsInElem(const ElInfo *upperElInfo, - DimMat<double> *coords); + /// + void getCoordsInElem(const ElInfo *upperElInfo, DimMat<double> *coords); - /** \brief - * Is used for parallel mesh traverse. - */ + /// Is used for parallel mesh traverse. inline void setMyThreadId(int myThreadId) { myThreadId_ = myThreadId; } - /** \brief - * Is used for parallel mesh traverse. - */ + /// Is used for parallel mesh traverse. inline void setMaxThreads(int maxThreads) { maxThreads_ = maxThreads; } + /// int getStackData(std::vector<ElInfo*> &elInfos, std::vector<int> &infos) { elInfos = elinfo_stack; infos = info_stack; @@ -173,24 +154,16 @@ namespace AMDiS { } private: - /** \brief - * Enlargement of the stack - */ + /// Enlargement of the stack void enlargeTraverseStack(); - /** \brief - * Used by \ref traverseFirst() \ref traverseNext() - */ + /// Used by \ref traverseFirst() \ref traverseNext() ElInfo* traverseLeafElement(); - /** \brief - * Used by \ref traverseFirst() \ref traverseNext() - */ + /// Used by \ref traverseFirst() \ref traverseNext() ElInfo* traverseLeafElementLevel(); - /** \brief - * Used by \ref traverseFirst() \ref traverseNext() - */ + /// Used by \ref traverseFirst() \ref traverseNext() ElInfo* traverseElementLevel(); /** \brief @@ -312,9 +285,7 @@ namespace AMDiS { id = ElInfo::traverseIdCounter++; } - /** \brief - * Performs the recursive traversal - */ + /// Performs the recursive traversal int recursive(ElInfoStack*); private: