diff --git a/AMDiS/libtool b/AMDiS/libtool index b9cd240167306cb085b4420383f389fcd091cf08..e96f67065e881c5fbc2155783211a810082e9175 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="/usr/bin/sed" +SED="/bin/sed" # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="/usr/bin/sed -e 1s/^X//" +Xsed="/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 deimos103: +# Libtool was configured on host NWRW15: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -66,12 +66,12 @@ fast_install=yes # The host system. host_alias= -host=x86_64-unknown-linux-gnu +host=i686-pc-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=x86_64-unknown-linux-gnu +build=i686-pc-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="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" +LTCC="gcc" # LTCC compiler flags. LTCFLAGS="-g -O2" # A language-specific compiler. -CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" +CC="gcc" # Is the compiler the GNU C compiler? with_gcc=yes -gcc_dir=`gcc -print-file-name=. | /usr/bin/sed 's,/\.$,,'` +gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` gcc_ver=`gcc -dumpversion` # An ERE matcher. EGREP="grep -E" # The linker used to build libraries. -LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64" +LD="/usr/bin/ld" # 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="" +link_static_flag="-static" # 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 "/lib64 /usr/lib64 /usr/local/lib64" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +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"` # Run-time system search path for libraries -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 " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/octave-2.9.9 /usr/lib/qt-3.3/lib /usr/lib/qt4/lib " # 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 deimos103: +# Libtool was configured on host NWRW15: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -6785,12 +6785,12 @@ fast_install=yes # The host system. host_alias= -host=x86_64-unknown-linux-gnu +host=i686-pc-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=x86_64-unknown-linux-gnu +build=i686-pc-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="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" +LTCC="gcc" # LTCC compiler flags. LTCFLAGS="-g -O2" # A language-specific compiler. -CC="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpiCC" +CC="g++" # Is the compiler the GNU C compiler? with_gcc=yes -gcc_dir=`gcc -print-file-name=. | /usr/bin/sed 's,/\.$,,'` +gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` gcc_ver=`gcc -dumpversion` # An ERE matcher. EGREP="grep -E" # The linker used to build libraries. -LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64" +LD="/usr/bin/ld" # 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="" +link_static_flag="-static" # 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/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"` +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"` # Dependencies to place after the objects being linked to create a # shared library. -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"` +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"` # 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="-lmpi_cxx -lmpi -lopen-rte -lopen-pal -libverbs -lrt -lnuma -ldl -lnsl -lutil -ldl -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s" +postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" # The library search path used internally by the compiler when linking # a shared library. -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"` +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"` # 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 "/lib64 /usr/lib64 /usr/local/lib64" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +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"` # Run-time system search path for libraries -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 " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/octave-2.9.9 /usr/lib/qt-3.3/lib /usr/lib/qt4/lib " # 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 deimos103: +# Libtool was configured on host NWRW15: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7093,12 +7093,12 @@ fast_install=yes # The host system. host_alias= -host=x86_64-unknown-linux-gnu +host=i686-pc-linux-gnu host_os=linux-gnu # The build system. build_alias= -build=x86_64-unknown-linux-gnu +build=i686-pc-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="/licsoft/libraries/openmpi/1.2.6/64bit/bin/mpicc" +LTCC="gcc" # LTCC compiler flags. LTCFLAGS="-g -O2" @@ -7118,16 +7118,16 @@ LTCFLAGS="-g -O2" CC="g77" # Is the compiler the GNU C compiler? -with_gcc= +with_gcc=yes -gcc_dir=`gcc -print-file-name=. | /usr/bin/sed 's,/\.$,,'` +gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` gcc_ver=`gcc -dumpversion` # An ERE matcher. EGREP="grep -E" # The linker used to build libraries. -LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64" +LD="/usr/bin/ld" # 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 "/lib64 /usr/lib64 /usr/local/lib64" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` +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"` # Run-time system search path for libraries -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 " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/octave-2.9.9 /usr/lib/qt-3.3/lib /usr/lib/qt4/lib " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" diff --git a/AMDiS/src/AMDiS_fwd.h b/AMDiS/src/AMDiS_fwd.h index eb64993d8b1df767bf943c88416cb84183416f53..64e103d2931bcfdd9150353e80e2870411ee5b0b 100644 --- a/AMDiS/src/AMDiS_fwd.h +++ b/AMDiS/src/AMDiS_fwd.h @@ -49,6 +49,7 @@ namespace AMDiS { class FillInfo; class FileWriterInterface; class FiniteElemSpace; + class Flag; class IdentityPreconditioner; class ITL_BasePreconditioner; class LeafDataPeriodic; diff --git a/AMDiS/src/Lagrange.cc b/AMDiS/src/Lagrange.cc index 5142d21bfaa05f422e84072acdd72c84f304bbbf..f3fe9d506e727ee75f4c28943fd129340dda62c8 100644 --- a/AMDiS/src/Lagrange.cc +++ b/AMDiS/src/Lagrange.cc @@ -217,13 +217,13 @@ namespace AMDiS { { FUNCNAME("Lagrange::setVertices()"); - TEST_EXIT_DBG((*vertices) == NULL)("vertices != NULL\n"); + TEST_EXIT_DBG(*vertices == NULL)("vertices != NULL\n"); int dimOfPosition = DIM_OF_INDEX(position, dim); *vertices = new int[dimOfPosition + 1]; - if ((degree == 4) && (dimOfPosition==1)) { + if (degree == 4 && dimOfPosition == 1) { (*vertices)[(nodeIndex != 2) ? 0 : 1] = Global::getReferenceElement(dim)->getVertexOfPosition(position, positionIndex, @@ -232,16 +232,16 @@ namespace AMDiS { Global::getReferenceElement(dim)->getVertexOfPosition(position, positionIndex, 1); - } else if ((degree==4) && (dimOfPosition==2)) { + } else if (degree==4 && dimOfPosition == 2) { for (int i = 0; i < dimOfPosition + 1; i++) { - (*vertices)[(i+dimOfPosition*nodeIndex) % (dimOfPosition + 1)] = + (*vertices)[(i + dimOfPosition*nodeIndex) % (dimOfPosition + 1)] = Global::getReferenceElement(dim)->getVertexOfPosition(position, positionIndex, i); } } else { for (int i = 0; i < dimOfPosition + 1; i++) { - (*vertices)[(i+nodeIndex) % (dimOfPosition + 1)] = + (*vertices)[(i + nodeIndex) % (dimOfPosition + 1)] = Global::getReferenceElement(dim)->getVertexOfPosition(position, positionIndex, i); @@ -661,10 +661,10 @@ namespace AMDiS { int partsAtPos = Global::getGeo(INDEX_OF_DIM(i, dim), dim); for (int j = 0; j < partsAtPos; j++) { // for all vertices/edges/faces/... int *coordInd = new int[i + 1]; // indices of relevant coords - for (int k = 0; k < i + 1; k++) { + for (int k = 0; k < i + 1; k++) coordInd[k] = Global::getReferenceElement(dim)-> getVertexOfPosition(INDEX_OF_DIM(i, dim), j, k); - } + createCoords(coordInd, i + 1, 0, degree); delete [] coordInd; if (static_cast<int>(bary->size()) == nBasFcts) @@ -785,17 +785,15 @@ namespace AMDiS { for (int j = offset; j < jto; j++) { boundaryType = el_info->getBoundary(j); int kto = (*nDOF)[INDEX_OF_DIM(i, dim)]; - for (int k = 0; k < kto; k++) { - bound[index++] = boundaryType; - } + for (int k = 0; k < kto; k++) + bound[index++] = boundaryType; } offset -= Global::getGeo(INDEX_OF_DIM(i + 1, dim), dim); } // interior nodes in the center - for (int i = 0; i < (*nDOF)[CENTER]; i++) { - bound[index++] = INTERIOR; - } + for (int i = 0; i < (*nDOF)[CENTER]; i++) + bound[index++] = INTERIOR; TEST_EXIT_DBG(index == nBasFcts)("found not enough boundarys\n"); } diff --git a/AMDiS/src/LeafData.cc b/AMDiS/src/LeafData.cc index 3fd84e7a26aa9d6ce3908d9d7ca81eb78fcb216c..7d2b3456f0f68301e716f15035021adf021369e2 100644 --- a/AMDiS/src/LeafData.cc +++ b/AMDiS/src/LeafData.cc @@ -203,10 +203,7 @@ namespace AMDiS { LeafDataPeriodic *ld[2] = {NULL, NULL}; std::list<LeafDataPeriodic::PeriodicInfo>::iterator it; - for (it = periodicInfoList.begin(); - it != periodicInfoList.end(); - ++it) { - + for (it = periodicInfoList.begin(); it != periodicInfoList.end(); ++it) { BoundaryType type = it->type; int parentSide = it->elementSide; int mode = it->periodicMode; @@ -242,8 +239,7 @@ namespace AMDiS { newCoords *= 0.5; coords[j] = newCoords; } else { - int posAtSide = parent->getPositionOfVertex(parentSide, - parentVertex); + int posAtSide = parent->getPositionOfVertex(parentSide, parentVertex); coords[j] = (*(it->periodicCoords))[posAtSide]; } } diff --git a/AMDiS/src/Line.cc b/AMDiS/src/Line.cc index 40cc2f551ac4f8700dc5f68a206f5bf734ba7268..ae5295f82e0c0c0facaf2ae8cc31dfc190757986 100644 --- a/AMDiS/src/Line.cc +++ b/AMDiS/src/Line.cc @@ -15,10 +15,10 @@ namespace AMDiS { {-1, 1}}; int Line::getVertexOfPosition(GeoIndex position, - int positionIndex, - int vertexIndex) const + int positionIndex, + int vertexIndex) const { - FUNCNAME("Line::getVertexOfPosition"); + FUNCNAME("Line::getVertexOfPosition()"); switch(position) { case VERTEX: diff --git a/AMDiS/src/MacroReader.cc b/AMDiS/src/MacroReader.cc index 9294f5bd334caace95a38b303f408acdc68e0809..6ac3230ebee2c26a62d6ac4598e013930db5df5e 100644 --- a/AMDiS/src/MacroReader.cc +++ b/AMDiS/src/MacroReader.cc @@ -85,10 +85,9 @@ namespace AMDiS { TEST_EXIT(result == 1)("vertEl2[%d]\n", j); } for (int j = 0; j < dim; j++) { - if (mode == 0) { + if (mode == 0) periodicMap.setEntry(melVertex[el1][verticesEl1[j]], - melVertex[el2][verticesEl2[j]]); - } + melVertex[el2][verticesEl2[j]]); vertexMapEl1[verticesEl1[j]] = verticesEl2[j]; vertexMapEl2[verticesEl2[j]] = verticesEl1[j]; } @@ -193,12 +192,10 @@ namespace AMDiS { std::map<BoundaryType, VertexVector*>::iterator assocEnd = mesh->periodicAssociations.end(); for (assoc = mesh->periodicAssociations.begin(); assoc != assocEnd; ++assoc) { - - for (int i = 0; i < mesh->getNumberOfVertices(); i++) { + for (int i = 0; i < mesh->getNumberOfVertices(); i++) if (i != (*(assoc->second))[i]) MSG("association %d: vertex %d -> vertex %d\n", - assoc->first, i, (*(assoc->second))[i]); - } + assoc->first, i, (*(assoc->second))[i]); } for (int i = 0; i < mesh->getNumberOfVertices(); i++) @@ -262,9 +259,8 @@ namespace AMDiS { MacroElement *macroEl = *(mel+i); Projection *projector = macroEl->getProjection(0); if (projector && projector->getType() == VOLUME_PROJECTION) { - for (int j = 0; j <= dim; j++) { - projector->project(macroEl->getCoord(j)); - } + for (int j = 0; j <= dim; j++) + projector->project(macroEl->getCoord(j)); } else { for (int j = 0; j < mesh->getGeo(EDGE); j++) { projector = macroEl->getProjection(numFaces + j); @@ -460,7 +456,6 @@ namespace AMDiS { { FUNCNAME("MacroInfo::readAMDiSMacro()"); - FILE *file; int dim; int dow, nv, ne, j, k; double dbl; @@ -474,7 +469,7 @@ namespace AMDiS { TEST_EXIT(strlen(filename) < static_cast<unsigned int>(127)) ("can only handle filenames up to 127 characters\n"); - file = fopen(filename, "r"); + FILE *file = fopen(filename, "r"); TEST_EXIT(file)("cannot open file %s\n", filename); /****************************************************************************/ @@ -484,7 +479,8 @@ namespace AMDiS { line_no = n_keys = 0; while (fgets(line, 255, file)) { line_no++; - if (!strchr(line, ':')) continue; + if (!strchr(line, ':')) + continue; key = read_key(line); int i_key = get_key_no(key); TEST_EXIT(i_key >= 0) @@ -851,7 +847,7 @@ namespace AMDiS { void MacroInfo::fillBoundaryInfo(Mesh *mesh) { - int i,j,k, nv = mesh->getNumberOfVertices(); + int i, j, k, nv = mesh->getNumberOfVertices(); std::deque<MacroElement*>::iterator melIt; @@ -866,78 +862,68 @@ namespace AMDiS { for (i = 0; i < nv; i++) bound[i] = INTERIOR; - for (i=0, melIt = mesh->firstMacroElement(); + for (i = 0, melIt = mesh->firstMacroElement(); melIt != mesh->endOfMacroElements(); - ++melIt, ++i) - { - for (j = 0; j < mesh->getGeo(NEIGH); j++) { - if ((*melIt)->getBoundary(j) != INTERIOR) { - if ((*melIt)->getBoundary(j) >= DIRICHLET) { - int j1 = mel_vertex[i][(j+1)%3]; - int j2 = mel_vertex[i][(j+2)%3]; - - bound[j1] = - max(bound[j1], (*melIt)->getBoundary(j)); - bound[j2] = - max(bound[j2], (*melIt)->getBoundary(j)); - } - else if ((*melIt)->getBoundary(j) <= NEUMANN) { - int j1 = mel_vertex[i][(j+1)%3]; - int j2 = mel_vertex[i][(j+2)%3]; - - if (bound[j1] != INTERIOR) - bound[j1] = - max(bound[j1], (*melIt)->getBoundary(j)); - else - bound[j1] = (*melIt)->getBoundary(j); - - if (bound[j2] != INTERIOR) - bound[j2] = - max(bound[j2], (*melIt)->getBoundary(j)); - else - bound[j2] = (*melIt)->getBoundary(j); - } + ++melIt, i++) { + for (j = 0; j < mesh->getGeo(NEIGH); j++) { + if ((*melIt)->getBoundary(j) != INTERIOR) { + if ((*melIt)->getBoundary(j) >= DIRICHLET) { + int j1 = mel_vertex[i][(j+1)%3]; + int j2 = mel_vertex[i][(j+2)%3]; + + bound[j1] = max(bound[j1], (*melIt)->getBoundary(j)); + bound[j2] = max(bound[j2], (*melIt)->getBoundary(j)); + } else if ((*melIt)->getBoundary(j) <= NEUMANN) { + int j1 = mel_vertex[i][(j+1)%3]; + int j2 = mel_vertex[i][(j+2)%3]; + + if (bound[j1] != INTERIOR) + bound[j1] = max(bound[j1], (*melIt)->getBoundary(j)); + else + bound[j1] = (*melIt)->getBoundary(j); + + if (bound[j2] != INTERIOR) + bound[j2] = max(bound[j2], (*melIt)->getBoundary(j)); + else + bound[j2] = (*melIt)->getBoundary(j); } } } + } - for (i=0, melIt = mesh->firstMacroElement(); + for (i = 0, melIt = mesh->firstMacroElement(); melIt != mesh->endOfMacroElements(); ++melIt, i++) - { - for (j = 0; j < mesh->getGeo(VERTEX); j++) - (*melIt)->setBoundary(3 + j, bound[mel_vertex[i][j]]); - } + for (j = 0; j < mesh->getGeo(VERTEX); j++) + (*melIt)->setBoundary(3 + j, bound[mel_vertex[i][j]]); + break; case 3: for (i = 0; i < nv; i++) bound[i] = INTERIOR; - for (i=0, melIt = mesh->firstMacroElement(); + for (i = 0, melIt = mesh->firstMacroElement(); melIt != mesh->endOfMacroElements(); - ++melIt, i++) - { - for (j = 0; j < mesh->getGeo(NEIGH); j++) { - for (k = 1; k < 4; k++) - bound[mel_vertex[i][(j+k)%4]] = - ((*melIt)->getBoundary(j) != INTERIOR) ? - newBound((*melIt)->getBoundary(j), - bound[mel_vertex[i][(j+k)%4]]) : - //(*melIt)->getBoundary(j)-> - //newVal(bound[data->mel_vertex[i][(j+k)%4]]) : - bound[mel_vertex[i][(j+k)%4]]; - } + ++melIt, i++) { + for (j = 0; j < mesh->getGeo(NEIGH); j++) { + for (k = 1; k < 4; k++) + bound[mel_vertex[i][(j+k)%4]] = + ((*melIt)->getBoundary(j) != INTERIOR) ? + newBound((*melIt)->getBoundary(j), + bound[mel_vertex[i][(j+k)%4]]) : + bound[mel_vertex[i][(j+k)%4]]; } + } for (i = 0, melIt = mesh->firstMacroElement(); melIt != mesh->endOfMacroElements(); - ++melIt, i++) - { - for (j = 0; j < mesh->getGeo(VERTEX); j++) - (*melIt)->setBoundary(10 + j, bound[mel_vertex[i][j]]); - } + ++melIt, i++) + for (j = 0; j < mesh->getGeo(VERTEX); j++) + (*melIt)->setBoundary(10 + j, bound[mel_vertex[i][j]]); + break; - default: ERROR_EXIT("invalid dim\n"); + default: + ERROR_EXIT("invalid dim\n"); } delete [] bound; @@ -1034,7 +1020,7 @@ namespace AMDiS { int dim = mesh->getDim(); - switch(dim) { + switch (dim) { case 2: for (mel = mesh->firstMacroElement(); mel != mesh->endOfMacroElements(); mel++) { // check for periodic boundary @@ -1048,11 +1034,9 @@ namespace AMDiS { dynamic_cast<LeafDataPeriodic*>(ed)->getInfoList(); std::list<LeafDataPeriodic::PeriodicInfo>::iterator it; std::list<LeafDataPeriodic::PeriodicInfo>::iterator end = periodicInfos.end(); - for (it = periodicInfos.begin(); it != end; ++it) { - if (it->type != 0) { + for (it = periodicInfos.begin(); it != end; ++it) + if (it->type != 0) periodic[it->elementSide] = true; - } - } } for (int i = 0; i < mesh->getGeo(NEIGH); i++) { @@ -1065,13 +1049,13 @@ namespace AMDiS { dof = el->setDOF(lnode + i, mesh->getDOF(EDGE)); if ((*mel)->getNeighbour(i)) { - Element *neigh = const_cast<Element*>((*mel)->getNeighbour(i)->getElement()); + Element *neigh = + const_cast<Element*>((*mel)->getNeighbour(i)->getElement()); - if (periodic[i]) { + if (periodic[i]) neigh->setDOF(lnode + (*mel)->getOppVertex(i), mesh->getDOF(EDGE)); - } else { - neigh->setDOF(lnode + (*mel)->getOppVertex(i), dof); - } + else + neigh->setDOF(lnode + (*mel)->getOppVertex(i), dof); } } } @@ -1105,50 +1089,51 @@ namespace AMDiS { /*********************************************************************/ n_neigh = 1; - if (newEdge(mesh, (*(mel+i)), k, &n_neigh/*, periodicEdge*/)) { + if (newEdge(mesh, (*(mel + i)), k, &n_neigh)) { mesh->incrementNumberOfEdges(1); max_n_neigh = max(max_n_neigh, n_neigh); } } for (k = 0; k < mesh->getGeo(NEIGH); k++) { - neigh = (*(mel+i))->getNeighbour(k); + neigh = (*(mel + i))->getNeighbour(k); /*********************************************************************/ /* face is counted and dof is added by the element with bigger index */ /*********************************************************************/ - if (neigh && (neigh->getIndex() > (*(mel+i))->getIndex())) continue; + if (neigh && (neigh->getIndex() > (*(mel + i))->getIndex())) + continue; mesh->incrementNumberOfFaces(1); if (mesh->getNumberOfDOFs(FACE)) { - TEST_EXIT(!(*(mel+i))->getElement()->getDOF(lnode + k)) + TEST_EXIT(!(*(mel + i))->getElement()->getDOF(lnode + k)) ("dof %d on element %d already set\n", - lnode+k, (*(mel+i))->getIndex()); + lnode + k, (*(mel + i))->getIndex()); - const_cast<Element*>((*(mel+i))->getElement())->setDOF(lnode + k, - mesh->getDOF(FACE)); + const_cast<Element*>((*(mel + i))->getElement())->setDOF(lnode + k, + mesh->getDOF(FACE)); if (neigh) { - ov = (*(mel+i))->getOppVertex(k); - TEST_EXIT(!neigh->getElement()->getDOF(lnode+ov)) + ov = (*(mel + i))->getOppVertex(k); + TEST_EXIT(!neigh->getElement()->getDOF(lnode + ov)) ("dof %d on neighbour %d already set\n", - lnode+ov, neigh->getIndex()); + lnode + ov, neigh->getIndex()); Element *neighEl = - const_cast<Element*>((*(mel+i))->getNeighbour(k)->getElement()); + const_cast<Element*>((*(mel + i))->getNeighbour(k)->getElement()); - if (periodic[k]) { + if (periodic[k]) neighEl->setDOF(lnode+ov, mesh->getDOF(FACE)); - } else { - neighEl->setDOF(lnode+ov, const_cast<int*>((*(mel+i))->getElement()-> - getDOF(lnode+k))); - } + else + neighEl->setDOF(lnode+ov, const_cast<int*>((*(mel + i))->getElement()-> + getDOF(lnode + k))); } } } } break; - default: ERROR_EXIT("invalid dim\n"); + default: + ERROR_EXIT("invalid dim\n"); } if (3 == dim) @@ -1196,22 +1181,17 @@ namespace AMDiS { { FUNCNAME("MacroReader::macrotest()"); - int *test; - int *zykl; - std::deque<MacroElement*>::const_iterator macro,mac; - int flg; - std::deque<MacroElement*>::const_iterator macrolfd; - int zykstart; + std::deque<MacroElement*>::const_iterator macro, mac; + int flg = 0; int dim = mesh->getDim(); - - test = new int[mesh->getNumberOfMacros()]; - zykl = new int[mesh->getNumberOfMacros()]; + int *test = new int[mesh->getNumberOfMacros()]; + int *zykl = new int[mesh->getNumberOfMacros()]; for (int i = 0; i < mesh->getNumberOfMacros(); i++) test[i] = 0; - zykstart = -1; - macrolfd = mesh->firstMacroElement(); + int zykstart = -1; + std::deque<MacroElement*>::const_iterator macrolfd = mesh->firstMacroElement(); while (macrolfd != mesh->endOfMacroElements()) { if (test[(*macrolfd)->getIndex()] == 1) { @@ -1234,15 +1214,13 @@ namespace AMDiS { } else if ((*macro)->getNeighbour(dim) == NULL) { flg = 1; test[(*macro)->getIndex()] = 1; - } - else if ((*macro) == (*macro)->getNeighbour(dim)->getNeighbour(dim)) { + } else if ((*macro) == (*macro)->getNeighbour(dim)->getNeighbour(dim)) { flg = 1; test[(*macro)->getIndex()] = 1; test[(*macro)->getNeighbour(dim)->getIndex()] = 1; } else { - for (mac = mesh->firstMacroElement(); - (*mac)!=(*macro)->getNeighbour(dim); - mac++); + for (mac = mesh->firstMacroElement(); + (*mac) != (*macro)->getNeighbour(dim); mac++); macro = mac; } } @@ -1281,7 +1259,7 @@ namespace AMDiS { // Macro-Datei kann angewendet werden void MacroReader::umb(int *ele, Mesh *mesh, - void (*umbvk)(Mesh*,MacroElement*,int,int*)) + void (*umbvk)(Mesh*, MacroElement*, int, int*)) { FUNCNAME("MacroReader::umb"); @@ -1298,24 +1276,22 @@ namespace AMDiS { bool MacroReader::newEdge(Mesh *mesh, MacroElement *mel, int mel_edge_no, int *n_neigh) { - FUNCNAME("MacroElement::newEdge"); - MacroElement *nei; + FUNCNAME("MacroElement::newEdge()"); + MacroElement *nei; const DegreeOfFreedom *dof[2]; DegreeOfFreedom *edge_dof = NULL; - int j, k, opp_v, mel_index, node=0; - BoundaryType lbound = INTERIOR; + int j, k, opp_v, node = 0; + BoundaryType lbound = INTERIOR; Projection *lproject = NULL; - const int max_no_list_el = 100; + const int max_no_list_el = 100; BoundaryType *list_bound[100]; Projection **list_project[100]; Element *el = const_cast<Element*>(mel->getElement()); int edge_no = mel_edge_no; - - static int next_el[6][2] = {{3,2},{1,3},{1,2},{0,3},{0,2},{0,1}}; - + static int next_el[6][2] = {{3,2},{1,3},{1,2},{0,3},{0,2},{0,1}}; int vertices = mesh->getGeo(VERTEX); - mel_index = mel->getIndex(); + int mel_index = mel->getIndex(); list_bound[0] = &(mel->boundary[mesh->getGeo(FACE)+edge_no]); list_project[0] = &(mel->projection[mesh->getGeo(FACE)+edge_no]); @@ -1333,11 +1309,9 @@ namespace AMDiS { } } - for (j = 0; j < 2; j++) { + for (j = 0; j < 2; j++) dof[j] = el->getDOF(el->getVertexOfEdge(edge_no, j)); - } - - + /****************************************************************************/ /* first look for all neighbours in one direction until a boundary is */ /* reached :-( or we are back to mel :-) */ @@ -1416,106 +1390,92 @@ namespace AMDiS { nei = nei->getNeighbour(next_el[edge_no][1]); } } - if (!nei) - { - /****************************************************************************/ - /* while looping around the edge the domain's boundary was reached. Now, */ - /* loop in the other direction to the domain's boundary */ - /****************************************************************************/ - edge_no = mel_edge_no; - - nei = mel->getNeighbour(next_el[edge_no][1]); - opp_v = mel->getOppVertex(next_el[edge_no][1]); - if (mel->getBoundary(next_el[edge_no][1])) { - lbound = newBound(mel->getBoundary(next_el[edge_no][1]), lbound); - Projection *neiProject = mel->getProjection(next_el[edge_no][1]); - if (!lproject) - lproject = neiProject; - else { - if (neiProject && (lproject->getID() < neiProject->getID())) { - lproject = neiProject; - } - } - } - while (nei) - { - for (j = 0; j < vertices; j++) - if (nei->getElement()->getDOF(j) == dof[0]) break; - for (k = 0; k < vertices; k++) - if (nei->getElement()->getDOF(k) == dof[1]) break; - - // check for periodic boundary - if (j == 4 || k == 4) { - return false; - } - - if (mesh->getNumberOfDOFs(EDGE)) - TEST_EXIT(nei->getIndex() > mel_index) - ("neighbour index %d < element index %d\n", nei->getIndex(), - mel_index); - if (nei->getIndex() < mel_index) - return false; - - edge_no = Tetrahedron::edgeOfDOFs[j][k]; - - TEST_EXIT(*n_neigh < max_no_list_el) - ("too many neigbours for local list\n"); - - list_bound[(*n_neigh)] = - &(nei->boundary[mesh->getGeo(FACE)+edge_no]); - - list_project[(*n_neigh)++] = - &(nei->projection[mesh->getGeo(FACE)+edge_no]); - - if (mesh->getNumberOfDOFs(EDGE)) { - TEST_EXIT(!nei->getElement()->getDOF(node+edge_no)) - ("dof %d on element %d is already set, but not on element %d\n", - node + edge_no, nei->getIndex(), mel_index); + if (!nei) { + /****************************************************************************/ + /* while looping around the edge the domain's boundary was reached. Now, */ + /* loop in the other direction to the domain's boundary */ + /****************************************************************************/ + edge_no = mel_edge_no; + + nei = mel->getNeighbour(next_el[edge_no][1]); + opp_v = mel->getOppVertex(next_el[edge_no][1]); + if (mel->getBoundary(next_el[edge_no][1])) { + lbound = newBound(mel->getBoundary(next_el[edge_no][1]), lbound); + Projection *neiProject = mel->getProjection(next_el[edge_no][1]); + if (!lproject) { + lproject = neiProject; + } else { + if (neiProject && (lproject->getID() < neiProject->getID())) + lproject = neiProject; + } + } + + while (nei) { + for (j = 0; j < vertices; j++) + if (nei->getElement()->getDOF(j) == dof[0]) break; + for (k = 0; k < vertices; k++) + if (nei->getElement()->getDOF(k) == dof[1]) break; - // if (periodic) { - // nei->element->setDOF(node+edge_no, mesh->getDOF(EDGE)); - // } else { - nei->element->setDOF(node+edge_no,edge_dof); - // } - } - - if (next_el[edge_no][0] != opp_v) - { - if (nei->getBoundary(next_el[edge_no][0])) { - lbound = newBound(nei->getBoundary(next_el[edge_no][0]), lbound); - Projection *neiProject = nei->getProjection(next_el[edge_no][0]); - if (!lproject) - lproject = neiProject; - else { - if (neiProject &&( lproject->getID() < neiProject->getID())) { - lproject = neiProject; - } - } - } + // check for periodic boundary + if (j == 4 || k == 4) + return false; + + if (mesh->getNumberOfDOFs(EDGE)) + TEST_EXIT(nei->getIndex() > mel_index) + ("neighbour index %d < element index %d\n", nei->getIndex(), + mel_index); + + if (nei->getIndex() < mel_index) + return false; + + edge_no = Tetrahedron::edgeOfDOFs[j][k]; + + TEST_EXIT(*n_neigh < max_no_list_el)("too many neigbours for local list\n"); + + list_bound[(*n_neigh)] = &(nei->boundary[mesh->getGeo(FACE) + edge_no]); + list_project[(*n_neigh)++] = &(nei->projection[mesh->getGeo(FACE) + edge_no]); - opp_v = nei->getOppVertex(next_el[edge_no][0]); - nei = nei->getNeighbour(next_el[edge_no][0]); - } - else { - if (nei->getBoundary(next_el[edge_no][1])) { - lbound = newBound(nei->getBoundary(next_el[edge_no][1]), lbound); - Projection *neiProject = nei->getProjection(next_el[edge_no][1]); - if (!lproject) - lproject = neiProject; - else { - if (neiProject && (lproject->getID() < neiProject->getID())) { - lproject = neiProject; - } - } - } + if (mesh->getNumberOfDOFs(EDGE)) { + TEST_EXIT(!nei->getElement()->getDOF(node+edge_no)) + ("dof %d on element %d is already set, but not on element %d\n", + node + edge_no, nei->getIndex(), mel_index); + + nei->element->setDOF(node+edge_no,edge_dof); + } - opp_v = nei->getOppVertex(next_el[edge_no][1]); - nei = nei->getNeighbour(next_el[edge_no][1]); + if (next_el[edge_no][0] != opp_v) { + if (nei->getBoundary(next_el[edge_no][0])) { + lbound = newBound(nei->getBoundary(next_el[edge_no][0]), lbound); + Projection *neiProject = nei->getProjection(next_el[edge_no][0]); + if (!lproject) { + lproject = neiProject; + } else { + if (neiProject &&( lproject->getID() < neiProject->getID())) + lproject = neiProject; } } + + opp_v = nei->getOppVertex(next_el[edge_no][0]); + nei = nei->getNeighbour(next_el[edge_no][0]); + } else { + if (nei->getBoundary(next_el[edge_no][1])) { + lbound = newBound(nei->getBoundary(next_el[edge_no][1]), lbound); + Projection *neiProject = nei->getProjection(next_el[edge_no][1]); + if (!lproject) { + lproject = neiProject; + } else { + if (neiProject && (lproject->getID() < neiProject->getID())) + lproject = neiProject; + } + } + + opp_v = nei->getOppVertex(next_el[edge_no][1]); + nei = nei->getNeighbour(next_el[edge_no][1]); + } } - + } + for (j = 0; j < *n_neigh; j++) { *(list_bound[j]) = lbound; *(list_project[j]) = lproject; @@ -1527,9 +1487,8 @@ namespace AMDiS { void MacroReader::fillMelBoundary(Mesh *mesh, MacroElement *mel, FixVec<BoundaryType ,NEIGH> ind) { - for (int i = 0; i < mesh->getGeo(NEIGH); i++) { - mel->boundary[i] = ind[i]; - } + for (int i = 0; i < mesh->getGeo(NEIGH); i++) + mel->boundary[i] = ind[i]; } @@ -1571,7 +1530,7 @@ namespace AMDiS { if (ka == 2); else { - for (i=0; i < 3; i++) { + for (i = 0; i < 3; i++) { macr->coord[i]=me->coord[i]; macr->setBoundary(facesPlusEdges + i, me->getBoundary(facesPlusEdges + i)); macr->setBoundary(i, me->getBoundary(i)); @@ -1579,9 +1538,8 @@ namespace AMDiS { macr->setOppVertex(i,me->getOppVertex(i)); } - for (i=0; i < 7; i++) { - d[i]=const_cast<int*>(me->getElement()->getDOF(i)); - } + for (i = 0; i < 7; i++) + d[i] = const_cast<int*>(me->getElement()->getDOF(i)); if (ka == 1) { me->coord[0] = macr->coord[2]; @@ -1605,24 +1563,21 @@ namespace AMDiS { me->setOppVertex(2,macr->getOppVertex(1)); - if (mesh->getNumberOfDOFs(VERTEX)) /* Ecken */ - { - n0=mesh->getNode(VERTEX); + if (mesh->getNumberOfDOFs(VERTEX)) { /* Ecken */ + n0 = mesh->getNode(VERTEX); - const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+2]); - const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0]); - const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0+1]); - } + const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+2]); + const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0]); + const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0+1]); + } - if (mesh->getNumberOfDOFs(EDGE)) /* Kanten */ - { - n0=mesh->getNode(EDGE); + if (mesh->getNumberOfDOFs(EDGE)) { /* Kanten */ + n0 = mesh->getNode(EDGE); - const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+2]); - const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0]); - const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0+1]); - } - + const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+2]); + const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0]); + const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0+1]); + } } else { me->coord[0] = macr->coord[1]; me->coord[1] = macr->coord[2]; @@ -1644,33 +1599,27 @@ namespace AMDiS { me->setOppVertex(1,macr->getOppVertex(2)); me->setOppVertex(2,macr->getOppVertex(0)); - if (mesh->getNumberOfDOFs(VERTEX)) /* Ecken */ - { - n0=mesh->getNode(VERTEX); + if (mesh->getNumberOfDOFs(VERTEX)) { /* Ecken */ + n0 = mesh->getNode(VERTEX); - const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+1]); - const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0+2]); - const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0]); - } + const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+1]); + const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0+2]); + const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0]); + } - if (mesh->getNumberOfDOFs(EDGE)) /* Kanten */ - { - n0=mesh->getNode(EDGE); + if (mesh->getNumberOfDOFs(EDGE)) { /* Kanten */ + n0 = mesh->getNode(EDGE); - const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+1]); - const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0+2]); - const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0]); - } + const_cast<Element*>(me->getElement())->setDOF(n0,d[n0+1]); + const_cast<Element*>(me->getElement())->setDOF(n0+1,d[n0+2]); + const_cast<Element*>(me->getElement())->setDOF(n0+2,d[n0]); + } } - for (i=0; i < vertices; i++) /* oppVertex der Nachbarn umsetzen*/ - { - if (me->getNeighbour(i)) - { - const_cast<MacroElement*>(me->getNeighbour(i))->setOppVertex(me->getOppVertex(i),i); - } - } + for (i = 0; i < vertices; i++) /* oppVertex der Nachbarn umsetzen*/ + if (me->getNeighbour(i)) + const_cast<MacroElement*>(me->getNeighbour(i))->setOppVertex(me->getOppVertex(i), i); } delete macr; } diff --git a/AMDiS/src/MacroWriter.cc b/AMDiS/src/MacroWriter.cc index 5ee2dd00152f9c645bbc43e2e195d739757f31bd..44103c5b2735a45fc1339bd48eab91d6ee7a444a 100644 --- a/AMDiS/src/MacroWriter.cc +++ b/AMDiS/src/MacroWriter.cc @@ -80,9 +80,8 @@ namespace AMDiS { std::list<VertexInfo>::iterator it2; for (it2 = it->begin(); it2 != it->end(); ++it2) { it2->outputIndex = counter++; - for (i = 0; i < dow; i++) { - file << std::scientific << it2->coords[i] << " "; - } + for (i = 0; i < dow; i++) + file << std::scientific << it2->coords[i] << " "; file << std::endl; } } @@ -95,10 +94,9 @@ namespace AMDiS { for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) { // for all vertices - for (i = 0; i < vertices; i++) { - file << elementIt->vertexInfo[i]->outputIndex << " "; - } - file << std::endl; + for (i = 0; i < vertices; i++) + file << elementIt->vertexInfo[i]->outputIndex << " "; + file << "\n"; } // === print boundaries === @@ -106,10 +104,9 @@ namespace AMDiS { for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) { // for all vertices - for (i = 0; i < vertices; i++) { - file << elementIt->boundary[i] << " "; - } - file << std::endl; + for (i = 0; i < vertices; i++) + file << elementIt->boundary[i] << " "; + file << "\n"; } // === print neighbours === @@ -117,10 +114,9 @@ namespace AMDiS { for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) { // for all vertices - for (i = 0; i < vertices; i++) { - file << elementIt->neighbour[i] << " "; - } - file << std::endl; + for (i = 0; i < vertices; i++) + file << elementIt->neighbour[i] << " "; + file << "\n"; } // === print boundary projections === @@ -158,13 +154,12 @@ namespace AMDiS { file << std::endl << "element type:" << std::endl; for (elementIt = elements->begin(); elementIt != elements->end(); ++elementIt) - file << (int)(elementIt->type) << " "; - + file << (int)(elementIt->type) << " "; } file.close(); - return(0); + return 0; } @@ -185,8 +180,7 @@ namespace AMDiS { // Iterate on all periodic connections for (periodicIt = dc->getPeriodicInfos()->begin(); - periodicIt != dc->getPeriodicInfos()->end(); - ++periodicIt) { + periodicIt != dc->getPeriodicInfos()->end(); ++periodicIt) { std::map<int, int>::iterator mapIt; diff --git a/AMDiS/src/Marker.cc b/AMDiS/src/Marker.cc index 30dded77fa210e964d02a97217e854658ee7a436..18c2fd44a449c13d5e3f0ca1829000195b9a546c 100644 --- a/AMDiS/src/Marker.cc +++ b/AMDiS/src/Marker.cc @@ -24,7 +24,8 @@ namespace AMDiS { case 4: marker = new GERSMarker(name, row); break; - default: ERROR_EXIT("invalid strategy\n"); + default: + ERROR_EXIT("invalid strategy\n"); } return marker; @@ -50,7 +51,8 @@ namespace AMDiS { INFO(info, 4)("%d elements marked for coarsening\n", elMarkCoarsen); } - void Marker::markElement(AdaptInfo *adaptInfo, ElInfo *elInfo) { + void Marker::markElement(AdaptInfo *adaptInfo, ElInfo *elInfo) + { Element *el = elInfo->getElement(); double lError = el->getEstimation(row); diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index cb317eb561a707daf6aab9f1ed77936e18f1fad3..9a009ca0d92a928a793c913aac214b929db14c6d 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -592,12 +592,11 @@ namespace AMDiS { Element *el = parent ? parent->clone() : elementPrototype->clone(); - if (!parent && elementDataPrototype) { + if (!parent && elementDataPrototype) el->setElementData(elementDataPrototype->clone()); - } else { + else el->setElementData(NULL); // must be done in ElementData::refineElementData() - } - + return el; } @@ -629,14 +628,12 @@ namespace AMDiS { { static const MacroElement *mel = NULL; DimVec<double> lambda(dim, NO_INIT); - ElInfo *mel_info = NULL; - - mel_info = createNewElInfo(); + ElInfo *mel_info = createNewElInfo(); if (start_mel != NULL) mel = start_mel; else - if ((mel == NULL) || (mel->getElement()->getMesh() != this)) + if (mel == NULL || mel->getElement()->getMesh() != this) mel = *(macroElements.begin()); mel_info->setFillFlag(Mesh::FILL_COORDS); @@ -689,6 +686,7 @@ namespace AMDiS { ElInfo* final_el_info) { FUNCNAME("Mesh::findElementAtPointRecursive()"); + Element *el = el_info->getElement(); DimVec<double> c_lambda(dim, NO_INIT); int inside; @@ -697,21 +695,20 @@ namespace AMDiS { if (el->isLeaf()) { *final_el_info = *el_info; if (outside < 0) { - for (int i = 0; i <= dim; i++) { + for (int i = 0; i <= dim; i++) final_lambda[i] = lambda[i]; - } - + return true; } else { /* outside */ if (g_xy0) { /* find boundary point of [xy0, xy] */ el_info->worldToCoord(*(g_xy0), &c_lambda); double s = lambda[outside] / (lambda[outside] - c_lambda[outside]); - for (int i = 0; i <= dim; i++) { - final_lambda[i] = s * c_lambda[i] + (1.0-s) * lambda[i]; - } - if (g_sp) { + for (int i = 0; i <= dim; i++) + final_lambda[i] = s * c_lambda[i] + (1.0 - s) * lambda[i]; + + if (g_sp) *(g_sp) = s; - } + if (dim == 3) MSG("outside finest level on el %d: s=%.3e\n", el->getIndex(), s); @@ -729,7 +726,7 @@ namespace AMDiS { c_el_info->fillElInfo(0, el_info); if (outside >= 0) { outside = el_info->worldToCoord(*(g_xy), &c_lambda); - if (outside >= 0) ERROR("point outside domain\n"); + TEST_EXIT(outside == 0)("point outside domain\n"); } else { c_lambda[0] = lambda[0] - lambda[1]; c_lambda[1] = 2.0 * lambda[1]; @@ -738,7 +735,7 @@ namespace AMDiS { c_el_info->fillElInfo(1, el_info); if (outside >= 0) { outside = el_info->worldToCoord(*(g_xy), &c_lambda); - if (outside >= 0) ERROR("point outside domain\n"); + TEST_EXIT(outside == 0)("point outside domain\n"); } else { c_lambda[1] = lambda[1] - lambda[0]; c_lambda[0] = 2.0 * lambda[0]; @@ -751,9 +748,7 @@ namespace AMDiS { c_el_info->fillElInfo(0, el_info); if (el->isNewCoordSet()) { outside = c_el_info->worldToCoord(*(g_xy), &c_lambda); - if (outside >= 0) { - ERROR("outside curved boundary child 0\n"); - } + TEST_EXIT(outside == 0)("outside curved boundary child 0\n"); } else { c_lambda[0] = lambda[2]; c_lambda[1] = lambda[0] - lambda[1]; @@ -763,9 +758,7 @@ namespace AMDiS { c_el_info->fillElInfo(1, el_info); if (el->isNewCoordSet()) { outside = c_el_info->worldToCoord(*(g_xy), &c_lambda); - if (outside >= 0) { - ERROR("outside curved boundary child 1\n"); - } + TEST_EXIT(outside == 0)("outside curved boundary child 1\n"); } else { c_lambda[0] = lambda[1] - lambda[0]; c_lambda[1] = lambda[2]; @@ -785,11 +778,10 @@ namespace AMDiS { if (c_outside>=0) { /* test is other child is better... */ DimVec<double> c_lambda2(dim, NO_INIT); - int c_outside2; ElInfo *c_el_info2 = createNewElInfo(); c_el_info2->fillElInfo(1-ichild, el_info); - c_outside2 = c_el_info2->worldToCoord(*(g_xy), &c_lambda2); + int c_outside2 = c_el_info2->worldToCoord(*(g_xy), &c_lambda2); MSG("new_coord CHILD %d: outside=%d, lambda=(%.2f %.2f %.2f %.2f)\n", ichild, c_outside, c_lambda[0],c_lambda[1],c_lambda[2],c_lambda[3]); @@ -832,8 +824,7 @@ namespace AMDiS { } } /* DIM == 3 */ - inside = findElementAtPointRecursive(c_el_info, c_lambda, outside, - final_el_info); + inside = findElementAtPointRecursive(c_el_info, c_lambda, outside, final_el_info); delete c_el_info; return inside; diff --git a/AMDiS/src/Operator.cc b/AMDiS/src/Operator.cc index 459c90d22d73f2894ab1cef39d97fa8b70d02a73..190881742e717054a100ebed5400dc1b442d5621 100644 --- a/AMDiS/src/Operator.cc +++ b/AMDiS/src/Operator.cc @@ -1255,8 +1255,6 @@ namespace AMDiS { auxFESpaces.push_back(dv->getFESpace()); } - - void MatrixFct_SOT::initElement(const ElInfo* elInfo, SubAssembler* subAssembler, Quadrature *quad) @@ -1428,8 +1426,7 @@ namespace AMDiS { SubAssembler* subAssembler, Quadrature *quad) { - TEST_EXIT(vec1->getFESpace() == vec2->getFESpace()) - ("Not yet implemented!\n"); + TEST_EXIT(vec1->getFESpace() == vec2->getFESpace())("Not yet implemented!\n"); vecAtQPs1 = getVectorAtQPs(vec1, smallElInfo, largeElInfo, subAssembler, quad); vecAtQPs2 = getVectorAtQPs(vec2, smallElInfo, largeElInfo, subAssembler, quad); @@ -1865,7 +1862,8 @@ namespace AMDiS { } void VecAndGradVec2AtQP_ZOT::getC(const ElInfo *, int nPoints, - std::vector<double> &C) const { + std::vector<double> &C) const + { for (int iq = 0; iq < nPoints; iq++) C[iq] += (*f)(vecAtQPs[iq], grad1AtQPs[iq], grad2AtQPs[iq]); } @@ -1882,7 +1880,8 @@ namespace AMDiS { fac * (*f)(vecAtQPs[iq], grad1AtQPs[iq], grad2AtQPs[iq]) * uhAtQP[iq]; } - void FctGradient_ZOT::getC(const ElInfo *, int nPoints, std::vector<double> &C) const { + void FctGradient_ZOT::getC(const ElInfo *, int nPoints, std::vector<double> &C) const + { for (int iq = 0; iq < nPoints; iq++) C[iq] += (*f)(gradAtQPs[iq]); } @@ -1899,7 +1898,8 @@ namespace AMDiS { } void CoordsAtQP_ZOT::getC(const ElInfo *elInfo, int nPoints, - std::vector<double> &C) const { + std::vector<double> &C) const + { for (int iq = 0; iq < nPoints; iq++) C[iq] += (*g)(coordsAtQPs[iq]); } diff --git a/AMDiS/src/Parameters.cc b/AMDiS/src/Parameters.cc index 5a407658b26608fb1ee2323383074a7b606d140b..adfd6cdb23fcd2f78d40ef7babd04597f64fbf69 100644 --- a/AMDiS/src/Parameters.cc +++ b/AMDiS/src/Parameters.cc @@ -24,16 +24,7 @@ namespace AMDiS { { FUNCNAME("Parameters::getGlobalParameter()"); - int count, *ival; std::vector<struct Parameters::param>::iterator i; - char *sval, *cval; - const char *word; - std::string s; - const char *p; - double *rval; - unsigned char *Uval; - char *Sval; - double dval; param tParam(key); const char* funcName2 = param_call_fct ? param_call_fct : funcName; va_list arg; @@ -48,7 +39,7 @@ namespace AMDiS { } if (0 == Parameters::singlett->allParam.size()) { - if (0==Parameters::singlett->filename.size()) { + if (0 == Parameters::singlett->filename.size()) { INFO(info, 1)("no parameters defined\n"); return 0; } else { @@ -71,28 +62,26 @@ namespace AMDiS { } va_start(arg, format); - count = 0; + int count = 0; INFO(info, 2)("parameter `%s' initialized with: ", key.data()); - s = (*i).parameters; + std::string s = (*i).parameters; - for (p = format; *p; p++) { + for (const char *p = format; *p; p++) { if (*p != '%') continue; - word = Parameters::singlett->getNextWord(&s); + const char *word = Parameters::singlett->getNextWord(&s); if (!*word) { PRINT_INFO(info, 2)("\n"); - if (0<(*i).funcName.size()) { - INFO(info, 4)("parameter initialized by %s()\n", - (*i).funcName.data()); - INFO(info, 4)("on line %d of file \"%s\"\n", (*i).lineNo, - (*i).filename.data()); - } else if (0<(*i).filename.size()) { - INFO(info, 4) - ("parameter initialized on line %2d of init file \"%s\"\n", - (*i).lineNo, (*i).filename.data()); + if (0 < (*i).funcName.size()) { + INFO(info, 4)("parameter initialized by %s()\n", (*i).funcName.data()); + INFO(info, 4)("on line %d of file \"%s\"\n", + (*i).lineNo, (*i).filename.data()); + } else if (0 < (*i).filename.size()) { + INFO(info, 4)("parameter initialized on line %2d of init file \"%s\"\n", + (*i).lineNo, (*i).filename.data()); } else { INFO(info, 4)("location of initialization unknown\n"); } @@ -103,36 +92,48 @@ namespace AMDiS { switch(*++p) { case 'S': - Sval = va_arg(arg, char *); - *Sval = static_cast<char>(atoi(word)); - INFO(info, 2)("%d ", *Sval); + { + char *Sval = va_arg(arg, char *); + *Sval = static_cast<char>(atoi(word)); + INFO(info, 2)("%d ", *Sval); + } break; case 'U': - Uval = va_arg(arg, unsigned char *); - *Uval = static_cast<unsigned char>(atoi(word)); - INFO(info, 2)("%d ", *Uval); + { + unsigned char *Uval = va_arg(arg, unsigned char *); + *Uval = static_cast<unsigned char>(atoi(word)); + INFO(info, 2)("%d ", *Uval); + } break; case 'c': - cval = va_arg(arg, char *); - *cval = *word; - INFO(info, 2)("%c ", *cval); + { + char *cval = va_arg(arg, char *); + *cval = *word; + INFO(info, 2)("%c ", *cval); + } break; case 's': - sval = va_arg(arg, char *); - strcpy(sval, word); - INFO(info, 2)("%s ", sval); + { + char *sval = va_arg(arg, char *); + strcpy(sval, word); + INFO(info, 2)("%s ", sval); + } break; case 'd': - ival = va_arg(arg, int *); - *ival = atoi(word); - INFO(info, 2)("%d ", *ival); + { + int *ival = va_arg(arg, int *); + *ival = atoi(word); + INFO(info, 2)("%d ", *ival); + } break; case 'e': case 'f': case 'g': - rval = va_arg(arg, double *); - *rval = dval = atof(word); - INFO(info, 2)("%g ", dval); + { + double *rval = va_arg(arg, double *); + *rval = atof(word); + INFO(info, 2)("%g ", *rval); + } break; case '*': break; @@ -144,7 +145,7 @@ namespace AMDiS { } } - INFO(info,2)("\n"); + INFO(info, 2)("\n"); if ((*i).funcName.size() > 0) { INFO(info, 4)("parameter initialized by %s()\n", (*i).funcName.data()); diff --git a/AMDiS/src/Parametric.cc b/AMDiS/src/Parametric.cc index 7fc768d01ee9c1240c9f65bc2dc8dc5072f4a4e7..ff89f272fb1af6bd0223de347dfdabb706626f2c 100644 --- a/AMDiS/src/Parametric.cc +++ b/AMDiS/src/Parametric.cc @@ -13,23 +13,23 @@ namespace AMDiS { const DegreeOfFreedom **dof = element->getDOF(); for (int i = 0; i < elInfo->getElement()->getGeo(VERTEX); i++) { - if (elInfo->getFillFlag().isSet(Mesh::FILL_COORDS)) { - for (int j = 0; j < dow; j++) { + if (elInfo->getFillFlag().isSet(Mesh::FILL_COORDS)) + for (int j = 0; j < dow; j++) elInfo->getCoord(i)[j] = (*(*dofCoords_)[j])[dof[i][0]]; - } - } + if (elInfo->getFillFlag().isSet(Mesh::FILL_OPP_COORDS)) { TEST_EXIT(elInfo->getFillFlag().isSet(Mesh::FILL_NEIGH)) ("FILL_NEIGH not set\n"); + if (elInfo->getNeighbour(i)) { const DegreeOfFreedom **neighDof = elInfo->getNeighbour(i)->getDOF(); - for (int j = 0; j < dow; j++) { + for (int j = 0; j < dow; j++) elInfo->getOppCoord(i)[j] = - (*(*dofCoords_)[j])[neighDof[elInfo->getOppVertex(i)][0]]; - } + (*(*dofCoords_)[j])[neighDof[elInfo->getOppVertex(i)][0]]; } } } + return elInfo; } diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc index 6e178db413a85ac50bff2e5602766eef0140613f..35396e73bcaac1566a711eb4f985e183e2622ee2 100644 --- a/AMDiS/src/PeriodicBC.cc +++ b/AMDiS/src/PeriodicBC.cc @@ -209,22 +209,16 @@ namespace AMDiS { { FUNCNAME("PeriodicBC::exitVector()"); - double entry; - - DegreeOfFreedom dof; - DegreeOfFreedom newDOF; - DOFIterator<double> vecIt(vector, USED_DOFS); - Mesh *mesh = vector->getFESpace()->getMesh(); VertexVector *associated = mesh->getPeriodicAssociations()[boundaryType]; for (vecIt.reset(); !vecIt.end(); ++vecIt) { - dof = vecIt.getDOFIndex(); - newDOF = (*associated)[dof]; + DegreeOfFreedom dof = vecIt.getDOFIndex(); + DegreeOfFreedom newDOF = (*associated)[dof]; if (dof < newDOF) { - entry = ((*vector)[dof] + (*vector)[newDOF]) * 0.5; + double entry = ((*vector)[dof] + (*vector)[newDOF]) * 0.5; (*vector)[dof] = entry; (*vector)[newDOF] = entry; } diff --git a/AMDiS/src/ProblemInstat.cc b/AMDiS/src/ProblemInstat.cc index 0421ef77ee0e5d69b03adc2f5e1d141d1c47e2ec..7deb73f57a30156b23c60669b6cde32ef6856556 100644 --- a/AMDiS/src/ProblemInstat.cc +++ b/AMDiS/src/ProblemInstat.cc @@ -27,37 +27,35 @@ namespace AMDiS { void ProblemInstatScal::transferInitialSolution(AdaptInfo *adaptInfo) { - TEST_EXIT(adaptInfo->getTime() == - adaptInfo->getStartTime()) + TEST_EXIT(adaptInfo->getTime() == adaptInfo->getStartTime()) ("after initial solution: time != start time\n"); problemStat->writeFiles(adaptInfo, true); } void ProblemInstatVec::transferInitialSolution(AdaptInfo *adaptInfo) { - TEST_EXIT(adaptInfo->getTime() == - adaptInfo->getStartTime()) + TEST_EXIT(adaptInfo->getTime() == adaptInfo->getStartTime()) ("after initial solution: time != start time\n"); problemStat->writeFiles(adaptInfo, true); } - ProblemInstatScal::ProblemInstatScal(std::string name_, + ProblemInstatScal::ProblemInstatScal(std::string sname, ProblemScal *prob, ProblemStatBase *initialProb) - : ProblemInstat(name_, initialProb), + : ProblemInstat(sname, initialProb), problemStat(prob), oldSolution(NULL) {} - ProblemInstatScal::ProblemInstatScal(std::string name_, ProblemScal& prob) - : ProblemInstat(name_, NULL), + ProblemInstatScal::ProblemInstatScal(std::string sname, ProblemScal& prob) + : ProblemInstat(sname, NULL), problemStat(&prob), oldSolution(NULL) {} - ProblemInstatScal::ProblemInstatScal(std::string name_, + ProblemInstatScal::ProblemInstatScal(std::string sname, ProblemScal& prob, ProblemStatBase& initialProb) - : ProblemInstat(name_, &initialProb), + : ProblemInstat(sname, &initialProb), problemStat(&prob), oldSolution(NULL) {} @@ -68,8 +66,8 @@ namespace AMDiS { } void ProblemInstatScal::initialize(Flag initFlag, - ProblemInstat *adoptProblem/* = NULL*/, - Flag adoptFlag /* = INIT_NOTHING*/) + ProblemInstat *adoptProblem, + Flag adoptFlag) { FUNCNAME("ProblemInstat::initialize()"); @@ -123,22 +121,22 @@ namespace AMDiS { problemStat->writeFiles(adaptInfo, force); } - ProblemInstatVec::ProblemInstatVec(std::string name_, + ProblemInstatVec::ProblemInstatVec(std::string sname, ProblemVec *prob, ProblemStatBase *initialProb) - : ProblemInstat(name_, initialProb), + : ProblemInstat(sname, initialProb), problemStat(prob), oldSolution(NULL) {} - ProblemInstatVec::ProblemInstatVec(std::string name_, ProblemVec &prob) - : ProblemInstat(name_, NULL), + ProblemInstatVec::ProblemInstatVec(std::string sname, ProblemVec &prob) + : ProblemInstat(sname, NULL), problemStat(&prob), oldSolution(NULL) {} - ProblemInstatVec::ProblemInstatVec(std::string name_, + ProblemInstatVec::ProblemInstatVec(std::string sname, ProblemVec &prob, ProblemStatBase &initialProb) - : ProblemInstat(name_, &initialProb), + : ProblemInstat(sname, &initialProb), problemStat(&prob), oldSolution(NULL) {} @@ -148,9 +146,8 @@ namespace AMDiS { delete oldSolution; } - void ProblemInstatVec::initialize(Flag initFlag, - ProblemInstat *adoptProblem/* = NULL*/, - Flag adoptFlag /* = INIT_NOTHING*/) + void ProblemInstatVec::initialize(Flag initFlag, ProblemInstat *adoptProblem, + Flag adoptFlag) { FUNCNAME("ProblemInstatVec::initialize()"); @@ -183,9 +180,7 @@ namespace AMDiS { } else { int size = problemStat->getNumComponents(); // create oldSolution - oldSolution = new SystemVector("old solution", - problemStat->getFESpaces(), - size); + oldSolution = new SystemVector("old solution", problemStat->getFESpaces(), size); for (int i = 0; i < size; i++) { oldSolution->setDOFVector(i, new DOFVector<double>(problemStat->getFESpace(i), name + "->uOld")); diff --git a/AMDiS/src/ProblemInterpolScal.cc b/AMDiS/src/ProblemInterpolScal.cc index 4a60301941e476af54e1fe061643ba056412e4ee..e22122cf19918dc0c279019434b7b2fc53db3de1 100644 --- a/AMDiS/src/ProblemInterpolScal.cc +++ b/AMDiS/src/ProblemInterpolScal.cc @@ -11,25 +11,23 @@ namespace AMDiS { AbstractFunction<double, WorldVector<double> > *fct, AbstractFunction<WorldVector<double>, WorldVector<double> > *grdFct) : ProblemScal(name), - interpolFct_(fct), - grdInterpolFct_(grdFct) + interpolFct(fct), + grdInterpolFct(grdFct) { - Flag adoptFlag = - INIT_SYSTEM | - INIT_MESH | - INIT_FE_SPACE; - + Flag adoptFlag = INIT_SYSTEM | INIT_MESH | INIT_FE_SPACE; Flag initFlag = INIT_ALL & ~adoptFlag & ~INIT_SOLVER & ~INIT_ESTIMATOR; initialize(initFlag, spaceProblem, adoptFlag); } - void ProblemInterpolScal::solve(AdaptInfo *adaptInfo) { + void ProblemInterpolScal::solve(AdaptInfo *adaptInfo) + { mesh->dofCompress(); - solution->interpol(interpolFct_); + solution->interpol(interpolFct); } - void ProblemInterpolScal::estimate(AdaptInfo *adaptInfo, double) { + void ProblemInterpolScal::estimate(AdaptInfo *adaptInfo, double) + { FUNCNAME("ProblemIterpolScal::estimate()"); double errMax = 0.0; double errSum = 0.0; @@ -38,18 +36,18 @@ namespace AMDiS { int relErr = 0; GET_PARAMETER(0, name + "->rel error", "%d", &relErr); - if (grdInterpolFct_) + if (grdInterpolFct) errorNorm = 1; else - if (interpolFct_) + if (interpolFct) errorNorm = 2; switch (errorNorm) { case 1: - errSum = Error<double>::H1Err(*grdInterpolFct_, *solution, relErr, &errMax, true); + errSum = Error<double>::H1Err(*grdInterpolFct, *solution, relErr, &errMax, true); break; case 2: - errSum = Error<double>::L2Err(*interpolFct_, *solution, relErr, &errMax, true); + errSum = Error<double>::L2Err(*interpolFct, *solution, relErr, &errMax, true); break; default: ERROR_EXIT("invalid error norm\n"); diff --git a/AMDiS/src/ProblemInterpolScal.h b/AMDiS/src/ProblemInterpolScal.h index e9af69b1646d732fe75024c6f2d27e1c448ed142..cbfd76a3fb2a1a7a8fa5871833558c3633ab6fef 100644 --- a/AMDiS/src/ProblemInterpolScal.h +++ b/AMDiS/src/ProblemInterpolScal.h @@ -22,68 +22,47 @@ #ifndef AMDIS_PROBLEMINTERPOLSCAL_H #define AMDIS_PROBLEMINTERPOLSCAL_H +#include "AMDiS_fwd.h" #include "ProblemScal.h" namespace AMDiS { -class AdaptInfo; - -// ============================================================================ -// ===== class ProblemInterpolScal ============================================ -// ============================================================================ - -/** \brief - * Interpolates a given function adaptive on spaceProblems mesh. - */ -class ProblemInterpolScal : public ProblemScal -{ -public: - /** \brief - * Constructor. fct will be interpolated on the mesh of spaceProblem. - * grdFct is used, if H1 error should be used for estimation. It points - * to the gradient of fct. - */ - ProblemInterpolScal(const char *name_, - ProblemScal *spaceProblem, - AbstractFunction<double, WorldVector<double> > *fct, - AbstractFunction<WorldVector<double>, WorldVector<double> > *grdFct); - - /** \brief - * no system assemblage. - */ - virtual void buildbeforeRefine(AdaptInfo *adaptInfo, Flag) {}; - - /** \brief - * no system assemblage. - */ - virtual void buildbeforeCoarsen(AdaptInfo *adaptInfo, Flag) {}; - - /** \brief - * no system assemblage. - */ - virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {}; - - /** \brief - * no equation system ins solved. Instead fct is interpolated to uh. - */ - virtual void solve(AdaptInfo *adaptInfo); - - /** \brief - * True H1 or L2 error is calculated. - */ - virtual void estimate(AdaptInfo *adaptInfo, double); - -protected: - /** \brief - * function to interpolate. - */ - AbstractFunction<double, WorldVector<double> > *interpolFct_; - - /** \brief - * gradient of \ref interpolFct_. Used for H1 error in estimate(). - */ - AbstractFunction<WorldVector<double>, WorldVector<double> > *grdInterpolFct_; -}; + /// Interpolates a given function adaptive on spaceProblems mesh. + class ProblemInterpolScal : public ProblemScal + { + public: + /** \brief + * Constructor. fct will be interpolated on the mesh of spaceProblem. + * grdFct is used, if H1 error should be used for estimation. It points + * to the gradient of fct. + */ + ProblemInterpolScal(const char *name_, + ProblemScal *spaceProblem, + AbstractFunction<double, WorldVector<double> > *fct, + AbstractFunction<WorldVector<double>, WorldVector<double> > *grdFct); + + /// No system assemblage. + virtual void buildbeforeRefine(AdaptInfo *adaptInfo, Flag) {} + + /// No system assemblage. + virtual void buildbeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} + + /// No system assemblage. + virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {} + + /// No equation system ins solved. Instead fct is interpolated to uh. + virtual void solve(AdaptInfo *adaptInfo); + + /// True H1 or L2 error is calculated. + virtual void estimate(AdaptInfo *adaptInfo, double); + + protected: + /// Function to interpolate. + AbstractFunction<double, WorldVector<double> > *interpolFct; + + /// Gradient of \ref interpolFct_. Used for H1 error in estimate(). + AbstractFunction<WorldVector<double>, WorldVector<double> > *grdInterpolFct; + }; } diff --git a/AMDiS/src/ProblemInterpolVec.cc b/AMDiS/src/ProblemInterpolVec.cc index d56e3548da4b3d4d905b1b88071b9082d1f1f6b7..ccb5d1dfcfb958061256c23cd4c956257b6e73bf 100644 --- a/AMDiS/src/ProblemInterpolVec.cc +++ b/AMDiS/src/ProblemInterpolVec.cc @@ -11,47 +11,45 @@ namespace AMDiS { std::vector<AbstractFunction<double, WorldVector<double> >*> *fct, std::vector<AbstractFunction<WorldVector<double>, WorldVector<double> >*> *grdFct) : ProblemVec(nameStr), - interpolFct_(fct), - grdInterpolFct_(grdFct) + interpolFct(fct), + grdInterpolFct(grdFct) { - Flag adoptFlag = - INIT_SYSTEM | - INIT_MESH | - INIT_FE_SPACE; - + Flag adoptFlag = INIT_SYSTEM | INIT_MESH | INIT_FE_SPACE; Flag initFlag = INIT_ALL & ~adoptFlag & ~INIT_SOLVER & ~INIT_ESTIMATOR; initialize(initFlag, spaceProblem, adoptFlag); } - void ProblemInterpolVec::solve(AdaptInfo *adaptInfo) { + void ProblemInterpolVec::solve(AdaptInfo *adaptInfo) + { int size = static_cast<int>(meshes.size()); - for (int i = 0; i < size; i++) { + for (int i = 0; i < size; i++) meshes[i]->dofCompress(); - } - solution->interpol(interpolFct_); + + solution->interpol(interpolFct); } - void ProblemInterpolVec::estimate(AdaptInfo *adaptInfo, double) { + void ProblemInterpolVec::estimate(AdaptInfo *adaptInfo, double) + { FUNCNAME("ProblemIterpolVec::estimate()"); + double errMax = 0.0, errSum = 0.0; int errorNorm = 0; - int size = static_cast<int>(interpolFct_ ? - interpolFct_->size() : - grdInterpolFct_->size()); - + int size = + static_cast<int>(interpolFct ? interpolFct->size() : grdInterpolFct->size()); int relErr = 0; GET_PARAMETER(0, name + "->rel error", "%d", &relErr); - if (grdInterpolFct_) + if (grdInterpolFct) errorNorm = 1; else - if(interpolFct_) errorNorm = 2; + if (interpolFct) + errorNorm = 2; switch (errorNorm) { case 1: for (int i = 0; i < size; i++) { - errSum = Error<double>::H1Err((*(*grdInterpolFct_)[i]), + errSum = Error<double>::H1Err((*(*grdInterpolFct)[i]), *(solution->getDOFVector(i)), relErr, &errMax, true, i); adaptInfo->setEstSum(errSum, i); @@ -60,14 +58,15 @@ namespace AMDiS { break; case 2: for (int i = 0; i < size; i++) { - errSum = Error<double>::L2Err((*(*interpolFct_)[i]), + errSum = Error<double>::L2Err((*(*interpolFct)[i]), *(solution->getDOFVector(i)), relErr, &errMax, true, i); adaptInfo->setEstSum(errSum, i); adaptInfo->setEstMax(errMax, i); } break; - default: ERROR_EXIT("invalid error norm\n"); + default: + ERROR_EXIT("invalid error norm\n"); } MSG("estimate: %e\n", errSum); diff --git a/AMDiS/src/ProblemInterpolVec.h b/AMDiS/src/ProblemInterpolVec.h index 34e6b4772b340ae54121696cddef1c6ca66a6e52..8c3bb079d5eaf09374904524c40fd23976ddc0c2 100644 --- a/AMDiS/src/ProblemInterpolVec.h +++ b/AMDiS/src/ProblemInterpolVec.h @@ -26,13 +26,7 @@ namespace AMDiS { - // ============================================================================ - // ===== class ProblemInterpolVec ============================================= - // ============================================================================ - - /** \brief - * Interpolates a given function adaptive on spaceProblems mesh. - */ + /// Interpolates a given function adaptive on spaceProblems mesh. class ProblemInterpolVec : public ProblemVec { public: @@ -46,41 +40,27 @@ namespace AMDiS { std::vector<AbstractFunction<double, WorldVector<double> >*> *fct, std::vector<AbstractFunction<WorldVector<double>, WorldVector<double> >*> *grdFct); - /** \brief - * no system assemblage. - */ + /// No system assemblage. virtual void buildbeforeRefine(AdaptInfo *adaptInfo, Flag) {} - /** \brief - * no system assemblage. - */ + /// No system assemblage. virtual void buildbeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} - /** \brief - * no system assemblage. - */ + /// No system assemblage. virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) {} - /** \brief - * no equation system ins solved. Instead fct is interpolated to uh. - */ + /// No equation system ins solved. Instead fct is interpolated to uh. virtual void solve(AdaptInfo *adaptInfo); - /** \brief - * True H1 or L2 error is calculated. - */ + /// True H1 or L2 error is calculated. virtual void estimate(AdaptInfo *adaptInfo, double); protected: - /** \brief - * function to interpolate. - */ - std::vector<AbstractFunction<double, WorldVector<double> >*> *interpolFct_; + /// Function to interpolate. + std::vector<AbstractFunction<double, WorldVector<double> >*> *interpolFct; - /** \brief - * gradient of \ref interpolFct_. Used for H1 error in estimate(). - */ - std::vector<AbstractFunction<WorldVector<double>, WorldVector<double> >*> *grdInterpolFct_; + /// Gradient of \ref interpolFct_. Used for H1 error in estimate(). + std::vector<AbstractFunction<WorldVector<double>, WorldVector<double> >*> *grdInterpolFct; }; } diff --git a/AMDiS/src/ProblemNonLin.cc b/AMDiS/src/ProblemNonLin.cc index c2e3b9444c106ec45b19e135d49db61f2518f4e6..59e13b629ab97fbd6795bfa3c9a01e41bccd57b7 100644 --- a/AMDiS/src/ProblemNonLin.cc +++ b/AMDiS/src/ProblemNonLin.cc @@ -9,8 +9,8 @@ namespace AMDiS { void ProblemNonLinScal::initialize(Flag initFlag, - ProblemScal *adoptProblem /*= NULL*/, - Flag adoptFlag /*= INIT_NOTHING*/) + ProblemScal *adoptProblem, + Flag adoptFlag) { ProblemScal::initialize(initFlag, adoptProblem, adoptFlag); @@ -20,29 +20,26 @@ namespace AMDiS { WARNING("updater already created\n"); } else { if (initFlag.isSet(INIT_UPDATER) || - ((!adoptFlag.isSet(INIT_UPDATER))&& - (initFlag.isSet(INIT_NONLIN_SOLVER)))) { - createUpdater(); - } + (!adoptFlag.isSet(INIT_UPDATER) && initFlag.isSet(INIT_NONLIN_SOLVER))) + createUpdater(); if (adoptProblem && (adoptFlag.isSet(INIT_UPDATER) || - ((!initFlag.isSet(INIT_UPDATER))&& - (adoptFlag.isSet(INIT_NONLIN_SOLVER))))) { + (!initFlag.isSet(INIT_UPDATER) && adoptFlag.isSet(INIT_NONLIN_SOLVER)))) { TEST_EXIT(updater_ == NULL)("updater already created\n"); updater_ = dynamic_cast<ProblemNonLinScal*>(adoptProblem)->getUpdater(); } } - if(updater_==NULL) WARNING("no updater created\n"); + if (updater_ == NULL) + WARNING("no updater created\n"); // === create nonlinear solver === if (nonLinSolver_) { WARNING("nonlinear solver already created\n"); } else { - if (initFlag.isSet(INIT_NONLIN_SOLVER)) { - createNonLinSolver(); - } + if (initFlag.isSet(INIT_NONLIN_SOLVER)) + createNonLinSolver(); if (adoptProblem && adoptFlag.isSet(INIT_NONLIN_SOLVER)) { TEST_EXIT(nonLinSolver_==NULL)("nonlinear solver already created\n"); @@ -86,7 +83,8 @@ namespace AMDiS { void ProblemNonLinScal::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag) { feSpace->getMesh()->dofCompress(); - MSG("%d DOFs for %s\n", feSpace->getAdmin()->getUsedSize(), feSpace->getName().c_str()); + MSG("%d DOFs for %s\n", + feSpace->getAdmin()->getUsedSize(), feSpace->getName().c_str()); TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(mesh, -1, @@ -115,14 +113,13 @@ namespace AMDiS { WARNING("updater already created\n"); } else { if (initFlag.isSet(INIT_UPDATER) || - ((!adoptFlag.isSet(INIT_UPDATER)) && initFlag.isSet(INIT_NONLIN_SOLVER))) { - createUpdater(); - } + ((!adoptFlag.isSet(INIT_UPDATER) && initFlag.isSet(INIT_NONLIN_SOLVER)) + createUpdater(); if (adoptProblem && (adoptFlag.isSet(INIT_UPDATER) || - ((!initFlag.isSet(INIT_UPDATER))&& adoptFlag.isSet(INIT_NONLIN_SOLVER)))) { - TEST_EXIT(updater_==NULL)("updater already created\n"); + (!initFlag.isSet(INIT_UPDATER) && adoptFlag.isSet(INIT_NONLIN_SOLVER)))) { + TEST_EXIT(updater_ == NULL)("updater already created\n"); updater_ = dynamic_cast<ProblemNonLinVec*>(adoptProblem)->getUpdater(); } } @@ -134,9 +131,8 @@ namespace AMDiS { if (nonLinSolver_) { WARNING("nonlinear solver already created\n"); } else { - if (initFlag.isSet(INIT_NONLIN_SOLVER)) { - createNonLinSolver(); - } + if (initFlag.isSet(INIT_NONLIN_SOLVER)) + createNonLinSolver(); if (adoptProblem && adoptFlag.isSet(INIT_NONLIN_SOLVER)) { TEST_EXIT(nonLinSolver_ == NULL)("nonlinear solver already created\n"); @@ -181,15 +177,13 @@ namespace AMDiS { FUNCNAME("ProblemNonLinVec::buildAfterCoarsen()"); int nMeshes = static_cast<int>(meshes.size()); - for (int i = 0; i < nMeshes; i++) { - meshes[i]->dofCompress(); - } + for (int i = 0; i < nMeshes; i++) + meshes[i]->dofCompress(); - for (int i = 0; i < nComponents; i++) { + for (int i = 0; i < nComponents; i++) MSG("%d DOFs for %s\n", componentSpaces[i]->getAdmin()->getUsedSize(), - componentSpaces[i]->getName().c_str()); - } + componentSpaces[i]->getName().c_str()); TraverseStack stack; ElInfo *elInfo; diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index b040e04e6e726e88a4d9ad1a3ca2f230af4f1ea8..2c5140a13bbb79a254a22e9d7fbf66cfb77937b7 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -43,11 +43,11 @@ namespace AMDiS { } else { if (initFlag.isSet(CREATE_MESH) || (!adoptFlag.isSet(INIT_MESH) && - (initFlag.isSet(INIT_SYSTEM) || initFlag.isSet(INIT_FE_SPACE)))) { + (initFlag.isSet(INIT_SYSTEM) || initFlag.isSet(INIT_FE_SPACE)))) createMesh(); - } + if (adoptProblem && - (adoptFlag.isSet(INIT_MESH) || + (adoptFlag.isSet(INIT_MESH) || adoptFlag.isSet(INIT_SYSTEM) || adoptFlag.isSet(INIT_FE_SPACE))) { meshes = adoptProblem->getMeshes(); diff --git a/AMDiS/src/Projection.cc b/AMDiS/src/Projection.cc index ff761f192feb41103f5d44cc6f59727408522b33..184dc50d1eaaed05af23b1871d5ea5e357ce9af7 100644 --- a/AMDiS/src/Projection.cc +++ b/AMDiS/src/Projection.cc @@ -1,7 +1,5 @@ #include "Projection.h" namespace AMDiS { - - std::map<int, Projection*> Projection::projectionMap_; - + std::map<int, Projection*> Projection::projectionMap; } diff --git a/AMDiS/src/Projection.h b/AMDiS/src/Projection.h index af8b62cbf5261d189359667adab128f74c520798..7d2c9550b71417b2abac995366b5e346de7c1d5b 100644 --- a/AMDiS/src/Projection.h +++ b/AMDiS/src/Projection.h @@ -45,14 +45,13 @@ namespace AMDiS { public: /// Constructs a prjection with given id and type. Projection(int id, ProjectionType type) - : projectionID_(id), - projectionType_(type) + : projectionID(id), + projectionType(type) { - TEST_EXIT(id != 0) - ("don't use 0 as projection id. is used as no projection\n"); - TEST_EXIT(projectionMap_[id] == NULL) + TEST_EXIT(id != 0)("don't use 0 as projection id. is used as no projection\n"); + TEST_EXIT(projectionMap[id] == NULL) ("there is already a projection with this id\n"); - projectionMap_[id] = this; + projectionMap[id] = this; } virtual ~Projection() {} @@ -61,29 +60,32 @@ namespace AMDiS { virtual void project(WorldVector<double>& x) = 0; /// Returns \ref projectionID. - inline int getID() { - return projectionID_; + inline int getID() + { + return projectionID; } /// Returns \ref projectionType; - inline ProjectionType getType() { - return projectionType_; + inline ProjectionType getType() + { + return projectionType; } /// Returns the projection with the given id, if existing. Returns NULL otherwise. - static Projection* getProjection(int id) { - return projectionMap_[id]; + static Projection* getProjection(int id) + { + return projectionMap[id]; } protected: /// Unique projection id. - int projectionID_; + int projectionID; /// Type of this projection. - ProjectionType projectionType_; + ProjectionType projectionType; /// Static mapping from ids to projection objects. Used in \ref getProjection(). - static std::map<int, Projection*> projectionMap_; + static std::map<int, Projection*> projectionMap; }; } diff --git a/AMDiS/src/ZeroOrderAssembler.cc b/AMDiS/src/ZeroOrderAssembler.cc index fc6b4000d2e846905e7d5b080bca5aec9ac4c390..736b07b80d151de2b5220fd90c3bec440f702e53 100644 --- a/AMDiS/src/ZeroOrderAssembler.cc +++ b/AMDiS/src/ZeroOrderAssembler.cc @@ -178,9 +178,9 @@ namespace AMDiS { } std::vector<double> &c = tmpC[myRank]; - if (c.size() < static_cast<int>(nPoints)) + if (static_cast<int>(c.size()) < nPoints) c.resize(nPoints); - for (int i = 0; i < static_cast<int>(nPoints); i++) + for (int i = 0; i < nPoints; i++) c[i] = 0.0; for (std::vector<OperatorTerm*>::iterator termIt = terms[myRank].begin();