diff --git a/AMDiS/AMDISConfig.cmake.in b/AMDiS/AMDISConfig.cmake.in index 46f95bdcca72213da0940d7a0ea67bcea5fc2680..c10c824b46a498762cead9a553d9f8004b65c8fb 100644 --- a/AMDiS/AMDISConfig.cmake.in +++ b/AMDiS/AMDISConfig.cmake.in @@ -29,7 +29,9 @@ # message(WARNING "the environment variable LIBRARY_PATH is set. this can lead to problems during linking. \n You can unset it in your CMakeLists.txt with the command unset(ENV{LIBRARY_PATH}).\n") #endif() ################################################################## -#try to detect the AMDiS include directory + +# try to detect the AMDiS include directory +# ------------------------------------------- find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_INCLUDE_DIR} ${AMDIS_DIR}/../../include/amdis/ /usr/include/amdis/) if(_AMDIS_H) get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE) @@ -38,32 +40,46 @@ else() message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.") endif() unset(_AMDIS_H CACHE) -set(MTL_DIR ${AMDIS_INCLUDE_DIR}/mtl4 CACHE PATH "the mtl directory") +set(MTL_DIR @MTL_INCLUDE_DIR@ CACHE PATH "the mtl directory") list(APPEND AMDIS_INCLUDE_DIRS ${MTL_DIR}) -if(WIN32) - set(LIBEXT lib) -else() - set(LIBEXT so) -endif() - +# AMDiS base libraries +# -------------------- find_library(_AMDIS_LIB amdis PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/ /usr/include/amdis) if(_AMDIS_LIB) - get_filename_component(AMDIS_LIBRARY_DIR ${_AMDIS_LIB} PATH CACHE) - set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR}) - set(AMDIS_LIBRARIES "${_AMDIS_LIB};${AMDIS_LIBRARY_DIR}/libmuparser.${LIBEXT}" CACHE STRING "amdis libraries") + get_filename_component(AMDIS_LIBRARY_DIR ${_AMDIS_LIB} PATH CACHE) + set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR}) + set(AMDIS_LIBRARIES "${_AMDIS_LIB}" CACHE STRING "amdis libraries") else() - message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library") + message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library") endif() unset(_AMDIS_LIB CACHE) -find_package(Boost 1.42 REQUIRED system iostreams filesystem program_options) +# Boost libraries +# --------------- +if(WIN32) + set(Boost_USE_STATIC_LIBS ON) + find_package(Boost 1.42 REQUIRED system iostreams filesystem program_options date_time zlib bzip2) +else() + set(Boost_USE_STATIC_LIBS OFF) + find_package(Boost 1.42 REQUIRED system iostreams filesystem program_options date_time) +endif() if(Boost_FOUND) - list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES}) - list(APPEND AMDIS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}) - list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) + list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES}) + list(APPEND AMDIS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}) + list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) +else() + message(ERROR "Boost libraries not found") endif(Boost_FOUND) +# more libraries and include-directories added by default +# ------------------------------------------------------- +list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit) +list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM) +list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser) + +# ------------------------------------------------------------------ + set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@) set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@) set(AMDIS_OPENMP @ENABLE_OPENMP@) @@ -95,6 +111,61 @@ if(AMDIS_OPENMP) endif() endif(AMDIS_OPENMP) + +# AMDiS-Extensions library +# ------------------------ +if(AMDIS_NEED_EXTENSIONS) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/time) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/nanoflann) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/pugixml) + + find_library(_EXTENSIONS_LIB extensions PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) + if(_EXTENSIONS_LIB) + list(APPEND AMDIS_LIBRARIES ${_EXTENSIONS_LIB}) + endif() + unset(_EXTENSIONS_LIB CACHE) +endif(AMDIS_NEED_EXTENSIONS) + +# AMDiS BaseProblems libraries +# ---------------------------- +if(AMDIS_NEED_BASE_PROBLEMS) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/base_problems) + + find_library(_BASE_PROBLEMS_LIB base_problems PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) + if(_BASE_PROBLEMS_LIB) + list(APPEND AMDIS_LIBRARIES ${_BASE_PROBLEMS_LIB}) + endif() + unset(_BASE_PROBLEMS_LIB CACHE) +endif(AMDIS_NEED_BASE_PROBLEMS) + +# ---------------------------- + +find_library(_REINIT_LIB reinit PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) +find_library(_COMPOSITE_FEM_LIB compositeFEM PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) +find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/) + +if(_REINIT_LIB) + list(APPEND AMDIS_LIBRARIES ${_REINIT_LIB}) +else() + message(ERROR "Reinit library not found") +endif() +unset(_REINIT_LIB CACHE) +if(_COMPOSITE_FEM_LIB) + list(APPEND AMDIS_LIBRARIES ${_COMPOSITE_FEM_LIB}) +else() + message(ERROR "CompositeFEM library not found") +endif() +unset(_COMPOSITE_FEM_LIB CACHE) +if(_MUPARSER_LIB) + list(APPEND AMDIS_LIBRARIES ${_MUPARSER_LIB}) +else() + message(ERROR "MuParser library not found") +endif() +unset(_MUPARSER_LIB CACHE) + +# ---------------------------- + if(AMDIS_NEED_UMFPACK) set(AMDIS_UMFPACK_PATH @UMFPACK_PATH@) list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_UMFPACK_PATH}) @@ -121,11 +192,11 @@ if(AMDIS_NEED_UMFPACK) list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARY}) list(APPEND AMDIS_LIBRARY_DIRS ${BLAS_LIBRARY_DIR}) else() - find_package(BLAS REQUIRED) + find_package(BLAS) if(BLAS_FOUND) list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARIES}) else() - message(FATAL_ERROR "Could not find the BLAS library. Please set the variable BLAS_LIBRARY to the blas library with full path") + message(STATUS "Could not find the BLAS library. Please set the variable BLAS_LIBRARY to the blas library with full path") endif() endif() endif("$ENV{BLA_VENDOR}" STREQUAL "ACML") @@ -207,51 +278,49 @@ return (0) ; endif() endif(AMDIS_NEED_UMFPACK) +# PNG library +# ----------- if(AMDIS_NEED_PNG) - set(AMDIS_PNG_PATH @PNG_PATH@) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_PNG_PATH}) - - find_library(PNG_LIB png - HINTS ENV LIBRARY_PATH - DOC "The PNG library") - if(PNG_LIB) - list(APPEND AMDIS_LIBRARIES ${PNG_LIB}) - else() - message(FATAL_ERROR "Could not find the PNG library") - endif() + set(AMDIS_PNG_PATH @PNG_PATH@) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_PNG_PATH}) + + find_library(PNG_LIB png + HINTS ENV LIBRARY_PATH + DOC "The PNG library") + if(PNG_LIB) + list(APPEND AMDIS_LIBRARIES ${PNG_LIB}) + else() + message(FATAL_ERROR "Could not find the PNG library") + endif() endif(AMDIS_NEED_PNG) +# BDDCML-library +# -------------- if(AMDIS_NEED_BDDCML) - set(AMDIS_BDDCML_PATH @BDDCML_PATH@) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_BDDCML_PATH}) + set(AMDIS_BDDCML_PATH @BDDCML_PATH@) + list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_BDDCML_PATH}) - set(AMDIS_BDDCML_LIB @BDDCML_LIB@) - list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LIB}) + set(AMDIS_BDDCML_LIB @BDDCML_LIB@) + list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LIB}) - set(AMDIS_BDDCML_LINK_LIST @BDDCML_LINK_LIST@) - list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LINK_LIST}) + set(AMDIS_BDDCML_LINK_LIST @BDDCML_LINK_LIST@) + list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LINK_LIST}) endif(AMDIS_NEED_BDDCML) -if(AMDIS_NEED_EXTENSIONS) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/time) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/nanoflann) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/pugixml) - list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/libextensions.${LIBEXT}) -endif(AMDIS_NEED_EXTENSIONS) - -if(AMDIS_NEED_BASE_PROBLEMS) - list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/base_problems) - list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/libbase_problems.${LIBEXT}) -endif(AMDIS_NEED_BASE_PROBLEMS) +# Zoltan library +# -------------- +if(AMDIS_NEED_ZOLTAN) + find_library(ZOLTAN_LIB zoltan + HINTS ENV LIBRARY_PATH + DOC "full path to the zoltan library") -#add directories for reinit -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit) -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM) -list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser) + if(ZOLTAN_LIB) + list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB}) + else() + message(FATAL_ERROR "Could not find zoltan library!") + endif() +endif() -list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/libcompositeFEM.${LIBEXT}) -list(APPEND AMDIS_LIBRARIES ${AMDIS_LIBRARY_DIR}/libreinit.${LIBEXT}) if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack ) if(NOT AMDIS_NEED_UMFPACK) @@ -259,16 +328,3 @@ if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack ) message(SEND_ERROR "The selected amdis was not compiled with umfpack") endif() endif() - -if(AMDIS_NEED_ZOLTAN) - find_library(ZOLTAN_LIB zoltan - HINTS ENV LIBRARY_PATH - DOC "full path to the zoltan library") - - if(ZOLTAN_LIB) - list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB}) - else() - message(FATAL_ERROR "Could not find zoltan library!") - endif() -endif() - diff --git a/AMDiS/CMakeLists.txt b/AMDiS/CMakeLists.txt index c98889a9c23c622b9d72f3c0a83dc160c856ebc3..9fc6a0d33d0579b83cde4bc36b3cd0e8bf4f77d2 100644 --- a/AMDiS/CMakeLists.txt +++ b/AMDiS/CMakeLists.txt @@ -414,6 +414,7 @@ if(ENABLE_EXTENSIONS) ${EXTENSIONS_DIR}/BackgroundMesh.cc ${EXTENSIONS_DIR}/GeometryTools.cc ${EXTENSIONS_DIR}/POperators.cc + ${EXTENSIONS_DIR}/SingularDirichletBC2.cc ${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc ${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp) @@ -423,6 +424,14 @@ if(ENABLE_EXTENSIONS) ${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc) endif(ENABLE_PETSC) + if(ENABLE_PARALLEL_DOMAIN) + list(APPEND EXTENSIONS_SRC + ${EXTENSIONS_DIR}/preconditioner/PetscSolverNavierStokes2.cc + ${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc + ${EXTENSIONS_DIR}/preconditioner/PhaseFieldCrystal_.cc + ${EXTENSIONS_DIR}/preconditioner/CahnHilliard_.cc) + endif(ENABLE_PARALLEL_DOMAIN) + list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1") list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}) list(APPEND AMDIS_INCLUDE_DIRS ${EXTENSIONS_DIR}/time) diff --git a/AMDiS/src/AMDiS.cc b/AMDiS/src/AMDiS.cc index b4c8429332798ca95edcbb5fe169b39b1ea54366..fdfdb218b898bcb680104d3e85d8c94f28b9dab8 100644 --- a/AMDiS/src/AMDiS.cc +++ b/AMDiS/src/AMDiS.cc @@ -31,7 +31,7 @@ namespace AMDiS { using namespace std; #if defined(HAVE_PARALLEL_MTL4) - mtl::par::environment* mtl_environment = NULL; + mtl::par::environment* mtl_environment = nullptr; #endif void init(int argc, char **argv, std::string initFileName) @@ -44,7 +44,7 @@ namespace AMDiS { #if defined(HAVE_PARALLEL_DOMAIN_AMDIS) Parallel::mpi::startRand(); #else - srand(time(NULL)); + srand(time(0)); #endif #endif diff --git a/AMDiS/src/AdaptBase.h b/AMDiS/src/AdaptBase.h index 2c2617aed61ad8ab0fb6fa79792446ed69231c39..01d5f7100ac26bae3487609e98800d012b7aba07 100644 --- a/AMDiS/src/AdaptBase.h +++ b/AMDiS/src/AdaptBase.h @@ -27,6 +27,7 @@ #include <string> #include "AMDiS_fwd.h" +#include "Global.h" namespace AMDiS { @@ -40,8 +41,8 @@ namespace AMDiS { AdaptBase(string sname, ProblemIterationInterface *problemIteration_, AdaptInfo *adapt, - ProblemTimeInterface *problemTime_ = NULL, - AdaptInfo *initialAdaptInfo_ = NULL) + ProblemTimeInterface *problemTime_ = nullptr, + AdaptInfo *initialAdaptInfo_ = nullptr) : name(sname), problemIteration(problemIteration_), adaptInfo(adapt), diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc index ef1d7ea00376f3d317c57e5de6c16e4f61f1590e..d669c47d4a18ccf27eec081beab05595e420c520 100644 --- a/AMDiS/src/AdaptInstationary.cc +++ b/AMDiS/src/AdaptInstationary.cc @@ -80,7 +80,7 @@ namespace AMDiS { fixedTimestep = (info->getMinTimestep() == info->getMaxTimestep()); if (initialTimestampSet == 0) - initialTimestamp = time(NULL); + initialTimestamp = time(0); else initialTimestamp = initialTimestampSet; @@ -345,7 +345,7 @@ namespace AMDiS { } while (!adaptInfo->reachedEndTime()) { - iterationTimestamp = time(NULL); + iterationTimestamp = time(0); problemTime->initTimestep(adaptInfo); oneTimestep(); @@ -417,7 +417,7 @@ namespace AMDiS { return false; // Get the current time. - time_t currentTimestamp = time(NULL); + time_t currentTimestamp = time(0); // Update list with the last iteration runtimes. lastIterationsDuration.push(currentTimestamp - iterationTimestamp); diff --git a/AMDiS/src/AdaptInstationary.h b/AMDiS/src/AdaptInstationary.h index 507a91bbbefa0936d0747771624089a597cfb2ff..da7ec285faf493e9ed4d4ca56c9868ed9e509a76 100644 --- a/AMDiS/src/AdaptInstationary.h +++ b/AMDiS/src/AdaptInstationary.h @@ -91,7 +91,7 @@ namespace AMDiS { } /// Implementation of AdaptBase::adapt() - virtual int adapt(); + int adapt() override; /// Serialization virtual void serialize(ostream &out); diff --git a/AMDiS/src/AdaptStationary.h b/AMDiS/src/AdaptStationary.h index 2c99f933a1d286a7a1ae034090c1d9f9261fdfc1..dd8e5c4f5d82dd16e5d852a1fab7b2c95e8d06eb 100644 --- a/AMDiS/src/AdaptStationary.h +++ b/AMDiS/src/AdaptStationary.h @@ -64,7 +64,7 @@ namespace AMDiS { virtual ~AdaptStationary() {} /// Implementation of AdaptBase::adapt() - virtual int adapt(); + int adapt() override; protected: /// Initialisation diff --git a/AMDiS/src/Assembler.cc b/AMDiS/src/Assembler.cc index 30b4c5bfbb42d88f4797f4d339fa01ef8fec7b16..aa9e9d4455a2bb07887435299fb6a96ac391bc37 100644 --- a/AMDiS/src/Assembler.cc +++ b/AMDiS/src/Assembler.cc @@ -44,8 +44,8 @@ namespace AMDiS { elementMatrix(nRow, nCol), elementVector(nRow), tmpMat(nRow, nCol), - lastMatEl(NULL), - lastVecEl(NULL), + lastMatEl(nullptr), + lastVecEl(nullptr), lastTraverseId(-1) {} @@ -105,7 +105,7 @@ namespace AMDiS { rememberElMat = true; Element *el = smallElInfo->getElement(); - lastVecEl = lastMatEl = NULL; + lastVecEl = lastMatEl = nullptr; if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) initElement(smallElInfo, largeElInfo); @@ -426,8 +426,8 @@ namespace AMDiS { void Assembler::finishAssembling() { - lastVecEl = NULL; - lastMatEl = NULL; + lastVecEl = nullptr; + lastMatEl = nullptr; } diff --git a/AMDiS/src/Assembler.h b/AMDiS/src/Assembler.h index 7691759bc229d3b869a457d75d6e8d35a64007e1..2641298db545f2fc211bc3426fc72c6a0a03c413 100644 --- a/AMDiS/src/Assembler.h +++ b/AMDiS/src/Assembler.h @@ -57,7 +57,7 @@ namespace AMDiS { /// Constructor Assembler(Operator *op, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); /// Destructor ~Assembler(); @@ -155,8 +155,8 @@ namespace AMDiS { /// Initialisation for the given ElInfo. The call is deligated to the sub assemblers. void initElement(const ElInfo *smallElInfo, - const ElInfo *largeElInfo = NULL, - Quadrature *quad = NULL); + const ElInfo *largeElInfo = nullptr, + Quadrature *quad = nullptr); /// Sets quadratures of all sub assemblers. void setQuadratures(Quadrature *quad2, @@ -287,7 +287,7 @@ namespace AMDiS { Quadrature *quad1GrdPhi, Quadrature *quad0, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); }; /** @@ -306,7 +306,7 @@ namespace AMDiS { Quadrature *quad1GrdPhi, Quadrature *quad0, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); }; } diff --git a/AMDiS/src/Boundary.h b/AMDiS/src/Boundary.h index dc7dfd0c1e1e8ecf53f33a41730ac28cd784537d..15fa519945fe553bcdd66196bcd6ffc8a00da67b 100644 --- a/AMDiS/src/Boundary.h +++ b/AMDiS/src/Boundary.h @@ -39,6 +39,12 @@ namespace AMDiS { typedef signed int BoundaryType; BoundaryType newBound(BoundaryType oldBound, BoundaryType newBound); + + struct BoundaryTypeContainer + { + BoundaryTypeContainer(BoundaryType b) : b(b) {} + BoundaryType b; + }; } diff --git a/AMDiS/src/BoundaryCondition.h b/AMDiS/src/BoundaryCondition.h index 3d08a0b8dda2af9e822f473f860aefe5caaf9ac6..6ebd386fcf39d9d9beaab9666dc50e65c21d7382 100644 --- a/AMDiS/src/BoundaryCondition.h +++ b/AMDiS/src/BoundaryCondition.h @@ -44,7 +44,7 @@ namespace AMDiS { /// Constructor. BoundaryCondition(BoundaryType type, const FiniteElemSpace *rowFeSpace_, - const FiniteElemSpace *colFeSpace_ = NULL) + const FiniteElemSpace *colFeSpace_ = nullptr) : boundaryType(type), rowFeSpace(rowFeSpace_), colFeSpace(colFeSpace_) diff --git a/AMDiS/src/BoundaryManager.cc b/AMDiS/src/BoundaryManager.cc index c504e67f4bee15c47c3538faf5eca4aa03cc30da..b420e97419bbc08cb9cae75d9b2befd1eee0bc57 100644 --- a/AMDiS/src/BoundaryManager.cc +++ b/AMDiS/src/BoundaryManager.cc @@ -59,7 +59,7 @@ namespace AMDiS { FUNCNAME("BoundaryManager::addBoundaryCondition()"); BoundaryType type = localBC->getBoundaryType(); - TEST_EXIT(localBCs[type] == NULL) + TEST_EXIT(localBCs[type] == nullptr) ("There is already a condition for this type %d.\n",type); localBCs[type] = localBC; diff --git a/AMDiS/src/Cholesky.cc b/AMDiS/src/Cholesky.cc index d0387f383fa8078344e4fae7da723c376cad23ce..72d39aa4a144332f19b3a45cfc526f2525a344cf 100644 --- a/AMDiS/src/Cholesky.cc +++ b/AMDiS/src/Cholesky.cc @@ -28,7 +28,7 @@ bool Cholesky::factorization(Matrix<double> *A, Vector<double> *p) int n = A->getNumRows(); // Checking memory for vector P of diagonal elements of factorization. - static Vector<double> *pT = NULL; + static Vector<double> *pT = nullptr; if (p) { @@ -99,7 +99,7 @@ bool Cholesky::solve(Matrix<double> *A, Vector<double> *b, Vector<double> *x, x = new Vector<double>(n); // Checking vector P. - static Vector<double> *pT = NULL; + static Vector<double> *pT = nullptr; if (!p || (p->getSize() != n)) { @@ -153,7 +153,7 @@ bool Cholesky::solve(Matrix<double> *A, Vector<WorldVector<double> > *b, x = new Vector<WorldVector<double> >(n); // Checking vector P. - static Vector<double> *pT = NULL; + static Vector<double> *pT = nullptr; if (!p || (p->getSize() != n)) { diff --git a/AMDiS/src/Cholesky.h b/AMDiS/src/Cholesky.h index df00076933efcc45f0574687ce41bef9be34877e..374a0284255acc3b9b3f6af21b37934620b58f9d 100644 --- a/AMDiS/src/Cholesky.h +++ b/AMDiS/src/Cholesky.h @@ -51,16 +51,16 @@ class Cholesky /** \brief * Solves system A*X=B, where A is a positive definite matrix. - * If P=NULL; A is assumed to be positive definite, and a Cholesky + * If P=nullptr; A is assumed to be positive definite, and a Cholesky * decomposition is computed using the previous routine. * If P is given, A and P are assumed to be already given as the output of * the previous routine. */ static bool solve(Matrix<double> *A, Vector<double> *b, Vector<double> *x, - Vector<double> *p = NULL); + Vector<double> *p = nullptr); static bool solve(Matrix<double> *A, Vector<WorldVector<double> > *b, Vector<WorldVector<double> > *x, - Vector<double> *p = NULL); + Vector<double> *p = nullptr); }; #endif diff --git a/AMDiS/src/CoarseningManager.h b/AMDiS/src/CoarseningManager.h index d78620e1a141555c19b6978914f424742bab7ab9..45843bf4bb97d0f49a36ccfadd2355d0ff557010 100644 --- a/AMDiS/src/CoarseningManager.h +++ b/AMDiS/src/CoarseningManager.h @@ -43,8 +43,8 @@ namespace AMDiS { public: /// Constructs a CoarseningManager which belongs to aMesh CoarseningManager() - : mesh(NULL), - stack(NULL), + : mesh(nullptr), + stack(nullptr), doMore(0) {} diff --git a/AMDiS/src/CoarseningManager1d.cc b/AMDiS/src/CoarseningManager1d.cc index 471aac93e93542bb465eaf4f82e235d4d9f04255..7bc94f0fb54d8163d56171ad803cbcc33d9c47a1 100644 --- a/AMDiS/src/CoarseningManager1d.cc +++ b/AMDiS/src/CoarseningManager1d.cc @@ -91,8 +91,8 @@ namespace AMDiS { if (mesh->getNumberOfDofs(VERTEX) && !mesh->queryCoarseDOFs()) { int node = mesh->getNode(VERTEX); - parent->setDof(node+0, const_cast<int*>( child[0]->getDof(node+0))); - parent->setDof(node+1, const_cast<int*>( child[1]->getDof(node+1))); + parent->setDof(node+0, const_cast<DegreeOfFreedom*>( child[0]->getDof(node+0))); + parent->setDof(node+1, const_cast<DegreeOfFreedom*>( child[1]->getDof(node+1))); } if (mesh->getNumberOfDofs(CENTER) && !mesh->queryCoarseDOFs()) { @@ -123,19 +123,19 @@ namespace AMDiS { if (mesh->getNumberOfDofs(VERTEX)) /*--- midpoint of parent ---*/ { - mesh->freeDof(const_cast<int*>( child[1]->getDof(mesh->getNode(VERTEX))), VERTEX); + mesh->freeDof(const_cast<DegreeOfFreedom*>( child[1]->getDof(mesh->getNode(VERTEX))), VERTEX); } if (mesh->getNumberOfDofs(CENTER)) /*--- center of the children ---*/ { - mesh->freeDof(const_cast<int*>( child[0]->getDof(mesh->getNode(CENTER))), CENTER); - mesh->freeDof(const_cast<int*>( child[1]->getDof(mesh->getNode(CENTER))), CENTER); + mesh->freeDof(const_cast<DegreeOfFreedom*>( child[0]->getDof(mesh->getNode(CENTER))), CENTER); + mesh->freeDof(const_cast<DegreeOfFreedom*>( child[1]->getDof(mesh->getNode(CENTER))), CENTER); } parent->coarsenElementData(child[0], child[1]); - parent->setFirstChild(NULL); - parent->setSecondChild(NULL); + parent->setFirstChild(nullptr); + parent->setSecondChild(nullptr); mesh->freeElement(child[0]); mesh->freeElement(child[1]); diff --git a/AMDiS/src/CoarseningManager2d.cc b/AMDiS/src/CoarseningManager2d.cc index b7aaee771b22dcfe842eb41a7301576e48805af6..d999fe2898b55a6bb1c65a450f336ad6eec0f039 100644 --- a/AMDiS/src/CoarseningManager2d.cc +++ b/AMDiS/src/CoarseningManager2d.cc @@ -52,20 +52,20 @@ namespace AMDiS { // remove dof from common edge of child[0] and child[1] if (mesh->getNumberOfDofs(EDGE)) - mesh->freeDof(const_cast<int*>(child[0]->getDof(4)), EDGE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[0]->getDof(4)), EDGE); // remove dof from the barycenters of child[0] and child[1] if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); - mesh->freeDof(const_cast<int*>(child[0]->getDof(node)), CENTER); - mesh->freeDof(const_cast<int*>(child[1]->getDof(node)), CENTER); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[0]->getDof(node)), CENTER); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[1]->getDof(node)), CENTER); } el->coarsenElementData(child[0], child[1]); - el->setFirstChild(NULL); - el->setSecondChild(NULL); + el->setFirstChild(nullptr); + el->setSecondChild(nullptr); mesh->freeElement(child[0]); mesh->freeElement(child[1]); @@ -92,10 +92,10 @@ namespace AMDiS { dynamic_cast<Triangle*>(const_cast<Element*>(coarsenList.getElement(1))); DegreeOfFreedom *dof[3]; - dof[0] = const_cast<int*>(el->getChild(0)->getDof(2)); + dof[0] = const_cast<DegreeOfFreedom*>(el->getChild(0)->getDof(2)); if (mesh->getNumberOfDofs(EDGE)) { - dof[1] = const_cast<int*>(el->getChild(0)->getDof(3)); - dof[2] = const_cast<int*>(el->getChild(1)->getDof(4)); + dof[1] = const_cast<DegreeOfFreedom*>(el->getChild(0)->getDof(3)); + dof[2] = const_cast<DegreeOfFreedom*>(el->getChild(1)->getDof(4)); } else { dof[1] = dof[2] = 0; } @@ -107,7 +107,7 @@ namespace AMDiS { if (!el->getDof(node + 2)) { el->setDof(node + 2, mesh->getDof(EDGE)); if (neigh) - neigh->setDof(node + 2, const_cast<int*>(el->getDof(node + 2))); + neigh->setDof(node + 2, const_cast<DegreeOfFreedom*>(el->getDof(node + 2))); } } @@ -171,11 +171,11 @@ namespace AMDiS { // give the refinement edge the right orientation if (el->getDof(0,0) < el->getDof(1,0)) { - edge[0] = const_cast<int*>(el->getDof(0)); - edge[1] = const_cast<int*>(el->getDof(1)); + edge[0] = const_cast<DegreeOfFreedom*>(el->getDof(0)); + edge[1] = const_cast<DegreeOfFreedom*>(el->getDof(1)); } else { - edge[1] = const_cast<int*>(el->getDof(0)); - edge[0] = const_cast<int*>(el->getDof(1)); + edge[1] = const_cast<DegreeOfFreedom*>(el->getDof(0)); + edge[0] = const_cast<DegreeOfFreedom*>(el->getDof(1)); } coarse_list.setElement(0, el, true); @@ -197,7 +197,7 @@ namespace AMDiS { DegreeOfFreedom *next_edge[2]; RCNeighbourList periodicList; - while (edge[0] != NULL) { + while (edge[0] != nullptr) { coarse_list.periodicSplit(edge, next_edge, &n_neigh, &n_neigh_periodic, periodicList); diff --git a/AMDiS/src/CoarseningManager3d.cc b/AMDiS/src/CoarseningManager3d.cc index acd78fefd0facb2209147f1c27a48d03e9bd3589..ef578c591b355b81e886543b1ba046bd9a8209f3 100644 --- a/AMDiS/src/CoarseningManager3d.cc +++ b/AMDiS/src/CoarseningManager3d.cc @@ -179,7 +179,7 @@ namespace AMDiS { DegreeOfFreedom *next_edge[2]; RCNeighbourList periodicList; - while (edge[0] != NULL) { + while (edge[0] != nullptr) { coarsenList.periodicSplit(edge, next_edge, &n_neigh, &n_neigh_periodic, periodicList); @@ -226,13 +226,13 @@ namespace AMDiS { if (mesh->getNumberOfDofs(EDGE)) { int node = mesh->getNode(EDGE) + Tetrahedron::nChildEdge[el_type][0][dir]; - mesh->freeDof(const_cast<int*>(child[0]->getDof(node)), EDGE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[0]->getDof(node)), EDGE); } if (mesh->getNumberOfDofs(FACE)) { int node = mesh->getNode(FACE) + Tetrahedron::nChildFace[el_type][0][dir]; - mesh->freeDof(const_cast<int*>(child[0]->getDof(node)), FACE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[0]->getDof(node)), FACE); node = mesh->getNode(FACE) + Tetrahedron::nChildFace[el_type][1][dir]; - mesh->freeDof(const_cast<int*>(child[1]->getDof(node)), FACE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[1]->getDof(node)), FACE); } } } @@ -244,14 +244,14 @@ namespace AMDiS { if (mesh->getNumberOfDofs(FACE)) { int node = mesh->getNode(FACE); - mesh->freeDof(const_cast<int*>(child[0]->getDof(node)), FACE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[0]->getDof(node)), FACE); } if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); for (int i = 0; i < 2; i++) - mesh->freeDof(const_cast<int*>(child[i]->getDof(node)), CENTER); + mesh->freeDof(const_cast<DegreeOfFreedom*>(child[i]->getDof(node)), CENTER); } /****************************************************************************/ @@ -260,8 +260,8 @@ namespace AMDiS { el->coarsenElementData(child[0], child[1], el_type); - el->setFirstChild(NULL); - el->setSecondChild(NULL); + el->setFirstChild(nullptr); + el->setSecondChild(nullptr); mesh->freeElement(child[0]); mesh->freeElement(child[1]); @@ -307,7 +307,7 @@ namespace AMDiS { dynamic_cast<Tetrahedron*>(const_cast<Element*>(elInfo->getElement())); Tetrahedron *neigh = dynamic_cast<Tetrahedron*>(const_cast<Element*>(elInfo->getNeighbour(3 - dir))); - if (neigh == NULL) + if (neigh == nullptr) return true; int opp_v = elInfo->getOppVertex(3 - dir); @@ -443,7 +443,7 @@ namespace AMDiS { Tetrahedron *el = dynamic_cast<Tetrahedron*>(const_cast<Element*>(coarsenList.getElement(0))); - DegreeOfFreedom *dof = NULL; + DegreeOfFreedom *dof = nullptr; TEST_EXIT_DBG(el)("No element!\n"); TEST_EXIT_DBG(el->getChild(0))("No child in element!\n"); @@ -452,7 +452,7 @@ namespace AMDiS { // === Get dof for coarsening edge. === int node = mesh->getNode(EDGE); - if (!(dof = const_cast<int*>(el->getDof(node)))) + if (!(dof = const_cast<DegreeOfFreedom*>(el->getDof(node)))) dof = mesh->getDof(EDGE); } @@ -477,20 +477,20 @@ namespace AMDiS { // === And now start to coarsen the patch: remove dof's of the coarsening edge. === - mesh->freeDof(const_cast<int*>(el->getChild(0)->getDof(3)), VERTEX); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getChild(0)->getDof(3)), VERTEX); mesh->incrementNumberOfVertices(-1); if (mesh->getNumberOfDofs(EDGE)) { int node = mesh->getNode(EDGE) + 2; - mesh->freeDof(const_cast<int*>(el->getChild(0)->getDof(node)), EDGE); - mesh->freeDof(const_cast<int*>(el->getChild(1)->getDof(node)), EDGE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getChild(0)->getDof(node)), EDGE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getChild(1)->getDof(node)), EDGE); } if (coarsenList.getElement(0)->isNewCoordSet()) coarsenList.getElement(0)->eraseNewCoord(); for (int i = 0; i < n_neigh; i++) { - coarsenList.getElement(i)->setNewCoord(NULL); + coarsenList.getElement(i)->setNewCoord(nullptr); coarsenTetrahedron(coarsenList, i); } diff --git a/AMDiS/src/ComponentTraverseInfo.cc b/AMDiS/src/ComponentTraverseInfo.cc index 262d05ed3851aa470cdb098b19b8c378b283c9bf..b77d7ab175bcb4f46cabe809cbd7d9dcdb1349ef 100644 --- a/AMDiS/src/ComponentTraverseInfo.cc +++ b/AMDiS/src/ComponentTraverseInfo.cc @@ -32,13 +32,13 @@ namespace AMDiS { void SingleComponentInfo::updateStatus() { - if (rowFeSpace == NULL) { + if (rowFeSpace == nullptr) { status = SingleComponentInfo::EMPTY; return; } - if (colFeSpace == NULL || - (colFeSpace != NULL && rowFeSpace->getMesh() == colFeSpace->getMesh())) { + if (colFeSpace == nullptr || + (colFeSpace != nullptr && rowFeSpace->getMesh() == colFeSpace->getMesh())) { if (auxFeSpaces.size() == 0) { status = SingleComponentInfo::EQ_SPACES_NO_AUX; } else { @@ -91,7 +91,7 @@ namespace AMDiS { const FiniteElemSpace* rowFeSpace = getRowFeSpace(row); - TEST_EXIT_DBG(rowFeSpace != NULL)("No row FE space!\n"); + TEST_EXIT_DBG(rowFeSpace != nullptr)("No row FE space!\n"); for (int i = 0; i < nComponents; i++) { if (matrixComponents[row][i].getColFeSpace() != rowFeSpace) @@ -103,7 +103,7 @@ namespace AMDiS { if (vectorComponents[row].getAuxFeSpace() != rowFeSpace) return vectorComponents[row].getAuxFeSpace(); - return NULL; + return nullptr; } } diff --git a/AMDiS/src/ComponentTraverseInfo.h b/AMDiS/src/ComponentTraverseInfo.h index 991bfe64142d0d87ccdcc8ee7f801c0f0f2aa9f9..7e7ae9bfbcf91ee26824f7a23f395ea7b19a074c 100644 --- a/AMDiS/src/ComponentTraverseInfo.h +++ b/AMDiS/src/ComponentTraverseInfo.h @@ -35,12 +35,12 @@ namespace AMDiS { { public: SingleComponentInfo() - : rowFeSpace(NULL), - colFeSpace(NULL), + : rowFeSpace(nullptr), + colFeSpace(nullptr), status(0) {} - void setFeSpace(const FiniteElemSpace *row, const FiniteElemSpace *col = NULL) + void setFeSpace(const FiniteElemSpace *row, const FiniteElemSpace *col = nullptr) { rowFeSpace = row; colFeSpace = col; @@ -58,7 +58,7 @@ namespace AMDiS { bool hasFeSpace() { - return rowFeSpace != NULL; + return rowFeSpace != nullptr; } void updateStatus(); @@ -87,7 +87,7 @@ namespace AMDiS { if (auxFeSpaces.size() == 1) return (*(auxFeSpaces.begin())); - return NULL; + return nullptr; } inline int getStatus() const diff --git a/AMDiS/src/CouplingIterationInterface.cc b/AMDiS/src/CouplingIterationInterface.cc index 0cc7f7371b4f02d4b3d9f4edbce58a81b2bbcb2d..c329559adcf7d409049ff8fba5bfae14ad1d2724 100644 --- a/AMDiS/src/CouplingIterationInterface.cc +++ b/AMDiS/src/CouplingIterationInterface.cc @@ -108,14 +108,14 @@ namespace AMDiS { throw(std::runtime_error("Problem number out of range.")); size_t sum = 0; - ProblemStatBase *probIter = NULL; + ProblemStatBase *probIter = nullptr; for (size_t i = 0; i < problems.size(); ++i) { if (sum + problems[i]->getNumProblems() <= static_cast<size_t>(number)) sum += problems[i]->getNumProblems(); else probIter = problems[i]->getProblem(number - sum); } - if (probIter == NULL) + if (probIter == nullptr) throw(std::runtime_error("Problem not found. Should not happen, since number is in range.")); return probIter; } diff --git a/AMDiS/src/CouplingProblemStat.h b/AMDiS/src/CouplingProblemStat.h index 10d04cc84e4cae2eb70db5972acfbbcf9b3bdce3..2c092ffdaa3ff9479240b38ee66387a79a64933c 100644 --- a/AMDiS/src/CouplingProblemStat.h +++ b/AMDiS/src/CouplingProblemStat.h @@ -51,8 +51,8 @@ namespace AMDiS { : name(name_), nComponents(0), nMeshes(0), - refinementManager(NULL), - coarseningManager(NULL) + refinementManager(nullptr), + coarseningManager(nullptr) {} /// Destructor @@ -67,12 +67,12 @@ namespace AMDiS { /// Initialisation of the problem. virtual void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = NULL, + ProblemStatSeq *adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING) { // create one refinement-/coarseningmanager for all problems - if (refinementManager != NULL && coarseningManager != NULL) { + if (refinementManager != nullptr && coarseningManager != nullptr) { WARNING("refinement-/coarseningmanager already created\n"); } else { if (!adoptProblem) @@ -83,7 +83,7 @@ namespace AMDiS { } } - if (refinementManager == NULL || coarseningManager == NULL) + if (refinementManager == nullptr || coarseningManager == nullptr) WARNING("no refinement-/coarseningmanager created\n"); // create Meshes and FeSpaces @@ -125,12 +125,12 @@ namespace AMDiS { Parameters::get(problems[i]->getName() + "->polynomial degree[" + boost::lexical_cast<string>(j) + "]", degree); - if (feSpaceMap[pair<Mesh*, int>(meshByName[meshName], degree)] == NULL) { + if (feSpaceMap[pair<Mesh*, int>(meshByName[meshName], degree)] == nullptr) { stringstream s; s << problems[i]->getName() << "->feSpace[" << j << "]"; FiniteElemSpace *newFeSpace = - FiniteElemSpace::provideFeSpace(NULL, Lagrange::getLagrange(dim, degree), + FiniteElemSpace::provideFeSpace(nullptr, Lagrange::getLagrange(dim, degree), meshByName[meshName], s.str()); feSpaceMap[pair<Mesh*, int>(meshByName[meshName], degree)] = newFeSpace; feSpaces.push_back(newFeSpace); diff --git a/AMDiS/src/CreatorInterface.h b/AMDiS/src/CreatorInterface.h index e9d199675a72ec01f966a6fc1e9f55bf2fad281c..05a42010590d2d63eb9cba2e8da1647abb5368cd 100644 --- a/AMDiS/src/CreatorInterface.h +++ b/AMDiS/src/CreatorInterface.h @@ -69,7 +69,7 @@ namespace AMDiS { }; /** \brief - * A Creator which creates no object abd returns NULL instead. + * A Creator which creates no object abd returns nullptr instead. * Used together with the key word 'no' in CreatorMap. */ template<typename BaseClass> @@ -78,13 +78,13 @@ namespace AMDiS { /// Creates no object. BaseClass* create() { - return NULL; + return nullptr; } virtual ~NullCreator() {} - /// - virtual bool isNullCreator() + /// Implementation of \ref CreatorInterface::isNullCreator() + bool isNullCreator() override { return true; } diff --git a/AMDiS/src/CreatorMap.h b/AMDiS/src/CreatorMap.h index e87de3a9d4c445f36a4ab61baa2855e67c005228..212fd6727c0ae0fabaae392cfbd1942bf62872cb 100644 --- a/AMDiS/src/CreatorMap.h +++ b/AMDiS/src/CreatorMap.h @@ -49,10 +49,15 @@ namespace AMDiS { { FUNCNAME("CreatorMap::addCreator()"); init(); - TEST_EXIT(creatorMap[key] == NULL) + TEST_EXIT(creatorMap[key] == nullptr) ("there is already a creator for key %s\n",key.c_str()); creatorMap[key] = creator; } + + static void addCreator(std::string backend, std::string key, CreatorInterface<BaseClass>* creator) + { + addCreator(backend + "_" + key, creator); + } /// Creates a object of the type corresponding to key. static CreatorInterface<BaseClass>* getCreator(std::string key, diff --git a/AMDiS/src/DOFAdmin.cc b/AMDiS/src/DOFAdmin.cc index 54b4287f5d3e4364593f776a24fa226f9d14bb2a..9a6115e9dab462ddea7f864e0684866b15f67894 100644 --- a/AMDiS/src/DOFAdmin.cc +++ b/AMDiS/src/DOFAdmin.cc @@ -113,7 +113,7 @@ namespace AMDiS { } - void DOFAdmin::freeDofIndex(int dof) + void DOFAdmin::freeDofIndex(DegreeOfFreedom dof) { FUNCNAME_DBG("DOFAdmin::freeDofIndex()"); @@ -134,7 +134,7 @@ namespace AMDiS { dofFree[dof] = true; - if (static_cast<int>(firstHole) > dof) + if (firstHole > dof) firstHole = dof; usedCount--; @@ -142,20 +142,20 @@ namespace AMDiS { } - int DOFAdmin::getDOFIndex() + DegreeOfFreedom DOFAdmin::getDOFIndex() { FUNCNAME_DBG("DOFAdmin::getDOFIndex()"); - int dof = 0; + DegreeOfFreedom dof = 0; // if there is a hole - if (firstHole < static_cast<int>(dofFree.size())) { + if (firstHole < static_cast<DofIndex::size_type>(dofFree.size())) { TEST_EXIT_DBG(dofFree[firstHole])("no hole at firstHole!\n"); // its no longer a hole dofFree[firstHole] = false; dof = firstHole; // search new hole - int dfsize = static_cast<int>(dofFree.size()); - int i = firstHole + 1; + DofIndex::size_type dfsize = static_cast<DofIndex::size_type>(dofFree.size()); + DofIndex::size_type i = firstHole + 1; for (; i < dfsize; i++) if (dofFree[i]) break; @@ -165,7 +165,7 @@ namespace AMDiS { // enlarge dof-list enlargeDofLists(); - TEST_EXIT_DBG(firstHole < static_cast<int>(dofFree.size())) + TEST_EXIT_DBG(firstHole < static_cast<DofIndex::size_type>(dofFree.size())) ("no free entry after enlargeDofLists\n"); TEST_EXIT_DBG(dofFree[firstHole])("no free bit at firstHole\n"); dofFree[firstHole] = false; @@ -184,12 +184,13 @@ namespace AMDiS { void DOFAdmin::enlargeDofLists(int minsize) { - int old = size; + DofIndex::size_type old = size; if (minsize > 0) if (old > minsize) return; - int newval = std::max(minsize, static_cast<int>((dofFree.size() + sizeIncrement))); + DofIndex::size_type newval = std::max(static_cast<DofIndex::size_type>(minsize), + static_cast<DofIndex::size_type>((dofFree.size() + sizeIncrement))); size = newval; diff --git a/AMDiS/src/DOFAdmin.h b/AMDiS/src/DOFAdmin.h index 4258985fae987b0ae534760b0ecdd7d4bcb07ad0..6260940a8235d32f211fc97e6b9ca6441af04080 100644 --- a/AMDiS/src/DOFAdmin.h +++ b/AMDiS/src/DOFAdmin.h @@ -123,25 +123,25 @@ namespace AMDiS { */ /// Returns \ref sizeUsed. - inline int getUsedSize() const + inline DofIndex::size_type getUsedSize() const { return sizeUsed; } /// Returns \ref size - inline int getSize() const + inline DofIndex::size_type getSize() const { return size; } /// Returns \ref usedCount - inline int getUsedDofs() const + inline DofIndex::size_type getUsedDofs() const { return usedCount; } /// Returns \ref holeCount - inline int getHoleCount() const + inline DofIndex::size_type getHoleCount() const { return holeCount; } @@ -189,31 +189,31 @@ namespace AMDiS { } /// Returns if the given DOF is free. - inline bool isDofFree(int i) const + inline bool isDofFree(DofIndex::size_type i) const { return dofFree[i]; } /// Sets a DOF to be free or not. - inline void setDofFree(int i, bool b) + inline void setDofFree(DofIndex::size_type i, bool b) { dofFree[i] = b; } /// Sets \ref usedSize. - inline void setUsedSize(int i) + inline void setUsedSize(DofIndex::size_type i) { sizeUsed = i; } /// Sets \ref usedCount. - inline void setUsedCount(int i) + inline void setUsedCount(DofIndex::size_type i) { usedCount = i; } /// Sets \ref firstHole - inline void setFirstHole(int i) + inline void setFirstHole(DofIndex::size_type i) { TEST_EXIT_DBG(dofFree[i])("There is no hole!\n"); @@ -262,10 +262,10 @@ namespace AMDiS { * Adds one index to all DOF lists. Used by Mesh::getDof() to provide * DOFS for a specific position */ - int getDOFIndex(); + DegreeOfFreedom getDOFIndex(); /// Frees index DOF. Used by Mesh::getDof() - void freeDofIndex(int dof); + void freeDofIndex(DegreeOfFreedom dof); /// void serialize(std::ostream &out); @@ -284,19 +284,19 @@ namespace AMDiS { std::vector<bool> dofFree; /// index of the first free value in \ref dofFree - int firstHole; + DegreeOfFreedom firstHole; /// allocated size of managed vectors and matrices - int size; + DofIndex::size_type size; /// number of used DOF indices - int usedCount; + DofIndex::size_type usedCount; /// number of FREED DOF indices (NOT size - sizeUsed) - int holeCount; + DofIndex::size_type holeCount; /// > max. index of a used entry - int sizeUsed; + DofIndex::size_type sizeUsed; /** \brief * Number of dofs for each position, i.e., vertex, edge, ..., center, diff --git a/AMDiS/src/DOFContainer.h b/AMDiS/src/DOFContainer.h index 60dba6b3762e0dc0f1148103768bcf1c598dbec2..fb6d998480adb29a75f889f8bd1e2eee9520c446 100644 --- a/AMDiS/src/DOFContainer.h +++ b/AMDiS/src/DOFContainer.h @@ -45,7 +45,7 @@ namespace AMDiS { * Returns the DOF index at position i. Must be overriden by a concrete * DOFContainer. */ - virtual DegreeOfFreedom& operator[](int i) = 0; + virtual DegreeOfFreedom& operator[](DegreeOfFreedom i) = 0; virtual void freeDofIndex(DegreeOfFreedom dof) {} @@ -57,8 +57,8 @@ namespace AMDiS { { FUNCNAME_DBG("DOFContainer::compressDofContainer()"); - for (int i = 0; i < size; i++) { - int j = newDOF[operator[](i)]; + for (DegreeOfFreedom i = 0; i < size; i++) { + DegreeOfFreedom j = newDOF[operator[](i)]; TEST_EXIT_DBG(j >= 0) ("Invalid DOF %d in DOF container! (%d %d)\n", j, i, operator[](i)); diff --git a/AMDiS/src/DOFIndexed.h b/AMDiS/src/DOFIndexed.h index 56650f61b2d866556fa70c70624b829ceaf50de9..a3b89a9c8e0aa454b0c698c3911df5052ecfa4de 100644 --- a/AMDiS/src/DOFIndexed.h +++ b/AMDiS/src/DOFIndexed.h @@ -64,7 +64,7 @@ namespace AMDiS { /// Performs needed action when a DOF index is freed. Can be overriden in /// sub classes. The default behavior is to do nothing. - virtual void freeDOFContent(int) {} + virtual void freeDOFContent(DegreeOfFreedom) {} /// Interpolation after refinement. Can be overriden in subclasses. /// The default behavior is to do nothing. diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc index b7aace6a9b18fa238b6346075c8a9a1c453e5feb..bb9741c0fc7167821942ef7b74913cf40f3d5c88 100644 --- a/AMDiS/src/DOFMatrix.cc +++ b/AMDiS/src/DOFMatrix.cc @@ -41,13 +41,13 @@ namespace AMDiS { using namespace mtl; DOFMatrix::DOFMatrix() - : rowFeSpace(NULL), - colFeSpace(NULL), + : rowFeSpace(nullptr), + colFeSpace(nullptr), elementMatrix(3, 3), nRow(0), nCol(0), nnzPerRow(0), - inserter(NULL) + inserter(nullptr) {} @@ -59,7 +59,7 @@ namespace AMDiS { name(n), coupleMatrix(false), nnzPerRow(0), - inserter(NULL) + inserter(nullptr) { FUNCNAME("DOFMatrix::DOFMatrix()"); @@ -165,7 +165,7 @@ namespace AMDiS { if (rhs.boundaryManager) boundaryManager = new BoundaryManager(*rhs.boundaryManager); else - boundaryManager = NULL; + boundaryManager = nullptr; nRow = rhs.nRow; nCol = rhs.nCol; @@ -213,7 +213,7 @@ namespace AMDiS { DegreeOfFreedom row = rowIndices[i]; BoundaryCondition *condition = - bound ? boundaryManager->getBoundaryCondition(bound[i]) : NULL; + bound ? boundaryManager->getBoundaryCondition(bound[i]) : nullptr; if (condition && condition->isDirichlet()) { if (condition->applyBoundaryCondition()) @@ -307,14 +307,14 @@ namespace AMDiS { std::vector<double*>::iterator factorIt = operatorFactor.begin(); for (; it != operators.end(); ++it, ++factorIt) if ((*it)->getNeedDualTraverse() == false && - (*factorIt == NULL || **factorIt != 0.0)) + (*factorIt == nullptr || **factorIt != 0.0)) (*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0); if (factor != 1.0) elementMatrix *= factor; if (operators.size()) - addElementMatrix(elementMatrix, bound, elInfo, NULL); + addElementMatrix(elementMatrix, bound, elInfo, nullptr); } @@ -333,7 +333,7 @@ namespace AMDiS { if (factor != 1.0) elementMatrix *= factor; - addElementMatrix(elementMatrix, bound, elInfo, NULL); + addElementMatrix(elementMatrix, bound, elInfo, nullptr); } @@ -409,7 +409,7 @@ namespace AMDiS { if (factor != 1.0) elementMatrix *= factor; - addElementMatrix(elementMatrix, bound, mainElInfo, NULL); + addElementMatrix(elementMatrix, bound, mainElInfo, nullptr); } @@ -532,9 +532,9 @@ namespace AMDiS { // Do the following only in sequential code. In parallel mode, the specific // solver method must care about dirichlet boundary conditions. inserter_type &ins = *inserter; - for (std::set<int>::iterator it = dirichletDofs.begin(); + for (std::set<DegreeOfFreedom>::iterator it = dirichletDofs.begin(); it != dirichletDofs.end(); ++it) - ins[*it][*it] = 1.0; + ins[(*it)][(*it)] = 1.0; } @@ -549,7 +549,7 @@ namespace AMDiS { { if (inserter) { delete inserter; - inserter = NULL; + inserter = nullptr; } inserter = new inserter_type(matrix, nnz_per_row); diff --git a/AMDiS/src/DOFMatrix.h b/AMDiS/src/DOFMatrix.h index 32dd045f00683d66c8b129e7c24242078f7fedf0..c8ec93dee3bb421db704d729fe741f283bf1ddcc 100644 --- a/AMDiS/src/DOFMatrix.h +++ b/AMDiS/src/DOFMatrix.h @@ -132,13 +132,13 @@ namespace AMDiS { } bool dummy; // Must be deleted later - bool& operator[](int i) + bool& operator[](DegreeOfFreedom i) { ERROR_EXIT("Shouldn't be used, only fake."); return dummy; } - const bool& operator[](int i) const + const bool& operator[](DegreeOfFreedom i) const { ERROR_EXIT("Shouldn't be used, only fake."); return dummy; @@ -172,8 +172,8 @@ namespace AMDiS { /// Adds an operator to the DOFMatrix. A factor, that is multipled to the /// operator, and a multilier factor for the estimator may be also given. void addOperator(Operator *op, - double* factor = NULL, - double* estFactor = NULL); + double* factor = nullptr, + double* estFactor = nullptr); /// void clearOperators(); @@ -218,12 +218,12 @@ namespace AMDiS { * minfo->fill_flags which specifies the elements to be visited and * information that should be present on the elements for the calculation of * the element matrices and boundary information (if minfo->boundBas is not - * NULL). On the elements, information about the row DOFs is accessed by + * nullptr). On the elements, information about the row DOFs is accessed by * minfo->rowBas using info->row_admin; this vector is also used for the * column DOFs if minfo->nCol is less or equal zero, or minfo->col_admin or - * minfo->colBas is a NULL pointer; if row and column DOFs are the same, the + * minfo->colBas is a nullptr pointer; if row and column DOFs are the same, the * boundary type of the DOFs is accessed by minfo->boundBas if - * minfo->boundBas is not a NULL pointer; then the element matrix is + * minfo->boundBas is not a nullptr pointer; then the element matrix is * computed by minfo->fillElementMatrix(el info, minfo->myFill); these * contributions, multiplied by minfo->factor, are eventually added to matrix * by a call of addElementMatrix() with all information about row and column @@ -242,13 +242,13 @@ namespace AMDiS { ElInfo *rowElInfo, ElInfo *colElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, const BoundaryType *bound, - Operator *op = NULL); + Operator *op = nullptr); void assemble2(double factor, ElInfo *mainElInfo, ElInfo *auxElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, const BoundaryType *bound, - Operator *op = NULL); + Operator *op = nullptr); /// Adds an element matrix to \ref matrix void addElementMatrix(const ElementMatrix& elMat, diff --git a/AMDiS/src/DOFVector.cc b/AMDiS/src/DOFVector.cc index 192a7f8ad6450e1873d63a4e26fc612bb8293302..ef7f4defbc591854235ba3a398dca0548c3f9701 100644 --- a/AMDiS/src/DOFVector.cc +++ b/AMDiS/src/DOFVector.cc @@ -94,10 +94,10 @@ namespace AMDiS { bool inside = false; if (oldElInfo && oldElInfo->getMacroElement()) { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), NULL, NULL); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), nullptr, nullptr); delete oldElInfo; } else - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, NULL, NULL, NULL); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, nullptr, nullptr, nullptr); if (oldElInfo) oldElInfo = elInfo; @@ -117,7 +117,7 @@ namespace AMDiS { } - if (oldElInfo == NULL) + if (oldElInfo == nullptr) delete elInfo; return value; @@ -141,10 +141,10 @@ namespace AMDiS { bool inside = false; if (oldElInfo && oldElInfo->getMacroElement()) { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), NULL, NULL); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), nullptr, nullptr); delete oldElInfo; } else - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, NULL, NULL, NULL); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, nullptr, nullptr, nullptr); if (oldElInfo) oldElInfo = elInfo; @@ -159,7 +159,7 @@ namespace AMDiS { ERROR_EXIT("Can not eval DOFVector at point p, because point is outside geometry."); } - if (oldElInfo == NULL) + if (oldElInfo == nullptr) delete elInfo; return value; @@ -215,7 +215,7 @@ namespace AMDiS { mtl::dense_vector<double> uh_vec(nPoints); double det = elInfo->calcSurfaceDet(*coords[face]); double normT = 0.0; - this->getVecAtQPs(elInfo, quadSurfaces[face], NULL, uh_vec); + this->getVecAtQPs(elInfo, quadSurfaces[face], nullptr, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadSurfaces[face]->getWeight(iq) * (uh_vec[iq]); result += det * normT; @@ -286,7 +286,7 @@ namespace AMDiS { int nPoints = quadSurfaces[face]->getNumPoints(); mtl::dense_vector<WorldVector<double> > uh_vec(nPoints); WorldVector<double> normT; normT.set(0.0); - this->getVecAtQPs(elInfo, quadSurfaces[face], NULL, uh_vec); + this->getVecAtQPs(elInfo, quadSurfaces[face], nullptr, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadSurfaces[face]->getWeight(iq) * (uh_vec[iq]); // scalar product between vector-valued solution and normal vector @@ -404,7 +404,7 @@ namespace AMDiS { ElementVector sourceLocalCoeffs(nSourceBasisFcts); if (feSpace->getMesh() == sourceFeSpace->getMesh()) { - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -478,7 +478,7 @@ namespace AMDiS { this->set(nul); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; const FiniteElemSpace *vFeSpace = v->getFeSpace(); if (feSpace == vFeSpace) @@ -531,7 +531,7 @@ namespace AMDiS { DOFAdmin *admin = feSpace->getAdmin(); // define result vector - static WorldVector<DOFVector<double>*> *result = NULL; + static WorldVector<DOFVector<double>*> *result = nullptr; if (grad) { result = grad; @@ -539,7 +539,7 @@ namespace AMDiS { if (!result) { result = new WorldVector<DOFVector<double>*>; - result->set(NULL); + result->set(nullptr); } for (int i = 0; i < dow; i++) { if ((*result)[i] && (*result)[i]->getFeSpace() != feSpace) { @@ -630,7 +630,7 @@ namespace AMDiS { TEST_EXIT_DBG(vec)("no vector\n"); int dow = Global::getGeo(WORLD); - static WorldVector<DOFVector<double>*> *result = NULL; + static WorldVector<DOFVector<double>*> *result = nullptr; if (!res && !result) { result = new WorldVector<DOFVector<double>*>; diff --git a/AMDiS/src/DOFVector.h b/AMDiS/src/DOFVector.h index 1a4473acd3990d4ebb17f5bf6a412b161217f986..333aa9388ee0e09ce4e656ecda99024a54934fda 100644 --- a/AMDiS/src/DOFVector.h +++ b/AMDiS/src/DOFVector.h @@ -55,9 +55,9 @@ namespace AMDiS { public: DOFVectorBase() - : feSpace(NULL), + : feSpace(nullptr), elementVector(3), - boundaryManager(NULL), + boundaryManager(nullptr), nBasFcts(0) {} @@ -128,13 +128,13 @@ namespace AMDiS { /// element matrix to the current DOF vector. void assemble(T factor, ElInfo *elInfo, const BoundaryType *bound, - Operator *op = NULL); + Operator *op = nullptr); void assemble2(T factor, ElInfo *mainElInfo, ElInfo *auxElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, const BoundaryType *bound, - Operator *op = NULL); + Operator *op = nullptr); void addElementVector(T sign, const ElementVector& elVec, @@ -148,8 +148,8 @@ namespace AMDiS { void finishAssembling(); inline void addOperator(Operator* op, - double *factor = NULL, - double *estFactor = NULL) + double *factor = nullptr, + double *estFactor = nullptr) { operators.push_back(op); operatorFactor.push_back(factor); @@ -460,7 +460,7 @@ namespace AMDiS { } /// Calculates Integral of this DOFVector - double Int(Quadrature* q = NULL) const + double Int(Quadrature* q = nullptr) const { return Int(-1, q); } @@ -475,12 +475,12 @@ namespace AMDiS { * \param[in] q Quadrature object. If not specified, the function * creates a new quadrature object. */ - double Int(int meshLevel, Quadrature* q = NULL) const; + double Int(int meshLevel, Quadrature* q = nullptr) const; /// Calculates Integral of this DOFVector over parts of the domain /// boundary, indicated by boundaryType. Implemented for DOFVector<double> - T IntOnBoundary(BoundaryType boundary, Quadrature* q = NULL) const + T IntOnBoundary(BoundaryType boundary, Quadrature* q = nullptr) const { FUNCNAME("DOFVector::IntOnBoundary())"); TEST_EXIT(false)("Please implement your integration\n"); @@ -490,7 +490,7 @@ namespace AMDiS { /// Calculates Integral of this DOFVector times normal vector over parts /// of the domain boundary, indicated by boundaryType. Implemented for /// DOFVector<WorldVector<double> > - double IntOnBoundaryNormal(BoundaryType boundary, Quadrature* q = NULL) const + double IntOnBoundaryNormal(BoundaryType boundary, Quadrature* q = nullptr) const { FUNCNAME("DOFVector::IntOnBoundaryNormal())"); TEST_EXIT(false)("Please implement your integration\n"); @@ -498,25 +498,25 @@ namespace AMDiS { } /// Calculates L1 norm of this DOFVector - double L1Norm(Quadrature* q = NULL) const; + double L1Norm(Quadrature* q = nullptr) const; /// Calculates L2 norm of this DOFVector - inline double L2Norm(Quadrature* q = NULL) const + inline double L2Norm(Quadrature* q = nullptr) const { return sqrt(L2NormSquare()); } /// Calculates square of L2 norm of this DOFVector - double L2NormSquare(Quadrature* q = NULL) const; + double L2NormSquare(Quadrature* q = nullptr) const; /// Calculates H1 norm of this DOFVector - inline double H1Norm(Quadrature* q = NULL) const + inline double H1Norm(Quadrature* q = nullptr) const { return sqrt(H1NormSquare()); } /// Calculates square of H1 norm of this DOFVector - double H1NormSquare(Quadrature* q = NULL) const; + double H1NormSquare(Quadrature* q = nullptr) const; /// Calculates euclidian norm of this DOFVector double nrm2() const; @@ -540,7 +540,7 @@ namespace AMDiS { } /// Calculates doublewell of this DOFVector - double DoubleWell(Quadrature* q = NULL) const; + double DoubleWell(Quadrature* q = nullptr) const; /// Calculates the sum of this DOFVector T sum() const; @@ -586,11 +586,11 @@ namespace AMDiS { void interpol(DOFVector<T> *v, double factor = 1.0); - /// Eval DOFVector at given point p. If oldElInfo != NULL the search for + /// Eval DOFVector at given point p. If oldElInfo != nullptr the search for /// the element, where p is inside, starts from oldElInfo. implemented for: /// double, WorldVector< double > T evalAtPoint(WorldVector<double> &p, - ElInfo *oldElInfo = NULL) const + ElInfo *oldElInfo = nullptr) const { FUNCNAME("DOFVector::evalAtPoint())"); TEST_EXIT(false)("Please implement your evaluation\n"); @@ -601,7 +601,7 @@ namespace AMDiS { /// otherwise. bool getDofIdxAtPoint(WorldVector<double> &p, DegreeOfFreedom &idx, - ElInfo *oldElInfo = NULL, + ElInfo *oldElInfo = nullptr, bool useOldElInfo = false) const; /// Writes the data of the DOFVector to an output stream. @@ -851,8 +851,8 @@ namespace AMDiS { inline void checkFeSpace(const FiniteElemSpace* feSpace, const std::vector<T>& vec) { FUNCNAME_DBG("checkFeSpace()"); - TEST_EXIT_DBG(feSpace)("feSpace is NULL\n"); - TEST_EXIT_DBG(feSpace->getAdmin())("admin is NULL\n"); + TEST_EXIT_DBG(feSpace)("feSpace is nullptr\n"); + TEST_EXIT_DBG(feSpace->getAdmin())("admin is nullptr\n"); TEST_EXIT_DBG(static_cast<int>(vec.size()) >= feSpace->getAdmin()->getUsedSize()) ("size = %d too small: admin->sizeUsed = %d\n", vec.size(), feSpace->getAdmin()->getUsedSize()); @@ -885,9 +885,9 @@ namespace AMDiS { template<typename TOut, typename T> TOut integrate(const DOFVector<T> &vec, - AbstractFunction<TOut, T> *fct = NULL) + AbstractFunction<TOut, T> *fct = nullptr) { - return fct == NULL ? vec.Int() : integrate_Vec(vec, fct); + return fct == nullptr ? vec.Int() : integrate_Vec(vec, fct); } /** \brief diff --git a/AMDiS/src/DOFVector.hh b/AMDiS/src/DOFVector.hh index 2b1fafefbc6b05a724af4ed9bca08216d602c7ce..5812de1379dc338490b7933183945de3add9d2fd 100644 --- a/AMDiS/src/DOFVector.hh +++ b/AMDiS/src/DOFVector.hh @@ -97,7 +97,7 @@ namespace AMDiS { : feSpace(f), name(n), elementVector(f->getBasisFcts()->getNumber()), - boundaryManager(NULL) + boundaryManager(nullptr) { nBasFcts = feSpace->getBasisFcts()->getNumber(); dim = feSpace->getMesh()->getDim(); @@ -153,9 +153,9 @@ namespace AMDiS { feSpace->getAdmin(), indices); - for (DegreeOfFreedom i = 0; i < nBasFcts; i++) { + for (int i = 0; i < nBasFcts; i++) { BoundaryCondition *condition = - bound ? this->getBoundaryManager()->getBoundaryCondition(bound[i]) : NULL; + bound ? this->getBoundaryManager()->getBoundaryCondition(bound[i]) : nullptr; if (!(condition && condition->isDirichlet())) { DegreeOfFreedom irow = indices[i]; @@ -354,7 +354,7 @@ namespace AMDiS { { FUNCNAME("DOFVector<T>::print()"); - const DOFAdmin *admin = NULL; + const DOFAdmin *admin = nullptr; const char *format; if (this->feSpace) @@ -458,7 +458,7 @@ namespace AMDiS { } if (!(fct)) { - MSG("function that should be interpolated only pointer to NULL, "); + MSG("function that should be interpolated only pointer to nullptr, "); Msg::print("skipping interpolation\n"); return; } @@ -473,7 +473,7 @@ namespace AMDiS { ElInfo *elInfo = stack.traverseFirst(this->getFeSpace()->getMesh(), -1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); while (elInfo) { - basFct->interpol(elInfo, 0, NULL, fct, fctInterpolValues); + basFct->interpol(elInfo, 0, nullptr, fct, fctInterpolValues); basFct->getLocalIndices(const_cast<Element*>(elInfo->getElement()), admin, myLocalIndices); for (int i = 0; i < nBasFcts; i++) @@ -511,7 +511,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); T normT; nullify(normT); - this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * (uh_vec[iq]); result += det * normT; @@ -691,8 +691,8 @@ namespace AMDiS { -1, -1, traverseFlag, traverseFlag, dualElInfo); while (cont) { - vec1.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, NULL, qp1); - vec2.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, NULL, qp2); + vec1.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, nullptr, qp1); + vec2.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, nullptr, qp2); TOut tmp; nullify(tmp); for (int iq = 0; iq < quad->getNumPoints(); iq++) @@ -823,7 +823,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * abs(uh_vec[iq]); result += det * normT; @@ -863,7 +863,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * sqr(uh_vec[iq]); result += det * normT; @@ -905,7 +905,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getGrdAtQPs(elInfo, NULL, quadFast, grduh_vec); + this->getGrdAtQPs(elInfo, nullptr, quadFast, grduh_vec); for (int iq = 0; iq < nPoints; iq++) { double norm2 = 0.0; @@ -949,10 +949,10 @@ namespace AMDiS { bool inside = false; if (oldElInfo && useOldElInfo && oldElInfo->getMacroElement()) { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), NULL, NULL); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), nullptr, nullptr); delete oldElInfo; } else { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, NULL, NULL, NULL); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, nullptr, nullptr, nullptr); } if (oldElInfo) @@ -1038,7 +1038,7 @@ namespace AMDiS { this->boundaryManager = new BoundaryManager(*rhs.boundaryManager); } else { - this->boundaryManager = NULL; + this->boundaryManager = nullptr; } return *this; @@ -1051,7 +1051,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator*=(DOFVector<T>& x, T scal)"); TEST_EXIT_DBG(x.getFeSpace() && x.getFeSpace()->getAdmin()) - ("pointer is NULL: %8X, %8X\n", x.getFeSpace(), x.getFeSpace()->getAdmin()); + ("pointer is nullptr: %8X, %8X\n", x.getFeSpace(), x.getFeSpace()->getAdmin()); typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&x), USED_DOFS); @@ -1068,7 +1068,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator+=(DOFVector<T>& x, const DOFVector<T>& y)"); TEST_EXIT_DBG(x.getFeSpace() && y.getFeSpace()) - ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); TEST_EXIT_DBG(x.getFeSpace()->getAdmin() && (x.getFeSpace()->getAdmin() == y.getFeSpace()->getAdmin())) ("no admin or different admins: %8X, %8X\n", @@ -1091,7 +1091,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator-=(DOFVector<T>& x, const DOFVector<T>& y)"); TEST_EXIT_DBG(x.getFeSpace() && y.getFeSpace()) - ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); TEST_EXIT_DBG(x.getFeSpace()->getAdmin() && (x.getFeSpace()->getAdmin() == y.getFeSpace()->getAdmin())) ("no admin or different admins: %8X, %8X\n", @@ -1114,7 +1114,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator*=(DOFVector<T>& x, const DOFVector<T>& y)"); TEST_EXIT_DBG(x.getFeSpace() && y.getFeSpace()) - ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); TEST_EXIT_DBG(x.getFeSpace()->getAdmin() && (x.getFeSpace()->getAdmin() == y.getFeSpace()->getAdmin())) ("no admin or different admins: %8X, %8X\n", @@ -1135,10 +1135,10 @@ namespace AMDiS { T operator*(DOFVector<T>& x, DOFVector<T>& y) { FUNCNAME("DOFVector<T>::operator*(DOFVector<T>& x, DOFVector<T>& y)"); - const DOFAdmin *admin = NULL; + const DOFAdmin *admin = nullptr; TEST_EXIT(x.getFeSpace() && y.getFeSpace()) - ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); TEST_EXIT((admin = x.getFeSpace()->getAdmin()) && (admin == y.getFeSpace()->getAdmin())) ("no admin or different admins: %8X, %8X\n", x.getFeSpace()->getAdmin(), y.getFeSpace()->getAdmin()); @@ -1167,7 +1167,7 @@ namespace AMDiS { TEST_EXIT(a.getRowFeSpace() && a.getColFeSpace() && x.getFeSpace() && result.getFeSpace()) - ("getFeSpace() is NULL: %8X, %8X, %8X, %8X\n", + ("getFeSpace() is nullptr: %8X, %8X, %8X, %8X\n", a.getRowFeSpace(), a.getColFeSpace(), x.getFeSpace(), result.getFeSpace()); const DOFAdmin *rowAdmin = a.getRowFeSpace()->getAdmin(); @@ -1224,7 +1224,7 @@ namespace AMDiS { FUNCNAME("DOFVector<T>::axpy()"); TEST_EXIT(x.getFeSpace() && y.getFeSpace()) - ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); const DOFAdmin *admin = x.getFeSpace()->getAdmin(); @@ -1276,7 +1276,7 @@ namespace AMDiS { FUNCNAME("DOFVector<T>::xpay()"); TEST_EXIT(x.getFeSpace() && y.getFeSpace()) - ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); const DOFAdmin *admin = x.getFeSpace()->getAdmin(); @@ -1351,7 +1351,7 @@ namespace AMDiS { TEST_EXIT_DBG(feSpace->getMesh() == el->getMesh()) ("Element is defined on a different mesh than the DOF vector!\n"); - std::vector<int> localIndices(nBasFcts); + std::vector<DegreeOfFreedom> localIndices(nBasFcts); const DOFAdmin* admin = feSpace->getAdmin(); feSpace->getBasisFcts()->getLocalIndices(el, admin, localIndices); @@ -1740,7 +1740,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * sqr(uh_vec[iq]) * sqr(1.0 - uh_vec[iq]); result += det * normT; @@ -1765,7 +1765,7 @@ namespace AMDiS { const FiniteElemSpace *feSpace = DOFVector<T>::feSpace; // define result vector - static DOFVector<typename GradientType<T>::type> *result = NULL; + static DOFVector<typename GradientType<T>::type> *result = nullptr; if (grad) { result = grad; @@ -1850,14 +1850,14 @@ namespace AMDiS { int dim = DOFVector<T>::dim; // define result vector - static DOFVector<typename GradientType<T>::type> *vec = NULL; + static DOFVector<typename GradientType<T>::type> *vec = nullptr; DOFVector<typename GradientType<T>::type> *result = grad; if (!result) { if (vec && vec->getFeSpace() != feSpace) { delete vec; - vec = NULL; + vec = nullptr; } if (!vec) vec = new DOFVector<typename GradientType<T>::type>(feSpace, "gradient"); @@ -1922,7 +1922,7 @@ namespace AMDiS { TEST_EXIT_DBG(vec)("no vector\n"); - static std::vector<DOFVector<double>*> *result = NULL; + static std::vector<DOFVector<double>*> *result = nullptr; int len = num_rows(GradientType<T>::getValues((*vec)[0])); @@ -1930,8 +1930,8 @@ namespace AMDiS { result = new std::vector<DOFVector<double>*>(len); for (int i = 0; i < len; i++) (*result)[i] = new DOFVector<double>(vec->getFeSpace(), "transform"); - } else if (res->size() == 0 || (*res)[0] == NULL) { - res->resize(len, NULL); + } else if (res->size() == 0 || (*res)[0] == nullptr) { + res->resize(len, nullptr); for (int i = 0; i < len; i++) (*res)[i] = new DOFVector<double>(vec->getFeSpace(), "transform"); } diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc index be47c930ddf4dbfce169e431ff0634bb2955963c..1af5fe2a596488f4cc2505cd7e8260bc981d2ece 100644 --- a/AMDiS/src/Debug.cc +++ b/AMDiS/src/Debug.cc @@ -232,7 +232,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return NULL; + return nullptr; } @@ -247,7 +247,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return NULL; + return nullptr; } @@ -262,7 +262,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return NULL; + return nullptr; } @@ -278,7 +278,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return NULL; + return nullptr; } @@ -293,7 +293,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return NULL; + return nullptr; } @@ -310,7 +310,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return NULL; + return nullptr; } diff --git a/AMDiS/src/DirichletBC.cc b/AMDiS/src/DirichletBC.cc index e92c249f70ff8261a8b728bf193aa1c925b8feeb..7ebef93f67fb54e725a6b5f1e7a35aa685b9fbe7 100644 --- a/AMDiS/src/DirichletBC.cc +++ b/AMDiS/src/DirichletBC.cc @@ -34,7 +34,7 @@ namespace AMDiS { bool apply) : BoundaryCondition(type, rowFeSpace, colFeSpace), f(fct), - dofVec(NULL), + dofVec(nullptr), applyBC(apply) {} @@ -43,7 +43,7 @@ namespace AMDiS { DOFVectorBase<double> *vec, bool apply) : BoundaryCondition(type, vec->getFeSpace(), vec->getFeSpace()), - f(NULL), + f(nullptr), dofVec(vec), applyBC(apply) {} diff --git a/AMDiS/src/DirichletBC.h b/AMDiS/src/DirichletBC.h index deef6f05862643363499665e5ba298d0b1ad1b4f..2fd06e49ba8307eb68ddd4ce86a2ab70ead1d956 100644 --- a/AMDiS/src/DirichletBC.h +++ b/AMDiS/src/DirichletBC.h @@ -48,7 +48,7 @@ namespace AMDiS { DirichletBC(BoundaryType type, AbstractFunction<double, WorldVector<double> > *fct, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL, + const FiniteElemSpace *colFeSpace = nullptr, bool apply = true); /// Constructor. diff --git a/AMDiS/src/DualTraverse.cc b/AMDiS/src/DualTraverse.cc index c1be056c8b26b754f77a49cee33c4b97b5264f1e..8ea4aea9f0adf803d1c3a833b62dd1eb216dd8cf 100644 --- a/AMDiS/src/DualTraverse.cc +++ b/AMDiS/src/DualTraverse.cc @@ -77,17 +77,17 @@ namespace AMDiS { // call standard traverse *elInfo1 = stack1.traverseFirst(mesh1, level1, flag1); - while (*elInfo1 != NULL && skipEl1(*elInfo1)) { + while (*elInfo1 != nullptr && skipEl1(*elInfo1)) { *elInfo1 = stack1.traverseNext(*elInfo1); } *elInfo2 = stack2.traverseFirst(mesh2, level2, flag2); - while (*elInfo2 != NULL && skipEl2(*elInfo2)) { + while (*elInfo2 != nullptr && skipEl2(*elInfo2)) { *elInfo2 = stack2.traverseNext(*elInfo2); } // finished ? - if (*elInfo1 == NULL || *elInfo2 == NULL) { + if (*elInfo1 == nullptr || *elInfo2 == nullptr) { TEST_EXIT(*elInfo1 == *elInfo2)("invalid dual traverse\n"); return false; } @@ -121,22 +121,22 @@ namespace AMDiS { if (inc1) { do { *elInfo1 = stack1.traverseNext(*elInfo1); - } while(*elInfo1 != NULL && skipEl1(*elInfo1)); + } while(*elInfo1 != nullptr && skipEl1(*elInfo1)); } if (inc2) { do { *elInfo2 = stack2.traverseNext(*elInfo2); - } while (*elInfo2 != NULL && skipEl2(*elInfo2)); + } while (*elInfo2 != nullptr && skipEl2(*elInfo2)); } // finished ? - if (*elInfo1 == NULL || *elInfo2 == NULL) { + if (*elInfo1 == nullptr || *elInfo2 == nullptr) { TEST_EXIT(*elInfo1 == *elInfo2)("invalid dual traverse\n"); return false; } // finished ? - if (*elInfo1 == NULL || *elInfo2 == NULL) { + if (*elInfo1 == nullptr || *elInfo2 == nullptr) { TEST_EXIT(*elInfo1 == *elInfo2)("invalid dual traverse\n"); return false; } diff --git a/AMDiS/src/DualTraverse.h b/AMDiS/src/DualTraverse.h index 64d84f0a35d875e51ed8acc49f0cf75be4c43893..97e44e232dd39d93948c7afb6260286ad3b851a3 100644 --- a/AMDiS/src/DualTraverse.h +++ b/AMDiS/src/DualTraverse.h @@ -49,7 +49,7 @@ namespace AMDiS { public: DualTraverse() : fillSubElemMat(false), - basisFcts(NULL) + basisFcts(nullptr) {} virtual ~DualTraverse() {} diff --git a/AMDiS/src/ElInfo.cc b/AMDiS/src/ElInfo.cc index e594269fa50fa8b8e1f04a247b9df4831b079168..b5b91f7af2a106562157315ee941e8dc3c80a045 100644 --- a/AMDiS/src/ElInfo.cc +++ b/AMDiS/src/ElInfo.cc @@ -41,9 +41,9 @@ namespace AMDiS { ElInfo::ElInfo(Mesh *aMesh) : mesh(aMesh), - element(NULL), - parent(NULL), - macroElement(NULL), + element(nullptr), + parent(nullptr), + macroElement(nullptr), level(0), elType(0), iChild(0), @@ -58,7 +58,7 @@ namespace AMDiS { refinementPath(0), refinementPathLength(0) { - projection.set(NULL); + projection.set(nullptr); for (int i = 0; i < neighbourCoord.getSize(); i++) neighbourCoord[i].init(mesh->getDim()); diff --git a/AMDiS/src/ElInfo.h b/AMDiS/src/ElInfo.h index 70d0986f52ef8204c4eb139434c673a76159b425..4b8eb44a6687dfc2bb2c3a4044e6ef8cf2df7c8a 100644 --- a/AMDiS/src/ElInfo.h +++ b/AMDiS/src/ElInfo.h @@ -476,7 +476,7 @@ namespace AMDiS { * for i=0,...,N_NEIGH - 1. In 3d * (*boundary)[N_FACES + i] is a pointer to the Boundary * object of the i-th edge, for i=0,..,N_EDGES - 1. It is - * a pointer to NULL for an interior edge/face. + * a nullptr for an interior edge/face. */ FixVec<BoundaryType, BOUNDARY> boundary; @@ -488,14 +488,14 @@ namespace AMDiS { FixVec<WorldVector<double>, NEIGH> oppCoord; /// neighbour[i] pointer to the element at the edge/face with local index i. - /// It is a pointer to NULL for boundary edges/faces. + /// It is a nullptr for boundary edges/faces. FixVec<Element*, NEIGH> neighbour; /// neighbourCoord[i][j] are the coordinate of the j-th vertex of the i-th /// neighbour element with the common edge/face. FixVec<FixVec<WorldVector<double>, VERTEX>, NEIGH> neighbourCoord; - /// oppVertex[i] is undefined if neighbour[i] is a pointer to NULL. + /// oppVertex[i] is undefined if neighbour[i] is a pointer to nullptr. /// Otherwise it is the local index of the neighbour's vertex opposite the /// common edge/face. FixVec<int, NEIGH> oppVertex; diff --git a/AMDiS/src/ElInfo1d.cc b/AMDiS/src/ElInfo1d.cc index d1e9b076e9b4dfb0e867969257d18c9251518847..139d0737efc4e07341e55207b3b3331de858784e 100644 --- a/AMDiS/src/ElInfo1d.cc +++ b/AMDiS/src/ElInfo1d.cc @@ -70,7 +70,7 @@ namespace AMDiS { macroElement = const_cast<MacroElement*>(mel); element = const_cast<Element*>(mel->getElement()); - parent = NULL; + parent = nullptr; level = 0; int vertices = mesh->getGeo(VERTEX); @@ -87,7 +87,7 @@ namespace AMDiS { int neighbours = mesh->getGeo(NEIGH); for (int i = 0; i < neighbours; i++) { - nb = NULL; + nb = nullptr; if ((mnb = const_cast<MacroElement*>(mel->getNeighbour(i)))) { if (fillFlag.isSet(Mesh::FILL_OPP_COORDS)) { oppC = mnb->coord[i]; @@ -163,7 +163,7 @@ namespace AMDiS { static DimVec<double> vec(dim, NO_INIT); - TEST_EXIT_DBG(lambda)("lambda must not be NULL\n"); + TEST_EXIT_DBG(lambda)("lambda must not be nullptr\n"); TEST_EXIT_DBG(dim == 1)("dim!=1\n"); TEST_EXIT_DBG(dimOfWorld == dim)("not yet for DIM != DIM_OF_WORLD\n"); diff --git a/AMDiS/src/ElInfo2d.cc b/AMDiS/src/ElInfo2d.cc index 83864e3d261467058c105ae6b5cfb082306f0526..5b373e1039ead2abccb2f7e81acea50ed4346679 100644 --- a/AMDiS/src/ElInfo2d.cc +++ b/AMDiS/src/ElInfo2d.cc @@ -142,7 +142,7 @@ namespace AMDiS { macroElement = const_cast<MacroElement*>(mel); element = const_cast<Element*>(mel->getElement()); - parent = NULL; + parent = nullptr; level = 0; if (fillFlag.isSet(Mesh::FILL_COORDS) || @@ -323,7 +323,7 @@ namespace AMDiS { } } } else { - neighbour[i] = NULL; + neighbour[i] = nullptr; } } } @@ -596,10 +596,10 @@ namespace AMDiS { } else { // boundary projection if (ichild == 0) { projection[0] = elInfoOld->getProjection(2); - projection[1] = NULL; + projection[1] = nullptr; projection[2] = elInfoOld->getProjection(1); } else { - projection[0] = NULL; + projection[0] = nullptr; projection[1] = elInfoOld->getProjection(2); projection[2] = elInfoOld->getProjection(0); } @@ -675,7 +675,7 @@ namespace AMDiS { { FUNCNAME("ElInfo::worldToCoord()"); - TEST_EXIT_DBG(lambda)("lambda must not be NULL\n"); + TEST_EXIT_DBG(lambda)("lambda must not be nullptr\n"); DimVec<WorldVector<double> > edge(mesh->getDim(), NO_INIT); WorldVector<double> x; diff --git a/AMDiS/src/ElInfo3d.cc b/AMDiS/src/ElInfo3d.cc index f05c937f8a38d418052f33d8c46875f5e633e74d..3fda43f4d2c07d6ec75e6e30a1ae6b8d92aeb200 100644 --- a/AMDiS/src/ElInfo3d.cc +++ b/AMDiS/src/ElInfo3d.cc @@ -192,7 +192,7 @@ namespace AMDiS { macroElement = const_cast<MacroElement*>(mel); element = const_cast<Element*>(mel->getElement()); - parent = NULL; + parent = nullptr; level = 0; elType = const_cast<MacroElement*>(mel)->getElType(); @@ -239,7 +239,7 @@ namespace AMDiS { } } } else { - neighbour[i] = NULL; + neighbour[i] = nullptr; } } } @@ -338,7 +338,7 @@ namespace AMDiS { static DimVec<double> vec(mesh->getDim(), NO_INIT); - TEST_EXIT_DBG(lambda)("lambda must not be NULL\n"); + TEST_EXIT_DBG(lambda)("lambda must not be nullptr\n"); int dim = mesh->getDim(); @@ -506,8 +506,8 @@ namespace AMDiS { TEST_EXIT_DBG(elInfoOld)("Missing old elInfo!\n"); int ochild = 0; /* index of other child = 1-ichild */ - int *cv = NULL; /* cv = child_vertex[el_type][ichild] */ - const int (*cvg)[4] = NULL; /* cvg = child_vertex[el_type] */ + int *cv = nullptr; /* cv = child_vertex[el_type][ichild] */ + const int (*cvg)[4] = nullptr; /* cvg = child_vertex[el_type] */ int *ce; /* ce = child_edge[el_type][ichild] */ Element *nb, *nbk; Element *elOld = elInfoOld->element; @@ -592,7 +592,7 @@ namespace AMDiS { } } else { ERROR_EXIT("no other child"); - (*neigh_local)[0] = NULL; + (*neigh_local)[0] = nullptr; } @@ -608,7 +608,7 @@ namespace AMDiS { if (nbk->getDof(0) == elOld->getDof(ichild)) { /* opp. vertex */ - dof = const_cast<int*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); + dof = const_cast<DegreeOfFreedom*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); if (dof == nbk->getDof(1)) { ov = 1; @@ -658,7 +658,7 @@ namespace AMDiS { mesh->associated(nbk->getDof(0, 0), elOld->getDof(ichild, 0))) { // opp. vertex - dof = const_cast<int*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); + dof = const_cast<DegreeOfFreedom*>(nb->getDof(elInfoOld->oppVertex[cv[i]])); if (dof == nbk->getDof(1) || mesh->associated(dof[0], nbk->getDof(1, 0))) { @@ -700,7 +700,7 @@ namespace AMDiS { ichild, elOld->getIndex(), elInfoOld->getMacroElement()->getIndex()); } } else { - (*neigh_local)[i] = NULL; + (*neigh_local)[i] = nullptr; } } /* end for i */ @@ -740,7 +740,7 @@ namespace AMDiS { projection[0] = elInfoOld->getProjection(0); } else { // boundary projection - projection[0] = NULL; + projection[0] = nullptr; projection[1] = elInfoOld->getProjection(cv[1]); projection[2] = elInfoOld->getProjection(cv[2]); projection[3] = elInfoOld->getProjection(ochild); diff --git a/AMDiS/src/Element.cc b/AMDiS/src/Element.cc index 4e3b608cb79f18957c2569d147321ffa6dd00674..9e73011c2d19d8610dda339dc3b6baa5567a10ff 100644 --- a/AMDiS/src/Element.cc +++ b/AMDiS/src/Element.cc @@ -38,16 +38,16 @@ namespace AMDiS { { mesh = aMesh; index = mesh ? mesh->getNextElementIndex() : -1; - child[0] = NULL; - child[1] = NULL; - newCoord = NULL; - elementData = NULL; + child[0] = nullptr; + child[1] = nullptr; + newCoord = nullptr; + elementData = nullptr; mark = 0; if (mesh) createNewDofPtrs(); else - dof = NULL; + dof = nullptr; } @@ -119,7 +119,7 @@ namespace AMDiS { ElementData *tmp = elementData; elementData = elementData->getDecorated(); delete tmp; - tmp = NULL; + tmp = nullptr; return true; } else { return elementData->deleteDecorated(typeID); @@ -168,11 +168,11 @@ namespace AMDiS { Element *el; if (isLine()) { - el = new Line(NULL); + el = new Line(nullptr); } else if (isTriangle()) { - el = new Triangle(NULL); + el = new Triangle(nullptr); } else { - el = new Tetrahedron(NULL); + el = new Tetrahedron(nullptr); } el->mesh = mesh; @@ -200,10 +200,10 @@ namespace AMDiS { if (ndof > 0) { for (int i = 0; i < mesh->getGeo(position); i++) { - if (dof[j] != NULL) { + if (dof[j] != nullptr) { std::pair<DegreeOfFreedom, int> idx = std::make_pair(dof[j][0], pos); - if (Mesh::serializedDOFs[idx] == NULL) { + if (Mesh::serializedDOFs[idx] == nullptr) { el->dof[j] = new DegreeOfFreedom[ndof]; for (int k = 0; k < ndof; k++) el->dof[j][k] = dof[j][k]; @@ -213,7 +213,7 @@ namespace AMDiS { el->dof[j] = Mesh::serializedDOFs[idx]; } } else { - el->dof[j] = NULL; + el->dof[j] = nullptr; } j++; } @@ -237,7 +237,7 @@ namespace AMDiS { /* should be used only at the end of dof_compress()!!!!! */ /****************************************************************************/ - void Element::newDofFct1(const DOFAdmin* admin, std::vector<int>& newDofIndex) + void Element::newDofFct1(const DOFAdmin* admin, std::vector<DegreeOfFreedom>& newDofIndex) { int n0, nd, nd0; @@ -322,12 +322,12 @@ namespace AMDiS { } - void Element::changeDofs1(const DOFAdmin* admin, std::vector<int>& newDofIndex, + void Element::changeDofs1(const DOFAdmin* admin, std::vector<DegreeOfFreedom>& newDofIndex, int n0, int nd0, int nd, int pos) { DegreeOfFreedom *ldof = dof[n0 + pos] + nd0; for (int j = 0; j < nd; j++) { - int k = ldof[j]; + DegreeOfFreedom k = ldof[j]; if (k >= 0) ldof[j] = -newDofIndex[k] - 1; } @@ -338,7 +338,7 @@ namespace AMDiS { { DegreeOfFreedom *ldof = dof[n0 + pos] + nd0; for (int j = 0; j < nd; j++) { - int k = ldof[j]; + DegreeOfFreedom k = ldof[j]; if (k < 0) ldof[j] = -k - 1; } @@ -398,9 +398,9 @@ namespace AMDiS { void Element::eraseNewCoord() { - if (newCoord != NULL) { + if (newCoord != nullptr) { delete newCoord; - newCoord = NULL; + newCoord = nullptr; } } @@ -413,7 +413,7 @@ namespace AMDiS { child[0]->serialize(out); child[1]->serialize(out); } else { - out << "NULL\n"; + out << "nullptr\n"; } // write dofs @@ -421,10 +421,10 @@ namespace AMDiS { int nodes = mesh->getNumberOfNodes(); int j = 0; SerUtil::serialize(out, nodes); - int dofValid = (dof != NULL ? 1 : 0); + int dofValid = (dof != nullptr ? 1 : 0); SerUtil::serialize(out, dofValid); - if (dof != NULL) { + if (dof != nullptr) { for (int pos = 0; pos <= dim; pos++) { GeoIndex position = INDEX_OF_DIM(pos, dim); int ndof = 0; @@ -434,11 +434,11 @@ namespace AMDiS { if (ndof > 0) { for (int i = 0; i < mesh->getGeo(position); i++) { - if (dof[j] != NULL) { + if (dof[j] != nullptr) { // Create index to check if the dofs were already written. std::pair<DegreeOfFreedom, int> idx = std::make_pair(dof[j][0], pos); - if (Mesh::serializedDOFs[idx] == NULL) { + if (Mesh::serializedDOFs[idx] == nullptr) { Mesh::serializedDOFs[idx] = dof[j]; SerUtil::serialize(out, ndof); SerUtil::serialize(out, pos); @@ -473,7 +473,7 @@ namespace AMDiS { out << "WorldVector\n"; newCoord->serialize(out); } else { - out << "NULL\n"; + out << "nullptr\n"; } // write element data @@ -481,7 +481,7 @@ namespace AMDiS { out << elementData->getTypeName() << "\n"; elementData->serialize(out); } else { - out << "NULL\n"; + out << "nullptr\n"; } } @@ -496,16 +496,16 @@ namespace AMDiS { in >> typeName; in.get(); - if (typeName != "NULL") { + if (typeName != "nullptr") { if (typeName == "Line") { - child[0] = new Line(NULL); - child[1] = new Line(NULL); + child[0] = new Line(nullptr); + child[1] = new Line(nullptr); }else if (typeName == "Triangle") { - child[0] = new Triangle(NULL); - child[1] = new Triangle(NULL); + child[0] = new Triangle(nullptr); + child[1] = new Triangle(nullptr); } else if (typeName == "Tetrahedron") { - child[0] = new Tetrahedron(NULL); - child[1] = new Tetrahedron(NULL); + child[0] = new Tetrahedron(nullptr); + child[1] = new Tetrahedron(nullptr); } else { ERROR_EXIT("Wrong element type!\n"); } @@ -513,7 +513,7 @@ namespace AMDiS { child[0]->deserialize(in); child[1]->deserialize(in); } else { - child[0] = child[1] = NULL; + child[0] = child[1] = nullptr; } // read dofs @@ -523,7 +523,7 @@ namespace AMDiS { SerUtil::deserialize(in, dofValid); TEST_EXIT_DBG(nodes > 0)("Should not happen!\n"); - dof = (dofValid ? new DegreeOfFreedom*[nodes] : NULL); + dof = (dofValid ? new DegreeOfFreedom*[nodes] : nullptr); if (dofValid) { for (int i = 0; i < nodes; i++) { @@ -539,7 +539,7 @@ namespace AMDiS { // Create index to check if the dofs were alread read from file. std::pair<DegreeOfFreedom, int> idx = std::make_pair(dof[i][0], pos); - if (Mesh::serializedDOFs[idx] != NULL) { + if (Mesh::serializedDOFs[idx] != nullptr) { DegreeOfFreedom *dofPtr = Mesh::serializedDOFs[idx]; delete [] dof[i]; dof[i] = dofPtr; @@ -557,7 +557,7 @@ namespace AMDiS { dof[i] = Mesh::serializedDOFs[idx]; } } else { - dof[i] = NULL; + dof[i] = nullptr; } } } @@ -572,7 +572,7 @@ namespace AMDiS { in >> typeName; in.get(); - if (typeName != "NULL") { + if (typeName != "nullptr") { if (typeName == "WorldVector") { newCoord = new WorldVector<double>; newCoord->deserialize(in); @@ -580,14 +580,14 @@ namespace AMDiS { ERROR_EXIT("unexpected type name\n"); } } else { - newCoord = NULL; + newCoord = nullptr; } // read element data in >> typeName; in.get(); - if (typeName != "NULL") { + if (typeName != "nullptr") { elementData = CreatorMap<ElementData>::getCreator(typeName, "deserializetion from file")->create(); @@ -596,7 +596,7 @@ namespace AMDiS { else ERROR_EXIT("unexpected type name\n"); } else { - elementData = NULL; + elementData = nullptr; } } @@ -662,7 +662,7 @@ namespace AMDiS { getNodeDofs(feSpace, bound, dofs, baseDofPtr); - if (dofGeoIndex != NULL) { + if (dofGeoIndex != nullptr) { // In the case dofGeoIndex should be filled, set all node DOFs to be // vertex DOFs. dofGeoIndex->resize(dofs.size()); diff --git a/AMDiS/src/Element.h b/AMDiS/src/Element.h index c2ff5f24d85e42df39fa14d9b9f6e4030cf2c639..17154406072fab59a61203f160b375c3c95a6920 100644 --- a/AMDiS/src/Element.h +++ b/AMDiS/src/Element.h @@ -111,17 +111,17 @@ namespace AMDiS { return child[i]; } - /// Returns true if Element is a leaf element (\ref child[0] == NULL), returns + /// Returns true if Element is a leaf element (\ref child[0] == nullptr), returns /// false otherwise. inline bool isLeaf() const { - return (child[0] == NULL); + return (child[0] == nullptr); } /// Returns \ref dof[i][j] which is the j-th DOF of the i-th node of Element. inline DegreeOfFreedom getDof(int i, int j) const { - TEST_EXIT_DBG(dof != NULL)("DOFs are not valid in element %d!\n", index); + TEST_EXIT_DBG(dof != nullptr)("DOFs are not valid in element %d!\n", index); return dof[i][j]; } @@ -129,7 +129,7 @@ namespace AMDiS { /// Returns \ref dof[i] which is a pointer to the DOFs of the i-th node. inline const DegreeOfFreedom* getDof(int i) const { - TEST_EXIT_DBG(dof != NULL)("DOFs are not valid in element %d!\n", index); + TEST_EXIT_DBG(dof != nullptr)("DOFs are not valid in element %d!\n", index); return dof[i]; } @@ -137,7 +137,7 @@ namespace AMDiS { /// Returns a pointer to the DOFs of this Element inline const DegreeOfFreedom** getDof() const { - TEST_EXIT_DBG(dof != NULL)("DOFs are not valid in element %d!\n", index); + TEST_EXIT_DBG(dof != nullptr)("DOFs are not valid in element %d!\n", index); return const_cast<const DegreeOfFreedom**>(dof); } @@ -214,7 +214,7 @@ namespace AMDiS { /// Returns \ref newCoord[i] inline double getNewCoord(int i) const { - TEST_EXIT_DBG(newCoord)("newCoord = NULL\n"); + TEST_EXIT_DBG(newCoord)("newCoord = nullptr\n"); return (*newCoord)[i]; } @@ -279,7 +279,7 @@ namespace AMDiS { void delDofPtr() { delete [] dof; - dof = NULL; + dof = nullptr; } /// Checks whether Element is a leaf element and whether it has leaf data. @@ -438,7 +438,7 @@ namespace AMDiS { BoundaryObject bound, DofContainer& dofs, bool baseDofPtr = false, - vector<GeoIndex>* dofGeoIndex = NULL) const = 0; + vector<GeoIndex>* dofGeoIndex = nullptr) const = 0; /// Combines \ref getNodeDofs and \ref getHigherOrderDofs to one function. /// See parameter description there. @@ -446,7 +446,7 @@ namespace AMDiS { BoundaryObject bound, DofContainer& dofs, bool baseDofPtr = false, - vector<GeoIndex>* dofGeoIndex = NULL); + vector<GeoIndex>* dofGeoIndex = nullptr); virtual void getSubBoundary(BoundaryObject bound, vector<BoundaryObject> &subBound) const = 0; @@ -484,13 +484,13 @@ namespace AMDiS { if (childData) { childData->coarsenElementData(this, child1, child2, elType); delete childData; - child1->setElementData(NULL); + child1->setElementData(nullptr); } childData = child2->getElementData(); if (childData) { childData->coarsenElementData(this, child2, child1, elType); delete childData; - child2->setElementData(NULL); + child2->setElementData(nullptr); } } @@ -506,7 +506,7 @@ namespace AMDiS { if (elementData) return elementData->getElementData(typeID); - return NULL; + return nullptr; } /// Deletes the \ref elementData with a specific typeID. @@ -524,7 +524,7 @@ namespace AMDiS { /// Returns whether Element's \ref newCoord is set inline bool isNewCoordSet() const { - return (newCoord != NULL); + return (newCoord != nullptr); } /// Frees memory for \ref newCoord @@ -547,13 +547,13 @@ namespace AMDiS { } /// Used by friend class Mesh while dofCompress - void newDofFct1(const DOFAdmin*, std::vector<int>&); + void newDofFct1(const DOFAdmin*, std::vector<DegreeOfFreedom>&); /// Used by friend class Mesh while dofCompress void newDofFct2(const DOFAdmin*); /// Changes old dofs to negative new dofs - void changeDofs1(const DOFAdmin* admin, std::vector<int>& newDofIndex, + void changeDofs1(const DOFAdmin* admin, std::vector<DegreeOfFreedom>& newDofIndex, int n0, int nd0, int nd, int pos); /// Changes negative new dofs to positive @@ -561,7 +561,7 @@ namespace AMDiS { protected: /// Pointers to the two children of interior elements of the tree. Pointers - /// to NULL for leaf elements. + /// to nullptr for leaf elements. Element *child[2]; /// Vector of pointers to DOFs. These pointers must be available for elements @@ -585,7 +585,7 @@ namespace AMDiS { /// If the element has a boundary edge on a curved boundary, this is a pointer /// to the coordinates of the new vertex that is created due to the refinement - /// of the element, otherwise it is a NULL pointer. Thus coordinate + /// of the element, otherwise it is a nullptr pointer. Thus coordinate /// information can be also produced by the traversal routines in the case of /// curved boundary. WorldVector<double> *newCoord; diff --git a/AMDiS/src/ElementData.cc b/AMDiS/src/ElementData.cc index 35da52ff09c79ab43d1cb749b85cfee57e2b20c6..5fe48b4aa4ffee0589979b92b4e2d26be540a027 100644 --- a/AMDiS/src/ElementData.cc +++ b/AMDiS/src/ElementData.cc @@ -31,7 +31,7 @@ namespace AMDiS { if (decorated) { decorated->coarsenElementData(parent, thisChild, otherChild, elTypeParent); delete decorated; - decorated = NULL; + decorated = nullptr; } } @@ -42,7 +42,7 @@ namespace AMDiS { ElementData *tmp = decorated; decorated = decorated->decorated; delete tmp; - tmp = NULL; + tmp = nullptr; return true; } else { return decorated->deleteDecorated(typeID); @@ -71,23 +71,23 @@ namespace AMDiS { out << decoratedType << "\n"; decorated->serialize(out); } else { - out << "NULL\n"; + out << "nullptr\n"; } } void ElementData::deserialize(std::istream& in) { - TEST_EXIT(decorated == NULL) + TEST_EXIT(decorated == nullptr) ("there are already decorated element data\n"); std::string decoratedType; in >> decoratedType; in.get(); - if (decoratedType != "NULL") { + if (decoratedType != "nullptr") { decorated = CreatorMap<ElementData>::getCreator(decoratedType, "deserialization from file")->create(); decorated->deserialize(in); } else { - decorated = NULL; + decorated = nullptr; } } diff --git a/AMDiS/src/ElementData.h b/AMDiS/src/ElementData.h index 6b3fd6667f6ae3db19646ee4478e7549ca45b84c..0cfad5f810d4a616415ab5318f8ac78f7033cf1d 100644 --- a/AMDiS/src/ElementData.h +++ b/AMDiS/src/ElementData.h @@ -46,7 +46,7 @@ namespace AMDiS { { public: /// constructor - ElementData(ElementData *dec = NULL) + ElementData(ElementData *dec = nullptr) : decorated(dec) {} @@ -84,7 +84,7 @@ namespace AMDiS { if (decorated) return decorated->clone(); - return NULL; + return nullptr; } /// Returns the id of element data type. @@ -114,7 +114,7 @@ namespace AMDiS { if (decorated) return decorated->getElementData(typeID); } - return NULL; + return nullptr; } inline ElementData *getDecorated(int typeID) @@ -122,7 +122,7 @@ namespace AMDiS { if (decorated) return decorated->getElementData(typeID); - return NULL; + return nullptr; } /** \ref @@ -142,7 +142,7 @@ namespace AMDiS { inline void setDecorated(ElementData *d) { if (getTypeID() == 1) - if (d != NULL) + if (d != nullptr) std::cout << "leafdata decorated with nonzero" << std::endl; decorated = d; diff --git a/AMDiS/src/ElementFunction.h b/AMDiS/src/ElementFunction.h index 2b9d7c34ddccd2a15e5e65025a8646e80e41fda5..c338d9b2bcbeb26928efa591f173666b8acda4c6 100644 --- a/AMDiS/src/ElementFunction.h +++ b/AMDiS/src/ElementFunction.h @@ -38,7 +38,7 @@ namespace AMDiS { public: /// constructor. ElementFunction() - : elInfo(NULL) + : elInfo(nullptr) {} /// destructor. diff --git a/AMDiS/src/ElementRegion_ED.h b/AMDiS/src/ElementRegion_ED.h index 0bfcd86d851acedc1d7aa711dfb3e37d100bee7b..759e480a77bfae4a3814dcca5d0c5830a24ac691 100644 --- a/AMDiS/src/ElementRegion_ED.h +++ b/AMDiS/src/ElementRegion_ED.h @@ -49,7 +49,7 @@ namespace AMDiS { } }; - ElementRegion_ED(ElementData *decorated = NULL) + ElementRegion_ED(ElementData *decorated = nullptr) : ElementData(decorated), region(-1) {} diff --git a/AMDiS/src/EmptyElementData.h b/AMDiS/src/EmptyElementData.h index f4e5e04718adba207f043fbcf3208d9f9f795ebe..738af556c537ab8221ed39944e0fee1e73c4ddaf 100644 --- a/AMDiS/src/EmptyElementData.h +++ b/AMDiS/src/EmptyElementData.h @@ -52,7 +52,7 @@ namespace AMDiS { } }; - EmptyElementData(ElementData *decorated = NULL) + EmptyElementData(ElementData *decorated = nullptr) : ElementData(decorated) {} diff --git a/AMDiS/src/Error.h b/AMDiS/src/Error.h index 05c88835a9dab438850308a746064753b1827484..c81ebf34b2630cfd396f41afd5ccec1f4b78f52f 100644 --- a/AMDiS/src/Error.h +++ b/AMDiS/src/Error.h @@ -122,12 +122,12 @@ namespace AMDiS { static int component; }; - template<typename T> ElInfo* Error<T>::elinfo = NULL; - template<typename T> const FastQuadrature* Error<T>::quadFast = NULL; - template<typename T> const AbstractFunction<T, WorldVector<double> >* Error<T>::pU = NULL; - template<typename T> const AbstractFunction<WorldVector<T>, WorldVector<double> >* Error<T>::pGrdU = NULL; - template<typename T> const BasisFunction* Error<T>::basFct = NULL; - template<typename T> const DOFVector<T>* Error<T>::errUh = NULL; + template<typename T> ElInfo* Error<T>::elinfo = nullptr; + template<typename T> const FastQuadrature* Error<T>::quadFast = nullptr; + template<typename T> const AbstractFunction<T, WorldVector<double> >* Error<T>::pU = nullptr; + template<typename T> const AbstractFunction<WorldVector<T>, WorldVector<double> >* Error<T>::pGrdU = nullptr; + template<typename T> const BasisFunction* Error<T>::basFct = nullptr; + template<typename T> const DOFVector<T>* Error<T>::errUh = nullptr; template<typename T> typename Error<T>::AbstrFctErrU Error<T>::errU; template<typename T> typename Error<T>::AbstrFctGrdErrU Error<T>::grdErrU; template<typename T> bool Error<T>::writeInLeafData = false; diff --git a/AMDiS/src/Error.hh b/AMDiS/src/Error.hh index 87fad6b802bba529953eda262417bac2a285a39a..9889a1a383f4e104dbeedf3482d4cc218b3a987b 100644 --- a/AMDiS/src/Error.hh +++ b/AMDiS/src/Error.hh @@ -81,8 +81,8 @@ namespace AMDiS { double err = 0.0; const double *u_vec; - u_vec = quadFast->getQuadrature()->fAtQp(errU, NULL); - errUh->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + u_vec = quadFast->getQuadrature()->fAtQp(errU, nullptr); + errUh->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); for (int i = 0; i < nPoints; i++) { err = u_vec[i] > uh_vec[i] ? u_vec[i] - uh_vec[i] : uh_vec[i] - u_vec[i]; @@ -109,7 +109,7 @@ namespace AMDiS { const FiniteElemSpace *fe_space; writeInLeafData = writeLeafData; component = comp; - Quadrature *q = NULL; + Quadrature *q = nullptr; pGrdU = &grdU; errUh = &uh; @@ -148,9 +148,9 @@ namespace AMDiS { const WorldVector<double> *grdu_vec; mtl::dense_vector<WorldVector<double> > grduh_vec; - grdu_vec = quadFast->getQuadrature()->grdFAtQp(grdErrU, NULL); + grdu_vec = quadFast->getQuadrature()->grdFAtQp(grdErrU, nullptr); det = elInfo->getDet(); - errUh->getGrdAtQPs(elinfo, NULL, quadFast, grduh_vec); + errUh->getGrdAtQPs(elinfo, nullptr, quadFast, grduh_vec); int nPoints = quadFast->getNumPoints(); int dow = Global::getGeo(WORLD); @@ -215,7 +215,7 @@ namespace AMDiS { FUNCNAME("Error<T>::L2Err()"); const FiniteElemSpace *fe_space; - Quadrature *q = NULL; + Quadrature *q = nullptr; writeInLeafData = writeLeafData; component = comp; @@ -257,7 +257,7 @@ namespace AMDiS { elinfo = elInfo; quadFast->getQuadrature()->fAtQp(errU, u_vec); - errUh->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + errUh->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); double det = elInfo->getDet(); double l2_err_el = 0.0, err = 0.0; @@ -317,7 +317,7 @@ namespace AMDiS { FUNCNAME("Error<T>::L2Err_ElementWise()"); const FiniteElemSpace *fe_space; - Quadrature *q = NULL; + Quadrature *q = nullptr; writeInLeafData = writeLeafData; component = comp; @@ -364,7 +364,7 @@ namespace AMDiS { elinfo = elInfo; quadFast->getQuadrature()->fAtQp(errU, u_vec); - errUh->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); + errUh->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); double det = elInfo->getDet(); double l2_err_el = 0.0; diff --git a/AMDiS/src/FiniteElemSpace.cc b/AMDiS/src/FiniteElemSpace.cc index f0af79c3edb4dc7f427400521c4747aa0ff93b5c..7e200729110b24df6499076c2462d9a37f9d2ac4 100644 --- a/AMDiS/src/FiniteElemSpace.cc +++ b/AMDiS/src/FiniteElemSpace.cc @@ -45,8 +45,8 @@ namespace AMDiS { TEST_EXIT(basFcts)("No basis functions!\n"); if (!admin) { - const DOFAdmin *admin_local = NULL; - const DimVec<int> *ndof = NULL; + const DOFAdmin *admin_local = nullptr; + const DimVec<int> *ndof = nullptr; ndof = basFcts->getNumberOfDofs(); TEST_EXIT(ndof)("no n_dof or basFcts->n_dof\n"); @@ -59,7 +59,7 @@ namespace AMDiS { break; if (j > mesh->getDim()) break; - admin_local = NULL; + admin_local = nullptr; } if (!admin_local) @@ -131,7 +131,7 @@ namespace AMDiS { ERROR_EXIT("FE space not found!\n"); - return NULL; + return nullptr; } #endif @@ -149,7 +149,7 @@ namespace AMDiS { for (unsigned int i = 0; i < feSpaces.size(); i++) { if (feSpaces[i]) { delete feSpaces[i]; - feSpaces[i] = NULL; + feSpaces[i] = nullptr; } } } diff --git a/AMDiS/src/FirstOrderAssembler.cc b/AMDiS/src/FirstOrderAssembler.cc index 11b3f2097bbac1b34796f753a4ec4421c276f6f4..3b1e3eb0060cc276d6be737774d54a34b7654005 100644 --- a/AMDiS/src/FirstOrderAssembler.cc +++ b/AMDiS/src/FirstOrderAssembler.cc @@ -78,7 +78,7 @@ namespace AMDiS { // check if a assembler is needed at all if (opTerms.size() == 0) - return NULL; + return nullptr; sort(opTerms.begin(), opTerms.end()); diff --git a/AMDiS/src/FirstOrderTerm.cc b/AMDiS/src/FirstOrderTerm.cc index 35425c80fe66c46175d00abcc1609a2712818c6e..1ac2a71cf9af41e641a628dab4170b53c13b6e80 100644 --- a/AMDiS/src/FirstOrderTerm.cc +++ b/AMDiS/src/FirstOrderTerm.cc @@ -753,13 +753,13 @@ namespace AMDiS { gradsAtQPs_.resize(grads_.size()); for (int i = 0; i < static_cast<int>(vecs.size()); i++) { - TEST_EXIT(vecs[i])("One vector is NULL!\n"); + TEST_EXIT(vecs[i])("One vector is nullptr!\n"); auxFeSpaces.insert(vecs[i]->getFeSpace()); } for (int i = 0; i < static_cast<int>(grads.size()); i++) { - TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + TEST_EXIT(grads[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -854,13 +854,13 @@ namespace AMDiS { gradsAtQPs_.resize(grads_.size()); for (int i = 0; i < static_cast<int>(vecs.size()); i++) { - TEST_EXIT(vecs[i])("One vector is NULL!\n"); + TEST_EXIT(vecs[i])("One vector is nullptr!\n"); auxFeSpaces.insert(vecs[i]->getFeSpace()); } for (int i = 0; i < static_cast<int>(grads.size()); i++) { - TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + TEST_EXIT(grads[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } diff --git a/AMDiS/src/FirstOrderTerm.h b/AMDiS/src/FirstOrderTerm.h index 20df9d0044a88386f02c0426c21dbace5ef6a897..61c6c7f0dc9773c1592cdcb30f83b8c476e68198 100644 --- a/AMDiS/src/FirstOrderTerm.h +++ b/AMDiS/src/FirstOrderTerm.h @@ -275,13 +275,13 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -325,7 +325,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FistOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -364,7 +364,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FistOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -404,7 +404,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -443,7 +443,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -484,7 +484,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FistOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -522,13 +522,13 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -574,7 +574,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -615,7 +615,7 @@ namespace AMDiS { void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); void getLb(const ElInfo *elInfo, vector<mtl::dense_vector<double> >& Lb) const; @@ -648,7 +648,7 @@ namespace AMDiS { WorldVector<double> *b_); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); void getLb(const ElInfo *elInfo, vector<mtl::dense_vector<double> >& Lb) const; @@ -685,7 +685,7 @@ namespace AMDiS { int bIdx); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); void getLb(const ElInfo *elInfo, vector<mtl::dense_vector<double> >& Lb) const; @@ -720,7 +720,7 @@ namespace AMDiS { int b); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); void getLb(const ElInfo *elInfo, vector<mtl::dense_vector<double> >& Lb) const; @@ -760,7 +760,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo*, SubAssembler* , - Quadrature *quad= NULL); + Quadrature *quad= nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -805,7 +805,7 @@ namespace AMDiS { vector<WorldVector<double> > > *f); /// Implementation of \ref OperatorTerm::initElement(). - void initElement(const ElInfo*, SubAssembler*, Quadrature *quad = NULL); + void initElement(const ElInfo*, SubAssembler*, Quadrature *quad = nullptr); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, diff --git a/AMDiS/src/Functors.h b/AMDiS/src/Functors.h index f67717ac93000d1dd28f7d9645c5e25048be1a8c..eff21171eff4533986ae25eaa0dc521f9689099a 100644 --- a/AMDiS/src/Functors.h +++ b/AMDiS/src/Functors.h @@ -285,7 +285,7 @@ struct Random : public AbstractFunction<double, WorldVector<double> > { Random(double mean_, double amplitude_) : mean(mean_), amplitude(amplitude_) { - std::srand(time(NULL)); + std::srand(time(0)); } double operator()(const WorldVector<double> &x) const diff --git a/AMDiS/src/Global.cc b/AMDiS/src/Global.cc index 947162ecd113b2f1e8a96a4b2b56dfc8769e531a..da9725d28ce1dd612512d0e05d34fd7fd95a07d7 100644 --- a/AMDiS/src/Global.cc +++ b/AMDiS/src/Global.cc @@ -34,27 +34,27 @@ #endif namespace AMDiS { - const char *funcName = NULL; + const char *funcName = nullptr; #ifdef HAVE_PARALLEL_DOMAIN_AMDIS bool Msg::outputMainRank = true; #endif - ThreadPrivate<const char *> Msg::oldFuncName(NULL); - std::ostream* Msg::out = NULL; - std::ostream* Msg::error = NULL; + ThreadPrivate<const char *> Msg::oldFuncName(nullptr); + std::ostream* Msg::out = nullptr; + std::ostream* Msg::error = nullptr; int Global::dimOfWorld = 0; std::vector<std::vector<int> > Global::geoIndexTable; int Msg::msgInfo = 10; bool Msg::msgWait = true; Element *Global::referenceElement[4] = - { NULL, - new Line(NULL), - new Triangle(NULL), - new Tetrahedron(NULL) + { nullptr, + new Line(nullptr), + new Triangle(nullptr), + new Tetrahedron(nullptr) }; - + void Msg::wait(bool w) { @@ -187,7 +187,7 @@ namespace AMDiS { vsprintf(buff, format, arg); PRINT_LINE((*error), buff); va_end(arg); -#if defined HAVE_PARALLEL_DOMAIN_AMDIS && !defined HAVE_PARALLEL_MTL4 +#if defined HAVE_PARALLEL_DOMAIN_AMDIS && !defined HAVE_PARALLEL_MTL4 && (DEBUG == 0 || defined NDEBUG) PetscError(MPI_COMM_WORLD, __LINE__, "Msg::print_error_exit", "Global.cc", "src/", 1, PETSC_ERROR_INITIAL, buff); #else throw std::runtime_error(buff); diff --git a/AMDiS/src/Global.h b/AMDiS/src/Global.h index 0b69288030ddc06cd17211f5cc1b54b6ab97d9a3..ee12a095b41f59f30bd6211c21c51e0826bd7f2c 100644 --- a/AMDiS/src/Global.h +++ b/AMDiS/src/Global.h @@ -37,6 +37,13 @@ #define OPENMODE std::ios::open_mode #endif +#ifndef HAS_Cpp11 //__cplusplus < 199711L + #define override +#endif +#ifndef HAS_Cpp11 //__cplusplus < 199711L + #define nullptr NULL +#endif + /** \brief current AMDiS version */ #ifndef AMDIS_VERSION #define AMDIS_VERSION "AMDiS: Version 0.9.1" @@ -87,9 +94,35 @@ namespace AMDiS { typedef enum { NO_NORM = 0, H1_NORM = 1, L2_NORM = 2 } Norm; + + // may be used in the future + struct DofIndex + { + typedef signed int size_type; + + DofIndex() : idx(0) {} + DofIndex(size_type i) : idx(i) {} + + DofIndex& operator=(const size_type &rhs) + { + idx = rhs; + return *this; + } + + operator size_type() const + { + return idx; + } + + size_type idx; + }; + + std::ostream& operator<<(std::ostream& os, const DofIndex& di); + std::istream& operator>>(std::istream& is, DofIndex& di); /// Datatype for degrees of freedom - typedef signed int DegreeOfFreedom; +// typedef signed int DegreeOfFreedom; + typedef DofIndex::size_type DegreeOfFreedom; /// Defines type for a vector of DOF pointers. typedef vector<const DegreeOfFreedom*> DofContainer; diff --git a/AMDiS/src/GlobalDOFNumbering.cc b/AMDiS/src/GlobalDOFNumbering.cc index 2e6781c75569d58c475d2b19815b085b4fce68bb..3cbe993c5eca126d716d652ea89ad96e33e45cbc 100644 --- a/AMDiS/src/GlobalDOFNumbering.cc +++ b/AMDiS/src/GlobalDOFNumbering.cc @@ -56,7 +56,7 @@ namespace AMDiS { // === handle === int firstRankUsed = -1; for(rank = 0; rank < mpiSize; rank++) { - if(meshCodes[rank] != NULL) { + if(meshCodes[rank] != nullptr) { firstRankUsed = rank; break; } @@ -93,11 +93,11 @@ namespace AMDiS { recursiveCodes[rank] = meshCodes[rank]; cont = true; } else { - recursiveCodes[rank] = NULL; + recursiveCodes[rank] = nullptr; } meshCodes[rank]->nextElement(); } else { - recursiveCodes[rank] = NULL; + recursiveCodes[rank] = nullptr; } } @@ -107,12 +107,12 @@ namespace AMDiS { } } - int GlobalDOFNumbering::getLocalIndex(int rank, int globalIndex) + DegreeOfFreedom GlobalDOFNumbering::getLocalIndex(int rank, DegreeOfFreedom globalIndex) { return (globalToLocal_[rank][globalIndex] - 1); } - int GlobalDOFNumbering::getGlobalIndex(int rank, int localIndex) + DegreeOfFreedom GlobalDOFNumbering::getGlobalIndex(int rank, DegreeOfFreedom localIndex) { return (localToGlobal_[rank][localIndex] - 1); } diff --git a/AMDiS/src/GlobalDOFNumbering.h b/AMDiS/src/GlobalDOFNumbering.h index 3e044cba65ebe67271187225f9e75d661393ff52..85c8cf93ef4de36b33516127b6d23bd79ddd2e48 100644 --- a/AMDiS/src/GlobalDOFNumbering.h +++ b/AMDiS/src/GlobalDOFNumbering.h @@ -45,10 +45,10 @@ namespace AMDiS { int dofsPerElement); /// Returns the local index of rank corresponding to global index. - int getLocalIndex(int rank, int globalIndex); + DegreeOfFreedom getLocalIndex(int rank, DegreeOfFreedom globalIndex); /// Returns the global index corresponing to local index of rank. - int getGlobalIndex(int rank, int localIndex); + DegreeOfFreedom getGlobalIndex(int rank, DegreeOfFreedom localIndex); protected: void handleRecursive(std::vector<MeshStructure*> &meshCodes, diff --git a/AMDiS/src/Initfile.cc b/AMDiS/src/Initfile.cc index a9b906ed915e078203526b5389c374edcb0e4e95..ae095c39d767bd78af016ca6187f54d005e2c113 100644 --- a/AMDiS/src/Initfile.cc +++ b/AMDiS/src/Initfile.cc @@ -51,7 +51,7 @@ namespace AMDiS { }; - Initfile* Initfile::singlett = NULL; + Initfile* Initfile::singlett = nullptr; std::set<std::string> Initfile::fn_include_list; diff --git a/AMDiS/src/Initfile.h b/AMDiS/src/Initfile.h index 72b09a1cb3b2825ad6bd156329157ce285fae700..422f682d774d9e7e495f2f3e30999a5c279cb586 100644 --- a/AMDiS/src/Initfile.h +++ b/AMDiS/src/Initfile.h @@ -402,7 +402,7 @@ namespace AMDiS { */ static void init(std::string in); - static void init(int print, string filename, const char *flags = NULL) + static void init(int print, string filename, const char *flags = nullptr) { WARNING("Parameters::init(int,std::string,const char*) is depreciated. " "Use Parameters::init(std::string) instead!\n"); @@ -519,21 +519,21 @@ else if(error_code == TAG_NOT_FOUND_BREAK) /// Returns specified info level static int getMsgInfo() { - return (singlett != NULL) ? singlett->msgInfo : 0; + return (singlett != nullptr) ? singlett->msgInfo : 0; } /// Returns specified wait value static int getMsgWait() { - return (singlett != NULL) ? singlett->msgWait : 0; + return (singlett != nullptr) ? singlett->msgWait : 0; } /// Checks whether parameters are initialized. if not, call init() static bool initialized() { - return (singlett != NULL); + return (singlett != nullptr); } @@ -574,7 +574,7 @@ protected: static void initIntern() { - if (singlett == NULL) + if (singlett == nullptr) singlett = new Initfile; } diff --git a/AMDiS/src/Lagrange.cc b/AMDiS/src/Lagrange.cc index cb3eced0c3b1f756224ec272ebd0dbc1ea22bd70..97dffa975bdcfaa2fcabc3d68433c3c34db48f23 100644 --- a/AMDiS/src/Lagrange.cc +++ b/AMDiS/src/Lagrange.cc @@ -71,7 +71,7 @@ namespace AMDiS { for (int i = 0; i < static_cast<int>(bary->size()); i++) if ((*bary)[i]) { delete (*bary)[i]; - (*bary)[i] = NULL; + (*bary)[i] = nullptr; } } @@ -95,7 +95,7 @@ namespace AMDiS { it != allBasFcts.end(); it++) if (*it) { delete *it; - *it = NULL; + *it = nullptr; } } @@ -140,13 +140,13 @@ namespace AMDiS { case 1: refineInter_fct = refineInter1; coarseRestr_fct = coarseRestr1; - coarseInter_fct = NULL; // not yet implemented + coarseInter_fct = nullptr; // not yet implemented break; case 2: switch (dim) { case 1: refineInter_fct = refineInter2_1d; - coarseRestr_fct = NULL; // not yet implemented + coarseRestr_fct = nullptr; // not yet implemented coarseInter_fct = coarseInter2_1d; break; case 2: @@ -244,7 +244,7 @@ namespace AMDiS { { FUNCNAME_DBG("Lagrange::setVertices()"); - TEST_EXIT_DBG(*vertices == NULL)("vertices != NULL\n"); + TEST_EXIT_DBG(*vertices == nullptr)("vertices != nullptr\n"); int dimOfPosition = DIM_OF_INDEX(position, dim); @@ -280,7 +280,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(NULL) + : vertices(nullptr) { FUNCNAME("Lagrange::Phi::Phi()"); @@ -412,7 +412,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(NULL) + : vertices(nullptr) { // get relevant vertices Lagrange::setVertices(owner->getDim(), @@ -539,7 +539,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(NULL) + : vertices(nullptr) { // get relevant vertices Lagrange::setVertices(owner->getDim(), @@ -666,7 +666,7 @@ namespace AMDiS { void Lagrange::createCoords(int* coordInd, int numCoords, int dimIndex, int rest, DimVec<double>* vec) { - if (vec == NULL) + if (vec == nullptr) vec = new DimVec<double>(dim, DEFAULT_VALUE, 0.0); if (dimIndex == numCoords - 1) { @@ -737,7 +737,7 @@ namespace AMDiS { return &sortedEdgeDeg2; int vertex[3]; - int** dof = const_cast<int**>(el->getDof()); + DegreeOfFreedom** dof = const_cast<DegreeOfFreedom**>(el->getDof()); int verticesOfPosition = dimOfPosition + 1; for (int i = 0; i < verticesOfPosition; i++) @@ -787,7 +787,7 @@ namespace AMDiS { return &sortedCenterDeg4; ERROR_EXIT("should not be reached\n"); - return NULL; + return nullptr; } void Lagrange::getBound(const ElInfo* elInfo, BoundaryType* bound) const @@ -1329,7 +1329,7 @@ namespace AMDiS { int node = drv->getFeSpace()->getMesh()->getNode(CENTER); int n0 = admin->getNumberOfPreDofs(CENTER); - int dof9 = el->getChild(1)->getDof(node, n0); + DegreeOfFreedom dof9 = el->getChild(1)->getDof(node, n0); (*drv)[dof9] = (0.0625 * ((*drv)[pdof[0]] - (*drv)[pdof[1]]) + 0.375 * (*drv)[pdof[3]] @@ -1420,7 +1420,7 @@ namespace AMDiS { int node = drv->getFeSpace()->getMesh()->getNode(CENTER); int n0 = admin->getNumberOfPreDofs(CENTER); - int dof9 = el->getChild(1)->getDof(node, n0); + DegreeOfFreedom dof9 = el->getChild(1)->getDof(node, n0); (*drv)[dof9] = (0.0625 * ((*drv)[pdof[0]] - (*drv)[pdof[1]]) + 0.375 * (*drv)[pdof[3]] @@ -2486,9 +2486,9 @@ namespace AMDiS { int n0 = drv->getFeSpace()->getAdmin()->getNumberOfPreDofs(CENTER); Element* el = list->getElement(0); - int dof0 = el->getDof(0,n0); /* 1st endpoint of refinement edge */ - int dof1 = el->getDof(1,n0); /* 2nd endpoint of refinement edge */ - int dof_new = el->getChild(0)->getDof(basFct->getDim(), n0); + DegreeOfFreedom dof0 = el->getDof(0,n0); /* 1st endpoint of refinement edge */ + DegreeOfFreedom dof1 = el->getDof(1,n0); /* 2nd endpoint of refinement edge */ + DegreeOfFreedom dof_new = el->getChild(0)->getDof(basFct->getDim(), n0); /* newest vertex is DIM */ (*drv)[dof0] += 0.5*(*drv)[dof_new]; (*drv)[dof1] += 0.5*(*drv)[dof_new]; @@ -4218,9 +4218,9 @@ namespace AMDiS { const DOFAdmin *admin = drv->getFeSpace()->getAdmin(); const Mesh *mesh = drv->getFeSpace()->getMesh(); - int cdof = el->getChild(0)->getDof(mesh->getNode(VERTEX) + 3, + DegreeOfFreedom cdof = el->getChild(0)->getDof(mesh->getNode(VERTEX) + 3, admin->getNumberOfPreDofs(VERTEX)); - int pdof = el->getDof(mesh->getNode(EDGE), admin->getNumberOfPreDofs(EDGE)); + DegreeOfFreedom pdof = el->getDof(mesh->getNode(EDGE), admin->getNumberOfPreDofs(EDGE)); (*drv)[pdof] = (*drv)[cdof]; } @@ -4244,7 +4244,7 @@ namespace AMDiS { // values on child[0] - int cdof, pdof; + DegreeOfFreedom cdof, pdof; if (el->getDof(0, 0) < el->getDof(1, 0)) pdof = el->getDof(node + 2, n0); @@ -4319,7 +4319,7 @@ namespace AMDiS { // values on child[0] - int cdof, pdof; + DegreeOfFreedom cdof, pdof; if (el->getDof(0, 0) < el->getDof(1, 0)) pdof = el->getDof(node + 2, n0); diff --git a/AMDiS/src/Lagrange.h b/AMDiS/src/Lagrange.h index c984b4fa9b365e88649b5b424477fcff2a2fa382..851d6a4320d5b518f51ef22677d3064b66f4478e 100644 --- a/AMDiS/src/Lagrange.h +++ b/AMDiS/src/Lagrange.h @@ -140,7 +140,7 @@ namespace AMDiS { /// Recursive calculation of coordinates. Used by \ref setBary void createCoords(int* coordInd, int numCoords, int dimIndex, int rest, - DimVec<double>* vec = NULL); + DimVec<double>* vec = nullptr); /// Used by \ref setBary int** getIndexPermutations(int numIndices) const; diff --git a/AMDiS/src/LeafData.cc b/AMDiS/src/LeafData.cc index d73bfca97348dceb329ebb0374d869d41da989d9..a34957dd7fb8ea0ce018139cda2ac09b8428348c 100644 --- a/AMDiS/src/LeafData.cc +++ b/AMDiS/src/LeafData.cc @@ -221,7 +221,7 @@ namespace AMDiS { Element* child[2] = {child1, child2}; int dim = parent->getMesh()->getDim(); - LeafDataPeriodic *ld[2] = {NULL, NULL}; + LeafDataPeriodic *ld[2] = {nullptr, nullptr}; std::list<LeafDataPeriodic::PeriodicInfo>::iterator it; for (it = periodicInfoList.begin(); it != periodicInfoList.end(); ++it) { @@ -304,7 +304,7 @@ namespace AMDiS { for (int i = 0; i < dim + 1; i++) (*periodicCoords)[i] = (*(rhs.periodicCoords))[i]; } else { - periodicCoords = NULL; + periodicCoords = nullptr; } } @@ -313,7 +313,7 @@ namespace AMDiS { : periodicMode(mode), type(t), elementSide(side), - periodicCoords(NULL) + periodicCoords(nullptr) { if (coords) { int dim = coords->getSize() - 1; @@ -350,7 +350,7 @@ namespace AMDiS { if (periodicCoords) delete periodicCoords; if (size == 0) { - periodicCoords = NULL; + periodicCoords = nullptr; } else { periodicCoords = new DimVec<WorldVector<double> >(size-1, NO_INIT); for (int i = 0; i < size; i++) diff --git a/AMDiS/src/LeafData.h b/AMDiS/src/LeafData.h index 8a8e7422a4ec1bc78f8f1b256d1bb7de32dff418..78b73563f4e0998578fe697dfd06ab98a9d8783e 100644 --- a/AMDiS/src/LeafData.h +++ b/AMDiS/src/LeafData.h @@ -64,7 +64,7 @@ namespace AMDiS { }; /// constructor - LeafDataEstimatable(ElementData *decorated = NULL) + LeafDataEstimatable(ElementData *decorated = nullptr) : ElementData(decorated), errorEstimate(0.0) {} @@ -97,7 +97,7 @@ namespace AMDiS { virtual ElementData *clone() const { // create new estimatable leaf data - LeafDataEstimatable *newObj = new LeafDataEstimatable(NULL); + LeafDataEstimatable *newObj = new LeafDataEstimatable(nullptr); newObj->errorEstimate = errorEstimate; @@ -148,7 +148,7 @@ namespace AMDiS { } /// constructor - LeafDataEstimatableVec(ElementData *decorated = NULL) + LeafDataEstimatableVec(ElementData *decorated = nullptr) : ElementData(decorated) {} @@ -180,7 +180,7 @@ namespace AMDiS { { // create new estimatable leaf data LeafDataEstimatableVec *newObj = - new LeafDataEstimatableVec(NULL); + new LeafDataEstimatableVec(nullptr); newObj->errorEstimate = errorEstimate; @@ -242,7 +242,7 @@ namespace AMDiS { } /// constructor - LeafDataCoarsenable(ElementData *decorated = NULL) + LeafDataCoarsenable(ElementData *decorated = nullptr) : ElementData(decorated), coarseningError(0.00) {} @@ -266,7 +266,7 @@ namespace AMDiS { inline ElementData *clone() const { // create new estimatable leaf data - LeafDataCoarsenable *newObj = new LeafDataCoarsenable(NULL); + LeafDataCoarsenable *newObj = new LeafDataCoarsenable(nullptr); // clone decorated element data (=> deep copy) newObj->decorated = ElementData::clone(); @@ -328,7 +328,7 @@ namespace AMDiS { } /// constructor - LeafDataCoarsenableVec(ElementData *decorated = NULL) + LeafDataCoarsenableVec(ElementData *decorated = nullptr) : ElementData(decorated) {} @@ -337,7 +337,7 @@ namespace AMDiS { { // create new estimatable leaf data LeafDataCoarsenableVec *newObj = - new LeafDataCoarsenableVec(NULL); + new LeafDataCoarsenableVec(nullptr); newObj->coarseningError = coarseningError; @@ -417,7 +417,7 @@ namespace AMDiS { { public: PeriodicInfo() - : periodicCoords(NULL) + : periodicCoords(nullptr) {} PeriodicInfo(int mode, @@ -448,7 +448,7 @@ namespace AMDiS { public: /// constructor - LeafDataPeriodic(ElementData *decorated = NULL) + LeafDataPeriodic(ElementData *decorated = nullptr) : ElementData(decorated) {} diff --git a/AMDiS/src/MacroElement.cc b/AMDiS/src/MacroElement.cc index dc5d6451968eefd36696a878ea89ec349726139d..4050e4d9939dad44185fa531d2ec1da06163e78b 100644 --- a/AMDiS/src/MacroElement.cc +++ b/AMDiS/src/MacroElement.cc @@ -32,7 +32,7 @@ namespace AMDiS { MacroElement::MacroElement(int dim) - : element(NULL), + : element(nullptr), coord(dim, NO_INIT), boundary(dim, DEFAULT_VALUE, INTERIOR), projection(dim, NO_INIT), @@ -40,10 +40,10 @@ namespace AMDiS { oppVertex(dim, NO_INIT), index(-1), elType(0), - deserializedNeighbourIndices(NULL) + deserializedNeighbourIndices(nullptr) { - neighbour.set(NULL); - projection.set(NULL); + neighbour.set(nullptr); + projection.set(nullptr); } @@ -127,11 +127,11 @@ namespace AMDiS { TEST_EXIT(typeName == element->getTypeName())("wrong element type name\n"); } else { if (typeName == "Line") - element = new Line(NULL); + element = new Line(nullptr); if (typeName == "Triangle") - element = new Triangle(NULL); + element = new Triangle(nullptr); if (typeName == "Tetrahedron") - element = new Tetrahedron(NULL); + element = new Tetrahedron(nullptr); } element->deserialize(in); @@ -163,7 +163,7 @@ namespace AMDiS { for (int i = 0; i < size; i++) { int id; SerUtil::deserialize(in, id); - projection[i] = (id != -1) ? Projection::getProjection(id) : NULL; + projection[i] = (id != -1) ? Projection::getProjection(id) : nullptr; } // === Read neighbour indices. === @@ -183,7 +183,7 @@ namespace AMDiS { for (int i = 0; i < size; i++) SerUtil::deserialize(in, (*deserializedNeighbourIndices)[i]); - deserializedNeighbourIndices = NULL; + deserializedNeighbourIndices = nullptr; // read oppVertex oppVertex.deserialize(in); diff --git a/AMDiS/src/Marker.cc b/AMDiS/src/Marker.cc index 5cecbb63ea8855562ea35ee554b4743403a060b9..961099800daae073994cbad807ea592ad9b558ea 100644 --- a/AMDiS/src/Marker.cc +++ b/AMDiS/src/Marker.cc @@ -32,7 +32,7 @@ namespace AMDiS { int strategy = 0; Parameters::get(name + "->strategy", strategy); - Marker *marker = NULL; + Marker *marker = nullptr; switch (strategy) { case 0: @@ -209,7 +209,7 @@ namespace AMDiS { markRLimit = GERSGamma * estMax; TraverseStack stack; - ElInfo *elInfo = NULL; + ElInfo *elInfo = nullptr; elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); while (elInfo) { markElementForRefinement(adaptInfo, elInfo); @@ -232,7 +232,7 @@ namespace AMDiS { markCLimit = GERSGamma * estMax; TraverseStack stack; - ElInfo *elInfo = NULL; + ElInfo *elInfo = nullptr; elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); while (elInfo) { markElementForCoarsening(adaptInfo, elInfo); diff --git a/AMDiS/src/MatrixVector.h b/AMDiS/src/MatrixVector.h index bedbbaeb78d2229d8fb374626f05b167118ddc87..dc8d84f4d24a6e05ce0ef1a3094b428a2c3b1b1e 100644 --- a/AMDiS/src/MatrixVector.h +++ b/AMDiS/src/MatrixVector.h @@ -43,24 +43,24 @@ namespace AMDiS { /// Constructor. Vector(int i = 0) : size(i), - valArray(NULL) + valArray(nullptr) { if (size == 0) - valArray = NULL; + valArray = nullptr; else valArray = new T[size]; } inline bool used() const { - return (valArray != NULL); + return (valArray != nullptr); } /// Change the size of the vector to newSize. inline void resize(int newSize) { if (size != newSize) { - if (valArray != NULL) + if (valArray != nullptr) delete [] valArray; valArray = new T[newSize]; size = newSize; @@ -79,9 +79,9 @@ namespace AMDiS { /// Destructor. virtual ~Vector() { - if (valArray != NULL) { + if (valArray != nullptr) { delete [] valArray; - valArray = NULL; + valArray = nullptr; } } diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index f13df84b145d1c840dcf5c332dd3d5e67ad1bcd9..985c33d3a865141bf2f135f5ba7b554cbe802e43 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -97,17 +97,17 @@ namespace AMDiS { nEdges(0), nLeaves(0), nElements(0), - parametric(NULL), + parametric(nullptr), preserveCoarseDOFs(false), nDofEl(0), nDof(dimension, DEFAULT_VALUE, 0), nNodeEl(0), node(dimension, DEFAULT_VALUE, 0), - elementPrototype(NULL), - elementDataPrototype(NULL), + elementPrototype(nullptr), + elementDataPrototype(nullptr), elementIndex(-1), initialized(false), - macroFileInfo(NULL), + macroFileInfo(nullptr), changeIndex(0), final_lambda(dimension, DEFAULT_VALUE, 0.0) { @@ -142,7 +142,7 @@ namespace AMDiS { { deleteMeshStructure(); - if (macroFileInfo != NULL) + if (macroFileInfo != nullptr) delete macroFileInfo; if (elementPrototype) delete elementPrototype; @@ -168,7 +168,7 @@ namespace AMDiS { nFaces = m.nFaces; maxEdgeNeigh = m.maxEdgeNeigh; diam = m.diam; - parametric = NULL; + parametric = nullptr; preserveCoarseDOFs = m.preserveCoarseDOFs; nDofEl = m.nDofEl; @@ -236,7 +236,7 @@ namespace AMDiS { // for the vector index the corresponding element is stored in. // 3. Get this element from macroElements, and set it as the i-th // neighbour for the current element. - if((*it)->getNeighbour(i)!=NULL) { + if((*it)->getNeighbour(i)!=nullptr) { macroElements[insertCounter]-> setNeighbour(i, macroElements[mapIndex[(*it)->getNeighbour(i)->getIndex()]]); } @@ -248,8 +248,8 @@ namespace AMDiS { /* ================== Things will be done when required ============ */ - TEST_EXIT(elementDataPrototype == NULL)("TODO\n"); - TEST_EXIT(m.parametric == NULL)("TODO\n"); + TEST_EXIT(elementDataPrototype == nullptr)("TODO\n"); + TEST_EXIT(m.parametric == nullptr)("TODO\n"); TEST_EXIT(periodicAssociations.size() == 0)("TODO\n"); return *this; @@ -348,7 +348,7 @@ namespace AMDiS { if ((*macroIt)->getNeighbour(i)) for (int j = 0; j < getGeo(NEIGH); j++) if ((*macroIt)->getNeighbour(i)->getNeighbour(j) == *macroIt) - (*macroIt)->getNeighbour(i)->setNeighbour(j, NULL); + (*macroIt)->getNeighbour(i)->setNeighbour(j, nullptr); Element *mel = (*macroIt)->getElement(); // Delete element hierarchie @@ -356,8 +356,8 @@ namespace AMDiS { delete mel->getChild(0); delete mel->getChild(1); - mel->child[0] = NULL; - mel->child[1] = NULL; + mel->child[0] = nullptr; + mel->child[1] = nullptr; mel->setElementData(elementDataPrototype->clone()); } @@ -488,7 +488,7 @@ namespace AMDiS { compressAdmin->getHoleCount() < 1) continue; - vector<int> newDofIndex(size); + vector<DegreeOfFreedom> newDofIndex(size); compressAdmin->compress(newDofIndex); Flag fill_flag = (preserveCoarseDOFs ? @@ -519,7 +519,7 @@ namespace AMDiS { int ndof = getNumberOfDofs(position); if (ndof <= 0) - return NULL; + return nullptr; DegreeOfFreedom *dof = new DegreeOfFreedom[ndof]; @@ -544,11 +544,11 @@ namespace AMDiS { DegreeOfFreedom **Mesh::createDofPtrs() { if (nNodeEl <= 0) - return NULL; + return nullptr; DegreeOfFreedom **ptrs = new DegreeOfFreedom*[nNodeEl]; for (int i = 0; i < nNodeEl; i++) - ptrs[i] = NULL; + ptrs[i] = nullptr; return ptrs; } @@ -558,7 +558,7 @@ namespace AMDiS { { FUNCNAME_DBG("Mesh::freeDofPtrs()"); - TEST_EXIT_DBG(ptrs)("ptrs is NULL!\n"); + TEST_EXIT_DBG(ptrs)("ptrs is nullptr!\n"); if (nNodeEl <= 0) return; @@ -582,7 +582,7 @@ namespace AMDiS { const DOFAdmin* Mesh::getVertexAdmin() const { - const DOFAdmin *localAdmin = NULL; + const DOFAdmin *localAdmin = nullptr; for (unsigned int i = 0; i < admin.size(); i++) { if (admin[i]->getNumberOfDofs(VERTEX)) { @@ -605,9 +605,9 @@ namespace AMDiS { ("unknown position %d\n", position); if (nDof[position]) { - TEST_EXIT_DBG(dof != NULL)("dof = NULL, but ndof = %d\n", nDof[position]); + TEST_EXIT_DBG(dof != nullptr)("dof = nullptr, but ndof = %d\n", nDof[position]); } else { - TEST_EXIT_DBG(dof == NULL)("dof != NULL, but ndof = 0\n"); + TEST_EXIT_DBG(dof == nullptr)("dof != nullptr, but ndof = 0\n"); } TEST_EXIT_DBG(nDof[position] <= MAX_DOF) @@ -646,7 +646,7 @@ namespace AMDiS { if (!parent && elementDataPrototype) el->setElementData(elementDataPrototype->clone()); else - el->setElementData(NULL); // must be done in ElementData::refineElementData() + el->setElementData(nullptr); // must be done in ElementData::refineElementData() return el; } @@ -668,7 +668,7 @@ namespace AMDiS { break; default: ERROR_EXIT("invalid dim [%d]\n",dim); - return NULL; + return nullptr; } } @@ -680,14 +680,14 @@ namespace AMDiS { const WorldVector<double> *xy0, double *sp) { - static const MacroElement *mel = NULL; + static const MacroElement *mel = nullptr; DimVec<double> lambda(dim, NO_INIT); ElInfo *mel_info = createNewElInfo(); - if (start_mel != NULL) + if (start_mel != nullptr) mel = start_mel; else - if (mel == NULL || mel->getElement()->getMesh() != this) + if (mel == nullptr || mel->getElement()->getMesh() != this) mel = *(macroElements.begin()); mel_info->setFillFlag(Mesh::FILL_COORDS); @@ -1145,7 +1145,7 @@ namespace AMDiS { int size; SerUtil::deserialize(in, size); - admin.resize(size, NULL); + admin.resize(size, nullptr); for (int i = 0; i < size; i++) { if (!admin[i]) admin[i] = new DOFAdmin(this); @@ -1188,7 +1188,7 @@ namespace AMDiS { macroElements[i]->setNeighbour(j, macroElements[index]); } else { - macroElements[i]->setNeighbour(j, NULL); + macroElements[i]->setNeighbour(j, nullptr); } } } @@ -1369,7 +1369,7 @@ namespace AMDiS { int filenameRandomNumber = 0; if (MPI::COMM_WORLD.Get_rank() == 0) { - srand(time(NULL)); + srand(time(0)); filenameRandomNumber = rand() % 1000000; } MPI::COMM_WORLD.Barrier(); @@ -1483,7 +1483,7 @@ namespace AMDiS { { macroFileInfo->clear(); delete macroFileInfo; - macroFileInfo = NULL; + macroFileInfo = nullptr; } diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h index 5ed973a3c290c1c01366f0c7f9d9b839a8880970..a27aef56c4348b8b554d2063a5bb1d7a8abf474d 100644 --- a/AMDiS/src/Mesh.h +++ b/AMDiS/src/Mesh.h @@ -373,7 +373,7 @@ namespace AMDiS { /** \} */ /// Creates a new Element by cloning \ref elementPrototype - Element* createNewElement(Element *parent = NULL); + Element* createNewElement(Element *parent = nullptr); /// Creates a new ElInfo dependent of \ref dim of the mesh ElInfo* createNewElInfo(); @@ -430,17 +430,17 @@ namespace AMDiS { * \param xy world coordinates of point * \param elp return address for a pointer to the element at xy * \param pary returns barycentric coordinates of xy - * \param start_mel initial guess for the macro element containing xy or NULL - * \param xy0 start point from a characteristic method, see below, or NULL + * \param start_mel initial guess for the macro element containing xy or nullptr + * \param xy0 start point from a characteristic method, see below, or nullptr * \param sp return address for relative distance to domain boundary in a - * characteristic method, see below, or NULL + * characteristic method, see below, or nullptr * \return true is xy is inside the domain , false otherwise * * For a characteristic method, where \f$ xy = xy_0 - V\tau \f$, it may be * convenient to know the point on the domain's boundary which lies on the * line segment between the old point xy0 and the new point xy, in case that * xy is outside the domain. Such information is returned when xy0 and a - * pointer sp!=NULL are supplied: *sp is set to the value s such that + * pointer sp!=nullptr are supplied: *sp is set to the value s such that * \f$ xy_0 +s (xy -xy_0) \in \partial Domain \f$, and the element and local * coordinates corresponding to that boundary point will be returned via elp * and bary. @@ -749,7 +749,7 @@ namespace AMDiS { /// Diameter of the mesh in the DIM_OF_WORLD directions WorldVector<double> diam; - /// Is pointer to NULL if mesh contains no parametric elements else pointer + /// Is pointer to nullptr if mesh contains no parametric elements else pointer /// to a Parametric object containing coefficients of the parameterization /// and related information Parametric *parametric; @@ -865,12 +865,12 @@ namespace AMDiS { /// for findElement-Fcts DimVec<double> final_lambda; - /// Temporary variables that are used in functions \ref fineElInfoatPoint - /// and \ref fineElementAtPointRecursive. + /// Temporary variables that are used in functions \ref findElInfoAtPoint + /// and \ref findElementAtPointRecursive. const WorldVector<double> *g_xy0, *g_xy; - /// Temporary variable that is used in functions \ref fineElInfoatPoint and - /// \ref fineElementAtPointRecursive. + /// Temporary variable that is used in functions \ref findElInfoAtPoint and + /// \ref findElementAtPointRecursive. double *g_sp; friend class MacroInfo; diff --git a/AMDiS/src/MeshStructure.cc b/AMDiS/src/MeshStructure.cc index 51d5096f5f81460cd4f4713515d60e35537276d4..dd8790199d80bc37cdd270cc061a4b053b0ca538 100644 --- a/AMDiS/src/MeshStructure.cc +++ b/AMDiS/src/MeshStructure.cc @@ -308,7 +308,7 @@ namespace AMDiS { // decorate leaf data reset(); TraverseStack stack; - ElInfo *elInfo = NULL; + ElInfo *elInfo = nullptr; if (macroElIndex == -1) elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); else @@ -361,7 +361,7 @@ namespace AMDiS { elInfo = stack.traverseFirstOneMacro(mesh, macroElIndex, -1, Mesh::CALL_LEAF_EL); while (elInfo) { Element *element = elInfo->getElement(); - if (element->getElementData(MESH_STRUCTURE) != NULL) { + if (element->getElementData(MESH_STRUCTURE) != nullptr) { element->setMark(1); finished = false; } else { diff --git a/AMDiS/src/MeshStructure.h b/AMDiS/src/MeshStructure.h index 4ac39be0bc50cd80a82fc4d5787e2246da25d2b3..98a8d015b99ab8c57ddc4f741d0874104362238b 100644 --- a/AMDiS/src/MeshStructure.h +++ b/AMDiS/src/MeshStructure.h @@ -86,11 +86,11 @@ namespace AMDiS { reset(); } - bool skipBranch(MeshStructure *insert = NULL); + bool skipBranch(MeshStructure *insert = nullptr); ElInfo *skipBranch(ElInfo *elInfo, TraverseStack *stack); - bool nextElement(MeshStructure *insert = NULL); + bool nextElement(MeshStructure *insert = nullptr); int lookAhead(unsigned int n = 1); diff --git a/AMDiS/src/MeshStructure_ED.h b/AMDiS/src/MeshStructure_ED.h index 0024821bcfbf7b6dec4e6e6d30045300dc3fb63f..55c1b201f9449303bccd7a781632819c77efac92 100644 --- a/AMDiS/src/MeshStructure_ED.h +++ b/AMDiS/src/MeshStructure_ED.h @@ -37,9 +37,9 @@ namespace AMDiS { class MeshStructure_ED : public ElementData { public: - MeshStructure_ED(ElementData *decorated = NULL) + MeshStructure_ED(ElementData *decorated = nullptr) : ElementData(decorated), - structure(NULL) + structure(nullptr) {} virtual ~MeshStructure_ED() diff --git a/AMDiS/src/Operator.cc b/AMDiS/src/Operator.cc index b6aa72b22bca2e71654d6726fb13cadae5daa48b..e6f6faf349c3a468e12bc79feeaca401b292258d 100644 --- a/AMDiS/src/Operator.cc +++ b/AMDiS/src/Operator.cc @@ -34,8 +34,8 @@ namespace AMDiS { fillFlag(Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS | Mesh::FILL_DET | Mesh::FILL_GRD_LAMBDA), needDualTraverse(false), - assembler(NULL), - uhOld(NULL), + assembler(nullptr), + uhOld(nullptr), optimized(true) { secondOrder.resize(0); @@ -60,7 +60,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(NULL, NULL, NULL, NULL); + initAssembler(nullptr, nullptr, nullptr, nullptr); assembler.get()->calculateElementMatrix(elInfo, userMat, factor); } @@ -73,7 +73,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(NULL, NULL, NULL, NULL); + initAssembler(nullptr, nullptr, nullptr, nullptr); assembler.get()->calculateElementMatrix(rowElInfo, colElInfo, smallElInfo, largeElInfo, @@ -87,7 +87,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(NULL, NULL, NULL, NULL); + initAssembler(nullptr, nullptr, nullptr, nullptr); assembler.get()->calculateElementVector(elInfo, userVec, factor); } @@ -99,7 +99,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(NULL, NULL, NULL, NULL); + initAssembler(nullptr, nullptr, nullptr, nullptr); assembler.get()->calculateElementVector(mainElInfo, auxElInfo, smallElInfo, largeElInfo, @@ -128,7 +128,7 @@ namespace AMDiS { int Operator::getQuadratureDegree(int order, FirstOrderType firstOrderType) { - std::vector<OperatorTerm*>* terms = NULL; + std::vector<OperatorTerm*>* terms = nullptr; switch(order) { case 0: @@ -171,7 +171,7 @@ namespace AMDiS { Assembler* Operator::getAssembler() { if (!assembler.get()) - initAssembler(NULL, NULL, NULL, NULL); + initAssembler(nullptr, nullptr, nullptr, nullptr); return assembler.get(); } diff --git a/AMDiS/src/Operator.h b/AMDiS/src/Operator.h index 6086ea359b6dbb23deb52f7e5875bb36b6c0b71c..0c2a9bba1bcebdce623ae383dcc7cbad1fce48ac 100644 --- a/AMDiS/src/Operator.h +++ b/AMDiS/src/Operator.h @@ -57,7 +57,7 @@ namespace AMDiS { public: /// Constructs an empty Operator of type operatorType for the given FiniteElemSpace. Operator(const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); /// Destructor. virtual ~Operator() {} diff --git a/AMDiS/src/OperatorTerm.h b/AMDiS/src/OperatorTerm.h index 532155125f70dc64a077f090d008f3de33e4b330..b6c05389e2a34c2f5995dce9e29eaa35c945b164 100644 --- a/AMDiS/src/OperatorTerm.h +++ b/AMDiS/src/OperatorTerm.h @@ -60,13 +60,13 @@ namespace AMDiS { /// each OperatorTerm belonging to this SubAssembler. E.g., vectors /// and coordinates at quadrature points can be calculated here. virtual void initElement(const ElInfo*, SubAssembler*, - Quadrature *quad = NULL) + Quadrature *quad = nullptr) {} virtual void initElement(const ElInfo* largeElInfo, const ElInfo* smallElInfo, SubAssembler*, - Quadrature *quad = NULL) + Quadrature *quad = nullptr) {} diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc index 7638b350b41b9b1cfb98543c3f88a0125b910321..b9ce8cc754e07c9c77afa9a5e3e065bb9b24d8fb 100644 --- a/AMDiS/src/PeriodicBC.cc +++ b/AMDiS/src/PeriodicBC.cc @@ -74,7 +74,7 @@ namespace AMDiS { { FUNCNAME("PeriodicDOFMapping::getDOFPermutation()"); - if (dofPermutation[vertexPermutation] == NULL) { + if (dofPermutation[vertexPermutation] == nullptr) { int dim = basFcts->getDim(); int nBasFcts = basFcts->getNumber(); int sum = 0; @@ -107,14 +107,14 @@ namespace AMDiS { PeriodicBC::PeriodicBC(BoundaryType type, const FiniteElemSpace *rowSpace) - : BoundaryCondition(type, rowSpace, NULL), - masterMatrix(NULL) + : BoundaryCondition(type, rowSpace, nullptr), + masterMatrix(nullptr) { if (rowFeSpace->getMesh()->getDim() > 1) periodicDOFMapping = PeriodicDOFMapping::providePeriodicDOFMapping(rowFeSpace->getBasisFcts()); else - periodicDOFMapping = NULL; + periodicDOFMapping = nullptr; } @@ -217,7 +217,7 @@ namespace AMDiS { TEST_EXIT(associated)("No associated vector!\n"); if (matrix == masterMatrix) - masterMatrix = NULL; + masterMatrix = nullptr; using namespace mtl; diff --git a/AMDiS/src/PeriodicConnection.h b/AMDiS/src/PeriodicConnection.h index e441e44da7b14c54dcf31cd3d2ee77b71d38bf06..c9ab6a89a94a13253470e87415ec4be7a7efd52f 100644 --- a/AMDiS/src/PeriodicConnection.h +++ b/AMDiS/src/PeriodicConnection.h @@ -55,7 +55,7 @@ el_[1] = el1; vertices_[0] = new DimVec<int>(vertices0); vertices_[1] = new DimVec<int>(vertices1); - child_[0] = child_[1] = NULL; + child_[0] = child_[1] = nullptr; }; ~PeriodicConnection() { @@ -79,8 +79,8 @@ FUNCNAME("PeriodicConnection::removeElement()"); TEST_EXIT(index >= 0 && index <= 2)("invalid index\n"); TEST_EXIT(el_[index])("element already removed\n"); - el_[index] = NULL; - return (el_[abs(index-1)] == NULL); + el_[index] = nullptr; + return (el_[abs(index-1)] == nullptr); }; bool refineElement(int index, @@ -93,8 +93,8 @@ TEST_EXIT(child_[0] && child_[1]) ("only one child\n"); - TEST_EXIT(el_[abs(index-1)] == NULL) - ("connection already refined but other element != NULL\n"); + TEST_EXIT(el_[abs(index-1)] == nullptr) + ("connection already refined but other element != nullptr\n"); *child0 = child_[0]; *child1 = child_[1]; diff --git a/AMDiS/src/ProblemImplicit.cc b/AMDiS/src/ProblemImplicit.cc index 1ca235d2feca5c10b82daebb312b35895d131d54..832f7511dd96c49586fdba9ee0d09d5c3408e5a9 100644 --- a/AMDiS/src/ProblemImplicit.cc +++ b/AMDiS/src/ProblemImplicit.cc @@ -59,10 +59,10 @@ namespace AMDiS { DOFVector<double>* phi2 = getPhi2(implMesh, comp); DOFVector<double>* levelSet = getLevelset(implMesh, comp); - TEST_EXIT(r != NULL)("no signed distance vector\n"); - TEST_EXIT(phi1 != NULL)("no phasefield1 vector\n"); - TEST_EXIT(phi2 != NULL)("no phasefield2 vector\n"); - TEST_EXIT(levelSet != NULL)("no levelSet vector\n"); + TEST_EXIT(r != nullptr)("no signed distance vector\n"); + TEST_EXIT(phi1 != nullptr)("no phasefield1 vector\n"); + TEST_EXIT(phi2 != nullptr)("no phasefield2 vector\n"); + TEST_EXIT(levelSet != nullptr)("no levelSet vector\n"); bool checkSize = r->getSize() == phi1->getSize() && r->getSize() == phi2->getSize(); @@ -87,10 +87,10 @@ namespace AMDiS { DOFVector<double>* phi2 = getPhi2(implMesh, comp); DOFVector<double>* levelSet = getLevelset(implMesh, comp); - TEST_EXIT(r != NULL)("no signed distance vector\n"); - TEST_EXIT(phi1 != NULL)("no phasefield1 vector\n"); - TEST_EXIT(phi2 != NULL)("no phasefield2 vector\n"); - TEST_EXIT(levelSet != NULL)("no levelSet vector\n"); + TEST_EXIT(r != nullptr)("no signed distance vector\n"); + TEST_EXIT(phi1 != nullptr)("no phasefield1 vector\n"); + TEST_EXIT(phi2 != nullptr)("no phasefield2 vector\n"); + TEST_EXIT(levelSet != nullptr)("no levelSet vector\n"); bool checkSize = r->getSize() == phi1->getSize() && r->getSize() == phi2->getSize(); @@ -115,10 +115,10 @@ namespace AMDiS { DOFVector<double>* phi2 = getPhi2(implMesh, comp); DOFVector<double>* levelSet = getLevelset(implMesh, comp); - TEST_EXIT(r != NULL)("no signed distance vector\n"); - TEST_EXIT(phi1 != NULL)("no phasefield1 vector\n"); - TEST_EXIT(phi2 != NULL)("no phasefield2 vector\n"); - TEST_EXIT(levelSet != NULL)("no levelSet vector\n"); + TEST_EXIT(r != nullptr)("no signed distance vector\n"); + TEST_EXIT(phi1 != nullptr)("no phasefield1 vector\n"); + TEST_EXIT(phi2 != nullptr)("no phasefield2 vector\n"); + TEST_EXIT(levelSet != nullptr)("no levelSet vector\n"); bool checkSize = r->getSize() == phi1->getSize() && r->getSize() == phi2->getSize(); @@ -184,7 +184,7 @@ namespace AMDiS { DOFVector<double>* ProblemImplicit::getSignedDistance(unsigned int im , unsigned int m) { if (m >= r.size() || im >= r[m].size()) - return NULL; + return nullptr; return (r[m])[im]; } @@ -192,7 +192,7 @@ namespace AMDiS { DOFVector<double>* ProblemImplicit::getPhi1(unsigned int im, unsigned int m) { if (m >= phi1.size() || im >= phi1[m].size()) - return NULL; + return nullptr; return (phi1[m])[im]; } @@ -201,7 +201,7 @@ namespace AMDiS { DOFVector<double>* ProblemImplicit::getPhi2(unsigned int im, unsigned int m) { if (m >= phi2.size() || im >= phi2[m].size()) - return NULL; + return nullptr; return (phi2[m])[im]; } @@ -210,7 +210,7 @@ namespace AMDiS { DOFVector<double>* ProblemImplicit::getLevelset(unsigned int im, unsigned int m) { if (m >= levelSet.size() || im >= levelSet[m].size()) - return NULL; + return nullptr; return (levelSet[m])[im]; } @@ -237,10 +237,10 @@ namespace AMDiS { Parameters::get(path + "nr meshes", nImplMeshes); if (nImplMeshes == 0) return false; - r[p].resize(nImplMeshes, NULL); - phi1[p].resize(nImplMeshes, NULL); - phi2[p].resize(nImplMeshes, NULL); - levelSet[p].resize(nImplMeshes, NULL); + r[p].resize(nImplMeshes, nullptr); + phi1[p].resize(nImplMeshes, nullptr); + phi2[p].resize(nImplMeshes, nullptr); + levelSet[p].resize(nImplMeshes, nullptr); for ( int i = 0; i < nImplMeshes ; ++i ) { (r[p])[i] = new DOFVector< double >(getFeSpace(p), "r"); @@ -269,7 +269,7 @@ namespace AMDiS { if (serType < 0) return false; - TEST_EXIT(meshes[comp] != NULL)("the mesh was not created\n"); + TEST_EXIT(meshes[comp] != nullptr)("the mesh was not created\n"); switch (serType) { case 0: @@ -327,16 +327,16 @@ namespace AMDiS { { for ( unsigned int p(0); p < meshes.size(); ++p ) { for ( unsigned int i = 0; i < r[p].size() ; ++i ) - if ( r[p][i] != NULL) + if ( r[p][i] != nullptr) delete r[p][i]; for ( unsigned int i(0); i < phi1[p].size(); ++i ) - if ( phi1[p][i] != NULL) + if ( phi1[p][i] != nullptr) delete phi1[p][i]; for ( unsigned int i(0); i < phi2[p].size(); ++i ) - if ( phi2[p][i] != NULL) + if ( phi2[p][i] != nullptr) delete phi2[p][i]; for ( unsigned int i(0); i < levelSet[p].size(); ++i ) - if ( levelSet[p][i] != NULL) + if ( levelSet[p][i] != nullptr) delete levelSet[p][i]; } diff --git a/AMDiS/src/ProblemImplicit.h b/AMDiS/src/ProblemImplicit.h index 05f3ad92c437c61dc9ab1a3a0edbc41a23b94237..77ad050c623de5a52ae0cd5820f1c2689b47f891 100644 --- a/AMDiS/src/ProblemImplicit.h +++ b/AMDiS/src/ProblemImplicit.h @@ -39,7 +39,7 @@ namespace AMDiS { { public: ProblemImplicit(string name, - ProblemIterationInterface* problem = NULL) + ProblemIterationInterface* problem = nullptr) : ProblemStat(name, problem), r(0), phi1(0), @@ -52,7 +52,7 @@ namespace AMDiS { virtual void createMesh(); virtual void initialize(Flag initFlag, - ProblemStatSeq* adoptProblem = NULL, + ProblemStatSeq* adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING); bool createImplicitMesh(); diff --git a/AMDiS/src/ProblemInstat.cc b/AMDiS/src/ProblemInstat.cc index edf184bc5dcbece6f06396b5f7c957b8c5f9253b..8b2f9df4bbb88aba879c8c49aad372bc0563b66a 100644 --- a/AMDiS/src/ProblemInstat.cc +++ b/AMDiS/src/ProblemInstat.cc @@ -72,15 +72,15 @@ namespace AMDiS { ProblemStatBase *initialProb) : ProblemInstatBase(sname, initialProb), problemStat(prob), - oldSolution(NULL) + oldSolution(nullptr) {} ProblemInstat::ProblemInstat(string sname, ProblemStatSeq &prob) - : ProblemInstatBase(sname, NULL), + : ProblemInstatBase(sname, nullptr), problemStat(&prob), - oldSolution(NULL) + oldSolution(nullptr) {} @@ -89,7 +89,7 @@ namespace AMDiS { ProblemStatBase &initialProb) : ProblemInstatBase(sname, &initialProb), problemStat(&prob), - oldSolution(NULL) + oldSolution(nullptr) {} diff --git a/AMDiS/src/ProblemInstat.h b/AMDiS/src/ProblemInstat.h index 6a307515db42daba4a43e46d260b3fe36a572d31..59f393c3dba30aedca1c5aedb17e0d6acdec510d 100644 --- a/AMDiS/src/ProblemInstat.h +++ b/AMDiS/src/ProblemInstat.h @@ -53,7 +53,7 @@ namespace AMDiS { /// Initialisation of the problem. virtual void initialize(Flag initFlag, - ProblemInstat *adoptProblem = NULL, + ProblemInstat *adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING) {} @@ -156,7 +156,7 @@ namespace AMDiS { /// Constructs a ProblemInstatVec with prob as its stationary problem. ProblemInstat(std::string name, ProblemStatSeq *prob, - ProblemStatBase *initialProb = NULL); + ProblemStatBase *initialProb = nullptr); ProblemInstat(std::string name, ProblemStatSeq &prob); @@ -167,7 +167,7 @@ namespace AMDiS { /// Initialisation of the problem. void initialize(Flag initFlag, - ProblemInstat *adoptProblem = NULL, + ProblemInstat *adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). diff --git a/AMDiS/src/ProblemIterationInterface.h b/AMDiS/src/ProblemIterationInterface.h index 81a63a14b3b4ddd9d7315ca5fb201e3d9065813e..f9c75f8a29d79973e5d489de83addb82cc4990c9 100644 --- a/AMDiS/src/ProblemIterationInterface.h +++ b/AMDiS/src/ProblemIterationInterface.h @@ -79,7 +79,7 @@ namespace AMDiS { /// Returns the problem with the given name. virtual ProblemStatBase *getProblem(std::string name) { - return NULL; + return nullptr; } /// Returns the name of the problem. diff --git a/AMDiS/src/ProblemStat.cc b/AMDiS/src/ProblemStat.cc index 618dd4e4dda2a688256c9bf358a5c7f51aca49eb..4a8f82ef774fc6124f69d2acdfa8cb041676a9ba 100644 --- a/AMDiS/src/ProblemStat.cc +++ b/AMDiS/src/ProblemStat.cc @@ -60,13 +60,13 @@ namespace AMDiS { nComponents(-1), nMeshes(0), traverseInfo(0), - solver(NULL), - solution(NULL), - rhs(NULL), - systemMatrix(NULL), + solver(nullptr), + solution(nullptr), + rhs(nullptr), + systemMatrix(nullptr), useGetBound(true), - refinementManager(NULL), - coarseningManager(NULL), + refinementManager(nullptr), + coarseningManager(nullptr), info(10), deserialized(false), computeExactError(false), @@ -76,8 +76,8 @@ namespace AMDiS { Parameters::get(name + "->components", nComponents); TEST_EXIT(nComponents > 0)("No value set for parameter \"%s->components\"!\n", name.c_str()); - estimator.resize(nComponents, NULL); - marker.resize(nComponents, NULL); + estimator.resize(nComponents, nullptr); + marker.resize(nComponents, nullptr); assembleMatrixOnlyOnce.resize(nComponents); assembledMatrix.resize(nComponents); @@ -114,39 +114,39 @@ namespace AMDiS { { if (rhs) delete rhs; - rhs = NULL; + rhs = nullptr; if (solution) delete solution; - solution = NULL; + solution = nullptr; if (systemMatrix) { for (int i = 0; i < nComponents; i++) for (int j = 0; j < nComponents; j++) if ((*systemMatrix)[i][j]) { delete (*systemMatrix)[i][j]; - (*systemMatrix)[i][j] = NULL; + (*systemMatrix)[i][j] = nullptr; } delete systemMatrix; - systemMatrix = NULL; + systemMatrix = nullptr; } for (unsigned int i = 0; i < meshes.size(); i++) if (meshes[i]) { // delete meshes[i]; -// meshes[i] = NULL; +// meshes[i] = nullptr; } for (unsigned int i = 0; i < estimator.size(); i++) if (estimator[i]) { delete estimator[i]; - estimator[i] = NULL; + estimator[i] = nullptr; } for (unsigned int i = 0; i < marker.size(); i++) if (marker[i]) { delete marker[i]; - marker[i] = NULL; + marker[i] = nullptr; } } @@ -189,7 +189,7 @@ namespace AMDiS { WARNING("no mesh created\n"); // === create refinement/corasening-manager === - if (refinementManager != NULL && coarseningManager != NULL) { + if (refinementManager != nullptr && coarseningManager != nullptr) { WARNING("refinement-/coarseningmanager already created\n"); } else { if (initFlag.isSet(CREATE_MESH) || @@ -206,7 +206,7 @@ namespace AMDiS { } } - if (refinementManager == NULL || coarseningManager == NULL) + if (refinementManager == nullptr || coarseningManager == nullptr) WARNING("no refinement-/coarseningmanager created\n"); // === create fespace === @@ -215,7 +215,7 @@ namespace AMDiS { } else { if (initFlag.isSet(INIT_FE_SPACE) || (initFlag.isSet(INIT_SYSTEM) && !adoptFlag.isSet(INIT_FE_SPACE))) - createFeSpace(NULL); + createFeSpace(nullptr); if (adoptProblem && (adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM))) { @@ -394,7 +394,7 @@ namespace AMDiS { if (refSet < 0) refSet = 0; - if (meshForRefinementSet[refSet] == NULL) { + if (meshForRefinementSet[refSet] == nullptr) { Mesh *newMesh = new Mesh(meshName, dim); meshForRefinementSet[refSet] = newMesh; meshes.push_back(newMesh); @@ -442,7 +442,7 @@ namespace AMDiS { Parameters::get(name + "->dim", dim); TEST_EXIT(dim != -1)("no problem dimension specified!\n"); - componentSpaces.resize(nComponents, NULL); + componentSpaces.resize(nComponents, nullptr); traverseInfo.resize(nComponents); for (int i = 0; i < nComponents; i++) { @@ -451,9 +451,9 @@ namespace AMDiS { boost::lexical_cast<string>(i) + "]", degree); TEST_EXIT(degree > 0) ("Poynomial degree in component %d must be larger than zero!\n", i); - TEST_EXIT(componentSpaces[i] == NULL)("feSpace already created\n"); + TEST_EXIT(componentSpaces[i] == nullptr)("feSpace already created\n"); - if (feSpaceMap[pair<Mesh*, int>(componentMeshes[i], degree)] == NULL) { + if (feSpaceMap[pair<Mesh*, int>(componentMeshes[i], degree)] == nullptr) { stringstream s; s << name << "->feSpace[" << i << "]"; @@ -490,7 +490,7 @@ namespace AMDiS { // === create vectors and system matrix === systemMatrix = new Matrix<DOFMatrix*>(nComponents, nComponents); - systemMatrix->set(NULL); + systemMatrix->set(nullptr); rhs = new SystemVector("rhs", componentSpaces, nComponents); solution = new SystemVector("solution", componentSpaces, nComponents); @@ -556,7 +556,7 @@ namespace AMDiS { (new LeafDataEstimatableVec(new LeafDataCoarsenableVec)); for (int i = 0; i < nComponents; i++) { - TEST_EXIT(estimator[i] == NULL)("estimator already created\n"); + TEST_EXIT(estimator[i] == nullptr)("estimator already created\n"); string estName = name + "->estimator[" + boost::lexical_cast<string>(i) + "]"; @@ -824,7 +824,7 @@ namespace AMDiS { // The DOFMatrix which should be assembled (or not, if assembleMatrix // will be set to false). DOFMatrix *matrix = - (asmMatrix ? (*systemMatrix)[rowComponent][colComponent] : NULL); + (asmMatrix ? (*systemMatrix)[rowComponent][colComponent] : nullptr); if (writeAsmInfo && matrix) { MSG(" -> matrix has %d operators\n", matrix->getOperators().size()); @@ -885,10 +885,10 @@ namespace AMDiS { // fe spaces, or all aux fe spaces are equal to the row and col fe space. assembleOnOneMesh(componentSpaces[rowComponent], assembleFlag, - assembleMatrix ? matrix : NULL, + assembleMatrix ? matrix : nullptr, ((rowComponent == colComponent) && asmVector) ? rhs->getDOFVector(rowComponent) : - NULL); + nullptr); // #pragma omp barrier @@ -946,8 +946,7 @@ namespace AMDiS { for (unsigned int i = 0; i < meshes.size(); i++) meshes[i]->dofCompress(); - - clock_t first = clock(); + Timer t; Flag assembleFlag = flag | @@ -995,7 +994,7 @@ namespace AMDiS { bool assembleMatrix = true; // The DOFMatrix which should be assembled (or not, if assembleMatrix // will be set to false). - DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL); + DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : nullptr); if (writeAsmInfo && matrix) { for (vector<Operator*>::iterator it = matrix->getOperatorsBegin(); @@ -1052,7 +1051,7 @@ namespace AMDiS { const BasisFunction *basisFcts = componentSpaces[0]->getBasisFcts(); BoundaryType *bound = - useGetBound ? new BoundaryType[basisFcts->getNumber()] : NULL; + useGetBound ? new BoundaryType[basisFcts->getNumber()] : nullptr; DualTraverse dualTraverse; DualElInfo dualElInfo; @@ -1070,21 +1069,21 @@ namespace AMDiS { for (int i = 0; i < nComponents; i++) { for (int j = 0; j < nComponents; j++) { - DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL); + DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : nullptr); if (!matrix) continue; if (traverseInfo.eqSpaces(i, j)) { - ElInfo *elInfo = NULL; + ElInfo *elInfo = nullptr; if (componentMeshes[i] == meshes[0] && newEl0) elInfo = dualElInfo.rowElInfo; if (componentMeshes[i] == meshes[1] && newEl1) elInfo = dualElInfo.colElInfo; - if (elInfo != NULL) { + if (elInfo != nullptr) { if (useGetBound) basisFcts->getBound(elInfo, bound); @@ -1157,7 +1156,7 @@ namespace AMDiS { for (int i = 0; i < nComponents; i++) { for (int j = 0; j < nComponents; j++) { - DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL); + DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : nullptr); if (!matrix) continue; @@ -1183,7 +1182,7 @@ namespace AMDiS { INFO(info, 8)("fillin of assembled matrix: %d\n", nnz); INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", - TIME_USED(first, clock())); + t.elapsed()); } @@ -1196,9 +1195,6 @@ namespace AMDiS { for (int i = 0; i < static_cast<int>(fileWriters.size()); i++) fileWriters[i]->writeFiles(adaptInfo, force); -#ifdef HAVE_PARALLEL_DOMAIN_AMDIS - MPI::COMM_WORLD.Barrier(); -#endif INFO(info, 8)("writeFiles needed %.5f seconds\n", t.elapsed()); } @@ -1451,7 +1447,7 @@ namespace AMDiS { boundaryConditionSet = true; RobinBC *robin = - new RobinBC(type, NULL, op, componentSpaces[row], componentSpaces[col]); + new RobinBC(type, nullptr, op, componentSpaces[row], componentSpaces[col]); if (systemMatrix && (*systemMatrix)[row][col]) (*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(robin); @@ -1464,7 +1460,7 @@ namespace AMDiS { boundaryConditionSet = true; RobinBC *robin = - new RobinBC(type, op, NULL, componentSpaces[row]); + new RobinBC(type, op, nullptr, componentSpaces[row]); if (rhs) rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(robin); @@ -1482,7 +1478,7 @@ namespace AMDiS { TraverseStack stack; BoundaryType *bound = - useGetBound ? new BoundaryType[basisFcts->getNumber()] : NULL; + useGetBound ? new BoundaryType[basisFcts->getNumber()] : nullptr; if (matrix) matrix->startInsertion(matrix->getNnz()); @@ -1505,7 +1501,7 @@ namespace AMDiS { } if (vector) - vector->assemble(1.0, elInfo, bound, NULL); + vector->assemble(1.0, elInfo, bound, nullptr); elInfo = stack.traverseNext(elInfo); } diff --git a/AMDiS/src/ProblemStat.h b/AMDiS/src/ProblemStat.h index 2f25d5a4bd22e5de147b3e8f1b5ebe181ae91f1a..042239e15c2d5febd07e709342ef098add11cde4 100644 --- a/AMDiS/src/ProblemStat.h +++ b/AMDiS/src/ProblemStat.h @@ -70,14 +70,14 @@ namespace AMDiS { public: /// Constructor ProblemStatSeq(string nameStr, - ProblemIterationInterface *problemIteration = NULL); + ProblemIterationInterface *problemIteration = nullptr); /// Destructor virtual ~ProblemStatSeq(); /// Initialisation of the problem. virtual void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = NULL, + ProblemStatSeq *adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). @@ -112,38 +112,38 @@ namespace AMDiS { /// of problems system to \ref solver. void solve(AdaptInfo *adaptInfo, bool createMatrixData = true, - bool storeMatrixData = false); + bool storeMatrixData = false) override; /// Implementation of ProblemStatBase::estimate(). Deligates the estimation /// to \ref estimator. - virtual void estimate(AdaptInfo *adaptInfo); + void estimate(AdaptInfo *adaptInfo) override; /// Implementation of ProblemStatBase::markElements(). /// Deligated to \ref adapt. - virtual Flag markElements(AdaptInfo *adaptInfo); + Flag markElements(AdaptInfo *adaptInfo) override; /// Implementation of ProblemStatBase::refineMesh(). Deligated to the /// RefinementManager of \ref adapt. - virtual Flag refineMesh(AdaptInfo *adaptInfo); + Flag refineMesh(AdaptInfo *adaptInfo) override; /// Implementation of ProblemStatBase::coarsenMesh(). Deligated to the /// CoarseningManager of \ref adapt. - virtual Flag coarsenMesh(AdaptInfo *adaptInfo); + Flag coarsenMesh(AdaptInfo *adaptInfo) override; /// Implementation of ProblemStatBase::buildBeforeRefine(). /// Does nothing here. - virtual void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) {} + void buildBeforeRefine(AdaptInfo *adaptInfo, Flag) override {} /// Implementation of ProblemStatBase::buildBeforeCoarsen(). /// Does nothing here. - virtual void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) {} + void buildBeforeCoarsen(AdaptInfo *adaptInfo, Flag) override {} /// Implementation of ProblemStatBase::buildAfterCoarsen(). /// Assembles \ref A and \ref rhs. With the last two parameters, assembling /// can be restricted to matrices or vectors only. - virtual void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag, + void buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag, bool assembleMatrix = true, - bool assembleVector = true); + bool assembleVector = true) override; bool dualMeshTraverseRequired(); @@ -153,15 +153,15 @@ namespace AMDiS { /// Determines the execution order of the single adaption steps. If adapt is /// true, mesh adaption will be performed. This allows to avoid mesh adaption, /// e.g. in timestep adaption loops of timestep adaptive strategies. - virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION); + Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo = FULL_ITERATION) override; /// Returns number of managed problems - virtual int getNumProblems() + int getNumProblems() override { return 1; } - /// Implementation of ProblemStatBase::getNumComponents() + /// Implementation of ProblemStatBase::getNumComponents(), TODO: Wrong!! virtual int getNumComponents() { return nComponents; @@ -169,7 +169,7 @@ namespace AMDiS { /// Returns the problem with the given number. If only one problem /// is managed by this master problem, the number hasn't to be given. - virtual ProblemStatBase *getProblem(int number = 0) + ProblemStatBase *getProblem(int number = 0) override { return this; } @@ -185,19 +185,19 @@ namespace AMDiS { /// Adds an operator to \ref A. void addMatrixOperator(Operator *op, int i, int j, - double *factor = NULL, double *estFactor = NULL); + double *factor = nullptr, double *estFactor = nullptr); /// Adds an operator to \ref A. void addMatrixOperator(Operator &op, int i, int j, - double *factor = NULL, double *estFactor = NULL); + double *factor = nullptr, double *estFactor = nullptr); /// Adds an operator to \ref rhs. void addVectorOperator(Operator *op, int i, - double *factor = NULL, double *estFactor = NULL); + double *factor = nullptr, double *estFactor = nullptr); /// Adds an operator to \ref rhs. void addVectorOperator(Operator &op, int i, - double *factor = NULL, double *estFactor = NULL); + double *factor = nullptr, double *estFactor = nullptr); /// Adds a Dirichlet boundary condition, where the rhs is given by an /// abstract function. @@ -388,7 +388,7 @@ namespace AMDiS { } /// Returns the name of the problem - inline virtual string getName() + inline string getName() override { return name; } @@ -539,10 +539,10 @@ namespace AMDiS { void writeResidualMesh(int comp, AdaptInfo *adaptInfo, string name); /// Function that implements the serialization procedure. - virtual void serialize(ostream &out); + void serialize(ostream &out) override; /// Function that implements the deserialization procedure. - virtual void deserialize(istream &in); + void deserialize(istream &in) override; /// Returns \ref fileWriters. diff --git a/AMDiS/src/ProblemStatDbg.cc b/AMDiS/src/ProblemStatDbg.cc index 3009b78bfaaa5d04284d7bdb0d0a7913b1b27cf4..3746de5ba6e4fcca9301d6cf31a66def7075b133 100644 --- a/AMDiS/src/ProblemStatDbg.cc +++ b/AMDiS/src/ProblemStatDbg.cc @@ -137,9 +137,9 @@ namespace AMDiS { createCoordToDofMap(coordToDof); int dimOfWorld = Global::getGeo(WORLD); - vector<vector<map<pair<int, int>, double> > > nnzValues(nComponents); - vector<map<int, double> > rhsValues(nComponents); - vector<map<int, double> > solValues(nComponents); + vector<vector<map<pair<DegreeOfFreedom, DegreeOfFreedom>, double> > > nnzValues(nComponents); + vector<map<DegreeOfFreedom, double> > rhsValues(nComponents); + vector<map<DegreeOfFreedom, double> > solValues(nComponents); for (int i = 0; i < nComponents; i++) nnzValues[i].resize(nComponents); @@ -220,7 +220,7 @@ namespace AMDiS { // Get dof indices for row and col of this problem matrix. DegreeOfFreedom rowHere = dofMapFileToHere[row]; DegreeOfFreedom colHere = dofMapFileToHere[col]; - pair<int, int> rowcol = make_pair(rowHere, colHere); + pair<DegreeOfFreedom, DegreeOfFreedom> rowcol = make_pair(rowHere, colHere); if (nnzValues[i][j].count(rowcol) == 0) nnzValues[i][j][rowcol] = value; @@ -305,11 +305,11 @@ namespace AMDiS { if (!dofmatrix) continue; - for (map<pair<int, int>, double>::iterator nnzIt = + for (map<pair<DegreeOfFreedom, DegreeOfFreedom>, double>::iterator nnzIt = nnzValues[i][j].begin(); nnzIt != nnzValues[i][j].end(); ++nnzIt) { - int row = nnzIt->first.first; - int col = nnzIt->first.second; + DegreeOfFreedom row = nnzIt->first.first; + DegreeOfFreedom col = nnzIt->first.second; double value = nnzIt->second; double valueHere = (dofmatrix->getBaseMatrix())[row][col]; @@ -333,10 +333,10 @@ namespace AMDiS { } for (int i = 0; i < nComponents; i++) { - for (map<int, double>::iterator rhsIt = rhsValues[i].begin(); + for (map<DegreeOfFreedom, double>::iterator rhsIt = rhsValues[i].begin(); rhsIt != rhsValues[i].end(); ++rhsIt) { - int row = rhsIt->first; + DegreeOfFreedom row = rhsIt->first; double value = rhsIt->second; double valueHere = (*(rhs->getDOFVector(i)))[row]; @@ -353,10 +353,10 @@ namespace AMDiS { } for (int i = 0; i < nComponents; i++) { - for (map<int, double>::iterator solIt = solValues[i].begin(); + for (map<DegreeOfFreedom, double>::iterator solIt = solValues[i].begin(); solIt != solValues[i].end(); ++solIt) { - int row = solIt->first; + DegreeOfFreedom row = solIt->first; double value = solIt->second; double valueHere = (*(solution->getDOFVector(i)))[row]; diff --git a/AMDiS/src/ProblemStatDbg.h b/AMDiS/src/ProblemStatDbg.h index a63a5182b7a5a6e5d0d9b2d02547eadf9066375f..7e5a73933ef015c6486578e3ceea054df0ac91b2 100644 --- a/AMDiS/src/ProblemStatDbg.h +++ b/AMDiS/src/ProblemStatDbg.h @@ -35,7 +35,7 @@ namespace AMDiS { { public: ProblemStatDbg(string nameStr, - ProblemIterationInterface *problemIteration = NULL) + ProblemIterationInterface *problemIteration = nullptr) : ProblemStatSeq(nameStr, problemIteration) {} diff --git a/AMDiS/src/Projection.h b/AMDiS/src/Projection.h index 6d0ac2b3142a669297dacb96fbd678e2a41b8d0b..51beaff830efd92aa4c8f29a6f6640da7736b234 100644 --- a/AMDiS/src/Projection.h +++ b/AMDiS/src/Projection.h @@ -52,7 +52,7 @@ namespace AMDiS { 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(projectionMap[id] == nullptr) ("there is already a projection with this id\n"); projectionMap[id] = this; } @@ -74,7 +74,7 @@ namespace AMDiS { return projectionType; } - /// Returns the projection with the given id, if existing. Returns NULL otherwise. + /// Returns the projection with the given id, if existing. Returns nullptr otherwise. static Projection* getProjection(int id) { return projectionMap[id]; diff --git a/AMDiS/src/QPInfo.cc b/AMDiS/src/QPInfo.cc index 41094ee03d35906e9a75b7f002c0dede8123fde8..cca315ec82f76f2526fa8c49b2e7feb97060078f 100644 --- a/AMDiS/src/QPInfo.cc +++ b/AMDiS/src/QPInfo.cc @@ -29,14 +29,14 @@ namespace AMDiS { QPInfo::QPInfo(const Quadrature *quad) : quadrature_(quad), - currentElInfo_(NULL), - coordsAtQPs_(NULL), + currentElInfo_(nullptr), + coordsAtQPs_(nullptr), coordsNumPointsValid_(0), - elementNormalAtQPs_(NULL), - elementNormalConst_(NULL), + elementNormalAtQPs_(nullptr), + elementNormalConst_(nullptr), elementNormalNumPointsValid_(0), - grdLambdaAtQPs_(NULL), - grdLambdaConst_(NULL), + grdLambdaAtQPs_(nullptr), + grdLambdaConst_(nullptr), grdLambdaNumPointsValid_(0) { numPoints_ = quadrature_->getNumPoints(); @@ -121,7 +121,7 @@ namespace AMDiS { } // create new info if necessary - if (vecQPInfos_[vec] == NULL) + if (vecQPInfos_[vec] == nullptr) vecQPInfos_[vec] = new VecQPInfo; VecQPInfo *localVecQPInfo = vecQPInfos_[vec]; @@ -157,7 +157,7 @@ namespace AMDiS { } // create new info if necessary - if (vecQPInfos_[vec] == NULL) + if (vecQPInfos_[vec] == nullptr) vecQPInfos_[vec] = new VecQPInfo; VecQPInfo *localVecQPInfo = vecQPInfos_[vec]; @@ -193,7 +193,7 @@ namespace AMDiS { } // create new info if necessary - if (vecQPInfos_[vec] == NULL) + if (vecQPInfos_[vec] == nullptr) vecQPInfos_[vec] = new VecQPInfo; VecQPInfo *localVecQPInfo = vecQPInfos_[vec]; @@ -311,7 +311,7 @@ namespace AMDiS { qpInfos_[quad] = newQPInfo; return newQPInfo; } else { - return NULL; + return nullptr; } } diff --git a/AMDiS/src/QPInfo.h b/AMDiS/src/QPInfo.h index b99ad5bdf9ade59d53e3e879fe0f16e3b0f4fbae..218a942318c4bc3b3dfbc903ebf81e56a78ccce7 100644 --- a/AMDiS/src/QPInfo.h +++ b/AMDiS/src/QPInfo.h @@ -47,7 +47,7 @@ namespace AMDiS { */ mtl::dense_vector<double>& getVecAtQPs(const DOFVector<double>*, int numPoints, - const FastQuadrature *quadFast = NULL); + const FastQuadrature *quadFast = nullptr); /** \brief * Returns gradient values at quadrature points. If quadFast is set it will be @@ -55,7 +55,7 @@ namespace AMDiS { */ mtl::dense_vector<WorldVector<double> >& getGrdAtQPs(const DOFVector<double>*, int numPoints, - const FastQuadrature *quadFast = NULL); + const FastQuadrature *quadFast = nullptr); /** \brief * Returns D2 values at quadrature points. If quadFast is set it will be @@ -63,7 +63,7 @@ namespace AMDiS { */ mtl::dense_vector<WorldMatrix<double> >& getD2AtQPs(const DOFVector<double>*, int numPoints, - const FastQuadrature *quadFast = NULL); + const FastQuadrature *quadFast = nullptr); /// Returns element normals at quadrature points. diff --git a/AMDiS/src/QPsiPhi.cc b/AMDiS/src/QPsiPhi.cc index b6b155ef91192c8578b5756a3ea823af33f428f7..e3c18c590e932d3d59dd0a5ae966ec5e1fe496ad 100644 --- a/AMDiS/src/QPsiPhi.cc +++ b/AMDiS/src/QPsiPhi.cc @@ -58,10 +58,10 @@ namespace AMDiS { : psi(ps), phi(ph), quadrature(quadrat), - nrEntries(NULL), - values(NULL), - k(NULL), - l(NULL) + nrEntries(nullptr), + values(nullptr), + k(nullptr), + l(nullptr) { FUNCNAME_DBG("Q11PsiPhi::Q11PsiPhi()"); @@ -197,7 +197,7 @@ namespace AMDiS { { std::list<Q11PsiPhi*>::iterator list; - if (!ps && !ph) return NULL; + if (!ps && !ph) return nullptr; if (!ps) ps = ph; if (!ph) ph = ps; @@ -243,9 +243,9 @@ namespace AMDiS { if (!psi && !phi) { - nrEntries=NULL; - k=NULL; - values=NULL; + nrEntries=nullptr; + k=nullptr; + values=nullptr; } if (!psi) psi = phi; @@ -357,7 +357,7 @@ namespace AMDiS { { std::list<Q10PsiPhi*>::iterator list; - if (!ps && !ph) return NULL; + if (!ps && !ph) return nullptr; if (!ps) ps = ph; if (!ph) ph = ps; @@ -401,9 +401,9 @@ namespace AMDiS { if (!psi && !phi) { - nrEntries=NULL; - l=NULL; - values=NULL; + nrEntries=nullptr; + l=nullptr; + values=nullptr; } if (!psi) psi = phi; @@ -517,7 +517,7 @@ namespace AMDiS { { std::list<Q01PsiPhi*>::iterator list; - if (!ps && !ph) return NULL; + if (!ps && !ph) return nullptr; if (!ps) ps = ph; if (!ph) ph = ps; @@ -558,7 +558,7 @@ namespace AMDiS { const double *Q00PsiPhi::getValVec(unsigned int i) const { if ((values)&&(values[i])) return values[i]; - return NULL; + return nullptr; } @@ -577,7 +577,7 @@ namespace AMDiS { int numPoints = quadrature->getNumPoints(); if (!psi && !phi) { - values=NULL; + values=nullptr; } if (!psi) psi = phi; @@ -638,7 +638,7 @@ namespace AMDiS { { std::list<Q00PsiPhi*>::iterator list; - if (!ps && !ph) return NULL; + if (!ps && !ph) return nullptr; if (!ps) ps = ph; if (!ph) ph = ps; @@ -677,7 +677,7 @@ namespace AMDiS { int numPoints = quadrature->getNumPoints(); if (!psi) - values = NULL; + values = nullptr; if (!quadrature) quadrature = Quadrature::provideQuadrature(psi->getDim(), 2*psi->getDegree()); @@ -714,7 +714,7 @@ namespace AMDiS { { std::list<Q0Psi*>::iterator list; - if (!ps) return NULL; + if (!ps) return nullptr; if (!quadrat) quadrat = Quadrature::provideQuadrature(ps->getDim(), 2*ps->getDegree()); @@ -740,7 +740,7 @@ namespace AMDiS { Q1Psi::Q1Psi(const BasisFunction *ps, const Quadrature *quadrat) - : psi(ps), quadrature(quadrat),nrEntries(NULL),values(NULL),k(NULL) + : psi(ps), quadrature(quadrat),nrEntries(nullptr),values(nullptr),k(nullptr) { FUNCNAME_DBG("Q1Psi::Q1Psi"); const FastQuadrature *q_psi; @@ -838,7 +838,7 @@ namespace AMDiS { { std::list<Q1Psi*>::iterator list; - if (!ps) return NULL; + if (!ps) return nullptr; if (!quadrat) quadrat = Quadrature::provideQuadrature(ps->getDim(), diff --git a/AMDiS/src/QPsiPhi.h b/AMDiS/src/QPsiPhi.h index f9fcb675487196dbe19b4108a76949c4c378238e..8ce025d48a037800c6c50f0a7973afc36ad7877e 100644 --- a/AMDiS/src/QPsiPhi.h +++ b/AMDiS/src/QPsiPhi.h @@ -182,7 +182,7 @@ namespace AMDiS { if (values && values[i] && values[i][j]) return values[i][j]; - return NULL; + return nullptr; } /// Returns \ref k[i][j] @@ -191,7 +191,7 @@ namespace AMDiS { if (k && k[i] && k[i][j]) return k[i][j]; - return NULL; + return nullptr; } /// Returns \ref l[i][j] @@ -200,7 +200,7 @@ namespace AMDiS { if (l && l[i] && l[i][j]) return l[i][j]; - return NULL; + return nullptr; } protected: @@ -330,7 +330,7 @@ namespace AMDiS { if (values && values[i] && values[i][j]) return values[i][j]; - return NULL; + return nullptr; } /// Returns \ref k[i][j] @@ -339,7 +339,7 @@ namespace AMDiS { if (k && k[i] && k[i][j]) return k[i][j]; - return NULL; + return nullptr; } protected: @@ -457,7 +457,7 @@ namespace AMDiS { if (values && values[i] && values[i][j]) return values[i][j]; - return NULL; + return nullptr; } /// Returns \ref k[i][j] @@ -466,7 +466,7 @@ namespace AMDiS { if (l && l[i] && l[i][j]) return l[i][j]; - return NULL; + return nullptr; } /// Returns \ref k[i][j][v] @@ -706,7 +706,7 @@ namespace AMDiS { if (k && k[i]) return k[i]; - return NULL; + return nullptr; } /// Returns \values[i] @@ -715,7 +715,7 @@ namespace AMDiS { if (values && values[i]) return values[i]; - return NULL; + return nullptr; } protected: diff --git a/AMDiS/src/Quadrature.cc b/AMDiS/src/Quadrature.cc index 0cf5857017d5ea65e61ccf5117408c9bedbaa423..0ba7c5c4bc8ed701a704d73abf7478b65df646be 100644 --- a/AMDiS/src/Quadrature.cc +++ b/AMDiS/src/Quadrature.cc @@ -58,7 +58,7 @@ namespace AMDiS { DimVec<double> >& f, WorldVector<double>* vec) const { - static WorldVector<double> *quad_vec_d = NULL; + static WorldVector<double> *quad_vec_d = nullptr; static size_t size = 0; WorldVector<double> *val; WorldVector<double> grd; @@ -89,7 +89,7 @@ namespace AMDiS { const double *Quadrature::fAtQp(const AbstractFunction<double, DimVec<double> >& f, double *vec) const { - static double *quad_vec = NULL; + static double *quad_vec = nullptr; static size_t size = 0; double *val; @@ -122,7 +122,7 @@ namespace AMDiS { VectorOfFixVecs<DimVec<double> > *Quadrature::x_0d; double *Quadrature::w_0d; - VectorOfFixVecs<DimVec<double> > *Quadrature::x0_1d = NULL; + VectorOfFixVecs<DimVec<double> > *Quadrature::x0_1d = nullptr; VectorOfFixVecs<DimVec<double> > *Quadrature::x1_1d; VectorOfFixVecs<DimVec<double> > *Quadrature::x2_1d; VectorOfFixVecs<DimVec<double> > *Quadrature::x3_1d; @@ -185,7 +185,7 @@ namespace AMDiS { void Quadrature::initStaticQuadratures() { - TEST_EXIT(x0_1d == NULL)("static quadratures already initialized\n"); + TEST_EXIT(x0_1d == nullptr)("static quadratures already initialized\n"); #define zero 0.0 #define one 1.0 @@ -1443,7 +1443,7 @@ namespace AMDiS { ERROR_EXIT("invalid dim\n"); } - if (x0_1d == NULL) + if (x0_1d == nullptr) initStaticQuadratures(); return (quad_nd[dim_][degree_]); @@ -1479,7 +1479,7 @@ namespace AMDiS { const Quadrature& quad, Flag init_flag) { - FastQuadrature *quad_fast = NULL; + FastQuadrature *quad_fast = nullptr; // #pragma omp critical { @@ -1633,6 +1633,6 @@ namespace AMDiS { const VectorOfFixVecs<DimMat<double> > *FastQuadrature::getSecDer(int q) const { - return D2Phi ? (&((*D2Phi)[q])) : NULL; + return D2Phi ? (&((*D2Phi)[q])) : nullptr; } } diff --git a/AMDiS/src/Quadrature.h b/AMDiS/src/Quadrature.h index 905602444b89c6576c4b106b5c33add301daee22..d92507011ef82382f20065b65c156a9fc44f8b2e 100644 --- a/AMDiS/src/Quadrature.h +++ b/AMDiS/src/Quadrature.h @@ -137,7 +137,7 @@ namespace AMDiS { /** \brief * Returns a pointer to a vector storing the values of a doubled valued * function at all quadrature points; f is that AbstractFunction - * , evaluated in barycentric coordinates; if vec is not NULL, the values are + * , evaluated in barycentric coordinates; if vec is not nullptr, the values are * stored in this vector, otherwise the values are stored in some static * local vector, which is overwritten on the next call */ @@ -149,7 +149,7 @@ namespace AMDiS { * coordinates) of a double valued function at all quadrature points; * grdF is a pointer to a AbstractFunction, evaluated in barycentric * coordinates and returning a pointer to a WorldVector storing the gradient; - * if vec is not NULL, the values are stored in this vector, otherwise the + * if vec is not nullptr, the values are stored in this vector, otherwise the * values are stored in some local static vector, which is overwritten on the * next call */ @@ -320,7 +320,7 @@ namespace AMDiS { FastQuadrature(BasisFunction* basFcts, Quadrature* quad, Flag flag) : init_flag(flag), phi(0, 0), - D2Phi(NULL), + D2Phi(nullptr), quadrature(quad), basisFunctions(basFcts) {} @@ -352,7 +352,7 @@ namespace AMDiS { return (!grdPhi.empty()); if (flag == INIT_D2_PHI) - return (D2Phi != NULL); + return (D2Phi != nullptr); ERROR_EXIT("invalid flag\n"); return false; diff --git a/AMDiS/src/Quadrature.hh b/AMDiS/src/Quadrature.hh index 15b2e55ea77af14cd53bf127a9425043c9e3a9d7..ac9c95e1d4949f7e15b64f7af7cfa606e7365b6d 100644 --- a/AMDiS/src/Quadrature.hh +++ b/AMDiS/src/Quadrature.hh @@ -31,7 +31,7 @@ namespace AMDiS { const T *uhLoc, T *vec) { FUNCNAME("uhAtQp()"); - static T *quadVec = NULL; + static T *quadVec = nullptr; static int size = 0; T *val; const double *phi; @@ -82,7 +82,7 @@ namespace AMDiS { int nPoints = quadFast->getQuadrature()->getNumPoints(); int nBasFcts = quadFast->getBasisFunctions()->getNumber(); - static GrdT *quadVec = NULL; + static GrdT *quadVec = nullptr; static int size = 0; GrdT *val; VectorOfFixVecs<DimVec<double> > *gradPhi; @@ -139,7 +139,7 @@ namespace AMDiS { int parts = Global::getGeo(PARTS, dim); int dow = Global::getGeo(WORLD); - static D2T *quadVec = NULL; + static D2T *quadVec = nullptr; static int size = 0; D2T *val; const VectorOfFixVecs<DimMat<double> > *D2Phil; diff --git a/AMDiS/src/RCNeighbourList.cc b/AMDiS/src/RCNeighbourList.cc index 79e05b8892b29839529797b6b97ccfad37479da0..d8a9e0f6ef9f68d897b8eece436aeb7f5e297634 100644 --- a/AMDiS/src/RCNeighbourList.cc +++ b/AMDiS/src/RCNeighbourList.cc @@ -149,7 +149,7 @@ namespace AMDiS { rclist[i]->oppVertex[dir] = 3 - k; break; } else { - rclist[i]->neigh[dir] = NULL; + rclist[i]->neigh[dir] = nullptr; rclist[i]->oppVertex[dir] = -1; } } @@ -160,7 +160,7 @@ namespace AMDiS { //none of the Elements in rcList is FACE neighbour of active Element if (j >= n_neigh) { - rclist[i]->neigh[dir] = NULL; + rclist[i]->neigh[dir] = nullptr; rclist[i]->oppVertex[dir] = -1; } } @@ -171,7 +171,7 @@ namespace AMDiS { void RCNeighbourList::addDOFParent(int elIndex, DegreeOfFreedom* dof) // 3d { Element *el = rclist[elIndex]->el; - RCListElement *neighbour = NULL; + RCListElement *neighbour = nullptr; Mesh *coarse_mesh = coarseningManager->getMesh(); RCListElement *coarse_list = rclist[elIndex]; @@ -188,16 +188,16 @@ namespace AMDiS { /* and now those handed on by the children */ /****************************************************************************/ - el->setDof(node + 1, const_cast<int*>(el->getFirstChild()->getDof(node))); - el->setDof(node + 2, const_cast<int*>(el->getFirstChild()->getDof(node + 1))); - el->setDof(node + 5, const_cast<int*>(el->getFirstChild()->getDof(node + 3))); + el->setDof(node + 1, const_cast<DegreeOfFreedom*>(el->getFirstChild()->getDof(node))); + el->setDof(node + 2, const_cast<DegreeOfFreedom*>(el->getFirstChild()->getDof(node + 1))); + el->setDof(node + 5, const_cast<DegreeOfFreedom*>(el->getFirstChild()->getDof(node + 3))); if (coarse_list->elType) { - el->setDof(node + 3, const_cast<int*>(el->getSecondChild()->getDof(node))); - el->setDof(node + 4, const_cast<int*>(el->getSecondChild()->getDof(node + 1))); + el->setDof(node + 3, const_cast<DegreeOfFreedom*>(el->getSecondChild()->getDof(node))); + el->setDof(node + 4, const_cast<DegreeOfFreedom*>(el->getSecondChild()->getDof(node + 1))); } else { - el->setDof(node + 3, const_cast<int*>(el->getSecondChild()->getDof(node + 1))); - el->setDof(node + 4, const_cast<int*>(el->getSecondChild()->getDof(node))); + el->setDof(node + 3, const_cast<DegreeOfFreedom*>(el->getSecondChild()->getDof(node + 1))); + el->setDof(node + 4, const_cast<DegreeOfFreedom*>(el->getSecondChild()->getDof(node))); } } @@ -212,10 +212,10 @@ namespace AMDiS { if (!neighbour || neighbour > coarse_list) { if (!el->getDof(node + 2)) { // face 2 - el->setDof(node + 2, const_cast<int*>(coarse_mesh->getDof(FACE))); + el->setDof(node + 2, const_cast<DegreeOfFreedom*>(coarse_mesh->getDof(FACE))); if (neighbour) neighbour->el->setDof(node + coarse_list->oppVertex[0], - const_cast<int*>(el->getDof(node + 2))); + const_cast<DegreeOfFreedom*>(el->getDof(node + 2))); } } @@ -223,24 +223,24 @@ namespace AMDiS { if (!neighbour || neighbour > coarse_list) { if (!el->getDof(node + 3)) { // face 3 - el->setDof(node + 3, const_cast<int*>(coarse_mesh->getDof(FACE))); + el->setDof(node + 3, const_cast<DegreeOfFreedom*>(coarse_mesh->getDof(FACE))); if (neighbour) neighbour->el->setDof(node + coarse_list->oppVertex[1], - const_cast<int*>(el->getDof(node + 3))); + const_cast<DegreeOfFreedom*>(el->getDof(node + 3))); } } /****************************************************************************/ /* and now those handed on by the children */ /****************************************************************************/ - el->setDof(node, const_cast<int*>(el->getSecondChild()->getDof(node + 3))); - el->setDof(node + 1, const_cast<int*>(el->getFirstChild()->getDof(node + 3))); + el->setDof(node, const_cast<DegreeOfFreedom*>(el->getSecondChild()->getDof(node + 3))); + el->setDof(node + 1, const_cast<DegreeOfFreedom*>(el->getFirstChild()->getDof(node + 3))); } if (coarse_mesh->getNumberOfDofs(CENTER)) { int node = coarse_mesh->getNode(CENTER); if (!el->getDof(node)) - el->setDof(node, const_cast<int*>(coarse_mesh->getDof(CENTER))); + el->setDof(node, const_cast<DegreeOfFreedom*>(coarse_mesh->getDof(CENTER))); } } @@ -256,8 +256,8 @@ namespace AMDiS { /* get dofs on the boundary of the coarsening patch from the children */ /****************************************************************************/ for (int i = 0; i < n_neigh; i++) { - rclist[i]->el->setDof(node, const_cast<int*>(rclist[i]->el->getSecondChild()->getDof(node + 2))); - rclist[i]->el->setDof(node + 1, const_cast<int*>(rclist[i]->el->getFirstChild()->getDof(node + 2))); + rclist[i]->el->setDof(node, const_cast<DegreeOfFreedom*>(rclist[i]->el->getSecondChild()->getDof(node + 2))); + rclist[i]->el->setDof(node + 1, const_cast<DegreeOfFreedom*>(rclist[i]->el->getFirstChild()->getDof(node + 2))); } } @@ -269,7 +269,7 @@ namespace AMDiS { /****************************************************************************/ for (int i = 0; i < n_neigh; i++) if (!rclist[i]->el->getDof(node)) - rclist[i]->el->setDof(node, const_cast<int*>(coarse_mesh->getDof(CENTER))); + rclist[i]->el->setDof(node, const_cast<DegreeOfFreedom*>(coarse_mesh->getDof(CENTER))); } } @@ -284,14 +284,14 @@ namespace AMDiS { for (int i = 0; i < n_neigh; i++) for (int j = 0; j < edges; j++) - rclist[i]->el->setDof(node + j, NULL); + rclist[i]->el->setDof(node + j, nullptr); } if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); for (int i = 0; i < n_neigh; i++) { - mesh->freeDof(const_cast<int*>(rclist[i]->el->getDof(node)), CENTER); - rclist[i]->el->setDof(node, NULL); + mesh->freeDof(const_cast<DegreeOfFreedom*>(rclist[i]->el->getDof(node)), CENTER); + rclist[i]->el->setDof(node, nullptr); } } } @@ -308,7 +308,7 @@ namespace AMDiS { if (mesh->getNumberOfDofs(EDGE)) { int node = mesh->getNode(EDGE); for (int j = 0; j < edges; j++) - el->setDof(node + j, NULL); + el->setDof(node + j, nullptr); } if (mesh->getNumberOfDofs(FACE)) { @@ -317,21 +317,21 @@ namespace AMDiS { // face 2 if (!neigh || neigh > rclist[index]) - mesh->freeDof(const_cast<int*>(el->getDof(node + 2)), FACE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(node + 2)), FACE); neigh = rclist[index]->neigh[1]; // face 3 if (!neigh || neigh > rclist[index]) - mesh->freeDof(const_cast<int*>(el->getDof(node + 3)), FACE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(node + 3)), FACE); for (int j = 0; j < faces; j++) - el->setDof(node + j, NULL); + el->setDof(node + j, nullptr); } if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); - mesh->freeDof(const_cast<int*>(el->getDof(node)), CENTER); - el->setDof(node, NULL); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(node)), CENTER); + el->setDof(node, nullptr); } } @@ -350,8 +350,8 @@ namespace AMDiS { bool secondPart = false; bool firstSplit = true; - nextEdge[0] = NULL; - nextEdge[1] = NULL; + nextEdge[0] = nullptr; + nextEdge[1] = nullptr; std::vector<RCListElement*>::iterator it = rclist.begin(); std::vector<RCListElement*>::iterator insertIt; diff --git a/AMDiS/src/RCNeighbourList.h b/AMDiS/src/RCNeighbourList.h index 69b7b5e04e0f757ca81b4453188644724958a61d..350dfa9e241ce415d2f931eae7462323a0d07806 100644 --- a/AMDiS/src/RCNeighbourList.h +++ b/AMDiS/src/RCNeighbourList.h @@ -77,26 +77,26 @@ namespace AMDiS { return rclist[i]->flag; } - /// If \ref rclist[i].neigh[j] is not a NULL pointer + /// If \ref rclist[i].neigh[j] is not a nullptr pointer /// \ref rclist[i].neigh[j]->ith will be returned. Otherwise the return value is -1 inline int getNeighbourNr(int i, int j) const { return rclist[i]->neigh[j] ? rclist[i]->neigh[j]->ith : -1; } - /// If \ref rclist[i].neigh[j] is not a NULL pointer + /// If \ref rclist[i].neigh[j] is not a nullptr pointer /// \ref rclist[i].neigh[j]->el will be returned. Otherwise the return value - /// is NULL + /// is nullptr inline Element* getNeighbourElement(int i, int j) const { - return rclist[i]->neigh[j] ? rclist[i]->neigh[j]->el : NULL; + return rclist[i]->neigh[j] ? rclist[i]->neigh[j]->el : nullptr; } /// Returns \ref rclist[i].el inline Element* getElement(int i) const { if (static_cast<int>(rclist.size()) <= i) - return NULL; + return nullptr; return rclist[i]->el; } @@ -200,7 +200,7 @@ namespace AMDiS { bool flag; /// neigh[0/1] neighbour of element to the right/left in the orientation - /// of the edge, or a NULL pointer in the case of a boundary face (only 3d) + /// of the edge, or a nullptr pointer in the case of a boundary face (only 3d) RCListElement* neigh[2]; /// opp vertex[0/1] the opposite vertex of neigh[0/1] (only 3d) diff --git a/AMDiS/src/Recovery.cc b/AMDiS/src/Recovery.cc index 6268058679e3564b6dc1140a15e0ba4d98db07af..e9b9b467ac6ef1ecf7bf9f7156339286f48176f5 100644 --- a/AMDiS/src/Recovery.cc +++ b/AMDiS/src/Recovery.cc @@ -33,7 +33,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (coords) { delete coords; - coords = NULL; + coords = nullptr; } } @@ -44,7 +44,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (A) { delete A; - A = NULL; + A = nullptr; } } @@ -55,7 +55,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (rec_uh) { delete rec_uh; - rec_uh = NULL; + rec_uh = nullptr; } } @@ -66,7 +66,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (rec_grdUh) { delete rec_grdUh; - rec_grdUh = NULL; + rec_grdUh = nullptr; } } @@ -77,7 +77,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (neighbors) { delete neighbors; - neighbors = NULL; + neighbors = nullptr; } } @@ -159,7 +159,7 @@ void Recovery::set_feSpace(const FiniteElemSpace *fe_space) if (!feSpace || feSpace != fe_space) { if (struct_vec) { delete struct_vec; - struct_vec = NULL; + struct_vec = nullptr; } feSpace = fe_space; @@ -297,14 +297,14 @@ void Recovery::compute_integrals(DOFVector<double> *uh, ElInfo *elInfo, double fAtQP = 1.0; if (f_scal) { if (aux_vec) - aux_vec->getVecAtQPs(elInfo, quad, NULL, uhAtQP); + aux_vec->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); else - uh->getVecAtQPs(elInfo, quad, NULL, uhAtQP); + uh->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); } // Get gradient at quadrature points mtl::dense_vector<WorldVector<double> > grdAtQP(n_points); - uh->getGrdAtQPs(elInfo, quad, NULL, grdAtQP); + uh->getGrdAtQPs(elInfo, quad, nullptr, grdAtQP); vec_sum = 0.0; for (int k = 0; k < n_points; k++) { elInfo->coordToWorld(quad->getLambda(k), quad_pts); @@ -320,7 +320,7 @@ void Recovery::compute_integrals(DOFVector<double> *uh, ElInfo *elInfo, + vec_sum * elInfo->getDet(); } else { // For recovery of DOFVector. // Get uh at quadrature points - uh->getVecAtQPs(elInfo, quad, NULL, uhAtQP); + uh->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); double sum = 0.0; for (int k = 0; k < n_points; k++) { elInfo->coordToWorld(quad->getLambda(k), quad_pts); @@ -365,13 +365,13 @@ void Recovery::compute_interior_sums(DOFVector<double> *uh, ElInfo *elInfo, double fAtQP = 1.0; if (f_scal) { if (aux_vec) - aux_vec->getVecAtQPs(elInfo, quad, NULL, uhAtQP); + aux_vec->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); else - uh->getVecAtQPs(elInfo, quad, NULL, uhAtQP); + uh->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); } // Get gradient at quadrature points - uh->getGrdAtQPs(elInfo, quad, NULL, grdAtQP); + uh->getGrdAtQPs(elInfo, quad, nullptr, grdAtQP); vec_sum = 0.0; for (int k = 0; k < n_points; k++) { elInfo->coordToWorld(quad->getLambda(k), quad_pts); @@ -505,7 +505,7 @@ void Recovery::fill_struct_vec(DOFVector<double> *uh, // Variables for passing information to integration routines. int degree = basis_fcts->getDegree(); - Quadrature *quad = NULL; + Quadrature *quad = nullptr; if (gradient && !method) quad = Quadrature::provideQuadrature(Global::getGeo(WORLD), degree); @@ -795,13 +795,13 @@ Recovery::recoveryUh(DOFVector<double> *uh, const FiniteElemSpace *fe_space) } // define result vector - static DOFVector<double> *vec = NULL; - DOFVector<double> *result = NULL; + static DOFVector<double> *vec = nullptr; + DOFVector<double> *result = nullptr; // Allocate memory for result vector if (vec && vec->getFeSpace() != feSpace) { delete vec; - vec = NULL; + vec = nullptr; } if (!vec) @@ -868,13 +868,13 @@ Recovery::recovery(DOFVector<double> *uh, const FiniteElemSpace *fe_space, } // define result vector - static DOFVector<WorldVector<double> > *vec = NULL; - DOFVector<WorldVector<double> > *result = NULL; + static DOFVector<WorldVector<double> > *vec = nullptr; + DOFVector<WorldVector<double> > *result = nullptr; // Allocate memory for result vector if (vec && vec->getFeSpace() != feSpace) { delete vec; - vec = NULL; + vec = nullptr; } if (!vec) @@ -920,13 +920,13 @@ Recovery::recovery(DOFVector<double> *uh, const FiniteElemSpace *fe_space = uh->getFeSpace(); // define result vector - static DOFVector<WorldVector<double> > *vec = NULL; - DOFVector<WorldVector<double> > *result = NULL; + static DOFVector<WorldVector<double> > *vec = nullptr; + DOFVector<WorldVector<double> > *result = nullptr; // Allocate memory for result vector if (vec && vec->getFeSpace() != fe_space) { delete vec; - vec = NULL; + vec = nullptr; } if (!vec) diff --git a/AMDiS/src/Recovery.h b/AMDiS/src/Recovery.h index 86036c5be7852041ea5ef2b94375ce3271532bac..81b1ee77ab76b8138b9ce307dc44e9b904d2e509 100644 --- a/AMDiS/src/Recovery.h +++ b/AMDiS/src/Recovery.h @@ -67,11 +67,11 @@ namespace AMDiS { { public: RecoveryStructure() - : coords(NULL), - A(NULL), - rec_uh(NULL), - rec_grdUh(NULL), - neighbors(NULL) + : coords(nullptr), + A(nullptr), + rec_uh(nullptr), + rec_grdUh(nullptr), + neighbors(nullptr) {} ~RecoveryStructure() @@ -80,11 +80,11 @@ namespace AMDiS { } RecoveryStructure(const RecoveryStructure& rhs) - : coords(NULL), - A(NULL), - rec_uh(NULL), - rec_grdUh(NULL), - neighbors(NULL) + : coords(nullptr), + A(nullptr), + rec_uh(nullptr), + rec_grdUh(nullptr), + neighbors(nullptr) { *this = rhs; } @@ -94,29 +94,29 @@ namespace AMDiS { /// Clear recovery structure inline void clear() { - if (coords != NULL) { + if (coords != nullptr) { delete coords; - coords = NULL; + coords = nullptr; } - if (A != NULL) { + if (A != nullptr) { delete A; - A = NULL; + A = nullptr; } - if (rec_uh != NULL) { + if (rec_uh != nullptr) { delete rec_uh; - rec_uh = NULL; + rec_uh = nullptr; } - if (rec_grdUh != NULL) { + if (rec_grdUh != nullptr) { delete rec_grdUh; - rec_grdUh = NULL; + rec_grdUh = nullptr; } - if (neighbors != NULL) { + if (neighbors != nullptr) { delete neighbors; - neighbors = NULL; + neighbors = nullptr; } } @@ -151,9 +151,9 @@ namespace AMDiS { { public: Recovery(int norm, int method_) - : struct_vec(NULL), - feSpace(NULL), - matrix_fcts(NULL), + : struct_vec(nullptr), + feSpace(nullptr), + matrix_fcts(nullptr), method(method_) { n_monomials = 0; @@ -173,15 +173,15 @@ namespace AMDiS { /// Recovers flux or gradient of given DOFVector. DOFVector<WorldVector<double> >* recovery(DOFVector<double> *uh, - AbstractFunction<double, WorldVector<double> > *f_vec = NULL, - AbstractFunction<double, double> *f_scal = NULL, - DOFVector<double> *aux_vec = NULL); + AbstractFunction<double, WorldVector<double> > *f_vec = nullptr, + AbstractFunction<double, double> *f_scal = nullptr, + DOFVector<double> *aux_vec = nullptr); DOFVector<WorldVector<double> >* recovery(DOFVector<double> *uh, const FiniteElemSpace *fe_space, - AbstractFunction<double, WorldVector<double> > *f_vec = NULL, - AbstractFunction<double, double> *f_scal = NULL, - DOFVector<double> *aux_vec = NULL); + AbstractFunction<double, WorldVector<double> > *f_vec = nullptr, + AbstractFunction<double, double> *f_scal = nullptr, + DOFVector<double> *aux_vec = nullptr); /// Computes higher order approximation of given DOFVector. void recoveryUh(DOFVector<double> *uh, DOFVector<double> &rec_vec); @@ -201,23 +201,23 @@ namespace AMDiS { /// Fills vector of recovery structures. void fill_struct_vec(DOFVector<double> *uh, - AbstractFunction<double, WorldVector<double> > *f_vec = NULL, - AbstractFunction<double, double> *f = NULL, - DOFVector<double> *aux_vec = NULL); + AbstractFunction<double, WorldVector<double> > *f_vec = nullptr, + AbstractFunction<double, double> *f = nullptr, + DOFVector<double> *aux_vec = nullptr); /// Compute integrals defining matrix and vector on elemen (continuous ZZ-recovery) void compute_integrals(DOFVector<double> *uh, ElInfo *elInfo, RecoveryStructure *rec_struct, - AbstractFunction<double, WorldVector<double> > *f_vec = NULL, - AbstractFunction<double, double> *f_scal = NULL, - DOFVector<double> *aux_vec = NULL); + AbstractFunction<double, WorldVector<double> > *f_vec = nullptr, + AbstractFunction<double, double> *f_scal = nullptr, + DOFVector<double> *aux_vec = nullptr); /// Compute integrals defining matrix and vector on element (superconvergent patch recovery) void compute_interior_sums(DOFVector<double> *uh, ElInfo *elInfo, RecoveryStructure *rec_struct, Quadrature *quad, - AbstractFunction<double, WorldVector<double> > *f_vec = NULL, - AbstractFunction<double, double> *f_scal = NULL, - DOFVector<double> *aux_vec = NULL); + AbstractFunction<double, WorldVector<double> > *f_vec = nullptr, + AbstractFunction<double, double> *f_scal = nullptr, + DOFVector<double> *aux_vec = nullptr); void compute_node_sums(DOFVector<double> *uh, ElInfo *elInfo, RecoveryStructure *rec_struct, DimVec<int> preDOFs, diff --git a/AMDiS/src/RefinementManager.h b/AMDiS/src/RefinementManager.h index ce280be89c2641f51bb8a13d7409187f19b3a2db..f2675b0e79c3716baf471780bab5110a0967d5e2 100644 --- a/AMDiS/src/RefinementManager.h +++ b/AMDiS/src/RefinementManager.h @@ -42,9 +42,9 @@ namespace AMDiS { public: /// Constructs a RefinementManager which belongs to aMesh RefinementManager() - : mesh(NULL), + : mesh(nullptr), newCoords(false), - stack(NULL) + stack(nullptr) {} /// Destructor @@ -93,7 +93,7 @@ namespace AMDiS { { FUNCNAME("RefinementManager::refineFunction()"); ERROR_EXIT("called for base class!\n"); - return NULL; + return nullptr; } inline void setMesh(Mesh *m) diff --git a/AMDiS/src/RefinementManager1d.cc b/AMDiS/src/RefinementManager1d.cc index dee090875803fefe6d8be9c6715c32facb0e54d4..9199adee5b21321cf865b97a4ebbcc926873552e 100644 --- a/AMDiS/src/RefinementManager1d.cc +++ b/AMDiS/src/RefinementManager1d.cc @@ -74,8 +74,8 @@ namespace AMDiS { /*--------------------------------------------------------------------------*/ /* the other vertices are handed on from the parent */ /*--------------------------------------------------------------------------*/ - child[0]->setDof(0, const_cast<int*>(el->getDof(0))); - child[1]->setDof(1, const_cast<int*>(el->getDof(1))); + child[0]->setDof(0, const_cast<DegreeOfFreedom*>(el->getDof(0))); + child[1]->setDof(1, const_cast<DegreeOfFreedom*>(el->getDof(1))); /*--------------------------------------------------------------------------*/ /* there is one more leaf element, two hierachical elements, */ @@ -90,8 +90,8 @@ namespace AMDiS { /*--------------------------------------------------------------------------*/ /* there are dofs at the barycenter of the triangles */ /*--------------------------------------------------------------------------*/ - child[0]->setDof(mesh->getNode(CENTER), const_cast<int*>(mesh->getDof(CENTER))); - child[1]->setDof(mesh->getNode(CENTER), const_cast<int*>(mesh->getDof(CENTER))); + child[0]->setDof(mesh->getNode(CENTER), const_cast<DegreeOfFreedom*>(mesh->getDof(CENTER))); + child[1]->setDof(mesh->getNode(CENTER), const_cast<DegreeOfFreedom*>(mesh->getDof(CENTER))); } /*--------------------------------------------------------------------------*/ @@ -111,8 +111,8 @@ namespace AMDiS { } if (!mesh->queryCoarseDOFs() && mesh->getNumberOfDofs(CENTER)) { - mesh->freeDof(const_cast<int*>( el->getDof(mesh->getNode(CENTER))), CENTER); - el->setDof(mesh->getNode(CENTER), NULL); + mesh->freeDof(const_cast<DegreeOfFreedom*>( el->getDof(mesh->getNode(CENTER))), CENTER); + el->setDof(mesh->getNode(CENTER), nullptr); } } diff --git a/AMDiS/src/RefinementManager2d.cc b/AMDiS/src/RefinementManager2d.cc index b5bdd0dff24f004e4f2a8f6ff83bf4108dc113e2..9c1c49c2234b8eb0561f98afe8bc49c9ae779e1c 100644 --- a/AMDiS/src/RefinementManager2d.cc +++ b/AMDiS/src/RefinementManager2d.cc @@ -55,11 +55,11 @@ namespace AMDiS { // === Give the refinement edge the right orientation. === if (elInfo->getElement()->getDof(0, 0) < elInfo->getElement()->getDof(1, 0)) { - edge[0] = const_cast<int*>(elInfo->getElement()->getDof(0)); - edge[1] = const_cast<int*>(elInfo->getElement()->getDof(1)); + edge[0] = const_cast<DegreeOfFreedom*>(elInfo->getElement()->getDof(0)); + edge[1] = const_cast<DegreeOfFreedom*>(elInfo->getElement()->getDof(1)); } else { - edge[1] = const_cast<int*>(elInfo->getElement()->getDof(0)); - edge[0] = const_cast<int*>(elInfo->getElement()->getDof(1)); + edge[1] = const_cast<DegreeOfFreedom*>(elInfo->getElement()->getDof(0)); + edge[0] = const_cast<DegreeOfFreedom*>(elInfo->getElement()->getDof(1)); } // === Get the refinement patch. === @@ -69,9 +69,9 @@ namespace AMDiS { // === Check for periodic boundary === - DegreeOfFreedom *next_edge[2] = {NULL, NULL}; + DegreeOfFreedom *next_edge[2] = {nullptr, nullptr}; DegreeOfFreedom *first_edge[2] = {edge[0], edge[1]}; - DegreeOfFreedom *last_edge[2] = {NULL, NULL}; + DegreeOfFreedom *last_edge[2] = {nullptr, nullptr}; int n_neigh_periodic; DegreeOfFreedom newDOF = -1; @@ -80,7 +80,7 @@ namespace AMDiS { RCNeighbourList periodicList; - while (edge[0] != NULL) { + while (edge[0] != nullptr) { refineList.periodicSplit(edge, next_edge, &n_neigh, &n_neigh_periodic, periodicList); @@ -179,7 +179,7 @@ namespace AMDiS { RCNeighbourList &refineList, int n_neigh, bool bound) { - DegreeOfFreedom *dof[3] = {NULL, NULL, NULL}; + DegreeOfFreedom *dof[3] = {nullptr, nullptr, nullptr}; Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>(refineList.getElement(0))); Triangle *neigh = @@ -236,7 +236,7 @@ namespace AMDiS { // === The only DOF that can be freed is that in the refinement edge; all === // === other DOFs are handed on the children. === - mesh->freeDof(const_cast<int*>(el->getDof(node+2)), EDGE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(node+2)), EDGE); } if (mesh->getNumberOfDofs(EDGE) || mesh->getNumberOfDofs(CENTER)) refineList.removeDOFParents(n_neigh); @@ -282,8 +282,8 @@ namespace AMDiS { // === The other vertices are handed on from the parent. === for (int i_child = 0; i_child < 2; i_child++) { - child[i_child]->setDof(i_child, const_cast<int*>(el->getDof(2))); - child[i_child]->setDof(1 - i_child, const_cast<int*>(el->getDof(i_child))); + child[i_child]->setDof(i_child, const_cast<DegreeOfFreedom*>(el->getDof(2))); + child[i_child]->setDof(1 - i_child, const_cast<DegreeOfFreedom*>(el->getDof(i_child))); } @@ -302,8 +302,8 @@ namespace AMDiS { child[1]->setDof(3, newEdgeDOFs); // Dofs handed on by the parent. - child[0]->setDof(5, const_cast<int*>(el->getDof(4))); - child[1]->setDof(5, const_cast<int*>(el->getDof(3))); + child[0]->setDof(5, const_cast<DegreeOfFreedom*>(el->getDof(4))); + child[1]->setDof(5, const_cast<DegreeOfFreedom*>(el->getDof(3))); // Dofs in the refinement edge. child[0]->setDof(3, newDOFs[1]); diff --git a/AMDiS/src/RefinementManager3d.cc b/AMDiS/src/RefinementManager3d.cc index c11e9e14dad72214734106a46b2b63c8ef66599f..361e530f4baf197337eb904b0796134820b5c529 100644 --- a/AMDiS/src/RefinementManager3d.cc +++ b/AMDiS/src/RefinementManager3d.cc @@ -76,9 +76,9 @@ namespace AMDiS { for (int i = 0; i < n_vertices - 1; i++) { child[0]-> - setDof(i, const_cast<int*>(el->getDof(Tetrahedron::childVertex[el_type][0][i]))); + setDof(i, const_cast<DegreeOfFreedom*>(el->getDof(Tetrahedron::childVertex[el_type][0][i]))); child[1]-> - setDof(i, const_cast<int*>(el->getDof(Tetrahedron::childVertex[el_type][1][i]))); + setDof(i, const_cast<DegreeOfFreedom*>(el->getDof(Tetrahedron::childVertex[el_type][1][i]))); } /****************************************************************************/ /* there is one more leaf element and two more hierachical elements */ @@ -101,22 +101,22 @@ namespace AMDiS { child[0]-> setDof(node, - const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][0]))); + const_cast<DegreeOfFreedom*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][0]))); child[1]-> setDof(node, - const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][0]))); + const_cast<DegreeOfFreedom*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][0]))); child[0]-> setDof(node + 1, - const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][1]))); + const_cast<DegreeOfFreedom*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][1]))); child[1]-> setDof(node + 1, - const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][1]))); + const_cast<DegreeOfFreedom*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][1]))); child[0]-> setDof(node + 3, - const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][3]))); + const_cast<DegreeOfFreedom*>(el->getDof(node + Tetrahedron::childEdge[el_type][0][3]))); child[1]-> setDof(node + 3, - const_cast<int*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][3]))); + const_cast<DegreeOfFreedom*>(el->getDof(node + Tetrahedron::childEdge[el_type][1][3]))); /****************************************************************************/ /* adjust pointers to the dof's in the refinement edge */ @@ -138,22 +138,22 @@ namespace AMDiS { /* set pointers to those dof's that are handed on from the parant */ /****************************************************************************/ - child[0]->setDof(node + 3, const_cast<int*>(el->getDof(node + 1))); - child[1]->setDof(node + 3, const_cast<int*>(el->getDof(node + 0))); + child[0]->setDof(node + 3, const_cast<DegreeOfFreedom*>(el->getDof(node + 1))); + child[1]->setDof(node + 3, const_cast<DegreeOfFreedom*>(el->getDof(node + 0))); /****************************************************************************/ /* get new dof for the common face of child0 and child1 */ /****************************************************************************/ DegreeOfFreedom *newDOF = mesh->getDof(FACE); - child[0]->setDof(node, static_cast<int*>(newDOF)); - child[1]->setDof(node, static_cast<int*>(newDOF)); + child[0]->setDof(node, static_cast<DegreeOfFreedom*>(newDOF)); + child[1]->setDof(node, static_cast<DegreeOfFreedom*>(newDOF)); } if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); - child[0]->setDof(node, const_cast<int*>(mesh->getDof(CENTER))); - child[1]->setDof(node, const_cast<int*>(mesh->getDof(CENTER))); + child[0]->setDof(node, const_cast<DegreeOfFreedom*>(mesh->getDof(CENTER))); + child[1]->setDof(node, const_cast<DegreeOfFreedom*>(mesh->getDof(CENTER))); } if (mesh->getNumberOfDofs(EDGE) || mesh->getNumberOfDofs(FACE)) @@ -234,7 +234,7 @@ namespace AMDiS { neigh->getChild(j)->getIndex(), node1); (const_cast<Element*>(el->getChild(i)))-> - setDof(node0, const_cast<int*>(neigh->getChild(j)->getDof(node1))); + setDof(node0, const_cast<DegreeOfFreedom*>(neigh->getChild(j)->getDof(node1))); } if (mesh->getNumberOfDofs(FACE)) { node0 = mesh->getNode(FACE) + i_neigh; @@ -245,7 +245,7 @@ namespace AMDiS { neigh->getChild(j)->getIndex(), node1); (const_cast<Element*>(el->getChild(i)))-> - setDof(node0, const_cast<int*>(neigh->getChild(j)->getDof(node1))); + setDof(node0, const_cast<DegreeOfFreedom*>(neigh->getChild(j)->getDof(node1))); } } /* for (i = 0; i < 2; i++) */ @@ -285,7 +285,7 @@ namespace AMDiS { int n_neigh = 1; for (int i = 0; i < 2; i++) - edge[i] = const_cast<int*>(elInfo->getElement()->getDof(i)); + edge[i] = const_cast<DegreeOfFreedom*>(elInfo->getElement()->getDof(i)); if (getRefinePatch(&elinfo, edge, 0, refineList, &n_neigh)) { // Domain's boundary was reached while looping around the refinement edge. @@ -335,7 +335,7 @@ namespace AMDiS { Tetrahedron *el = dynamic_cast<Tetrahedron*>(const_cast<Element*>(refineList.getElement(0))); /* first element in the list */ - DegreeOfFreedom *dof[3] = {NULL, NULL, NULL}; + DegreeOfFreedom *dof[3] = {nullptr, nullptr, nullptr}; /****************************************************************************/ /* get new dof's in the refinement edge */ @@ -374,7 +374,7 @@ namespace AMDiS { /****************************************************************************/ el = dynamic_cast<Tetrahedron*>(const_cast<Element*>(refineList.getElement(0))); - mesh->freeDof(const_cast<int*>(el->getDof(mesh->getNode(EDGE))), EDGE); + mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(mesh->getNode(EDGE))), EDGE); } if (mesh->getNumberOfDofs(EDGE) || @@ -415,7 +415,7 @@ namespace AMDiS { Tetrahedron *el = dynamic_cast<Tetrahedron*>(const_cast<Element*>((*elInfo)->getElement())); - if ((*elInfo)->getNeighbour(localNeighbour) == NULL) + if ((*elInfo)->getNeighbour(localNeighbour) == nullptr) return true; int oppVertex = (*elInfo)->getOppVertex(localNeighbour); @@ -760,9 +760,9 @@ namespace AMDiS { // ============ Check for periodic boundary ============ - DegreeOfFreedom *next_edge[2] = {NULL, NULL}; + DegreeOfFreedom *next_edge[2] = {nullptr, nullptr}; DegreeOfFreedom *first_edge[2] = {edge[0], edge[1]}; - DegreeOfFreedom *last_edge[2] = {NULL, NULL}; + DegreeOfFreedom *last_edge[2] = {nullptr, nullptr}; int n_neigh_periodic = 0; DegreeOfFreedom lastNewDof = -1; @@ -770,7 +770,7 @@ namespace AMDiS { RCNeighbourList periodicList; - while (edge[0] != NULL) { + while (edge[0] != nullptr) { refineList.periodicSplit(edge, next_edge, &n_neigh, &n_neigh_periodic, periodicList); diff --git a/AMDiS/src/RobinBC.cc b/AMDiS/src/RobinBC.cc index 1aa9dfc5430bc86e67e8c8279b40885528b5bad7..0c03e4c90e7feaf76bfa5d007d9d3d518ae2b4b0 100644 --- a/AMDiS/src/RobinBC.cc +++ b/AMDiS/src/RobinBC.cc @@ -36,8 +36,8 @@ namespace AMDiS { const FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *colFeSpace_) : BoundaryCondition(type, rowFeSpace_, colFeSpace_), - neumannOperators(NULL), - robinOperators(NULL) + neumannOperators(nullptr), + robinOperators(nullptr) { int dim = rowFeSpace->getMesh()->getDim(); @@ -89,8 +89,8 @@ namespace AMDiS { const FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *colFeSpace_) : BoundaryCondition(type, rowFeSpace_, colFeSpace_), - neumannOperators(NULL), - robinOperators(NULL) + neumannOperators(nullptr), + robinOperators(nullptr) { int dim = rowFeSpace->getMesh()->getDim(); @@ -112,7 +112,7 @@ namespace AMDiS { if (j) { Operator *jOp = new Operator(rowFeSpace); - jOp->addZeroOrderTerm(new VecAtQP_ZOT(j, NULL)); + jOp->addZeroOrderTerm(new VecAtQP_ZOT(j, nullptr)); neumannOperators = new DimVec<SurfaceOperator*>(dim, NO_INIT); for (int i = 0; i < dim + 1; i++) @@ -123,7 +123,7 @@ namespace AMDiS { if (alpha) { Operator *alphaOp = new Operator(rowFeSpace, colFeSpace); - alphaOp->addZeroOrderTerm(new VecAtQP_ZOT(alpha, NULL)); + alphaOp->addZeroOrderTerm(new VecAtQP_ZOT(alpha, nullptr)); robinOperators = new DimVec<SurfaceOperator*>(dim, NO_INIT); for (int i = 0; i < dim + 1; i++) @@ -140,8 +140,8 @@ namespace AMDiS { const FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *colFeSpace_) : BoundaryCondition(type, rowFeSpace_, colFeSpace_), - neumannOperators(NULL), - robinOperators(NULL) + neumannOperators(nullptr), + robinOperators(nullptr) { int dim = rowFeSpace->getMesh()->getDim(); @@ -270,7 +270,7 @@ namespace AMDiS { mtl::dense_vector<double> uhAtQp(nPoints); mtl::dense_vector<WorldVector<double> > grdUhAtQp; mtl::dense_vector<WorldMatrix<double> > D2UhAtQp; - dv->getVecAtQPs(elInfo, quadrature, NULL, uhAtQp); + dv->getVecAtQPs(elInfo, quadrature, nullptr, uhAtQp); ElementVector f(nPoints); f = 0.0; diff --git a/AMDiS/src/RobinBC.h b/AMDiS/src/RobinBC.h index 9cadf4f12fbd7087e9eef3f8bff96b7c9bd2f978..4c582b2aa07dd58407a9023ba4c1e90cc1f4c8d1 100644 --- a/AMDiS/src/RobinBC.h +++ b/AMDiS/src/RobinBC.h @@ -48,20 +48,20 @@ namespace AMDiS { AbstractFunction<double, WorldVector<double> > *j, AbstractFunction<double, WorldVector<double> > *alpha, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); /// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as DOFVectors. RobinBC(BoundaryType type, DOFVectorBase<double> *j, DOFVectorBase<double> *alpha, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); /// Constructor. \f$ j \f$ and \f$ alpha \f$ are given as Operator objects. RobinBC(BoundaryType type, Operator* jOp, Operator* alphaOp, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); /// Implements BoundaryCondition::fillBoundaryCondition(); virtual void fillBoundaryCondition(DOFMatrix* matrix, @@ -99,15 +99,15 @@ namespace AMDiS { NeumannBC(BoundaryType type, AbstractFunction<double, WorldVector<double> > *j, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL) - : RobinBC(type, j, NULL, rowFeSpace, colFeSpace) + const FiniteElemSpace *colFeSpace = nullptr) + : RobinBC(type, j, nullptr, rowFeSpace, colFeSpace) {} NeumannBC(BoundaryType type, DOFVectorBase<double> *j, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL) - : RobinBC(type, j, NULL, rowFeSpace, colFeSpace) + const FiniteElemSpace *colFeSpace = nullptr) + : RobinBC(type, j, nullptr, rowFeSpace, colFeSpace) {} }; diff --git a/AMDiS/src/ScalableQuadrature.h b/AMDiS/src/ScalableQuadrature.h index 0d352efabc928db2bc159a5b4e9750ae263d3852..fb69fbdb35a1993235f1c9be8b96a9af69459981 100644 --- a/AMDiS/src/ScalableQuadrature.h +++ b/AMDiS/src/ScalableQuadrature.h @@ -94,7 +94,7 @@ namespace AMDiS { return &((*oldLambda)[a]); } else { ERROR_EXIT("Should not happen!\n"); - return NULL; + return nullptr; } } diff --git a/AMDiS/src/SecondOrderAssembler.cc b/AMDiS/src/SecondOrderAssembler.cc index c064b9597ac902a7b65159165151de4a06216951..ce8cbd00c3be13ec945f3cd074c965f24f2bbb02 100644 --- a/AMDiS/src/SecondOrderAssembler.cc +++ b/AMDiS/src/SecondOrderAssembler.cc @@ -53,7 +53,7 @@ namespace AMDiS { { // check if a assembler is needed at all if (op->secondOrder.size() == 0) - return NULL; + return nullptr; SecondOrderAssembler *newAssembler; diff --git a/AMDiS/src/SecondOrderTerm.cc b/AMDiS/src/SecondOrderTerm.cc index 11518d4aee38ea899ee91951deab17b0edf18e92..8138777de23187912ccb00cf2fbfbfe756b9d1b1 100644 --- a/AMDiS/src/SecondOrderTerm.cc +++ b/AMDiS/src/SecondOrderTerm.cc @@ -923,13 +923,13 @@ namespace AMDiS { gradsAtQPs_.resize(grads_.size()); for (int i = 0; i < static_cast<int>(vecs.size()); i++) { - TEST_EXIT(vecs[i])("One vector is NULL!\n"); + TEST_EXIT(vecs[i])("One vector is nullptr!\n"); auxFeSpaces.insert(vecs[i]->getFeSpace()); } for (int i = 0; i < static_cast<int>(grads.size()); i++) { - TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + TEST_EXIT(grads[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -1056,13 +1056,13 @@ namespace AMDiS { gradsAtQPs_.resize(grads_.size()); for (int i = 0; i < static_cast<int>(vecs.size()); i++) { - TEST_EXIT(vecs[i])("One vector is NULL!\n"); + TEST_EXIT(vecs[i])("One vector is nullptr!\n"); auxFeSpaces.insert(vecs[i]->getFeSpace()); } for (int i = 0; i < static_cast<int>(grads.size()); i++) { - TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + TEST_EXIT(grads[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } diff --git a/AMDiS/src/SecondOrderTerm.h b/AMDiS/src/SecondOrderTerm.h index 79ed800c6ed689035460c9fe73c8f69efbc03339..2b97250eaada0c531f34d8aa88540deaa5c9444a 100644 --- a/AMDiS/src/SecondOrderTerm.h +++ b/AMDiS/src/SecondOrderTerm.h @@ -197,7 +197,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -362,18 +362,18 @@ namespace AMDiS { { public: /// Constructor. - VecAtQP_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af = NULL, + VecAtQP_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af = nullptr, double factor_ = 1.0); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -417,12 +417,12 @@ namespace AMDiS { /// Constructor. Vec2AtQP_SOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - BinaryAbstractFunction<double, double, double> *af = NULL, + BinaryAbstractFunction<double, double, double> *af = nullptr, double factor_ = 1.0); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -472,7 +472,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -518,13 +518,13 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -581,7 +581,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -631,7 +631,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -687,7 +687,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -737,7 +737,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::eval(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -788,7 +788,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -836,7 +836,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -886,7 +886,7 @@ namespace AMDiS { bool symmetric); /// Implementation of \ref OperatorTerm::initElement(). - void initElement(const ElInfo*, SubAssembler*, Quadrature *quad= NULL); + void initElement(const ElInfo*, SubAssembler*, Quadrature *quad= nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -944,7 +944,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo*, SubAssembler* , - Quadrature *quad= NULL); + Quadrature *quad= nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -1004,7 +1004,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). @@ -1055,7 +1055,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -1109,7 +1109,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -1156,7 +1156,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; @@ -1208,7 +1208,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, vector<mtl::dense2D<double> > &LALt) const; diff --git a/AMDiS/src/Serializer.h b/AMDiS/src/Serializer.h index 3fbe38f76ce7cdbac9955f382ffe56f37d3661ad..877c659efbf15be05d060fecff11a6160f71f164 100644 --- a/AMDiS/src/Serializer.h +++ b/AMDiS/src/Serializer.h @@ -93,7 +93,7 @@ namespace AMDiS { bool force, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL) + bool (*writeElem)(ElInfo*) = nullptr) { FUNCNAME("Serializer::writeFiles()"); diff --git a/AMDiS/src/StandardProblemIteration.cc b/AMDiS/src/StandardProblemIteration.cc index 9803e91e725fdeee9b30c600210ff4a8283be951..695eb3089f4a93d64f3b589b4db44aadf69b5e36 100644 --- a/AMDiS/src/StandardProblemIteration.cc +++ b/AMDiS/src/StandardProblemIteration.cc @@ -99,7 +99,6 @@ namespace AMDiS { flag |= problem->coarsenMesh(adaptInfo); #ifdef HAVE_PARALLEL_DOMAIN_AMDIS - MPI::COMM_WORLD.Barrier(); INFO(info, 8)("Local mesh adaption needed %.5f seconds\n", t.elapsed()); #endif diff --git a/AMDiS/src/StandardProblemIteration.h b/AMDiS/src/StandardProblemIteration.h index 01894614a73b4677dd01a71fd292e2d36f78b6f2..3ae5226fe4d430f89e1e09aa32ee4165a5e0fb1b 100644 --- a/AMDiS/src/StandardProblemIteration.h +++ b/AMDiS/src/StandardProblemIteration.h @@ -42,34 +42,34 @@ namespace AMDiS { virtual ~StandardProblemIteration() {} /// Implementation of \ref ProblemIterationIterface::beginIteration() - virtual void beginIteration(AdaptInfo *adaptInfo); + void beginIteration(AdaptInfo *adaptInfo) override; /// Implementation of \ref ProblemIterationInterface::oneIteration() - virtual Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo); + Flag oneIteration(AdaptInfo *adaptInfo, Flag toDo) override; /// Implementation of \ref ProblemIterationInterface::endIteration() - virtual void endIteration(AdaptInfo *adaptInfo); + void endIteration(AdaptInfo *adaptInfo) override; /// Implementation of \ref ProblemIterationInterface::getNumProblems() - int getNumProblems() + int getNumProblems() override { return 1; } /// Implementation of \ref ProblemIterationInterface::getProblem(int) - ProblemStatBase *getProblem(int number = 0) + ProblemStatBase *getProblem(int number = 0) override { return problem; } /// Returns the name of the problem. - virtual std::string getName(); + std::string getName() override; /// Function that serializes the problem plus information about the iteration. - virtual void serialize(std::ostream &out); + void serialize(std::ostream &out) override; /// Function that deserializes the problem plus information about the iteration. - virtual void deserialize(std::istream &in); + void deserialize(std::istream &in) override; /// Nested assemblage and mesh adaption. Flag buildAndAdapt(AdaptInfo *adaptInfo, Flag toDo); diff --git a/AMDiS/src/SubAssembler.cc b/AMDiS/src/SubAssembler.cc index 055bbdb3fa6936a3ce23edc19bbedc90dc36c330..77c182e6836cd664706f56d1e48e39e8e31b542c 100644 --- a/AMDiS/src/SubAssembler.cc +++ b/AMDiS/src/SubAssembler.cc @@ -42,8 +42,8 @@ namespace AMDiS { nCol(0), coordsNumAllocated(0), quadrature(quadrat), - psiFast(NULL), - phiFast(NULL), + psiFast(nullptr), + phiFast(nullptr), symmetric(true), opt(optimized), firstCall(true), @@ -133,7 +133,7 @@ namespace AMDiS { // calls initElement of each term for (vector<OperatorTerm*>::iterator it = terms.begin(); it != terms.end(); ++it) { - if (largeElInfo == NULL) + if (largeElInfo == nullptr) (*it)->initElement(smallElInfo, this, quad); else (*it)->initElement(smallElInfo, largeElInfo, this, quad); diff --git a/AMDiS/src/SubAssembler.h b/AMDiS/src/SubAssembler.h index 53af0c000ad7fb209dbe44b516b6964c91e62367..16b71187792935c36c58b24f1466a206cb9a8d90 100644 --- a/AMDiS/src/SubAssembler.h +++ b/AMDiS/src/SubAssembler.h @@ -155,8 +155,8 @@ namespace AMDiS { /// \ref calculateElementVector() is called for the first time for this /// Element. virtual void initElement(const ElInfo *smallElInfo, - const ElInfo *largeElInfo = NULL, - Quadrature *quad = NULL); + const ElInfo *largeElInfo = nullptr, + Quadrature *quad = nullptr); /// Returns \ref psiFast. const FastQuadrature *getPsiFast() const @@ -203,9 +203,9 @@ namespace AMDiS { /// Used for \ref getVectorAtQPs() and \ref getGradientsAtQPs(). struct ValuesAtQPs { ValuesAtQPs() - : valid(false), quad(NULL) + : valid(false), quad(nullptr) {} - ValuesAtQPs(boost::any values_, bool valid_, Quadrature* quad_=NULL) + ValuesAtQPs(boost::any values_, bool valid_, Quadrature* quad_=nullptr) : values(values_), valid(valid_), quad(quad_) {} diff --git a/AMDiS/src/SubAssembler.hh b/AMDiS/src/SubAssembler.hh index 94f2deb416f8a4a5fbf89d3f96c4651d7c5cf343..eddc22d593ec4bbfc51279bcc59d216f29052b29 100644 --- a/AMDiS/src/SubAssembler.hh +++ b/AMDiS/src/SubAssembler.hh @@ -70,14 +70,14 @@ namespace AMDiS { if (opt && !quad && sameFeSpaces) { if (psiFast->getBasisFunctions() == basFcts) { - vec->getVecAtQPs(elInfo, NULL, psiFast, values); + vec->getVecAtQPs(elInfo, nullptr, psiFast, values); } else if (phiFast->getBasisFunctions() == basFcts) { - vec->getVecAtQPs(elInfo, NULL, phiFast, values); + vec->getVecAtQPs(elInfo, nullptr, phiFast, values); } else { - vec->getVecAtQPs(elInfo, localQuad, NULL, values); + vec->getVecAtQPs(elInfo, localQuad, nullptr, values); } } else { - vec->getVecAtQPs(elInfo, localQuad, NULL, values); + vec->getVecAtQPs(elInfo, localQuad, nullptr, values); } cachedValuesAtQPs[vec]->valid = true; @@ -114,7 +114,7 @@ namespace AMDiS { mtl::dense_vector<T>& values = boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values); cachedValuesAtQPs[vec]->valid = true; - vec->getVecAtQPs(smallElInfo, largeElInfo, localQuad, NULL, values); + vec->getVecAtQPs(smallElInfo, largeElInfo, localQuad, nullptr, values); vecAtQPs = values; } @@ -166,13 +166,13 @@ namespace AMDiS { if (opt && !quad && sameFeSpaces) { if (psiFast->getBasisFunctions() == basFcts) - vec->getGrdAtQPs(elInfo, NULL, psiFast, values); + vec->getGrdAtQPs(elInfo, nullptr, psiFast, values); else if (phiFast->getBasisFunctions() == basFcts) - vec->getGrdAtQPs(elInfo, NULL, phiFast, values); + vec->getGrdAtQPs(elInfo, nullptr, phiFast, values); else - vec->getGrdAtQPs(elInfo, NULL, phiFast, values); + vec->getGrdAtQPs(elInfo, nullptr, phiFast, values); } else { - vec->getGrdAtQPs(elInfo, localQuad, NULL, values); + vec->getGrdAtQPs(elInfo, localQuad, nullptr, values); } cachedGradientsAtQPs[vec]->valid = true; @@ -212,7 +212,7 @@ namespace AMDiS { boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values); cachedGradientsAtQPs[vec]->valid = true; - vec->getGrdAtQPs(smallElInfo, largeElInfo, localQuad, NULL, values); + vec->getGrdAtQPs(smallElInfo, largeElInfo, localQuad, nullptr, values); grdAtQPs = values; } @@ -256,13 +256,13 @@ namespace AMDiS { if (opt && !quad && sameFeSpaces) { if (psiFast->getBasisFunctions() == basFcts) - vec->getDerivativeAtQPs(elInfo, NULL, psiFast, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, nullptr, psiFast, comp, grdAtQPs); else if (phiFast->getBasisFunctions() == basFcts) - vec->getDerivativeAtQPs(elInfo, NULL, phiFast, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, nullptr, phiFast, comp, grdAtQPs); else - vec->getDerivativeAtQPs(elInfo, NULL, phiFast, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, nullptr, phiFast, comp, grdAtQPs); } else { - vec->getDerivativeAtQPs(elInfo, localQuad, NULL, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, localQuad, nullptr, comp, grdAtQPs); } } @@ -289,7 +289,7 @@ namespace AMDiS { return; } - vec->getDerivativeAtQPs(smallElInfo, largeElInfo, localQuad, NULL, comp, grdAtQPs); + vec->getDerivativeAtQPs(smallElInfo, largeElInfo, localQuad, nullptr, comp, grdAtQPs); } } diff --git a/AMDiS/src/SubQuadrature.h b/AMDiS/src/SubQuadrature.h index d53d20c06442266a309c88e05d9af1c70e092250..a0a8d5ea22c72622eee530fbf1619fca188829c2 100644 --- a/AMDiS/src/SubQuadrature.h +++ b/AMDiS/src/SubQuadrature.h @@ -39,7 +39,7 @@ namespace AMDiS { quad->getDegree(), dim_, quad->getNumPoints(), - NULL, + nullptr, quad->getWeight()), quad_(quad), subDim_(quad_->getDim()) diff --git a/AMDiS/src/SurfaceAssembler.h b/AMDiS/src/SurfaceAssembler.h index e8dd38a9f8d6c64c58dac1c5be75cd75a3baa9b8..2b502114eef8663a70a8ceb7dacaaa7b70a2897a 100644 --- a/AMDiS/src/SurfaceAssembler.h +++ b/AMDiS/src/SurfaceAssembler.h @@ -57,25 +57,25 @@ namespace AMDiS { subQuadrature = new SubQuadrature(rowQuad11_, rowDim_); rowQuad11_ = colQuad11_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo11_ = colQPInfo11_ = QPInfo::provideQPInfo(rowQuad11_, NULL); + rowQPInfo11_ = colQPInfo11_ = QPInfo::provideQPInfo(rowQuad11_, nullptr); } if (rowQuad10_) { subQuadrature = new SubQuadrature(rowQuad10_, rowDim_); rowQuad10_ = colQuad10_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo10_ = colQPInfo10_ = QPInfo::provideQPInfo(rowQuad10_, NULL); + rowQPInfo10_ = colQPInfo10_ = QPInfo::provideQPInfo(rowQuad10_, nullptr); } if (rowQuad01_) { subQuadrature = new SubQuadrature(rowQuad01_, rowDim_); rowQuad01_ = colQuad01_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo01_ = colQPInfo01_ = QPInfo::provideQPInfo(rowQuad01_, NULL); + rowQPInfo01_ = colQPInfo01_ = QPInfo::provideQPInfo(rowQuad01_, nullptr); } if (rowQuad00_) { subQuadrature = new SubQuadrature(rowQuad00_, rowDim_); rowQuad00_ = colQuad00_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo00_ = colQPInfo00_ = QPInfo::provideQPInfo(rowQuad00_, NULL); + rowQPInfo00_ = colQPInfo00_ = QPInfo::provideQPInfo(rowQuad00_, nullptr); } } diff --git a/AMDiS/src/SurfaceOperator.h b/AMDiS/src/SurfaceOperator.h index d8c9accabe991b2dbe20aa334b149c5df0e47586..bc5b9ebe34559b8c1563e06cc3dadd32d46ad341 100644 --- a/AMDiS/src/SurfaceOperator.h +++ b/AMDiS/src/SurfaceOperator.h @@ -52,12 +52,12 @@ namespace AMDiS { VectorOfFixVecs<DimVec<double> > &coords) : Operator(*operat), coords_(coords), - quad2(NULL), - quad1GrdPsi(NULL), - quad1GrdPhi(NULL), - quad0(NULL) + quad2(nullptr), + quad1GrdPsi(nullptr), + quad1GrdPhi(nullptr), + quad0(nullptr) { - assembler = NULL; + assembler = nullptr; int dim = rowFeSpace->getMesh()->getDim(); int degree; diff --git a/AMDiS/src/SurfaceQuadrature.cc b/AMDiS/src/SurfaceQuadrature.cc index 49eb47da89fb4e8a9ed44df4e60869387f547a72..4eb9d381b162b35c73c8a8372467383e5b863aa7 100644 --- a/AMDiS/src/SurfaceQuadrature.cc +++ b/AMDiS/src/SurfaceQuadrature.cc @@ -32,7 +32,7 @@ namespace AMDiS { q->getDegree(), q->getDim() + 1, q->getNumPoints(), - NULL, + nullptr, q->getWeight()), quad(q), coords(c) diff --git a/AMDiS/src/SurfaceRegion_ED.h b/AMDiS/src/SurfaceRegion_ED.h index 2045993e009714234a9f2475a059673c67f2ecc9..5b295f34084e67fcafd7c9afc5844dea378b9466 100644 --- a/AMDiS/src/SurfaceRegion_ED.h +++ b/AMDiS/src/SurfaceRegion_ED.h @@ -49,7 +49,7 @@ namespace AMDiS { } }; - SurfaceRegion_ED(ElementData *decorated = NULL) + SurfaceRegion_ED(ElementData *decorated = nullptr) : ElementData(decorated), side(-1), region(-1) diff --git a/AMDiS/src/SystemVector.h b/AMDiS/src/SystemVector.h index 92ecd120d1599058a32bdbeab0dd77078ef9fe9e..40b362574cd372f3edbb6d911a10a681ad74d052 100644 --- a/AMDiS/src/SystemVector.h +++ b/AMDiS/src/SystemVector.h @@ -40,12 +40,13 @@ namespace AMDiS { SystemVector(std::string name_, std::vector<const FiniteElemSpace*> feSpace_, int size, - bool createVec = false) + bool createVec_ = false) : name(name_), componentSpaces(feSpace_), - vectors(size) + vectors(size), + createVec(createVec_) { - if (createVec) + if (createVec_) for (int i = 0; i < size; i++) vectors[i] = new DOFVector<double>(componentSpaces[i], "tmp"); } @@ -62,8 +63,10 @@ namespace AMDiS { ~SystemVector() { - for (unsigned int i = 0; i < vectors.size(); i++) - delete vectors[i]; + if (createVec) { + for (unsigned int i = 0; i < vectors.size(); i++) + delete vectors[i]; + } } /// Sets \ref vectors[index] = vec. @@ -239,6 +242,8 @@ namespace AMDiS { /// Local dof vectors. std::vector<DOFVector<double>*> vectors; + + bool createVec; }; diff --git a/AMDiS/src/Tetrahedron.cc b/AMDiS/src/Tetrahedron.cc index c79920ff0db5ef526c8414967878dae4aaacce6b..1291c2b1c6d488ca516f25e6d2f31c79556c177d 100644 --- a/AMDiS/src/Tetrahedron.cc +++ b/AMDiS/src/Tetrahedron.cc @@ -131,9 +131,9 @@ namespace AMDiS { void Tetrahedron::sortFaceIndices(int face, FixVec<int,WORLD> &vec) const { - static MatrixOfFixVecs<FixVec<int,WORLD> > *sorted_3d = NULL; + static MatrixOfFixVecs<FixVec<int,WORLD> > *sorted_3d = nullptr; - if (sorted_3d == NULL) { + if (sorted_3d == nullptr) { sorted_3d = new MatrixOfFixVecs<FixVec<int,WORLD> >(3, 4, 7, NO_INIT); (*sorted_3d)[0][0][0] = (*sorted_3d)[0][0][1] = @@ -417,7 +417,7 @@ namespace AMDiS { if (elDofIter.getCurrentPos() == 1 && elDofIter.getCurrentElementPos() == bound.ithObj) { dofs.push_back(elDofIter.getBaseDof()); - if (dofGeoIndex != NULL) + if (dofGeoIndex != nullptr) dofGeoIndex->push_back(EDGE); } } while (elDofIter.nextStrict()); @@ -427,7 +427,7 @@ namespace AMDiS { elDofIter.getCurrentElementPos() == bound.ithObj) { dofs.push_back(elDofIter.getDofPtr()); - if (dofGeoIndex != NULL) + if (dofGeoIndex != nullptr) dofGeoIndex->push_back(EDGE); } } while (elDofIter.next()); @@ -515,7 +515,7 @@ namespace AMDiS { else dofs.push_back(elDofIter.getDofPtr()); - if (dofGeoIndex != NULL) + if (dofGeoIndex != nullptr) dofGeoIndex->push_back(elDofIter.getPosIndex()); } diff --git a/AMDiS/src/Tetrahedron.h b/AMDiS/src/Tetrahedron.h index 826bc0d3463326c32895815df1ed77bc5912c202..f02307348e3d21c2e9d668e659fca7733fd5103d 100644 --- a/AMDiS/src/Tetrahedron.h +++ b/AMDiS/src/Tetrahedron.h @@ -156,7 +156,7 @@ namespace AMDiS { BoundaryObject bound, DofContainer& dofs, bool baseDofPtr = false, - vector<GeoIndex>* dofGeoIndex = NULL) const; + vector<GeoIndex>* dofGeoIndex = nullptr) const; void getSubBoundary(BoundaryObject bound, vector<BoundaryObject> &subBound) const; diff --git a/AMDiS/src/TimedObject.h b/AMDiS/src/TimedObject.h index 7f7ae2d80ba5131d6fd074d5d91bfbd326f0a55a..4c7dea05a132c93ef0cb6196a787982915013ad2 100644 --- a/AMDiS/src/TimedObject.h +++ b/AMDiS/src/TimedObject.h @@ -38,7 +38,7 @@ namespace AMDiS { public: /// Constructor. TimedObject() - : timePtr(NULL) + : timePtr(nullptr) {} /// Sets the time pointer. diff --git a/AMDiS/src/TransformDOF.h b/AMDiS/src/TransformDOF.h index 0764e21179633f543c0a3862e150f078b90bc538..f20717e6e8a73dc7522d9881240c31b2f9c19bfd 100644 --- a/AMDiS/src/TransformDOF.h +++ b/AMDiS/src/TransformDOF.h @@ -84,7 +84,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec, DOFVector<T2> *result, Abs std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts); mtl::dense_vector<T1> vecLocalCoeffs(nVecBasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -185,7 +185,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV mtl::dense_vector<T1> vec1LocalCoeffs(nVec1BasisFcts); mtl::dense_vector<T2> vec2LocalCoeffs(nVec2BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -271,7 +271,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts); ElementVector vec1LocalCoeffs(nVec1BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -355,7 +355,7 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts); ElementVector vec1LocalCoeffs(nVec1BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -454,7 +454,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV mtl::dense_vector<T2> vec2LocalCoeffs(nVec2BasisFcts); mtl::dense_vector<T3> vec3LocalCoeffs(nVec3BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -535,7 +535,7 @@ inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVe ElementVector vec1LocalCoeffs(nVec1BasisFcts); ElementVector vec2LocalCoeffs(nVec2BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -599,7 +599,7 @@ inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVe ElementVector vec1LocalCoeffs(nVec1BasisFcts); ElementVector vec3LocalCoeffs(nVec3BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -663,7 +663,7 @@ inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVe ElementVector vec2LocalCoeffs(nVec2BasisFcts); ElementVector vec3LocalCoeffs(nVec3BasisFcts); - DimVec<double> *coords = NULL; + DimVec<double> *coords = nullptr; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | diff --git a/AMDiS/src/Traverse.cc b/AMDiS/src/Traverse.cc index 79917219e4810aec04ef67acad74297db8aa1918..d92760960cf81d6f1681da234dde2aaab38d3f86 100644 --- a/AMDiS/src/Traverse.cc +++ b/AMDiS/src/Traverse.cc @@ -64,10 +64,10 @@ namespace AMDiS { TEST_EXIT_DBG(level >= 0)("invalid level: %d\n", level); } - traverse_mel = NULL; + traverse_mel = nullptr; stack_used = 0; - return traverseNext(NULL); + return traverseNext(nullptr); } @@ -89,7 +89,7 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseNext()"); - ElInfo *elinfo = NULL; + ElInfo *elinfo = nullptr; Parametric *parametric = traverse_mesh->getParametric(); if (stack_used) { @@ -98,7 +98,7 @@ namespace AMDiS { TEST_EXIT_DBG(elinfo_old == elinfo_stack[stack_used])("invalid old elinfo\n"); } else { - TEST_EXIT_DBG(elinfo_old == NULL)("invalid old elinfo != nil\n"); + TEST_EXIT_DBG(elinfo_old == nullptr)("invalid old elinfo != nil\n"); } if (traverse_fill_flag.isSet(Mesh::CALL_LEAF_EL)) { @@ -135,11 +135,11 @@ namespace AMDiS { { int new_stack_size = stack_size + 10; - elinfo_stack.resize(new_stack_size, NULL); + elinfo_stack.resize(new_stack_size, nullptr); // create new elinfos for (int i = stack_size; i < new_stack_size; i++) { - TEST_EXIT_DBG(elinfo_stack[i] == NULL)("???\n"); + TEST_EXIT_DBG(elinfo_stack[i] == nullptr)("???\n"); elinfo_stack[i] = traverse_mesh->createNewElInfo(); } @@ -148,11 +148,11 @@ namespace AMDiS { elinfo_stack[i]->setFillFlag(elinfo_stack[0]->getFillFlag()); info_stack.resize(new_stack_size); - save_elinfo_stack.resize(new_stack_size, NULL); + save_elinfo_stack.resize(new_stack_size, nullptr); // create new elinfos for (int i = stack_size; i < new_stack_size; i++) { - TEST_EXIT_DBG(save_elinfo_stack[i] == NULL)("???\n"); + TEST_EXIT_DBG(save_elinfo_stack[i] == nullptr)("???\n"); save_elinfo_stack[i] = traverse_mesh->createNewElInfo(); } save_info_stack.resize(new_stack_size); @@ -165,7 +165,7 @@ namespace AMDiS { { FUNCNAME_DBG("TraverseStack::traverseLeafElement()"); - Element *el = NULL; + Element *el = nullptr; if (stack_used == 0) { /* first call */ currentMacro = traverse_mesh->firstMacroElement(); @@ -185,7 +185,7 @@ namespace AMDiS { } if (currentMacro == traverse_mesh->endOfMacroElements()) - return NULL; + return nullptr; traverse_mel = *currentMacro; stack_used = 1; @@ -193,14 +193,14 @@ namespace AMDiS { info_stack[stack_used] = 0; el = elinfo_stack[stack_used]->getElement(); - if (el == NULL || el->getFirstChild() == NULL) + if (el == nullptr || el->getFirstChild() == nullptr) return elinfo_stack[stack_used]; } else { el = elinfo_stack[stack_used]->getElement(); /* go up in tree until we can go down again */ while ((stack_used > 0) && - ((info_stack[stack_used] >= 2) || (el->getFirstChild() == NULL))) { + ((info_stack[stack_used] >= 2) || (el->getFirstChild() == nullptr))) { stack_used--; el = elinfo_stack[stack_used]->getElement(); } @@ -208,7 +208,7 @@ namespace AMDiS { /* goto next macro element */ if (stack_used < 1) { if (limitedToMacroElement >= 0) - return NULL; + return nullptr; do { currentMacro++; @@ -216,7 +216,7 @@ namespace AMDiS { ((*currentMacro)->getIndex() % maxThreads != myThreadId)); if (currentMacro == traverse_mesh->endOfMacroElements()) - return NULL; + return nullptr; traverse_mel = *currentMacro; stack_used = 1; @@ -224,7 +224,7 @@ namespace AMDiS { info_stack[stack_used] = 0; el = elinfo_stack[stack_used]->getElement(); - if (el == NULL || el->getFirstChild() == NULL) + if (el == nullptr || el->getFirstChild() == nullptr) return elinfo_stack[stack_used]; } } @@ -257,7 +257,7 @@ namespace AMDiS { ERROR_EXIT("not yet implemented\n"); - return NULL; + return nullptr; } @@ -266,7 +266,7 @@ namespace AMDiS { ElInfo *elInfo; do { elInfo = traverseEveryElementPreorder(); - } while (elInfo != NULL && elInfo->getLevel() != traverse_level); + } while (elInfo != nullptr && elInfo->getLevel() != traverse_level); return elInfo; } @@ -279,8 +279,8 @@ namespace AMDiS { if (stack_used == 0) { /* first call */ currentMacro = traverse_mesh->firstMacroElement(); traverse_mel = *currentMacro; - if (traverse_mel == NULL) - return NULL; + if (traverse_mel == nullptr) + return nullptr; stack_used = 1; elinfo_stack[stack_used]->fillMacroInfo(traverse_mel); @@ -296,7 +296,7 @@ namespace AMDiS { /* go up in tree until we can go down again */ while ((stack_used > 0) && - ((info_stack[stack_used] >= 2) || (el->getFirstChild()==NULL))) { + ((info_stack[stack_used] >= 2) || (el->getFirstChild()==nullptr))) { stack_used--; el = elinfo_stack[stack_used]->getElement(); } @@ -306,7 +306,7 @@ namespace AMDiS { if (stack_used < 1) { currentMacro++; if (currentMacro == traverse_mesh->endOfMacroElements()) - return NULL; + return nullptr; traverse_mel = *currentMacro; stack_used = 1; @@ -363,8 +363,8 @@ namespace AMDiS { } traverse_mel = *currentMacro; - if (traverse_mel == NULL) - return NULL; + if (traverse_mel == nullptr) + return nullptr; stack_used = 1; elinfo_stack[stack_used]->fillMacroInfo(traverse_mel); @@ -377,7 +377,7 @@ namespace AMDiS { /* go up in tree until we can go down again */ while (stack_used > 0 && - (info_stack[stack_used] >= 2 || el->getFirstChild() == NULL)) { + (info_stack[stack_used] >= 2 || el->getFirstChild() == nullptr)) { stack_used--; el = elinfo_stack[stack_used]->getElement(); } @@ -386,11 +386,11 @@ namespace AMDiS { /* goto next macro element */ if (stack_used < 1) { if (limitedToMacroElement >= 0) - return NULL; + return nullptr; currentMacro++; if (currentMacro == traverse_mesh->endOfMacroElements()) - return NULL; + return nullptr; traverse_mel = *currentMacro; stack_used = 1; @@ -430,7 +430,7 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseEveryElementInorder"); ERROR_EXIT("not yet implemented\n"); - return NULL; + return nullptr; } @@ -450,7 +450,7 @@ namespace AMDiS { } if (currentMacro == traverse_mesh->endOfMacroElements()) - return NULL; + return nullptr; traverse_mel = *currentMacro; stack_used = 1; @@ -463,7 +463,7 @@ namespace AMDiS { /* go up in tree until we can go down again */ /* postorder!!! */ while (stack_used > 0 && - (info_stack[stack_used] >= 3 || el->getFirstChild() == NULL)) { + (info_stack[stack_used] >= 3 || el->getFirstChild() == nullptr)) { stack_used--; el = elinfo_stack[stack_used]->getElement(); } @@ -472,11 +472,11 @@ namespace AMDiS { /* goto next macro element */ if (stack_used < 1) { if (limitedToMacroElement >= 0) - return NULL; + return nullptr; currentMacro++; if (currentMacro == traverse_mesh->endOfMacroElements()) - return NULL; + return nullptr; traverse_mel = *currentMacro; stack_used = 1; @@ -522,7 +522,7 @@ namespace AMDiS { default: ERROR_EXIT("invalid dim\n"); } - return NULL; + return nullptr; } @@ -530,8 +530,8 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseNeighbour3d()"); - Element *el2 = NULL; - ElInfo *elinfo2 = NULL; + Element *el2 = nullptr; + ElInfo *elinfo2 = nullptr; int stack2_used = 0; int sav_neighbour = neighbour; @@ -613,8 +613,8 @@ namespace AMDiS { int i = traverse_mel->getOppVertex(nb); traverse_mel = traverse_mel->getNeighbour(nb); - if (traverse_mel == NULL) - return NULL; + if (traverse_mel == nullptr) + return nullptr; if (nb < 2 && save_stack_used > 1) { // go down one level in OLD hierarchy @@ -793,8 +793,8 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseNeighbour2d()"); -// Triangle *el2 = NULL; -// ElInfo *elinfo2 = NULL; +// Triangle *el2 = nullptr; +// ElInfo *elinfo2 = nullptr; int stack2_used = 0; int sav_neighbour = neighbour; @@ -894,8 +894,8 @@ namespace AMDiS { int i = traverse_mel->getOppVertex(nb); traverse_mel = traverse_mel->getNeighbour(nb); - if (traverse_mel == NULL) - return NULL; + if (traverse_mel == nullptr) + return nullptr; nb = i; stack_used = 1; diff --git a/AMDiS/src/Traverse.h b/AMDiS/src/Traverse.h index e68a5f63a2bb9d4aec4bd9ee216712b715dc6408..64ed13039a1fced1c7bb38f940c34bcaf0ce4f59 100644 --- a/AMDiS/src/Traverse.h +++ b/AMDiS/src/Traverse.h @@ -60,7 +60,7 @@ namespace AMDiS { /// Creates an empty TraverseStack TraverseStack() : limitedToMacroElement(-1), - traverse_mel(NULL), + traverse_mel(nullptr), stack_size(0), stack_used(0), save_stack_used(0), @@ -91,7 +91,7 @@ namespace AMDiS { Flag fill_flag); /// Returns the next ElInfo in a traversal initiated by \ref traverseFirst() - /// If NULL is returned, the traversal is finished. + /// If nullptr is returned, the traversal is finished. ElInfo* traverseNext(ElInfo* elinfo_old); /// Returns the neighbour-th neighbour of elInfoOld @@ -146,7 +146,7 @@ namespace AMDiS { FUNCNAME_DBG("TraverseStack::getElInfo()"); if (stack_used < 0) - return NULL; + return nullptr; TEST_EXIT_DBG(elinfo_stack.size() > static_cast<unsigned int>(stack_used)) ("Should not happen!\n"); diff --git a/AMDiS/src/Triangle.cc b/AMDiS/src/Triangle.cc index 3cb4e585b7005d50436e373a01ea58447377ac8d..c1c4731e5bebaf2e012099ef8dc40d720bfeffee 100644 --- a/AMDiS/src/Triangle.cc +++ b/AMDiS/src/Triangle.cc @@ -62,9 +62,9 @@ namespace AMDiS { void Triangle::sortFaceIndices(int face, FixVec<int, WORLD> &vec) const { - static MatrixOfFixVecs<FixVec<int, WORLD> > *sorted_2d = NULL; + static MatrixOfFixVecs<FixVec<int, WORLD> > *sorted_2d = nullptr; - if (sorted_2d == NULL) { + if (sorted_2d == nullptr) { sorted_2d = new MatrixOfFixVecs<FixVec<int, WORLD> >(2, 3, 2, NO_INIT); (*sorted_2d)[1][0][1] = (*sorted_2d)[1][1][0] = @@ -262,13 +262,13 @@ namespace AMDiS { if (bound.reverseMode) { for (int i = addDofs.size() - 1; i >= 0; i--) { dofs.push_back(addDofs[i]); - if (dofGeoIndex != NULL) + if (dofGeoIndex != nullptr) dofGeoIndex->push_back(EDGE); } } else { for (unsigned int i = 0; i < addDofs.size(); i++) { dofs.push_back(addDofs[i]); - if (dofGeoIndex != NULL) + if (dofGeoIndex != nullptr) dofGeoIndex->push_back(EDGE); } } diff --git a/AMDiS/src/Triangle.h b/AMDiS/src/Triangle.h index 947e33ac0a3f124161e58db76e02d687e8fc2843..6964e6ff29ea4182e4d6ca0ee607132bfdb17cf2 100644 --- a/AMDiS/src/Triangle.h +++ b/AMDiS/src/Triangle.h @@ -205,7 +205,7 @@ namespace AMDiS { BoundaryObject bound, DofContainer& dofs, bool baseDofPtr = false, - vector<GeoIndex>* dofGeoIndex = NULL) const; + vector<GeoIndex>* dofGeoIndex = nullptr) const; void prepareNextBound(BoundaryObject &bound, int ithChild) const; diff --git a/AMDiS/src/VertexVector.cc b/AMDiS/src/VertexVector.cc index 0932688522ed37114d4c00b6097080403cf44601..e884c4396f6cc8b4dcbfaab00dc611a7d86feaaf 100644 --- a/AMDiS/src/VertexVector.cc +++ b/AMDiS/src/VertexVector.cc @@ -29,7 +29,7 @@ namespace AMDiS { : DOFVectorDOF() { name = n; - feSpace = NULL; + feSpace = nullptr; admin = a; const_cast<DOFAdmin*>(admin)->addDOFIndexed(this); const_cast<DOFAdmin*>(admin)->addDOFContainer(this); @@ -62,13 +62,13 @@ namespace AMDiS { } - void VertexVector::changeDofIndices(std::map<int, int>& dofIndexMap) + void VertexVector::changeDofIndices(std::map<DegreeOfFreedom, DegreeOfFreedom>& dofIndexMap) { std::vector<DegreeOfFreedom> tmp(vec.size()); - for (int i = 0; i < static_cast<int>(tmp.size()); i++) + for (DofIndex::size_type i = 0; i < static_cast<DofIndex::size_type>(tmp.size()); i++) tmp[i] = i; - for (std::map<int, int>::iterator it = dofIndexMap.begin(); + for (std::map<DegreeOfFreedom, DegreeOfFreedom>::iterator it = dofIndexMap.begin(); it != dofIndexMap.end(); ++it) if (vec[it->first] == -1) tmp[it->second] = -1; diff --git a/AMDiS/src/VertexVector.h b/AMDiS/src/VertexVector.h index c837e9d034de701e993e05656701ac62b8c21b78..589c545ecaeedb835ce592ff3c1673a0332a8de0 100644 --- a/AMDiS/src/VertexVector.h +++ b/AMDiS/src/VertexVector.h @@ -77,7 +77,7 @@ namespace AMDiS { vec[i] = i; } - void changeDofIndices(std::map<int, int>& dofIndexMap); + void changeDofIndices(std::map<DegreeOfFreedom, DegreeOfFreedom>& dofIndexMap); void print(); diff --git a/AMDiS/src/ZeroOrderAssembler.cc b/AMDiS/src/ZeroOrderAssembler.cc index 6553ca3c79f31ab8db9505475fc1892d7d2c3b4d..e3b35135994c6cf532467e62f484a48a0f7421a0 100644 --- a/AMDiS/src/ZeroOrderAssembler.cc +++ b/AMDiS/src/ZeroOrderAssembler.cc @@ -53,7 +53,7 @@ namespace AMDiS { { // check if an assembler is needed at all if (op->zeroOrder.size() == 0) - return NULL; + return nullptr; ZeroOrderAssembler *newAssembler; diff --git a/AMDiS/src/ZeroOrderTerm.cc b/AMDiS/src/ZeroOrderTerm.cc index c280480cda77d27e95fa39d12105d254e36ef220..7d3e3d21aa01d8324334fc3680ac4d7918a288da 100644 --- a/AMDiS/src/ZeroOrderTerm.cc +++ b/AMDiS/src/ZeroOrderTerm.cc @@ -596,7 +596,7 @@ namespace AMDiS { vecsAtQPs.resize(vecs.size()); for (unsigned int i = 0; i < dv.size(); i++) { - TEST_EXIT(dv[i])("One vector is NULL!\n"); + TEST_EXIT(dv[i])("One vector is nullptr!\n"); auxFeSpaces.insert(dv[i]->getFeSpace()); } @@ -655,7 +655,7 @@ namespace AMDiS { gradsAtQPs.resize(vecs.size()); for (int i = 0; i < static_cast<int>(dv.size()); i++) { - TEST_EXIT(dv[i])("One vector is NULL!\n"); + TEST_EXIT(dv[i])("One vector is nullptr!\n"); auxFeSpaces.insert(dv[i]->getFeSpace()); } @@ -773,7 +773,7 @@ namespace AMDiS { auxFeSpaces.insert(v->getFeSpace()); for (int i = 0; i < static_cast<int>(dv.size()); i++) { - TEST_EXIT(dv[i])("One gradient vector is NULL!\n"); + TEST_EXIT(dv[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(dv[i]->getFeSpace()); } @@ -924,13 +924,13 @@ namespace AMDiS { gradsAtQPs_.resize(grads_.size()); for (int i = 0; i < static_cast<int>(vecs.size()); i++) { - TEST_EXIT(vecs[i])("One vector is NULL!\n"); + TEST_EXIT(vecs[i])("One vector is nullptr!\n"); auxFeSpaces.insert(vecs[i]->getFeSpace()); } for (int i = 0; i < static_cast<int>(grads.size()); i++) { - TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + TEST_EXIT(grads[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -1004,13 +1004,13 @@ namespace AMDiS { gradsAtQPs.resize(grads_.size()); for (int i = 0; i < static_cast<int>(vecs.size()); i++) { - TEST_EXIT(vecs[i])("One vector is NULL!\n"); + TEST_EXIT(vecs[i])("One vector is nullptr!\n"); auxFeSpaces.insert(vecs[i]->getFeSpace()); } for (int i = 0; i < static_cast<int>(grads.size()); i++) { - TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); + TEST_EXIT(grads[i])("One gradient vector is nullptr!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -1083,7 +1083,7 @@ namespace AMDiS { } void CoordsAtQP_ZOT::getC(const ElInfo *elInfo, int nPoints, ElementVector& C) - { + { for (int iq = 0; iq < nPoints; iq++) C[iq] += (*g)(coordsAtQPs[iq]); } diff --git a/AMDiS/src/ZeroOrderTerm.h b/AMDiS/src/ZeroOrderTerm.h index 5c0dc44632e62ab1030972839218b6c835a84bbf..c7c8adec2e59ab4b89add07fa9bf54aef0b1f1cf 100644 --- a/AMDiS/src/ZeroOrderTerm.h +++ b/AMDiS/src/ZeroOrderTerm.h @@ -99,20 +99,20 @@ namespace AMDiS { public: /// Constructor. VecAtQP_ZOT(DOFVectorBase<double> *dv, - AbstractFunction<double, double> *ab = NULL, + AbstractFunction<double, double> *ab = nullptr, double factor_ = 1.0 ); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implementation of \ref OperatorTerm::initElement() for multiple meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -160,7 +160,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -203,19 +203,19 @@ namespace AMDiS { /// Constructor. Vec2AtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - BinaryAbstractFunction<double, double, double> *f = NULL, + BinaryAbstractFunction<double, double, double> *f = nullptr, double factor_ = 1.0 ); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -260,13 +260,13 @@ namespace AMDiS { Vec3AtQP_ZOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, DOFVectorBase<double> *dv3, - TertiaryAbstractFunction<double, double, double, double> *f = NULL, + TertiaryAbstractFunction<double, double, double, double> *f = nullptr, double factor_ = 1.0 ); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -309,7 +309,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *elInfo, int nPoints, ElementVector& C); @@ -349,7 +349,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -392,7 +392,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -433,7 +433,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -477,7 +477,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *elInfo, int nPoints, ElementVector& C); @@ -519,7 +519,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -557,7 +557,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -599,7 +599,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -645,7 +645,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -679,7 +679,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -710,12 +710,12 @@ namespace AMDiS { /// Constructor. VecDivergence_ZOT(int nComponents, DOFVectorBase<double> *vec0, - DOFVectorBase<double> *vec1 = NULL, - DOFVectorBase<double> *vec2 = NULL); + DOFVectorBase<double> *vec1 = nullptr, + DOFVectorBase<double> *vec2 = nullptr); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -747,7 +747,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -786,7 +786,7 @@ namespace AMDiS { QuartAbstractFunction<double, double, double, WorldVector<double>, WorldVector<double> > *af); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -816,7 +816,7 @@ namespace AMDiS { TertiaryAbstractFunction<double, double, double, WorldVector<double> > *f); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -850,7 +850,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -899,7 +899,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); @@ -950,7 +950,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = NULL); + Quadrature *quad = nullptr); /// Implements ZeroOrderTerm::getC(). void getC(const ElInfo *, int nPoints, ElementVector& C); diff --git a/AMDiS/src/compositeFEM/CFE_Integration.h b/AMDiS/src/compositeFEM/CFE_Integration.h index fd64a0b3f3215e55c84ff188af3f97be16714bef..4bc168772f2e3f61d0ae2500e943267d1300bf79 100644 --- a/AMDiS/src/compositeFEM/CFE_Integration.h +++ b/AMDiS/src/compositeFEM/CFE_Integration.h @@ -38,7 +38,7 @@ namespace AMDiS { static double integrate_onNegLs(ElementFunction<double> *f, ElementLevelSet *elLS, int deg = 1, - Quadrature *q = NULL); + Quadrature *q = nullptr); /** * Calculates surface integral of function f on the zero level set. @@ -48,7 +48,7 @@ namespace AMDiS { static double integrate_onZeroLs(ElementFunction<double> *f, ElementLevelSet *elLS, int deg = 1, - Quadrature *q = NULL); + Quadrature *q = nullptr); protected: /// Calculates determinant for surface given through surfVert. static double calcSurfaceDet(ElInfo *loc_elInfo, diff --git a/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.cc b/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.cc index 04aeadab454b56a94b1fa3210273a9b54353053c..d42cb369cd945254c175843d03fdc6cebe6a3d19 100644 --- a/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.cc +++ b/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.cc @@ -96,7 +96,7 @@ namespace AMDiS { { double val = 0.0; mtl::dense_vector<double> dofAtQPs(q->getNumPoints()); - dofVec->getVecAtQPs(elInfo, q, NULL, dofAtQPs); + dofVec->getVecAtQPs(elInfo, q, nullptr, dofAtQPs); for (int iq = 0; iq < nQPts; ++iq) val += q->getWeight(iq) * fabs(dofAtQPs[iq]); @@ -111,7 +111,7 @@ namespace AMDiS { { double val = 0.0; mtl::dense_vector<double> dofAtQPs(q->getNumPoints()); - dofVec->getVecAtQPs(elInfo, q, NULL, dofAtQPs); + dofVec->getVecAtQPs(elInfo, q, nullptr, dofAtQPs); for (int iq = 0; iq < nQPts; ++iq) val += q->getWeight(iq) * sqr(dofAtQPs[iq]); @@ -127,7 +127,7 @@ namespace AMDiS { double val = 0.0; double norm_grd2; mtl::dense_vector<WorldVector<double> > grdDofAtQPs; - dofVec->getGrdAtQPs(elInfo, q, NULL, grdDofAtQPs); + dofVec->getGrdAtQPs(elInfo, q, nullptr, grdDofAtQPs); for (int iq = 0; iq < nQPts; ++iq) { @@ -150,7 +150,7 @@ namespace AMDiS { double val = 0.0; double val_nrm = 0.0; mtl::dense_vector<double> uhAtQPs(q->getNumPoints()); - uh->getVecAtQPs(elInfo, q, NULL, uhAtQPs); + uh->getVecAtQPs(elInfo, q, nullptr, uhAtQPs); WorldVector<double> worldCoordsAtQP; for (int iq = 0; iq < nQPts; ++iq) { @@ -179,7 +179,7 @@ namespace AMDiS { double norm_err_grd2; double norm_grd2; mtl::dense_vector<WorldVector<double> > grdUhAtQPs; - uh->getGrdAtQPs(elInfo, q, NULL, grdUhAtQPs); + uh->getGrdAtQPs(elInfo, q, nullptr, grdUhAtQPs); WorldVector<double> worldCoordsAtQP; for (int iq = 0; iq < nQPts; ++iq) { diff --git a/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.h b/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.h index 3f8061ecedf5781e59baf8602424cc599e05bd5a..8974ecd74c52d48807f6ff5b9c0ff3c913533cb5 100644 --- a/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.h +++ b/AMDiS/src/compositeFEM/CFE_NormAndErrorFcts.h @@ -307,52 +307,52 @@ namespace AMDiS { ElementLevelSet *elLS, int domainFlag, int deg = 1, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double L2Norm_Analyt(AbstractFunction<double, WorldVector<double> > *f, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double L2NormSquare_Analyt(AbstractFunction<double, WorldVector<double> > *f, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double H1Norm_Analyt(AbstractFunction<WorldVector<double>, WorldVector<double> > *grd, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double H1NormSquare_Analyt(AbstractFunction<WorldVector<double>, WorldVector<double> > *grd, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double L1Norm_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 1, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double L2Norm_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double L2NormSquare_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double H1Norm_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = NULL); + Quadrature* q = nullptr); static double H1NormSquare_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = NULL); + Quadrature* q = nullptr); // ======================================================================== // Calculation of error between @@ -379,7 +379,7 @@ namespace AMDiS { int domainFlag, int relErr = 0, int deg = 2, - Quadrature *q = NULL); + Quadrature *q = nullptr); static double H1Err( AbstractFunction<WorldVector<double>, WorldVector<double> > *grdU, DOFVector<double> *uh, @@ -387,7 +387,7 @@ namespace AMDiS { int domainFlag, int relErr = 0, int deg = 0, - Quadrature *q = NULL); + Quadrature *q = nullptr); /** * Get absolute L2 error. diff --git a/AMDiS/src/compositeFEM/CompositeFEMOperator.cc b/AMDiS/src/compositeFEM/CompositeFEMOperator.cc index d46e3c05c2f9db5be64ae9f86bbd27fb1a3549de..640f8fc913562483af63a515100f6c33994eefec 100644 --- a/AMDiS/src/compositeFEM/CompositeFEMOperator.cc +++ b/AMDiS/src/compositeFEM/CompositeFEMOperator.cc @@ -31,8 +31,8 @@ void CompositeFEMOperator::getElementMatrix(const ElInfo *elInfo, { FUNCNAME("CompositeFEMOperator::getElementMatrix"); - VectorOfFixVecs<DimVec<double> > *intersecPoints = NULL; - SubPolytope *subPolytope = NULL; + VectorOfFixVecs<DimVec<double> > *intersecPoints = nullptr; + SubPolytope *subPolytope = nullptr; double levelSetSubPolytope; DimVec<double> subElVertexBarCoords(elInfo->getMesh()->getDim()); @@ -129,7 +129,7 @@ void CompositeFEMOperator::getElementMatrix(const ElInfo *elInfo, set_to_zero(subPolMat2); if (!assembler.get()) { - Assembler *aptr = new StandardAssembler(this, NULL, NULL, NULL, NULL, rowFeSpace, colFeSpace); + Assembler *aptr = new StandardAssembler(this, nullptr, nullptr, nullptr, nullptr, rowFeSpace, colFeSpace); assembler.set(aptr); } @@ -166,8 +166,8 @@ void CompositeFEMOperator::getElementVector(const ElInfo *elInfo, { FUNCNAME("CompositeFEMOperator::getElementVector"); - VectorOfFixVecs<DimVec<double> >*intersecPoints = NULL; - SubPolytope *subPolytope = NULL; + VectorOfFixVecs<DimVec<double> >*intersecPoints = nullptr; + SubPolytope *subPolytope = nullptr; double levelSetSubPolytope; DimVec<double> subElVertexBarCoords(elInfo->getMesh()->getDim()); @@ -260,7 +260,7 @@ void CompositeFEMOperator::getElementVector(const ElInfo *elInfo, set_to_zero(subPolVec2); if (!assembler.get()) { - Assembler *aptr = new StandardAssembler(this, NULL, NULL, NULL, NULL, rowFeSpace, colFeSpace); + Assembler *aptr = new StandardAssembler(this, nullptr, nullptr, nullptr, nullptr, rowFeSpace, colFeSpace); assembler.set(aptr); } diff --git a/AMDiS/src/compositeFEM/CompositeFEMOperator.h b/AMDiS/src/compositeFEM/CompositeFEMOperator.h index 1a4fd81e29e31e4bba2043c8596bae02a9fab48b..492598398c133473207e5759a4380a66951c90e2 100644 --- a/AMDiS/src/compositeFEM/CompositeFEMOperator.h +++ b/AMDiS/src/compositeFEM/CompositeFEMOperator.h @@ -59,10 +59,10 @@ public: /// Constructor. CompositeFEMOperator(ElementLevelSet *elLS_, const FiniteElemSpace *rowFeSpace_, - const FiniteElemSpace *colFeSpace_ = NULL) + const FiniteElemSpace *colFeSpace_ = nullptr) : Operator(rowFeSpace_, colFeSpace_), elLS(elLS_), - subElementAssembler(NULL), + subElementAssembler(nullptr), elStatus(ElementLevelSet::LEVEL_SET_UNDEFINED) {} diff --git a/AMDiS/src/compositeFEM/ElementLevelSet.cc b/AMDiS/src/compositeFEM/ElementLevelSet.cc index 2a193f9f0cb39aef19eb8f29735e7c00a15203e7..8bc3cd353bf67dfad084792689e4523c7a010c20 100644 --- a/AMDiS/src/compositeFEM/ElementLevelSet.cc +++ b/AMDiS/src/compositeFEM/ElementLevelSet.cc @@ -28,7 +28,7 @@ ElementLevelSet::createElementLevelSet(const ElInfo *elInfo_, { Element *el = elInfo_->getElement(); - if (elInfo == NULL || el != lastEl) { + if (elInfo == nullptr || el != lastEl) { /** * Element has changed. New calculation. */ diff --git a/AMDiS/src/compositeFEM/ElementLevelSet.h b/AMDiS/src/compositeFEM/ElementLevelSet.h index a6f54f308097ab96759e8e50f20b362bf3b58911..9ffa04d28516206221241d30ad4d29b3f90cbd6a 100644 --- a/AMDiS/src/compositeFEM/ElementLevelSet.h +++ b/AMDiS/src/compositeFEM/ElementLevelSet.h @@ -86,8 +86,8 @@ public: ElementFunction<double> *lSFct_, Mesh *mesh_) : name(name_), - elInfo(NULL), - lastEl(NULL), + elInfo(nullptr), + lastEl(nullptr), level_set_domain(LEVEL_SET_UNDEFINED), numIntersecPoints(0), elStatus(LEVEL_SET_UNDEFINED), diff --git a/AMDiS/src/compositeFEM/PenaltyOperator.cc b/AMDiS/src/compositeFEM/PenaltyOperator.cc index 5da67b807810e864b9f0c6d19a6e510022c18fbe..dbf8af157219087514fab6f7aa07f82354da29ed 100644 --- a/AMDiS/src/compositeFEM/PenaltyOperator.cc +++ b/AMDiS/src/compositeFEM/PenaltyOperator.cc @@ -40,7 +40,7 @@ PenaltyOperator::getElementMatrix(const ElInfo *elInfo, ElementMatrix& userMat, double factor) { - VectorOfFixVecs<DimVec<double> > *intersecPoints = NULL; + VectorOfFixVecs<DimVec<double> > *intersecPoints = nullptr; double penaltyCoeff = getPenaltyCoeff(elInfo); /** @@ -156,7 +156,7 @@ PenaltyOperator::getElementVector(const ElInfo *elInfo, ElementVector& userVec, double factor) { - VectorOfFixVecs<DimVec<double> > *intersecPoints = NULL; + VectorOfFixVecs<DimVec<double> > *intersecPoints = nullptr; double penaltyCoeff = getPenaltyCoeff(elInfo); /** diff --git a/AMDiS/src/compositeFEM/PenaltyOperator.h b/AMDiS/src/compositeFEM/PenaltyOperator.h index 3a9a9bc8b93ab6e22e2cc0db689daa41c7dab31c..9df5e3de5bae12cce94edb99a0a39eb8011f6e33 100644 --- a/AMDiS/src/compositeFEM/PenaltyOperator.h +++ b/AMDiS/src/compositeFEM/PenaltyOperator.h @@ -47,13 +47,13 @@ public: double factor_, bool penaltyCoeffFlag_, FiniteElemSpace *rowFeSpace_, - FiniteElemSpace *colFeSpace_ = NULL) + FiniteElemSpace *colFeSpace_ = nullptr) : Operator(rowFeSpace_, colFeSpace_), elLS(elLS_), elStatus(ElementLevelSet::LEVEL_SET_UNDEFINED), factor(factor_), penaltyCoeffFlag(penaltyCoeffFlag_), - surfaceOp(NULL), + surfaceOp(nullptr), dim(getRowFeSpace()->getMesh()->getDim()), degree(getRowFeSpace()->getBasisFcts()->getDegree()) { diff --git a/AMDiS/src/compositeFEM/SubElementAssembler.cc b/AMDiS/src/compositeFEM/SubElementAssembler.cc index 0744e0f17d3f2c57584590b3806306c91ad0d9b9..3a5bf7cddc48d05b9dc893f7d074fb3312352301 100644 --- a/AMDiS/src/compositeFEM/SubElementAssembler.cc +++ b/AMDiS/src/compositeFEM/SubElementAssembler.cc @@ -30,7 +30,7 @@ namespace AMDiS { SubElementAssembler::SubElementAssembler(Operator *op, const FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *colFeSpace_) - : StandardAssembler(op, NULL, NULL, NULL, NULL, rowFeSpace_, colFeSpace_) + : StandardAssembler(op, nullptr, nullptr, nullptr, nullptr, rowFeSpace_, colFeSpace_) { /** * Create a scalable quadrature for subassembler and replace the original @@ -43,7 +43,7 @@ namespace AMDiS { new ScalableQuadrature(zeroOrderAssembler->getQuadrature()); zeroOrderAssembler->setQuadrature(zeroOrderScalableQuadrature); } else { - zeroOrderScalableQuadrature = NULL; + zeroOrderScalableQuadrature = nullptr; } if (firstOrderAssemblerGrdPsi) { @@ -52,7 +52,7 @@ namespace AMDiS { new ScalableQuadrature(firstOrderAssemblerGrdPsi->getQuadrature()); firstOrderAssemblerGrdPsi->setQuadrature(firstOrderGrdPsiScalableQuadrature); } else { - firstOrderGrdPsiScalableQuadrature = NULL; + firstOrderGrdPsiScalableQuadrature = nullptr; } if (firstOrderAssemblerGrdPhi) { @@ -61,7 +61,7 @@ namespace AMDiS { new ScalableQuadrature(firstOrderAssemblerGrdPhi->getQuadrature()); firstOrderAssemblerGrdPhi->setQuadrature(firstOrderGrdPhiScalableQuadrature); } else { - firstOrderGrdPhiScalableQuadrature = NULL; + firstOrderGrdPhiScalableQuadrature = nullptr; } if (secondOrderAssembler) { @@ -70,7 +70,7 @@ namespace AMDiS { new ScalableQuadrature(secondOrderAssembler->getQuadrature()); secondOrderAssembler->setQuadrature(secondOrderScalableQuadrature); } else { - secondOrderScalableQuadrature = NULL; + secondOrderScalableQuadrature = nullptr; } } diff --git a/AMDiS/src/compositeFEM/SubElementAssembler.h b/AMDiS/src/compositeFEM/SubElementAssembler.h index 86d807c1c067239f2151e775b7b30e707ae618c3..a77e3cea2f2234e2e158e4edaffb282b6e1990c7 100644 --- a/AMDiS/src/compositeFEM/SubElementAssembler.h +++ b/AMDiS/src/compositeFEM/SubElementAssembler.h @@ -77,7 +77,7 @@ namespace AMDiS { public: SubElementAssembler(Operator *op, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = NULL); + const FiniteElemSpace *colFeSpace = nullptr); virtual ~SubElementAssembler() { diff --git a/AMDiS/src/est/Estimator.cc b/AMDiS/src/est/Estimator.cc index 3fe5d3946eb82f9fa840755506fc086953a8c2a5..0eb0897cf4b4dd733c9029d82250e62ddaf7d24a 100644 --- a/AMDiS/src/est/Estimator.cc +++ b/AMDiS/src/est/Estimator.cc @@ -30,8 +30,8 @@ namespace AMDiS { : name(name_), norm(NO_NORM), row(r), - mesh(NULL), - auxMesh(NULL), + mesh(nullptr), + auxMesh(nullptr), traverseInfo(0) { Parameters::get(name + "->error norm", norm); @@ -42,7 +42,7 @@ namespace AMDiS { { bool dualTraverse = false; - /* + for (unsigned int i = 0; i < matrix.size(); i++) { TEST_EXIT(traverseInfo.getStatus(row, i) != SingleComponentInfo::DIF_SPACES_WITH_DIF_AUX) ("Not yet implemented!\n"); @@ -51,11 +51,13 @@ namespace AMDiS { traverseInfo.getStatus(row, i) == SingleComponentInfo::DIF_SPACES_NO_AUX || traverseInfo.getStatus(row, i) == SingleComponentInfo::DIF_SPACES_WITH_AUX) dualTraverse = true; + + MSG("traverseInfo = %d, dualTraverse = %d\n", traverseInfo.getStatus(row, i), int(dualTraverse)); } if (!dualTraverse) { mesh = uh[row == -1 ? 0 : row]->getFeSpace()->getMesh(); - auxMesh = NULL; + auxMesh = nullptr; } else { const FiniteElemSpace *mainFeSpace = traverseInfo.getRowFeSpace(row); const FiniteElemSpace *auxFeSpace = traverseInfo.getNonRowFeSpace(row); @@ -70,10 +72,10 @@ namespace AMDiS { auxFeSpace->getBasisFcts()->getDegree()) ("Mh, do you really want to do this? Think about it ...\n"); } - */ + - mesh = uh[row == -1 ? 0 : row]->getFeSpace()->getMesh(); - auxMesh = NULL; +// mesh = uh[row == -1 ? 0 : row]->getFeSpace()->getMesh(); +// auxMesh = nullptr; init(ts); diff --git a/AMDiS/src/est/Estimator.h b/AMDiS/src/est/Estimator.h index a0ffa938b2d0a6b169d498d8d3c4ede6f3171576..f7d0697a543cf3f429fc7861f113698c99073319 100644 --- a/AMDiS/src/est/Estimator.h +++ b/AMDiS/src/est/Estimator.h @@ -78,7 +78,7 @@ namespace AMDiS { * and dualElInfo contains all elInfo informations about the main mesh element and * the col (or aux) mesh element. */ - virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL) =0; + virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = nullptr) =0; /// virtual void exit(bool output = true) =0; @@ -129,7 +129,7 @@ namespace AMDiS { virtual void addSystem(DOFMatrix *matrix_, DOFVector<double> *uh_, DOFVector<double> *fh_, - DOFVector<double> *uhOld_ = NULL) + DOFVector<double> *uhOld_ = nullptr) { matrix.push_back(matrix_); uh.push_back(uh_); @@ -148,7 +148,7 @@ namespace AMDiS { FUNCNAME("Estimator::addUhOldToSystem()"); TEST_EXIT(static_cast<int>(uhOld.size()) > system)("Invalid system!\n"); - TEST_EXIT(uhOld[system] == NULL)("There is already an uhOld!\n"); + TEST_EXIT(uhOld[system] == nullptr)("There is already an uhOld!\n"); uhOld[system] = uhOld_; } @@ -268,7 +268,7 @@ namespace AMDiS { { public: /// constructor - EstimatorCreator() : row(-1), uh(NULL) {} + EstimatorCreator() : row(-1), uh(nullptr) {} /// destructor virtual ~EstimatorCreator() {} diff --git a/AMDiS/src/est/RecoveryEstimator.cc b/AMDiS/src/est/RecoveryEstimator.cc index e790bbd63a469ae089017a67e9f40da6f2ec7df5..9fba5d9d25a663f684e931b11e42810ee6ecdd06 100644 --- a/AMDiS/src/est/RecoveryEstimator.cc +++ b/AMDiS/src/est/RecoveryEstimator.cc @@ -30,11 +30,11 @@ namespace AMDiS { relative(0), C(1.0), method(0), - feSpace(NULL), - f_vec(NULL), - f_scal(NULL), - aux_vec(NULL), - rec_struct(NULL) + feSpace(nullptr), + f_vec(nullptr), + f_scal(nullptr), + aux_vec(nullptr), + rec_struct(nullptr) { FUNCNAME("RecoveryEstimator::constructor()"); @@ -55,7 +55,7 @@ namespace AMDiS { } else { degree = uh_->getFeSpace()->getBasisFcts()->getDegree() + 1; feSpace = - FiniteElemSpace::provideFeSpace(NULL, + FiniteElemSpace::provideFeSpace(nullptr, Lagrange::getLagrange(uh_->getFeSpace()->getMesh()->getDim(), degree), uh_->getFeSpace()->getMesh(), @@ -160,13 +160,13 @@ namespace AMDiS { if (norm == H1_NORM) { // get gradient and recovery gradient at quadrature points - uh->getGrdAtQPs(elInfo, NULL, quadFast, grdAtQP); - rec_grd->getVecAtQPs(elInfo, NULL, rec_quadFast, recoveryGrdAtQP); + uh->getGrdAtQPs(elInfo, nullptr, quadFast, grdAtQP); + rec_grd->getVecAtQPs(elInfo, nullptr, rec_quadFast, recoveryGrdAtQP); if (f_scal) { if (aux_vec) - aux_vec->getVecAtQPs(elInfo, NULL, quadFast, uhAtQP); + aux_vec->getVecAtQPs(elInfo, nullptr, quadFast, uhAtQP); else - uh->getVecAtQPs(elInfo, NULL, quadFast, uhAtQP); + uh->getVecAtQPs(elInfo, nullptr, quadFast, uhAtQP); } // calc h1 error @@ -186,8 +186,8 @@ namespace AMDiS { } } else { // get vector and recovery vector at quadrature points - uh->getVecAtQPs(elInfo, NULL, quadFast, uhAtQP); - rec_uh->getVecAtQPs(elInfo, NULL, rec_quadFast, recoveryUhAtQP); + uh->getVecAtQPs(elInfo, nullptr, quadFast, uhAtQP); + rec_uh->getVecAtQPs(elInfo, nullptr, rec_quadFast, recoveryUhAtQP); // calc l2 error for (int i = 0; i < nPoints; i++) diff --git a/AMDiS/src/est/RecoveryEstimator.h b/AMDiS/src/est/RecoveryEstimator.h index b3582481e16d4e3e68edfa9c8790aa7c6e89ab69..e84801c3f055664b07acf911156964318f67fc93 100644 --- a/AMDiS/src/est/RecoveryEstimator.h +++ b/AMDiS/src/est/RecoveryEstimator.h @@ -59,7 +59,7 @@ namespace AMDiS { virtual void init(double ts); /// implements \ref Estimator::estimateElement(ElInfo*, DualElInfo*). - virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL); + virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = nullptr); /// implements \ref Estimator::exit(bool). virtual void exit(bool output = true); diff --git a/AMDiS/src/est/ResidualEstimator.cc b/AMDiS/src/est/ResidualEstimator.cc index 1c37433ba7d3a8ec0ba6597d6831de7e36e282d4..3c4f11335af93964d36dbfd6694cd95603b45503 100644 --- a/AMDiS/src/est/ResidualEstimator.cc +++ b/AMDiS/src/est/ResidualEstimator.cc @@ -154,7 +154,7 @@ namespace AMDiS { for (int system = 0; system < nSystems; system++) { secondOrderTerms[system] = false; - if (matrix[system] == NULL) + if (matrix[system] == nullptr) continue; for (std::vector<Operator*>::iterator it = matrix[system]->getOperators().begin(); @@ -223,7 +223,7 @@ namespace AMDiS { stdMpiDet.getSendData(it->first).push_back(detNeigh); for (int system = 0; system < nSystems; system++) { - if (matrix[system] == NULL || secondOrderTerms[system] == false) + if (matrix[system] == nullptr || secondOrderTerms[system] == false) continue; uh[system]->getLocalVector(el, uhNeigh[system]); @@ -334,7 +334,7 @@ namespace AMDiS { // === Init assemblers. === for (int system = 0; system < nSystems; system++) { - if (matrix[system] == NULL) + if (matrix[system] == nullptr) continue; DOFMatrix *dofMat = const_cast<DOFMatrix*>(matrix[system]); @@ -342,7 +342,7 @@ namespace AMDiS { for (it = dofMat->getOperatorsBegin(), itfac = dofMat->getOperatorEstFactorBegin(); it != dofMat->getOperatorsEnd(); ++it, ++itfac) - if (*itfac == NULL || **itfac != 0.0) { + if (*itfac == nullptr || **itfac != 0.0) { // If the estimator must only compute the jump residual but there are no // second order terms in the operator, it can be skipped. if (jumpResidualOnly && (*it)->secondOrderTerms() == false) @@ -353,7 +353,7 @@ namespace AMDiS { dualElInfo->largeElInfo, quad); else - (*it)->getAssembler()->initElement(elInfo, NULL, quad); + (*it)->getAssembler()->initElement(elInfo, nullptr, quad); } if (C0 > 0.0) @@ -363,7 +363,7 @@ namespace AMDiS { dualElInfo->largeElInfo, quad); else - (*it)->getAssembler()->initElement(elInfo, NULL, quad); + (*it)->getAssembler()->initElement(elInfo, nullptr, quad); } } @@ -398,7 +398,7 @@ namespace AMDiS { riq = 0.0; for (int system = 0; system < nSystems; system++) { - if (matrix[system] == NULL) + if (matrix[system] == nullptr) continue; if (timestep && uhOld[system]) { @@ -408,8 +408,8 @@ namespace AMDiS { // === Compute time error. === if (C0 > 0.0 || C3 > 0.0) { - uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP); - uhOld[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhOldQP); + uh[system]->getVecAtQPs(elInfo, nullptr, quadFast[system], uhQP); + uhOld[system]->getVecAtQPs(elInfo, nullptr, quadFast[system], uhOldQP); if (C3 > 0.0 && system == std::max(row, 0)) { double result = 0.0; @@ -431,18 +431,18 @@ namespace AMDiS { for (it = dofMat->getOperatorsBegin(), itfac = dofMat->getOperatorEstFactorBegin(); it != dofMat->getOperatorsEnd(); ++it, ++itfac) { - if (*itfac == NULL || **itfac != 0.0) { + if (*itfac == nullptr || **itfac != 0.0) { if ((*it)->zeroOrderTerms()) { uhQP.change_dim(nPoints); - uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP); + uh[system]->getVecAtQPs(elInfo, nullptr, quadFast[system], uhQP); } if ((*it)->firstOrderTermsGrdPsi() || (*it)->firstOrderTermsGrdPhi()) { grdUhQp.change_dim(nPoints); - uh[system]->getGrdAtQPs(elInfo, NULL, quadFast[system], grdUhQp); + uh[system]->getGrdAtQPs(elInfo, nullptr, quadFast[system], grdUhQp); } if (degree > 2 && (*it)->secondOrderTerms()) { D2UhQp.change_dim(nPoints); - uh[system]->getD2AtQPs(elInfo, NULL, quadFast[system], D2UhQp); + uh[system]->getD2AtQPs(elInfo, nullptr, quadFast[system], D2UhQp); } } } @@ -496,7 +496,7 @@ namespace AMDiS { bool parallelMode = false; #ifdef HAVE_PARALLEL_DOMAIN_AMDIS - if (neigh == NULL) { + if (neigh == nullptr) { BoundaryObject testObj(el, elInfo->getType(), EDGE, face); if (elBoundDet.count(testObj)) { @@ -581,7 +581,7 @@ namespace AMDiS { jump[iq].set(0.0); for (int system = 0; system < nSystems; system++) { - if (matrix[system] == NULL || secondOrderTerms[system] == false) + if (matrix[system] == nullptr || secondOrderTerms[system] == false) continue; uh[system]->getLocalVector(el, uhEl[system]); @@ -618,7 +618,7 @@ namespace AMDiS { for (it = mat->getOperatorsBegin(), fac = mat->getOperatorEstFactorBegin(); it != mat->getOperatorsEnd(); ++it, ++fac) { - if (*fac == NULL || **fac != 0.0) { + if (*fac == nullptr || **fac != 0.0) { for (int iq = 0; iq < nPointsSurface; iq++) localJump[iq].set(0.0); diff --git a/AMDiS/src/est/ResidualEstimator.h b/AMDiS/src/est/ResidualEstimator.h index 1cc3c0fdd7f8904809aafdb33da922056579f354..e75adb0fbc0107f4f43c53f70c15cf41fbe8cf13 100644 --- a/AMDiS/src/est/ResidualEstimator.h +++ b/AMDiS/src/est/ResidualEstimator.h @@ -94,7 +94,7 @@ namespace AMDiS { /// Estimates the error on an element. For more information about the /// parameter, see the description \ref Estimator::estimateElement. - void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL); + void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = nullptr); void exit(bool output = true); diff --git a/AMDiS/src/est/SimpleResidualEstimator.cc b/AMDiS/src/est/SimpleResidualEstimator.cc index fcceef79cc525038a311443b9651139f8ae84316..311cb00c0f77c7d167a9770d0364da88126a2df3 100644 --- a/AMDiS/src/est/SimpleResidualEstimator.cc +++ b/AMDiS/src/est/SimpleResidualEstimator.cc @@ -152,15 +152,15 @@ namespace AMDiS { // factors are != 0 for (it = dofMat->getOperatorsBegin(), itfac = dofMat->getOperatorEstFactorBegin(); it != dofMat->getOperatorsEnd(); ++it, ++itfac) - if (*itfac == NULL || **itfac != 0.0) - (*it)->getAssembler()->initElement(elInfo, NULL, quad); + if (*itfac == nullptr || **itfac != 0.0) + (*it)->getAssembler()->initElement(elInfo, nullptr, quad); // Vector assembler are only initialized if C0 is set. Note that the jump // residual (thus C1) does not contain the right hand side. if (C0 > 0.0) for (it = dofVec->getOperatorsBegin(); it != dofVec->getOperatorsEnd(); ++it) - (*it)->getAssembler()->initElement(elInfo, NULL, quad); + (*it)->getAssembler()->initElement(elInfo, nullptr, quad); // === Compute element residuals and time error estimation. === @@ -194,15 +194,15 @@ namespace AMDiS { std::vector<double*>::iterator itfac; for (it = dofMat->getOperatorsBegin(), itfac = dofMat->getOperatorEstFactorBegin(); it != dofMat->getOperatorsEnd(); ++it, ++itfac) { - if (*itfac == NULL || **itfac != 0.0) { + if (*itfac == nullptr || **itfac != 0.0) { if ((*it)->zeroOrderTerms()) { uhQP.change_dim(nPoints); - uh[0]->getVecAtQPs(elInfo, NULL, quadFast, uhQP); + uh[0]->getVecAtQPs(elInfo, nullptr, quadFast, uhQP); } if (degree > 2 && (*it)->secondOrderTerms()) { D2UhQp.change_dim(nPoints); - uh[0]->getD2AtQPs(elInfo, NULL, quadFast, D2UhQp); + uh[0]->getD2AtQPs(elInfo, nullptr, quadFast, D2UhQp); } } } @@ -297,7 +297,7 @@ namespace AMDiS { for (it = mat->getOperatorsBegin(), fac = mat->getOperatorEstFactorBegin(); it != mat->getOperatorsEnd(); ++it, ++fac) { - if (*fac == NULL || **fac != 0.0) { + if (*fac == nullptr || **fac != 0.0) { for (int iq = 0; iq < nPointsSurface; iq++) localJump[iq].set(0.0); diff --git a/AMDiS/src/est/SimpleResidualEstimator.h b/AMDiS/src/est/SimpleResidualEstimator.h index 41b08c59ff2dbc3726b2a7341114e7af6431e88a..68fea1c60dbffa8abb786436be8eba0c5d5bfaaf 100644 --- a/AMDiS/src/est/SimpleResidualEstimator.h +++ b/AMDiS/src/est/SimpleResidualEstimator.h @@ -75,7 +75,7 @@ namespace AMDiS { /// \param[in] elInfo Info object for the element to be estimated. /// \param[in] dualElInfo Not used here. In general, this may be used for /// estimating with the multi-mesh technique. - void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL); + void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = nullptr); /// Finalize the error estimator, i.e., delete all temporary data structures. void exit(bool output = true); diff --git a/AMDiS/src/io/ArhReader.cc b/AMDiS/src/io/ArhReader.cc index cbcb88c5dd34bdd4f556bca19bd6f450c1aa5e18..0eb3720aad67da14c5706a01310fc5c152264dfd 100644 --- a/AMDiS/src/io/ArhReader.cc +++ b/AMDiS/src/io/ArhReader.cc @@ -225,7 +225,7 @@ namespace AMDiS { macroInMesh.insert((*it)->getIndex()); - RefinementManager *refManager = NULL; + RefinementManager *refManager = nullptr; switch (mesh->getDim()) { case 2: refManager = new RefinementManager2d(); @@ -281,7 +281,7 @@ namespace AMDiS { for (unsigned int j = 0; j < nValueVectors; j++) { vector<double> values(nValuesPerVector); file.read(reinterpret_cast<char*>(&(values[0])), 8 * nValuesPerVector); - if (vecs[j] != NULL) { + if (vecs[j] != nullptr) { if (macroInMesh.count(elIndex)) setDofValues(elIndex, mesh, values, vecs[j]); } @@ -358,7 +358,7 @@ namespace AMDiS { if (nValueVectors > 2) vecs.push_back(vec2); for (uint32_t i = 3; i < nValueVectors; i++) - vecs.push_back(NULL); + vecs.push_back(nullptr); readFromMemoryBlock(data, mesh, vecs, writeParallel, nProcs); } @@ -392,7 +392,7 @@ namespace AMDiS { macroInMesh.insert((*it)->getIndex()); - RefinementManager *refManager = NULL; + RefinementManager *refManager = nullptr; switch (mesh->getDim()) { case 2: refManager = new RefinementManager2d(); @@ -452,7 +452,7 @@ namespace AMDiS { vector<double> values(nValuesPerVector); memcpy(reinterpret_cast<char*>(&values[0]), &data[mem_index], 8 * nValuesPerVector); mem_index += 8 * nValuesPerVector; - if (vecs[j] != NULL) { + if (vecs[j] != nullptr) { if (macroInMesh.count(elIndex) == 1) setDofValues(elIndex, mesh, values, vecs[j]); } diff --git a/AMDiS/src/io/ArhReader.h b/AMDiS/src/io/ArhReader.h index e076504d843369502ffaba2f18f73f018fb0706e..529b7faced7e067174859d691484c724e74a067b 100644 --- a/AMDiS/src/io/ArhReader.h +++ b/AMDiS/src/io/ArhReader.h @@ -26,6 +26,7 @@ #define AMDIS_ARH_READER_H #include "AMDiS_fwd.h" +#include "Global.h" namespace AMDiS { @@ -36,9 +37,9 @@ namespace AMDiS { public: static void read(string filename, Mesh *mesh, - DOFVector<double>* vec0 = NULL, - DOFVector<double>* vec1 = NULL, - DOFVector<double>* vec2 = NULL, + DOFVector<double>* vec0 = nullptr, + DOFVector<double>* vec1 = nullptr, + DOFVector<double>* vec2 = nullptr, #ifdef HAVE_PARALLEL_DOMAIN_AMDIS bool writeParallel = true, #else @@ -58,9 +59,9 @@ namespace AMDiS { static void readMeta(string filename, Mesh *mesh, - DOFVector<double>* vec0 = NULL, - DOFVector<double>* vec1 = NULL, - DOFVector<double>* vec2 = NULL); + DOFVector<double>* vec0 = nullptr, + DOFVector<double>* vec1 = nullptr, + DOFVector<double>* vec2 = nullptr); static void readMeta(string filename, Mesh *mesh, @@ -83,9 +84,9 @@ namespace AMDiS { static int readMetaData(string filename); static void readFromMemoryBlock(vector<char> &data, Mesh *mesh, - DOFVector<double>* vec0 = NULL, - DOFVector<double>* vec1 = NULL, - DOFVector<double>* vec2 = NULL, + DOFVector<double>* vec0 = nullptr, + DOFVector<double>* vec1 = nullptr, + DOFVector<double>* vec2 = nullptr, #ifdef HAVE_PARALLEL_DOMAIN_AMDIS bool writeParallel = true, #else diff --git a/AMDiS/src/io/ArhWriter.cc b/AMDiS/src/io/ArhWriter.cc index 8628ee302c1039f41e7d2299ef66e60f7554703d..5328b8c237b9dd37da982d1e4ba3df798b391ba6 100644 --- a/AMDiS/src/io/ArhWriter.cc +++ b/AMDiS/src/io/ArhWriter.cc @@ -39,11 +39,11 @@ namespace AMDiS { DOFVector<double>* vec2) { vector<DOFVector<double>*> vecs(0); - if (vec0 != NULL) + if (vec0 != nullptr) vecs.push_back(vec0); - if (vec1 != NULL) + if (vec1 != nullptr) vecs.push_back(vec1); - if (vec2 != NULL) + if (vec2 != nullptr) vecs.push_back(vec2); ArhWriter::write(filename, mesh, vecs); diff --git a/AMDiS/src/io/ArhWriter.h b/AMDiS/src/io/ArhWriter.h index 2ef6fc0ada6e80cd03a59f34696db98ffd4626d3..45dd4244f4db71d9d6714f13feeb9129fadff453 100644 --- a/AMDiS/src/io/ArhWriter.h +++ b/AMDiS/src/io/ArhWriter.h @@ -38,9 +38,9 @@ namespace AMDiS { { public: static void write(std::string filename, Mesh *mesh, - DOFVector<double>* vec0 = NULL, - DOFVector<double>* vec1 = NULL, - DOFVector<double>* vec2 = NULL); + DOFVector<double>* vec0 = nullptr, + DOFVector<double>* vec1 = nullptr, + DOFVector<double>* vec2 = nullptr); static void write(std::string filename, Mesh *mesh, std::vector<DOFVector<double>*> vecs, diff --git a/AMDiS/src/io/DataCollector.h b/AMDiS/src/io/DataCollector.h index 608445e2981d8206a83e1283cddb688c4f046301..5b40b35ba70938c597dfe785f7477c918f791f10 100644 --- a/AMDiS/src/io/DataCollector.h +++ b/AMDiS/src/io/DataCollector.h @@ -47,10 +47,10 @@ namespace AMDiS { public: /// Constructor DataCollector(const FiniteElemSpace *feSpace, - DOFVector<T> *values = NULL, + DOFVector<T> *values = nullptr, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL); + bool (*writeElem)(ElInfo*) = nullptr); ~DataCollector(); diff --git a/AMDiS/src/io/DataCollector.hh b/AMDiS/src/io/DataCollector.hh index e4ebc03422065bb62b1d62e29f23ba664e0edaaf..c48c087d0af50db3a39ddefcaadcc02fcb9621b3 100644 --- a/AMDiS/src/io/DataCollector.hh +++ b/AMDiS/src/io/DataCollector.hh @@ -402,13 +402,13 @@ namespace AMDiS { int index1 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim), it->elementSide, i); - int dof1 = elInfo->getElement()->getDof(index1, nPreDofs); + DegreeOfFreedom dof1 = elInfo->getElement()->getDof(index1, nPreDofs); for (int j = 0; j < dim; j++) { int index2 = elInfo->getElement()->getVertexOfPosition(INDEX_OF_DIM(dim - 1, dim), elInfo->getOppVertex(it->elementSide), j); - int dof2 = elInfo->getNeighbour(it->elementSide)->getDof(index2, nPreDofs); + DegreeOfFreedom dof2 = elInfo->getNeighbour(it->elementSide)->getDof(index2, nPreDofs); if ((dof1 == dof2) || (mesh->associated(dof1, dof2))) { periodicInfo.vertexMap[index1] = index2; diff --git a/AMDiS/src/io/ElementFileWriter.cc b/AMDiS/src/io/ElementFileWriter.cc index bcb77ad15a3f3b7a5642ea841574d3be05928a03..e56fc6be12894be1cb8e11f07cb7745fcc6ef8eb 100644 --- a/AMDiS/src/io/ElementFileWriter.cc +++ b/AMDiS/src/io/ElementFileWriter.cc @@ -55,7 +55,7 @@ namespace AMDiS { timestepNumber(-1), mesh(mesh_), vec(&mapvec), - vecs(NULL) + vecs(nullptr) { if (name != "") { Parameters::get(name + "->output->filename", filename); @@ -89,7 +89,7 @@ namespace AMDiS { tsModulo(1), timestepNumber(-1), mesh(mesh_), - vec(NULL), + vec(nullptr), vecs(&mapvec) { if (name != "") { @@ -294,7 +294,7 @@ namespace AMDiS { { FUNCNAME("ElementFileWriter::writeVtkValues()"); - TEST_EXIT((vec!=NULL || vecs!=NULL) && (vec==NULL || vecs==NULL)) + TEST_EXIT((vec!=nullptr || vecs!=nullptr) && (vec==nullptr || vecs==nullptr)) ("Ether vec or vecs must be given, not both and not nothing!"); #if HAVE_PARALLEL_DOMAIN_AMDIS @@ -402,9 +402,9 @@ namespace AMDiS { file << " </DataArray>\n"; file << " </Cells>\n"; - int dataLength = (vecs != NULL ? (*(vecs->begin())).second.size() : 1); - int nComponents = (!writeAsVector || (vecs == NULL && vec != NULL) ? 1 : dataLength); - int nDataArrays = (!writeAsVector && (vec == NULL && vecs != NULL) ? dataLength : 1); + int dataLength = (vecs != nullptr ? (*(vecs->begin())).second.size() : 1); + int nComponents = (!writeAsVector || (vecs == nullptr && vec != nullptr) ? 1 : dataLength); + int nDataArrays = (!writeAsVector && (vec == nullptr && vecs != nullptr) ? dataLength : 1); file << " <CellData>\n"; for (int i = 0; i < nDataArrays; i++) { file << " <DataArray type=\"Float32\" Name=\"value"<<i<<"\" format=\"ascii\" NumberOfComponents=\""<<(writeAsVector ? std::max(3,nComponents) : nComponents)<<"\">\n"; @@ -418,7 +418,7 @@ namespace AMDiS { int idx = elInfo->getElement()->getIndex(); for (int j = 0; j < nComponents; j++) { - double val = (vec != NULL ? (*vec)[idx] : (static_cast<int>((*vecs)[idx].size())==dataLength ? (*vecs)[idx][i*nComponents+j] : 0.0)); + double val = (vec != nullptr ? (*vec)[idx] : (static_cast<int>((*vecs)[idx].size())==dataLength ? (*vecs)[idx][i*nComponents+j] : 0.0)); // Write value for each vertex of each element. if (fabs(val) < 1.e-40) @@ -429,7 +429,7 @@ namespace AMDiS { if (j < nComponents-1) file << " "; } - if (writeAs3dVector && writeAsVector && vecs != NULL) { + if (writeAs3dVector && writeAsVector && vecs != nullptr) { for (int j = nComponents; j < 3; j++) file << " 0.0"; } diff --git a/AMDiS/src/io/ElementFileWriter.h b/AMDiS/src/io/ElementFileWriter.h index 37f5dbc4699079898588536e3d069d6387c8cdc4..a3c2432f0bd8ada0027646c82465e3d9662e85de 100644 --- a/AMDiS/src/io/ElementFileWriter.h +++ b/AMDiS/src/io/ElementFileWriter.h @@ -59,7 +59,7 @@ namespace AMDiS { void writeFiles(AdaptInfo *adaptInfo, bool force, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL); + bool (*writeElem)(ElInfo*) = nullptr); /// Simple writing procedure for one element map. static void writeFile(map<int, double> &vec, diff --git a/AMDiS/src/io/FileWriter.h b/AMDiS/src/io/FileWriter.h index 4e93f8e82ce47dab72a598a84a7eac2a6cfaf53e..78bf37771311da2d04486d6ce995c1055c55a635 100644 --- a/AMDiS/src/io/FileWriter.h +++ b/AMDiS/src/io/FileWriter.h @@ -47,7 +47,7 @@ namespace AMDiS { : filename(""), traverseLevel(-1), traverseFlag(Mesh::CALL_LEAF_EL), - writeElement(NULL) + writeElement(nullptr) {} virtual ~FileWriterInterface() {} @@ -60,7 +60,7 @@ namespace AMDiS { virtual void writeFiles(AdaptInfo *adaptInfo, bool force, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL) = 0; + bool (*writeElem)(ElInfo*) = nullptr) = 0; void setTraverseProperties(int level, Flag flag, @@ -120,10 +120,10 @@ namespace AMDiS { virtual ~FileWriterTemplated(); /// Implementation of FileWriterInterface::writeFiles(). - virtual void writeFiles(AdaptInfo *adaptInfo, bool force, - int level = -1, - Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL); + void writeFiles(AdaptInfo *adaptInfo, bool force, + int level = -1, + Flag traverseFlag = Mesh::CALL_LEAF_EL, + bool (*writeElem)(ElInfo*) = nullptr) override; vector<pair<double, string> >& getParaviewAnimationFrames() { diff --git a/AMDiS/src/io/GNUPlotWriter.cc b/AMDiS/src/io/GNUPlotWriter.cc index 9442571996ea5f573edbeda0920cde2f19af94e3..993a6ea66eeadd8f4e02212cc7167b15484f3bc0 100644 --- a/AMDiS/src/io/GNUPlotWriter.cc +++ b/AMDiS/src/io/GNUPlotWriter.cc @@ -65,7 +65,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - FILE *file = NULL; + FILE *file = nullptr; if (!(file = fopen(filename_.c_str(), "w"))) ERROR("could not open file %s for writing\n", filename_.c_str()); diff --git a/AMDiS/src/io/GNUPlotWriter.h b/AMDiS/src/io/GNUPlotWriter.h index 14f44dafdb72994f4fffea6462dc4090f2911d97..7867f9278bb980c15e7dc01aa322056300630f99 100644 --- a/AMDiS/src/io/GNUPlotWriter.h +++ b/AMDiS/src/io/GNUPlotWriter.h @@ -48,7 +48,7 @@ namespace AMDiS { virtual void writeFiles(AdaptInfo *adaptInfo, bool force, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL); + bool (*writeElem)(ElInfo*) = nullptr); protected: /// Contains the mesh diff --git a/AMDiS/src/io/GridWriter.hh b/AMDiS/src/io/GridWriter.hh index 5c135f41c5de579222b3652153e5b357b6dd150f..f8016c439b510fc325d02afbd2c121a7cb4955de 100644 --- a/AMDiS/src/io/GridWriter.hh +++ b/AMDiS/src/io/GridWriter.hh @@ -107,7 +107,7 @@ namespace AMDiS { int inside = (const_cast<Mesh*>(mesh))->findElementAtPoint(curCoord, &elp, bary, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); // write coords for (int l = 0; l < dim; l++) @@ -221,7 +221,7 @@ namespace AMDiS { int inside = (const_cast<Mesh*>(mesh))->findElementAtPoint(curCoord, &elp, bary, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); // write coords for (int l = 0; l < dim; l++) diff --git a/AMDiS/src/io/MacroInfo.cc b/AMDiS/src/io/MacroInfo.cc index b277ea858a5ca62cadcc2c6ec961b3405fa41ce5..4ad3ef225ea0f1a3042620ae44a2aa10202b0cea 100644 --- a/AMDiS/src/io/MacroInfo.cc +++ b/AMDiS/src/io/MacroInfo.cc @@ -73,11 +73,11 @@ namespace AMDiS { delete [] mel_vertex; delete [] coords; - coords = NULL; + coords = nullptr; delete [] dof; - dof = NULL; + dof = nullptr; - mesh = NULL; + mesh = nullptr; neigh_set = false; } @@ -156,7 +156,7 @@ namespace AMDiS { int line_no, n_keys, sort_key[N_KEYS], nv_key, ne_key; int key_def[N_KEYS] = {0,0,0,0,0,0,0,0,0,0,0,0}; const char *key; - DimVec<int> *ind = NULL; + DimVec<int> *ind = nullptr; TEST_EXIT(filename != "")("No filename specified!\n"); diff --git a/AMDiS/src/io/MacroReader.cc b/AMDiS/src/io/MacroReader.cc index a7a24a754f6021538dd9c733b43418643c4231fc..7e1c22e961b5863e6115ee65440db00a0bec2a28 100644 --- a/AMDiS/src/io/MacroReader.cc +++ b/AMDiS/src/io/MacroReader.cc @@ -46,7 +46,7 @@ namespace AMDiS { { FUNCNAME("MacroReader::readMacro()"); - TEST_EXIT(filename != "")("no file specified; filename NULL pointer\n"); + TEST_EXIT(filename != "")("no file specified; filename nullptr\n"); MacroInfo *macroInfo = new MacroInfo(); macroInfo->readAMDiSMacro(filename, mesh); @@ -350,14 +350,14 @@ namespace AMDiS { for (int i = 0; i < mesh->getNumberOfLeaves(); i++) { for (int k = 0; k < mesh->getGeo(NEIGH); k++) { mesh->getMacroElement(i)->setOppVertex(k, AMDIS_UNDEFINED); - mesh->getMacroElement(i)->setNeighbour(k, NULL); + mesh->getMacroElement(i)->setNeighbour(k, nullptr); } } for (int i = 0; i < mesh->getNumberOfLeaves(); i++) { for (int k = 0; k < mesh->getGeo(NEIGH); k++) { if (mesh->getMacroElement(i)->getBoundary(k) != INTERIOR) { - mesh->getMacroElement(i)->setNeighbour(k, NULL); + mesh->getMacroElement(i)->setNeighbour(k, nullptr); mesh->getMacroElement(i)->setOppVertex(k, -1); continue; } @@ -533,7 +533,7 @@ namespace AMDiS { if (periodic[k]) neighEl->setDof(lnode+ov, mesh->getDof(FACE)); else - neighEl->setDof(lnode+ov, const_cast<int*>((*(mel + i))->getElement()-> + neighEl->setDof(lnode+ov, const_cast<DegreeOfFreedom*>((*(mel + i))->getElement()-> getDof(lnode + k))); } } @@ -556,7 +556,7 @@ namespace AMDiS { wenn Zyklus auftritt: ordnet Eintraege in MacroElement-Struktur um, so dass kein Zyklus auftritt erzeugt neue Macro-Datei nameneu mit umgeordnetem Netz - (wenn nameneu=NULL wird keine MAcro-Datei erzeugt) + (wenn nameneu=nullptr wird keine MAcro-Datei erzeugt) */ void MacroReader::macroTest(Mesh *mesh) @@ -568,7 +568,7 @@ namespace AMDiS { if (i >= 0) { WARNING("There is a cycle beginning in macro element %d\n", i); WARNING("Entries in MacroElement structures get reordered\n"); - umb(NULL, mesh, umbVkantMacro); + umb(nullptr, mesh, umbVkantMacro); } } @@ -614,7 +614,7 @@ namespace AMDiS { if (test[(*macro)->getIndex()] == 1) { flg = 1; - } else if ((*macro)->getNeighbour(dim) == NULL) { + } else if ((*macro)->getNeighbour(dim) == nullptr) { flg = 1; test[(*macro)->getIndex()] = 1; } else if ((*macro) == (*macro)->getNeighbour(dim)->getNeighbour(dim)) { @@ -669,7 +669,7 @@ namespace AMDiS { for (int i = 0; i < static_cast<int>(mesh->getNumberOfMacros()); i++) test[i] = 0; - recumb(mesh, (*mesh->firstMacroElement()), NULL, test, 0, 0, ele, umbvk); + recumb(mesh, (*mesh->firstMacroElement()), nullptr, test, 0, 0, ele, umbvk); delete [] test; } @@ -680,10 +680,10 @@ namespace AMDiS { FUNCNAME("MacroElement::newEdge()"); MacroElement *nei; const DegreeOfFreedom *dof[2]; - DegreeOfFreedom *edge_dof = NULL; + DegreeOfFreedom *edge_dof = nullptr; int j, k, opp_v, node = 0; BoundaryType lbound = INTERIOR; - Projection *lproject = NULL; + Projection *lproject = nullptr; const int max_no_list_el = 100; BoundaryType *list_bound[100]; Projection **list_project[100]; @@ -739,7 +739,7 @@ namespace AMDiS { // check for periodic boundary if (j == 4 || k == 4) { - nei = NULL; + nei = nullptr; break; } @@ -906,7 +906,7 @@ namespace AMDiS { if (ind[k] >= 0) mel->neighbour[k] = macro_elements[ind[k]]; else - mel->neighbour[k] = NULL; + mel->neighbour[k] = nullptr; } } @@ -919,7 +919,7 @@ namespace AMDiS { // wenn NEIGH_IN_EL macro->el->neigh, macro->el->oppVertex) // (wird fuer ALBERT-Routine write_macro benoetigt) - // ele wird nicht benoetigt (es kann NULL uebergeben werden) + // ele wird nicht benoetigt (es kann nullptr uebergeben werden) void MacroReader::umbVkantMacro(Mesh *mesh, MacroElement* me, int ka, int *) { MacroElement* macr=new MacroElement(mesh->getDim()); @@ -941,7 +941,7 @@ namespace AMDiS { } for (i = 0; i < 7; i++) - d[i] = const_cast<int*>(me->getElement()->getDof(i)); + d[i] = const_cast<DegreeOfFreedom*>(me->getElement()->getDof(i)); if (ka == 1) { me->coord[0] = macr->coord[2]; @@ -1224,7 +1224,7 @@ namespace AMDiS { DOFIteratorBase it(localAdmin, USED_DOFS); for (it.reset(); !it.end(); ++it) { nused++; - if (!mesh->dof_used[it.getDOFIndex()]) { + if (mesh->dof_used[it.getDOFIndex()] == 0) { error_detected++; MSG("dof[%d] not used??\n",it.getDOFIndex()); } @@ -1233,7 +1233,7 @@ namespace AMDiS { DOFIteratorBase freeIt(localAdmin, FREE_DOFS); for (freeIt.reset(); !freeIt.end(); ++freeIt) { nfree++; - if (mesh->dof_used[freeIt.getDOFIndex()]) { + if (mesh->dof_used[freeIt.getDOFIndex()] != 0) { error_detected++; MSG("dof[%d] used??\n",freeIt.getDOFIndex()); } @@ -1286,7 +1286,7 @@ namespace AMDiS { if (!error_detected) MSG("error detected!!!\n"); error_detected++; - MSG("interior (*boundary)[%d] non NULL on element = %d\n", + MSG("interior (*boundary)[%d] non nullptr on element = %d\n", i, el->getIndex()); } @@ -1329,7 +1329,7 @@ namespace AMDiS { if (!error_detected) MSG("error detected!!!\n"); error_detected++; - MSG("(*boundary)[%d] on domains boundary is NULL on element = %d\n", + MSG("(*boundary)[%d] on domains boundary is nullptr on element = %d\n", i, el->getIndex()); } } @@ -1358,11 +1358,11 @@ namespace AMDiS { j0, ndof, mesh->getNumberOfDofs(VERTEX)); int i0 = mesh->getNode(VERTEX); for (int i = 0; i < mesh->getGeo(VERTEX); i++) { - if ((dof = el->getDof(i0 + i)) == NULL) { + if ((dof = el->getDof(i0 + i)) == nullptr) { ERROR("no vertex dof %d on element %d\n", i, el->getIndex()); } else { for (int j = 0; j < ndof; j++) { - int jdof = dof[j0 + j]; + DegreeOfFreedom jdof = dof[j0 + j]; TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size())) ("vertex dof = %d invalid? size = %d\n", jdof, mesh->dof_used.size()); mesh->dof_used[jdof]++; @@ -1390,18 +1390,18 @@ namespace AMDiS { for (int i = 0; i < mesh->getGeo(EDGE); i++) { dof = el->getDof(i0 + i); - if (dof == NULL) { + if (dof == nullptr) { ERROR("no edge dof %d on element %d\n", i, el->getIndex()); } else { for (int j = 0; j < ndof; j++) { - int jdof = dof[j0 + j]; + DegreeOfFreedom jdof = dof[j0 + j]; TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size())) ("edge dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size()); mesh->dof_used[jdof]++; } } - if (el->getFirstChild() == NULL) { + if (el->getFirstChild() == nullptr) { if (mesh->getDim() == 2) { neig = elinfo->getNeighbour(i); @@ -1447,13 +1447,13 @@ namespace AMDiS { for (int i = 0; i < mesh->getGeo(FACE); i++) { TEST(dof = el->getDof(i0 + i))("no face dof %d ???\n", i); for (int j = 0; j < ndof; j++) { - int jdof = dof[j0 + j]; + DegreeOfFreedom jdof = dof[j0 + j]; TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size())) ("face dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size()); mesh->dof_used[jdof]++; } - if (el->getChild(0) == NULL) { + if (el->getChild(0) == nullptr) { if ((neig = elinfo->getNeighbour(i))) { int ov = elinfo->getOppVertex(i); @@ -1476,7 +1476,7 @@ namespace AMDiS { ("admin.getNumberOfPreDofs(CENTER) %d + nDOF %d > mesh->nDOF %d\n", j0, ndof, mesh->getNumberOfDofs(CENTER)); for (int j = 0; j < ndof; j++) { - int jdof = dof[j0 + j]; + DegreeOfFreedom jdof = dof[j0 + j]; TEST(jdof >= 0 && jdof < static_cast<int>(mesh->dof_used.size())) ("center dof=%d invalid? size=%d\n",jdof, mesh->dof_used.size()); mesh->dof_used[jdof]++; diff --git a/AMDiS/src/io/MacroWriter.cc b/AMDiS/src/io/MacroWriter.cc index 65b1cfa1cb80c6fa64da2ad5f3f6323bb8a1a3e4..3ff64677657ff46c437ee93b57d6295f0a83aa54 100644 --- a/AMDiS/src/io/MacroWriter.cc +++ b/AMDiS/src/io/MacroWriter.cc @@ -36,12 +36,12 @@ namespace AMDiS { - DOFVector< std::list<VertexInfo> >* MacroWriter::vertexInfos = NULL; + DOFVector< std::list<VertexInfo> >* MacroWriter::vertexInfos = nullptr; std::list<ElementInfo> MacroWriter::elements; - Mesh *MacroWriter::mesh = NULL; - FILE *MacroWriter::macroFile = NULL; - FILE *MacroWriter::periodicFile = NULL; + Mesh *MacroWriter::mesh = nullptr; + FILE *MacroWriter::macroFile = nullptr; + FILE *MacroWriter::periodicFile = nullptr; int MacroWriter::n0 = 0; int MacroWriter::nv = 0; int MacroWriter::ne = 0; @@ -52,7 +52,7 @@ namespace AMDiS { std::vector<DimVec<bool> > MacroWriter::periodicConnections; - bool (*MacroWriter::writeElement)(ElInfo*) = NULL; + bool (*MacroWriter::writeElement)(ElInfo*) = nullptr; int MacroWriter::writeMacro(DataCollector<> *dc, const char *name, diff --git a/AMDiS/src/io/MacroWriter.h b/AMDiS/src/io/MacroWriter.h index 5ee9e4e9f59e7361fee2aa7858f13c25eb6ede66..b3c5a9d59be27defe2ff1b016716656314fac524 100644 --- a/AMDiS/src/io/MacroWriter.h +++ b/AMDiS/src/io/MacroWriter.h @@ -62,7 +62,7 @@ namespace AMDiS { double time = 0.0, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL); + bool (*writeElem)(ElInfo*) = nullptr); /// Init \ref periodicFile for the next macro to be written. static void writePeriodicFile(DataCollector<> *dc, std::string filename); diff --git a/AMDiS/src/io/PngReader.cc b/AMDiS/src/io/PngReader.cc index 4684ec58251256cc3e614c21e94286f762f6243f..36eb33290d68ba517fb4ab1c733ff0a49a46789c 100644 --- a/AMDiS/src/io/PngReader.cc +++ b/AMDiS/src/io/PngReader.cc @@ -44,17 +44,17 @@ namespace AMDiS { int bytesPerPixel = 0; // Open files and create the png data structures. - if ((fp = fopen(filename.c_str(), "rb")) == NULL) { + if ((fp = fopen(filename.c_str(), "rb")) == nullptr) { TEST_EXIT(0)("ERROR: file can not >be opened\n"); } - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL) { + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); + if (png_ptr == nullptr) { TEST_EXIT(0)("ERROR in png_create_read_struct\n"); } info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { + if (info_ptr == nullptr) { TEST_EXIT(0)("ERROR in png_create_info_struct\n"); } @@ -66,7 +66,7 @@ namespace AMDiS { png_set_sig_bytes(png_ptr, sig_read); // Read the whole png at once to the pointer info_ptr. - png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); + png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, nullptr); bytesPerPixel = info_ptr->rowbytes / info_ptr->width; @@ -114,7 +114,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); fclose(fp); }; diff --git a/AMDiS/src/io/PngWriter.cc b/AMDiS/src/io/PngWriter.cc index a258b66db7b0dc1cb968a2d0e9d7ca6491a00390..5838c2c9a96542dd5e79743676f6673c98566ab7 100644 --- a/AMDiS/src/io/PngWriter.cc +++ b/AMDiS/src/io/PngWriter.cc @@ -63,7 +63,7 @@ namespace AMDiS { int imageY = static_cast<int>(maxY / pointdist) + 1; png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); if (!png_ptr) return 0; @@ -119,7 +119,7 @@ namespace AMDiS { png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, (png_infopp)NULL); + png_destroy_write_struct(&png_ptr, (png_infopp)nullptr); return 0; } @@ -137,7 +137,7 @@ namespace AMDiS { png_set_rows(png_ptr, info_ptr, rowPointers); - png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, png_voidp_NULL); + png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, png_voidp_nullptr); png_destroy_write_struct(&png_ptr, &info_ptr); diff --git a/AMDiS/src/io/PovrayWriter.cc b/AMDiS/src/io/PovrayWriter.cc index 0da9b633b0e273b1f06fa023f98a0438a38e0e38..0263c518ac528ce87734b9854ab23640125909c1 100644 --- a/AMDiS/src/io/PovrayWriter.cc +++ b/AMDiS/src/io/PovrayWriter.cc @@ -38,9 +38,9 @@ namespace AMDiS { PovrayWriter::~PovrayWriter() { // free the memory for the bounding box - if (bBox==NULL) { + if (bBox==nullptr) { delete bBox; - bBox = NULL; + bBox = nullptr; } } @@ -75,7 +75,7 @@ namespace AMDiS { } /* map DOFs to values */ - std::map <int, double> value_map; + std::map <DegreeOfFreedom, double> value_map; while (elInfo) { basFcts->getLocalIndices(elInfo->getElement(), feSpace->getAdmin(), dofs); @@ -91,12 +91,12 @@ namespace AMDiS { out << "\ttexture_list {" << endl; out << "\t" << value_map.size() << "," << endl; - std::map<int, double>::iterator map_iter; + std::map<DegreeOfFreedom, double>::iterator map_iter; for (map_iter = value_map.begin(); map_iter != value_map.end(); ++map_iter) { double value = map_iter->second; double color_weight = computeWeight(min_value,max_value,value); out << "\t\ttexture{ pigment{ " << getColorString(color_weight) << "}}"; - std::map<int, double>::iterator final_iter = value_map.end(); + std::map<DegreeOfFreedom, double>::iterator final_iter = value_map.end(); --final_iter; if (map_iter != final_iter) out << ","; @@ -111,7 +111,7 @@ namespace AMDiS { // problems in simulations with changing geometries BoundingBox* PovrayWriter::getBoundingBox(ofstream &out) { - if (bBox != NULL) + if (bBox != nullptr) return bBox; DOFVector< std::list<VertexInfo> > *vertexInfos = dataCollector->getVertexInfos(); diff --git a/AMDiS/src/io/PovrayWriter.h b/AMDiS/src/io/PovrayWriter.h index f99e4dd7f8544170cacda81ee952f57b55748721..c91415e302c9061bdde3cbbe7633644fbbba0aee 100644 --- a/AMDiS/src/io/PovrayWriter.h +++ b/AMDiS/src/io/PovrayWriter.h @@ -58,7 +58,7 @@ namespace AMDiS { /* TEST_EXIT(dataCollector->getMesh()->getDim()==3) ("Povray export only possible for 3D data!");*/ - bBox = NULL; + bBox = nullptr; } ~PovrayWriter(); diff --git a/AMDiS/src/io/ValueReader.cc b/AMDiS/src/io/ValueReader.cc index 68a99b40a1d2f2efc80f383746525bdb053658ab..db9cf31268ebc51b9a8dd6e4850c9798ffbf30c2 100644 --- a/AMDiS/src/io/ValueReader.cc +++ b/AMDiS/src/io/ValueReader.cc @@ -77,7 +77,7 @@ namespace AMDiS { for (int i = 0; i < mesh->getNumberOfMacros(); i++) { for (int j = 0; j < mesh->getGeo(VERTEX); j++) { int fileIndex = macroFileInfo->mel_vertex[i][j]; - int dofIndex = *(macroFileInfo->dof[fileIndex]); + DegreeOfFreedom dofIndex = *(macroFileInfo->dof[fileIndex]); (*dofVector)[dofIndex] = values[fileIndex]; } } diff --git a/AMDiS/src/io/ValueWriter.cc b/AMDiS/src/io/ValueWriter.cc index 47510c68e32cefc30f596ad2d78d8d8714040bc1..6be93730bcbaec1a647c7b1a7655b26426730997 100644 --- a/AMDiS/src/io/ValueWriter.cc +++ b/AMDiS/src/io/ValueWriter.cc @@ -31,11 +31,11 @@ namespace AMDiS { - const DOFAdmin* ValueWriter::admin = NULL; - FILE* ValueWriter::valueFile = NULL; - DOFVector<double>* ValueWriter::valueVec = NULL; - DOFVector<int>* ValueWriter::interpPointInd = NULL; - DOFVector< std::list<WorldVector<double> > >* ValueWriter::dofCoords = NULL; + const DOFAdmin* ValueWriter::admin = nullptr; + FILE* ValueWriter::valueFile = nullptr; + DOFVector<double>* ValueWriter::valueVec = nullptr; + DOFVector<int>* ValueWriter::interpPointInd = nullptr; + DOFVector< std::list<WorldVector<double> > >* ValueWriter::dofCoords = nullptr; int ValueWriter::ni = 0; void ValueWriter::writeValues(DataCollector<> *dc, diff --git a/AMDiS/src/io/ValueWriter.h b/AMDiS/src/io/ValueWriter.h index 5097dc634247410e4cf3a92ad4fe86dd53298886..e8e0069b926df867041c999c94df6b7d453dba4b 100644 --- a/AMDiS/src/io/ValueWriter.h +++ b/AMDiS/src/io/ValueWriter.h @@ -54,7 +54,7 @@ namespace AMDiS { double time = 0.0, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = NULL); + bool (*writeElem)(ElInfo*) = nullptr); protected: /// File to which the values should be written diff --git a/AMDiS/src/nonlin/Newton.h b/AMDiS/src/nonlin/Newton.h index 251247e7c0aff2cc01e0f5b8eba910e4540f933f..f8f377dbe655247a766633e1560f1cc1e13ddaa4 100644 --- a/AMDiS/src/nonlin/Newton.h +++ b/AMDiS/src/nonlin/Newton.h @@ -58,7 +58,7 @@ namespace AMDiS { /// Calls constructor of base class NonLinSolver Newton(const std::string& name, LinearSolver *linSolver) : NonLinSolver(name, linSolver), - b(NULL), + b(nullptr), buildCycle(1) { @@ -77,7 +77,7 @@ namespace AMDiS { { FUNCNAME("Newton::nlsolve()"); - if (b == NULL) + if (b == nullptr) b = new SystemVector(x); double err = 0.0, errOld = -1.0; @@ -134,9 +134,9 @@ namespace AMDiS { /// Realisation of NonLinSolver::exit void exit() { - if (b != NULL) { + if (b != nullptr) { delete b; - b = NULL; + b = nullptr; } } diff --git a/AMDiS/src/nonlin/NewtonArmijo.h b/AMDiS/src/nonlin/NewtonArmijo.h index 0ce5f1be26256fd03e2a5bc05c01798d8d83dc8a..49d286a59b8377925cb1da789aaa7dd871242c81 100644 --- a/AMDiS/src/nonlin/NewtonArmijo.h +++ b/AMDiS/src/nonlin/NewtonArmijo.h @@ -59,7 +59,7 @@ namespace AMDiS { /// Calls constructor of base class NonLinSolver NewtonArmijo(const std::string& name, LinearSolver *linSolver) : NonLinSolver(name, linSolver), - b(NULL), + b(nullptr), buildCycle(1), delta(1.e-2), // Abstiegsregulator, z.B. 1.e-2, 1.e-4 alpha(0.5), // Daempfungsfaktor, z.B. 0.5 @@ -83,7 +83,7 @@ namespace AMDiS { { FUNCNAME("Newton::nlsolve()"); - if (b == NULL) + if (b == nullptr) b = new SystemVector(x); double err = 0.0, errOld = -1.0, lambda = 1.0; @@ -151,9 +151,9 @@ namespace AMDiS { /// Realisation of NonLinSolver::exit void exit() { - if (b != NULL) { + if (b != nullptr) { delete b; - b = NULL; + b = nullptr; } } diff --git a/AMDiS/src/nonlin/ProblemNonLin.cc b/AMDiS/src/nonlin/ProblemNonLin.cc index 2853060bb13ee1fd94385f3e0aec7f525391b2cd..7d9e6820723bce15dcf3d272ebac9b95de5f3497 100644 --- a/AMDiS/src/nonlin/ProblemNonLin.cc +++ b/AMDiS/src/nonlin/ProblemNonLin.cc @@ -28,7 +28,7 @@ namespace AMDiS { void ProblemNonLin::initialize(Flag initFlag, - ProblemStatSeq *adoptProblem /*= NULL*/, + ProblemStatSeq *adoptProblem /*= nullptr*/, Flag adoptFlag /*= INIT_NOTHING*/) { FUNCNAME("ProblemNonLin::initialize()"); @@ -43,12 +43,12 @@ namespace AMDiS { createNonLinSolver(); if (adoptProblem && adoptFlag.isSet(INIT_NONLIN_SOLVER)) { - TEST_EXIT(nonLinSolver == NULL)("Nonlinear solver already created!\n"); + TEST_EXIT(nonLinSolver == nullptr)("Nonlinear solver already created!\n"); nonLinSolver = dynamic_cast<ProblemNonLin*>(adoptProblem)->getNonLinSolver(); } } - if (nonLinSolver == NULL) + if (nonLinSolver == nullptr) WARNING("No nonlinear solver created!\n"); } diff --git a/AMDiS/src/nonlin/ProblemNonLin.h b/AMDiS/src/nonlin/ProblemNonLin.h index af76f3d477878cfb46ee5bf2eb1a0f0d40aa91aa..891ec13757659664706cef6611b290f099462467 100644 --- a/AMDiS/src/nonlin/ProblemNonLin.h +++ b/AMDiS/src/nonlin/ProblemNonLin.h @@ -51,11 +51,11 @@ namespace AMDiS { /// Constructs a ProblemNonLin with given name. ProblemNonLin(const std::string& name_) : ProblemStat(name_.c_str()), - nonLinSolver(NULL) + nonLinSolver(nullptr) { u0.resize(nComponents); for (int i = 0; i < nComponents; i++) - u0[i] = NULL; + u0[i] = nullptr; } /// Sets \ref u0 and interpolates it to \ref solution. @@ -75,7 +75,7 @@ namespace AMDiS { /// Initialization of the problem. virtual void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = NULL, + ProblemStatSeq *adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). diff --git a/AMDiS/src/parallel/CheckerPartitioner.cc b/AMDiS/src/parallel/CheckerPartitioner.cc index 1d2ec582f9b1b1e3dd2e2302a79844f6ef061e13..dbdd3e7caa54ed8edca48babf6abf665857e5748 100644 --- a/AMDiS/src/parallel/CheckerPartitioner.cc +++ b/AMDiS/src/parallel/CheckerPartitioner.cc @@ -264,7 +264,7 @@ namespace AMDiS { namespace Parallel { TEST_EXIT(localDofs.size() == 3)("Should not happen!\n"); - while (mel != NULL) { + while (mel != nullptr) { int replaceDof = -1; for (int i = 0; i < mesh->getGeo(VERTEX); i++) if (localDofs.count(i) == 0) diff --git a/AMDiS/src/parallel/DofComm.cc b/AMDiS/src/parallel/DofComm.cc index 550adde7cfd91d40bed3bb16549098b442d4569a..24583648d1478bbacfeb405873348967178f18de 100644 --- a/AMDiS/src/parallel/DofComm.cc +++ b/AMDiS/src/parallel/DofComm.cc @@ -158,7 +158,7 @@ namespace AMDiS { namespace Parallel { feMapIter = dataIter->second.begin(); - if (traverseFeSpace != NULL) { + if (traverseFeSpace != nullptr) { if ((dataIter->second.count(traverseFeSpace) == 0)) return false; diff --git a/AMDiS/src/parallel/DofComm.h b/AMDiS/src/parallel/DofComm.h index 6c9d853290dec322296753bb427b1146b3f6ef90..e92617cfea272e9efb500fc9b8e4b86314f6d7bc 100644 --- a/AMDiS/src/parallel/DofComm.h +++ b/AMDiS/src/parallel/DofComm.h @@ -104,7 +104,7 @@ namespace AMDiS { namespace Parallel { { public: Iterator(DataType &d, - const FiniteElemSpace *fe = NULL) + const FiniteElemSpace *fe = nullptr) : data(d), dofCounter(-1), traverseFeSpace(fe), @@ -143,9 +143,9 @@ namespace AMDiS { namespace Parallel { } } - inline void beginDofIter(const FiniteElemSpace *fe = NULL) + inline void beginDofIter(const FiniteElemSpace *fe = nullptr) { - if (fe != NULL) { + if (fe != nullptr) { feMapIter = dataIter->second.begin(); while (feMapIter->first != fe && diff --git a/AMDiS/src/parallel/ElementObjectDatabase.cc b/AMDiS/src/parallel/ElementObjectDatabase.cc index a1f4b9f8f6bced0b80a85e610e2980e8a02aea05..95af26ff6d6a1f91b54ca009af707a8335ad9506 100644 --- a/AMDiS/src/parallel/ElementObjectDatabase.cc +++ b/AMDiS/src/parallel/ElementObjectDatabase.cc @@ -566,7 +566,7 @@ namespace AMDiS { namespace Parallel { edgeReverseMode.clear(); faceReverseMode.clear(); - macroElementRankMap = NULL; + macroElementRankMap = nullptr; macroElIndexMap.clear(); macroElIndexTypeMap.clear(); } diff --git a/AMDiS/src/parallel/ElementObjectDatabase.h b/AMDiS/src/parallel/ElementObjectDatabase.h index 0950b0497188aa96c719c54b7cd4a3dcea7b069f..cd4b71ae7dd57896fcbeae7aa96047c7151de34d 100644 --- a/AMDiS/src/parallel/ElementObjectDatabase.h +++ b/AMDiS/src/parallel/ElementObjectDatabase.h @@ -110,11 +110,11 @@ namespace AMDiS { namespace Parallel { class ElementObjectDatabase { public: ElementObjectDatabase() - : feSpace(NULL), - mesh(NULL), + : feSpace(nullptr), + mesh(nullptr), iterGeoPos(CENTER), - macroElementRankMap(NULL), - levelData(NULL) + macroElementRankMap(nullptr), + levelData(nullptr) {} void setFeSpace(const FiniteElemSpace *fe) diff --git a/AMDiS/src/parallel/InteriorBoundary.cc b/AMDiS/src/parallel/InteriorBoundary.cc index bfdfc94da8ca14f5ae86975234840b835e7f3a08..71c9496f925cf95319c26d00a9f5f878f61a5ffc 100644 --- a/AMDiS/src/parallel/InteriorBoundary.cc +++ b/AMDiS/src/parallel/InteriorBoundary.cc @@ -672,7 +672,7 @@ namespace AMDiS { namespace Parallel { if (elIndexMap.count(bound.neighObj.elIndex)) bound.neighObj.el = elIndexMap[bound.neighObj.elIndex]; else - bound.neighObj.el = NULL; + bound.neighObj.el = nullptr; } } } diff --git a/AMDiS/src/parallel/MatrixNnzStructure.cc b/AMDiS/src/parallel/MatrixNnzStructure.cc index 0310af5ea1596301b31561863eddc32c18f628f6..733ba38fab249789a5ed7d7058b063e7afe4b9f7 100644 --- a/AMDiS/src/parallel/MatrixNnzStructure.cc +++ b/AMDiS/src/parallel/MatrixNnzStructure.cc @@ -37,12 +37,12 @@ namespace AMDiS { namespace Parallel { { if (dnnz) { delete [] dnnz; - dnnz = NULL; + dnnz = nullptr; } if (onnz) { delete [] onnz; - onnz = NULL; + onnz = nullptr; } } @@ -89,7 +89,7 @@ namespace AMDiS { namespace Parallel { // First, create for all ranks, to which we send data to, MatrixNnzEntry // object with 0 entries. for (int i = 0; i < nComponents; i++) { - const FiniteElemSpace* feSpace = NULL; + const FiniteElemSpace* feSpace = nullptr; for (int j = 0; j < nComponents; j++) if (mat[i][j]) feSpace = mat[i][j]->getRowFeSpace(); @@ -108,7 +108,7 @@ namespace AMDiS { namespace Parallel { // Create list of ranks from which we receive data from. std::set<int> recvFromRank; for (int i = 0; i < nComponents; i++) { - const FiniteElemSpace* feSpace = NULL; + const FiniteElemSpace* feSpace = nullptr; for (int j = 0; j < nComponents; j++) if (mat[i][j]) feSpace = mat[i][j]->getRowFeSpace(); diff --git a/AMDiS/src/parallel/MatrixNnzStructure.h b/AMDiS/src/parallel/MatrixNnzStructure.h index c14a87081b7838f2fcb3107ccb99d4b7fd8b951f..16fbc6e2d8d502f37b35e0470fed11223ef3bab1 100644 --- a/AMDiS/src/parallel/MatrixNnzStructure.h +++ b/AMDiS/src/parallel/MatrixNnzStructure.h @@ -36,8 +36,8 @@ namespace AMDiS { namespace Parallel { class MatrixNnzStructure { public: MatrixNnzStructure() - : dnnz(NULL), - onnz(NULL) + : dnnz(nullptr), + onnz(nullptr) {} ~MatrixNnzStructure(); diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index c885dae719c33f1c1ae56cf534c29e80d78af92d..7ac7cf95236807dfc81f8ec19bb07995a065c448 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -69,7 +69,7 @@ namespace AMDiS { namespace Parallel { using namespace boost::filesystem; using namespace std; - MeshDistributor* MeshDistributor::globalMeshDistributor = NULL; + MeshDistributor* MeshDistributor::globalMeshDistributor = nullptr; const Flag MeshDistributor::BOUNDARY_SUBOBJ_SORTED = 0X01L; const Flag MeshDistributor::BOUNDARY_FILL_INFO_SEND_DOFS = 0X02L; @@ -84,10 +84,10 @@ namespace AMDiS { namespace Parallel { : problemStat(0), initialized(false), name("parallel"), - mesh(NULL), - refineManager(NULL), - partitioner(NULL), - initialPartitioner(NULL), + mesh(nullptr), + refineManager(nullptr), + partitioner(nullptr), + initialPartitioner(nullptr), deserialized(false), writeSerializationFile(false), repartitioningAllowed(false), @@ -178,7 +178,7 @@ namespace AMDiS { namespace Parallel { { if (partitioner) { delete partitioner; - partitioner = NULL; + partitioner = nullptr; } } @@ -282,8 +282,8 @@ namespace AMDiS { namespace Parallel { int neighIndex = (*it)->getNeighbour(i)->getIndex(); - (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), NULL); - (*it)->setNeighbour(i, NULL); + (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), nullptr); + (*it)->setNeighbour(i, nullptr); (*it)->setBoundary(i, 0); macroElementNeighbours[(*it)->getIndex()][i] = -1; @@ -300,8 +300,8 @@ namespace AMDiS { namespace Parallel { int neighIndex = (*it)->getNeighbour(i)->getIndex(); - (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), NULL); - (*it)->setNeighbour(i, NULL); + (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), nullptr); + (*it)->setNeighbour(i, nullptr); (*it)->setBoundary(i, 0); macroElementNeighbours[(*it)->getIndex()][i] = -1; @@ -485,7 +485,7 @@ namespace AMDiS { namespace Parallel { // === Add mesh of stationary problem and create a corresponding === // === refinement manager object. === - if (mesh != NULL) { + if (mesh != nullptr) { TEST_EXIT(mesh == probStat->getMesh()) ("Does not yet support for different meshes!\n"); } else { @@ -593,7 +593,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("MeshDistributor::addProblemStatGlobal()"); - if (globalMeshDistributor == NULL) + if (globalMeshDistributor == nullptr) globalMeshDistributor = new MeshDistributor(); globalMeshDistributor->addProblemStat(probStat); @@ -1537,7 +1537,7 @@ namespace AMDiS { namespace Parallel { // First, reset all neighbour relations. The correct neighbours will be // set later. for (int i = 0; i < mesh->getGeo(NEIGH); i++) - mel->setNeighbour(i, NULL); + mel->setNeighbour(i, nullptr); // Create new DOFs for the macro element. mel->getElement()->createNewDofPtrs(true); @@ -1620,7 +1620,7 @@ namespace AMDiS { namespace Parallel { if (neighIndex == -1 || partitioner->getElementInRank()[neighIndex] == false) { - (*it)->setNeighbour(i, NULL); + (*it)->setNeighbour(i, nullptr); } else { TEST_EXIT_DBG(elIndexMap.count(neighIndex) == 1) ("Should not happen!\n"); @@ -1743,7 +1743,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("MeshDistributor::createBoundaryDofs()"); - Timer *t = NULL; + Timer *t = nullptr; if (printTimings) t = new Timer(); @@ -1931,7 +1931,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("MeshDistributor::updateParallelDofMappings()"); - Timer *t = NULL; + Timer *t = nullptr; if (printTimings) t = new Timer(); diff --git a/AMDiS/src/parallel/MeshManipulation.cc b/AMDiS/src/parallel/MeshManipulation.cc index fe5f62a932b2bd02bb1146debb41c04ef44adbee..800a79783295063f2003c1d0625b83729b93730b 100644 --- a/AMDiS/src/parallel/MeshManipulation.cc +++ b/AMDiS/src/parallel/MeshManipulation.cc @@ -496,7 +496,7 @@ namespace AMDiS { namespace Parallel { elInfo = pstack->traverseNext(elInfo); } while (elInfo && elInfo->getElement() != child1); - TEST_EXIT_DBG(elInfo != NULL)("This should not happen!\n"); + TEST_EXIT_DBG(elInfo != nullptr)("This should not happen!\n"); } TEST_EXIT_DBG(elInfo->getElement() == child1) diff --git a/AMDiS/src/parallel/MeshPartitioner.h b/AMDiS/src/parallel/MeshPartitioner.h index 01c29a594331db48301e04e0d33e9790ac222863..b784db9e1af2b5205ae8c05457b5eef0df201636 100644 --- a/AMDiS/src/parallel/MeshPartitioner.h +++ b/AMDiS/src/parallel/MeshPartitioner.h @@ -58,9 +58,9 @@ namespace AMDiS { namespace Parallel { MeshPartitioner(string name, MPI::Intracomm *comm) : initFileStr(name), mpiComm(comm), - mesh(NULL), + mesh(nullptr), boxPartitioning(false), - mapLocalGlobal(NULL) + mapLocalGlobal(nullptr) {} virtual ~MeshPartitioner() {} diff --git a/AMDiS/src/parallel/MpiHelper.cc b/AMDiS/src/parallel/MpiHelper.cc index 1fb8cf469b3e3a3d1dc335deb21ce14fc4e3c20c..80f1d20fefa12790bb40c657bf08182c535e9cf3 100644 --- a/AMDiS/src/parallel/MpiHelper.cc +++ b/AMDiS/src/parallel/MpiHelper.cc @@ -64,7 +64,7 @@ namespace AMDiS { namespace Parallel { void startRand() { - srand(time(NULL) * (MPI::COMM_WORLD.Get_rank() + 1)); + srand(time(0) * (MPI::COMM_WORLD.Get_rank() + 1)); } } } } diff --git a/AMDiS/src/parallel/ParMetisPartitioner.cc b/AMDiS/src/parallel/ParMetisPartitioner.cc index fd85f60c4471ec4533660b5cfb8610075bd38531..5a871952e8be7e45fb062f2ffc98ef0befdf663f 100644 --- a/AMDiS/src/parallel/ParMetisPartitioner.cc +++ b/AMDiS/src/parallel/ParMetisPartitioner.cc @@ -71,7 +71,7 @@ namespace AMDiS { namespace Parallel { if (dim == dow) xyz = new float[nElements * dim]; else - xyz = NULL; + xyz = nullptr; eptr[0] = 0; @@ -323,7 +323,7 @@ namespace AMDiS { namespace Parallel { parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), &(wgts[0]), - NULL, + nullptr, &wgtflag, &numflag, &ncon, @@ -345,7 +345,7 @@ namespace AMDiS { namespace Parallel { parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), &(wgts[0]), - NULL, + nullptr, &(vsize[0]), &wgtflag, &numflag, @@ -365,7 +365,7 @@ namespace AMDiS { namespace Parallel { parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), &(wgts[0]), - NULL, + nullptr, &wgtflag, &numflag, &ncon, @@ -524,7 +524,7 @@ namespace AMDiS { namespace Parallel { } delete parMetisMesh; - parMetisMesh = NULL; + parMetisMesh = nullptr; delete [] rankElements; delete [] nPartitionElements; diff --git a/AMDiS/src/parallel/ParMetisPartitioner.h b/AMDiS/src/parallel/ParMetisPartitioner.h index a891b8a2382a1509f33eef29800fffa6f0ca9163..26548f6bd99f4ce1bffbf9ed10ceb2101a65d0ef 100644 --- a/AMDiS/src/parallel/ParMetisPartitioner.h +++ b/AMDiS/src/parallel/ParMetisPartitioner.h @@ -172,7 +172,7 @@ namespace AMDiS { namespace Parallel { public: ParMetisPartitioner(string name, MPI::Intracomm *comm) : MeshPartitioner(name, comm), - parMetisMesh(NULL), + parMetisMesh(nullptr), itr(1000000.0) {} diff --git a/AMDiS/src/parallel/ParallelDofMapping.cc b/AMDiS/src/parallel/ParallelDofMapping.cc index 6ae8be433a06ee95f26f680a1e54bf8307e8b536..57aa4ce3301b73965e47e22811895df19a043daa 100644 --- a/AMDiS/src/parallel/ParallelDofMapping.cc +++ b/AMDiS/src/parallel/ParallelDofMapping.cc @@ -47,8 +47,8 @@ namespace AMDiS { namespace Parallel { ComponentDofMap::ComponentDofMap() - : dofComm(NULL), - feSpace(NULL), + : dofComm(nullptr), + feSpace(nullptr), globalMapping(false) { clear(); @@ -212,7 +212,7 @@ namespace AMDiS { namespace Parallel { ParallelDofMapping::ParallelDofMapping(DofMappingMode mode, bool matIndexFromGlobal) - : dofComm(NULL), + : dofComm(nullptr), globalMapping(true), needMatIndexFromGlobal(matIndexFromGlobal), nRankDofs(1), @@ -399,7 +399,7 @@ namespace AMDiS { namespace Parallel { if (!globalMapping) continue; - TEST_EXIT_DBG(dofComm != NULL)("No communicator given!\n"); + TEST_EXIT_DBG(dofComm != nullptr)("No communicator given!\n"); // === Communicate the matrix indices for all DOFs that are on some === // === interior boundaries. === diff --git a/AMDiS/src/parallel/ParallelProblemStat.cc b/AMDiS/src/parallel/ParallelProblemStat.cc index 78203a06de025db46c1b1f8b2476efc551c76d21..d9738c4c6e64f9155507b7aa4f4855f54456c518 100644 --- a/AMDiS/src/parallel/ParallelProblemStat.cc +++ b/AMDiS/src/parallel/ParallelProblemStat.cc @@ -53,7 +53,7 @@ namespace AMDiS { namespace Parallel { ParallelProblemStat::ParallelProblemStat(std::string nameStr, ProblemIterationInterface *problemIteration) : ProblemStatSeq(nameStr, problemIteration), - meshDistributor(NULL) + meshDistributor(nullptr) { initTimeStamp = MPI::Wtime(); mpi::globalMin(initTimeStamp); @@ -77,7 +77,7 @@ namespace AMDiS { namespace Parallel { meshDistributor->addInterchangeVector(getSolution()); ParallelSolver *parallelSolver = dynamic_cast<ParallelSolver*>(solver); - TEST_EXIT(parallelSolver != NULL) + TEST_EXIT(parallelSolver != nullptr) ("ParallelProblem loaded, but no ParallelSolver selected! This does not fit together.\n"); parallelSolver->setMeshDistributor(meshDistributor, 0); @@ -91,7 +91,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("ParallelProblemStat::buildAfterCoarsen()"); - TEST_EXIT(MeshDistributor::globalMeshDistributor != NULL) + TEST_EXIT(MeshDistributor::globalMeshDistributor != nullptr) ("No Meshdistributor! Should not happen!\n"); MeshDistributor::globalMeshDistributor->checkMeshChange(); diff --git a/AMDiS/src/parallel/ParallelProblemStat.h b/AMDiS/src/parallel/ParallelProblemStat.h index aaee530fa184e8515ec1aec9e91cd1f3974a3dd0..5bf478d4417463e6ad9b7c627dda85bc87b8125d 100644 --- a/AMDiS/src/parallel/ParallelProblemStat.h +++ b/AMDiS/src/parallel/ParallelProblemStat.h @@ -43,7 +43,7 @@ namespace AMDiS { public: ParallelProblemStat(std::string nameStr, - ProblemIterationInterface *problemIteration = NULL); + ProblemIterationInterface *problemIteration = nullptr); virtual ~ParallelProblemStat() {} @@ -52,7 +52,7 @@ namespace AMDiS bool assembleVector = true); void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = NULL, + ProblemStatSeq *adoptProblem = nullptr, Flag adoptFlag = INIT_NOTHING); /// Must be called before Meshdistributor::initParallelization() diff --git a/AMDiS/src/parallel/ParallelSolver.cc b/AMDiS/src/parallel/ParallelSolver.cc index d103a9b9546e18269e0f2a6cff0c20d8777be2e9..f2e4f3664af8a10c0d42c3f7ea3ea95c1fb76e05 100644 --- a/AMDiS/src/parallel/ParallelSolver.cc +++ b/AMDiS/src/parallel/ParallelSolver.cc @@ -25,10 +25,10 @@ namespace AMDiS { namespace Parallel { ParallelSolver::ParallelSolver(std::string name, bool globalIndices) : LinearSolver(name), - interiorMap(NULL), + interiorMap(nullptr), dofMap(FESPACE_WISE, globalIndices), parallelDofMappingsRegistered(false), - meshDistributor(NULL), + meshDistributor(nullptr), meshLevel(0) { setDofMapping(&dofMap); diff --git a/AMDiS/src/parallel/PetscHelper.cc b/AMDiS/src/parallel/PetscHelper.cc index 36461460088a49f784f5156fd82c98ac1947298a..f49ba98981dbc5c61df82a772914cf0f8da5b151 100644 --- a/AMDiS/src/parallel/PetscHelper.cc +++ b/AMDiS/src/parallel/PetscHelper.cc @@ -302,6 +302,15 @@ namespace AMDiS if (matSolverPackage != PETSC_NULL) PCFactorSetMatSolverPackage(pc, matSolverPackage); PCSetFromOptions(pc); + +#if DEBUG != 0 + MSG("PetscOptionsView:\n"); + PetscViewer viewer; + PetscViewerCreate(PETSC_COMM_WORLD, &viewer); + PetscViewerSetType(viewer, PETSCVIEWERASCII); + PetscOptionsView(viewer); + PetscViewerDestroy(&viewer); +#endif } diff --git a/AMDiS/src/parallel/PetscSolver.cc b/AMDiS/src/parallel/PetscSolver.cc index 82548894896e10dbeecd06c0369f65f2852b7b4f..3462b7669e176927ab18fba14f34206649562093 100644 --- a/AMDiS/src/parallel/PetscSolver.cc +++ b/AMDiS/src/parallel/PetscSolver.cc @@ -95,7 +95,7 @@ namespace AMDiS { namespace Parallel { INFO(info, 8)("creation of parallel data structures needed %.5f seconds\n", t.elapsed()); - solvePetscMatrix(x, NULL); + solvePetscMatrix(x, nullptr); if (!storeMatrixData) { destroyVectorData(); diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard.cc b/AMDiS/src/parallel/PetscSolverCahnHilliard.cc index eefd1f8bbc92cbc7f7a555b70addbd6338bbe6ce..76fb678d743b2c4f14edff295d85aac69ec5224b 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard.cc +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard.cc @@ -30,81 +30,57 @@ namespace AMDiS { namespace Parallel { /// solve Cahn-Hilliard Preconditioner PetscErrorCode pcChShell(PC pc, Vec b, Vec x) // solve Px=b - {FUNCNAME("PCApply()"); - - void *ctx; - PCShellGetContext(pc, &ctx); - CahnHilliardData* data = static_cast<CahnHilliardData*>(ctx); - - Vec b1, b2, x1, x2; - VecNestGetSubVec(b, 0, &b1); - VecNestGetSubVec(b, 1, &b2); - - VecNestGetSubVec(x, 0, &x1); - VecNestGetSubVec(x, 1, &x2); - - Vec y1, y2; - VecDuplicate(b1, &y1); - VecDuplicate(b2, &y2); - - // MatGetDiagonal(data->matM, y2); - // VecReciprocal(y2); - // VecPointwiseMult(y1, y2, b1); - KSPSolve(data->kspMass, b1, y1); // M*y1 = b1 - MatMultAdd(data->matMinusDeltaK, y1, b2, x1); // -> x1 := b2-delta*K*y1 - - KSPSolve(data->kspLaplace, x1, y2); // (M+eps*sqrt(delta))*y2 = x1 - MatMult(data->matM, y2, x1); // x1 := M*y2 - - KSPSolve(data->kspLaplace2, x1, x2); // (M+eps*sqrt(delta))*x2 = x1 - double factor = (*data->eps)/sqrt(*data->delta); - VecCopy(x2, x1); // x1 := x2 - VecAXPBYPCZ(x1, 1.0, factor, -factor, y1, y2); // x1 = 1*y1 + factor*y2 - factor*x1 - - VecDestroy(&y1); - VecDestroy(&y2); - - PetscFunctionReturn(0); + { + void *ctx; + PCShellGetContext(pc, &ctx); + CahnHilliardData* data = static_cast<CahnHilliardData*>(ctx); + + Vec b1, b2, x1, x2; + VecNestGetSubVec(b, 0, &b1); + VecNestGetSubVec(b, 1, &b2); + + VecNestGetSubVec(x, 0, &x1); + VecNestGetSubVec(x, 1, &x2); + + Vec y1, y2; + VecDuplicate(b1, &y1); + VecDuplicate(b2, &y2); + + // MatGetDiagonal(data->matM, y2); + // VecReciprocal(y2); + // VecPointwiseMult(y1, y2, b1); + KSPSolve(data->kspMass, b1, y1); // M*y1 = b1 + MatMultAdd(data->matMinusDeltaK, y1, b2, x1); // -> x1 := b2-delta*K*y1 + + KSPSolve(data->kspLaplace, x1, y2); // (M+eps*sqrt(delta))*y2 = x1 + MatMult(data->matM, y2, x1); // x1 := M*y2 + + KSPSolve(data->kspLaplace, x1, x2); // (M+eps*sqrt(delta))*x2 = x1 + double factor = (*data->eps)/sqrt(*data->delta); + VecCopy(x2, x1); // x1 := x2 + VecAXPBYPCZ(x1, 1.0, factor, -factor, y1, y2); // x1 = 1*y1 + factor*y2 - factor*x1 + + VecDestroy(&y1); + VecDestroy(&y2); + + PetscFunctionReturn(0); } PetscSolverCahnHilliard::PetscSolverCahnHilliard(string name, double *epsPtr, double *deltaPtr) : PetscSolverGlobalBlockMatrix(name), - massMatrixSolver(NULL), - laplaceMatrixSolver(NULL), - deltaKMatrixSolver(NULL), + massMatrixSolver(nullptr), + laplaceMatrixSolver(nullptr), + deltaKMatrixSolver(nullptr), useOldInitialGuess(false), + phase(nullptr), eps(epsPtr), - delta(deltaPtr) + delta(deltaPtr), + tau(nullptr) { Parameters::get(initFileStr + "->use old initial guess", useOldInitialGuess); } - - void PetscSolverCahnHilliard::solvePetscMatrix(SystemVector &vec, - AdaptInfo *adaptInfo) - { - FUNCNAME("PetscSolverCahnHilliard::solvePetscMatrix()"); - - /* if (useOldInitialGuess) { - if (getVecSolInterior()) - {VecSet(getVecSolInterior(), 0.0); - - for (int i = 0; i < solution->getSize(); i++) - { - Vec tmp; - VecNestGetSubVec(getVecSolInterior(), i, &tmp); - setDofVector(tmp, solution->getDOFVector(i)); - } - - vecSolAssembly(); - KSPSetInitialGuessNonzero(kspInterior, PETSC_TRUE); - } - KSPSetInitialGuessNonzero(kspInterior, PETSC_TRUE); - }*/ - PetscSolverGlobalBlockMatrix::solvePetscMatrix(vec, adaptInfo); - } - void PetscSolverCahnHilliard::initSolver(KSP &ksp) { // Create FGMRES based outer solver @@ -116,6 +92,9 @@ namespace AMDiS { namespace Parallel { KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); KSPSetFromOptions(ksp); + + if (useOldInitialGuess) + KSPSetInitialGuessNonzero(ksp, PETSC_TRUE); } @@ -124,8 +103,14 @@ namespace AMDiS { namespace Parallel { FUNCNAME("PetscSolverCahnHilliard::initPreconditioner()"); MSG("PetscSolverCahnHilliard::initPreconditioner()\n"); + if (tau) { + delta = new double; + *delta = (*gamma) * (*tau); + } + TEST_EXIT(eps && delta)("eps and/or delta pointers not set!\n"); + // KSPSetUp(kspInterior); PCSetType(pc, PCSHELL); @@ -144,24 +129,18 @@ namespace AMDiS { namespace Parallel { DOFMatrix deltaKMatrix(feSpace, feSpace); Operator laplaceOp2(feSpace, feSpace); - DOFMatrix massMatrix2(feSpace, feSpace); - if (phase) { - VecAtQP_ZOT zot(phase, NULL); + VecAtQP_ZOT zot(phase, nullptr); massOp.addTerm(&zot); laplaceOp.addTerm(&zot); // M - VecAtQP_SOT sot2(phase, NULL, (*eps)*sqrt(*delta)); + VecAtQP_SOT sot2(phase, nullptr, (*eps)*sqrt(*delta)); laplaceOp.addTerm(&sot2); // eps*sqrt(delta)*K - VecAtQP_SOT sot(phase, NULL, -(*delta)); + VecAtQP_SOT sot(phase, nullptr, -(*delta)); laplaceOp2.addTerm(&sot); // -delta*K massMatrix.assembleOperator(massOp); massMatrixSolver = createSubSolver(0, "mass_"); massMatrixSolver->fillPetscMatrix(&massMatrix); - massMatrix2.assembleOperator(massOp); - massMatrixSolver2 = createSubSolver(0, "laplace_"); - massMatrixSolver2->fillPetscMatrix(&massMatrix2); - // === matrix (M + eps*sqrt(delta)*K) === laplaceMatrix.assembleOperator(laplaceOp); laplaceMatrixSolver = createSubSolver(0, "laplace_"); @@ -186,10 +165,6 @@ namespace AMDiS { namespace Parallel { massMatrixSolver = createSubSolver(0, "mass_"); massMatrixSolver->fillPetscMatrix(&massMatrix); - massMatrix2.assembleOperator(massOp); - massMatrixSolver2 = createSubSolver(0, "laplace_"); - massMatrixSolver2->fillPetscMatrix(&massMatrix2); - // === matrix (M + eps*sqrt(delta)*K) === laplaceMatrix.assembleOperator(laplaceOp); laplaceMatrixSolver = createSubSolver(0, "laplace_"); @@ -200,10 +175,8 @@ namespace AMDiS { namespace Parallel { deltaKMatrixSolver = createSubSolver(0, "laplace2_"); deltaKMatrixSolver->fillPetscMatrix(&deltaKMatrix); } - - Mat matK0MalMinusEps2; - MatNestGetSubMat(mat[0][0], 0, 1, &(matK0MalMinusEps2)); - MatAXPY(massMatrixSolver2->getMatInterior(), -sqrt(*delta) / (*eps), matK0MalMinusEps2, DIFFERENT_NONZERO_PATTERN); + + // === Setup solver === @@ -211,13 +184,12 @@ namespace AMDiS { namespace Parallel { matShellContext.kspLaplace = laplaceMatrixSolver->getSolver(); matShellContext.matM = massMatrixSolver->getMatInterior(); matShellContext.matMinusDeltaK = deltaKMatrixSolver->getMatInterior(); - matShellContext.kspLaplace2 = massMatrixSolver2->getSolver(); matShellContext.eps = eps; matShellContext.delta = delta; matShellContext.mpiCommGlobal= &(meshDistributor->getMpiComm(0)); - petsc_helper::setSolver(matShellContext.kspMass, "", KSPCG, PCJACOBI, 0.0, 1e-14, 2); + petsc_helper::setSolver(matShellContext.kspMass, "mass_", KSPCG, PCBJACOBI, 0.0, 1e-14, 2); // petsc_helper::setSolver(matShellContext.kspMass, "mass_", KSPRICHARDSON, PCLU, 0.0, 1e-14, 1); // { // PC pc; @@ -226,8 +198,6 @@ namespace AMDiS { namespace Parallel { // } petsc_helper::setSolver(matShellContext.kspLaplace, "laplace_", KSPRICHARDSON, PCHYPRE, 0.0, 1e-14, 2); - - petsc_helper::setSolver(matShellContext.kspLaplace2, "laplace_", KSPRICHARDSON, PCHYPRE, 0.0, 1e-14, 2); // petsc_helper::setSolver(matShellContext.kspLaplace, "laplace_", KSPRICHARDSON, PCLU, 0.0, 1e-14, 1); // { // PC pc; @@ -265,24 +235,24 @@ namespace AMDiS { namespace Parallel { massMatrixSolver->destroyMatrixData(); laplaceMatrixSolver->destroyMatrixData(); deltaKMatrixSolver->destroyMatrixData(); - massMatrixSolver2->destroyMatrixData(); massMatrixSolver->destroyVectorData(); laplaceMatrixSolver->destroyVectorData(); deltaKMatrixSolver->destroyVectorData(); - massMatrixSolver2->destroyVectorData(); - delete massMatrixSolver; - massMatrixSolver = NULL; - delete massMatrixSolver2; - massMatrixSolver2 = NULL; + delete massMatrixSolver; + massMatrixSolver = nullptr; delete laplaceMatrixSolver; - laplaceMatrixSolver = NULL; + laplaceMatrixSolver = nullptr; delete deltaKMatrixSolver; - deltaKMatrixSolver = NULL; + deltaKMatrixSolver = nullptr; + + if (tau) { + delete delta; + } } diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard.h b/AMDiS/src/parallel/PetscSolverCahnHilliard.h index 89f6b5c12320df124d41ac67970b2799405d76b2..d4cc7f8d3566aecac2510a84f900e6ee5570dbcc 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard.h +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard.h @@ -56,15 +56,20 @@ namespace AMDiS { namespace Parallel { } }; - void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo); - - PetscSolverCahnHilliard(string name, double *epsPtr = NULL, double *deltaPtr = NULL); + PetscSolverCahnHilliard(string name, double *epsPtr = nullptr, double *deltaPtr = nullptr); - void setChData(double *epsPtr, double *deltaPtr, SystemVector* vec, DOFVector<double> *p=NULL) + void setChData(double *epsPtr, double *deltaPtr, DOFVector<double> *p=nullptr) { eps = epsPtr; - delta = deltaPtr; // sqrt(tau) - solution = vec; + delta = deltaPtr; // gamma*tau + phase = p; + } + + void setChData2(double *epsPtr, double *gammaPtr, double *tauPtr, DOFVector<double> *p=nullptr) + { + eps = epsPtr; + gamma = gammaPtr; + tau = tauPtr; phase = p; } @@ -85,11 +90,9 @@ namespace AMDiS { namespace Parallel { bool useOldInitialGuess; - SystemVector* solution; - DOFVector<double> *phase; - double *eps, *delta; + double *eps, *delta, *gamma, *tau; }; } } diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc b/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc index 70d4b3b92375ffd0d7762fce5fca692940eb78eb..e71ac593c08a4e214c8011362de6b26da994d694 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc @@ -91,35 +91,20 @@ namespace AMDiS { namespace Parallel { : PetscSolverGlobalMatrix(name), useOldInitialGuess(false), laplaceSolutionMode(0), - massMatrixSolver(NULL), - laplaceMatrixSolver(NULL), - deltaKMatrixSolver(NULL), - phase(NULL) + massMatrixSolver(nullptr), + laplaceMatrixSolver(nullptr), + deltaKMatrixSolver(nullptr), + eps(nullptr), + delta(nullptr), + tau(nullptr), + solution(nullptr), + phase(nullptr) { - Parameters::get(initFileStr + "->cahnhilliard->use old initial guess", + Parameters::get(initFileStr + "->use old initial guess", useOldInitialGuess); } - void PetscSolverCahnHilliard2::solvePetscMatrix(SystemVector &vec, - AdaptInfo *adaptInfo) - { - FUNCNAME("PetscSolverCahnHilliard2::solvePetscMatrix()"); - - if (useOldInitialGuess) { - VecSet(getVecSolInterior(), 0.0); - - for (int i = 0; i < solution->getSize(); i++) - setDofVector(getVecSolInterior(), solution->getDOFVector(i), i, true); - - vecSolAssembly(); - KSPSetInitialGuessNonzero(kspInterior, PETSC_TRUE); - } - - PetscSolverGlobalMatrix::solvePetscMatrix(vec, adaptInfo); - } - - void PetscSolverCahnHilliard2::initSolver(KSP &ksp) { FUNCNAME("PetscSolverCahnHilliard2::initSolver()"); @@ -129,9 +114,14 @@ namespace AMDiS { namespace Parallel { MSG("CREATE POS 1: %p\n", &ksp); KSPCreate(domainComm, &ksp); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); - KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); - petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, 1e-6, 1e-8, 10000); - + if (getInfo() >= 10) + KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); + else if (getInfo() >= 20) + KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); + petsc_helper::setSolver(ksp, "ch_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); + + if (useOldInitialGuess) + KSPSetInitialGuessNonzero(ksp, PETSC_TRUE); } @@ -143,6 +133,12 @@ namespace AMDiS { namespace Parallel { MPI::COMM_WORLD.Barrier(); double wtime = MPI::Wtime(); + + if (tau) { + delta = new double; + *delta = sqrt(*tau); + } + vector<int> chPotentialComponent; chPotentialComponent.push_back(0); vector<int> chSchurComponent; @@ -243,13 +239,17 @@ namespace AMDiS { namespace Parallel { deltaKMatrixSolver->destroyVectorData(); delete massMatrixSolver; - massMatrixSolver = NULL; + massMatrixSolver = nullptr; delete laplaceMatrixSolver; - laplaceMatrixSolver = NULL; + laplaceMatrixSolver = nullptr; delete deltaKMatrixSolver; - deltaKMatrixSolver = NULL; + deltaKMatrixSolver = nullptr; + + if (tau) { + delete delta; + } } } } diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard2.h b/AMDiS/src/parallel/PetscSolverCahnHilliard2.h index 8bd40547f3dc5efc98a7808cfc5dd1a10af0bb39..1a0d32fca1c8fb3ab3dea4e168adadcea588ef28 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard2.h +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard2.h @@ -56,14 +56,19 @@ namespace AMDiS { namespace Parallel { PetscSolverCahnHilliard2(string name); - void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo); - void setChData(double *epsPtr, double *deltaPtr) { eps = epsPtr; delta = deltaPtr; } + void setChData2(double *epsPtr, double *tauPtr, SystemVector* vec=nullptr) + { + eps = epsPtr; + tau = tauPtr; + solution = vec; + } + void setPhase(DOFVector<double> *d, double eP3=0) { @@ -99,7 +104,7 @@ namespace AMDiS { namespace Parallel { CahnHilliardData2 matShellContext; - double *eps, *delta; + double *eps, *delta, *tau; double epsPhase3; diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index 83991b7e58e84f9e8797261171aab4bebc044a3a..e1e81b3abd532c20224c8524d1b57fa76870818f 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.cc +++ b/AMDiS/src/parallel/PetscSolverFeti.cc @@ -49,8 +49,8 @@ namespace AMDiS { namespace Parallel { schurPrimalSolver(0), levelMode(1), subDomainIsLocal(true), - subdomain(NULL), - massMatrixSolver(NULL), + subdomain(nullptr), + massMatrixSolver(nullptr), printTimings(false), augmentedLagrange(false), nRankEdges(0), @@ -159,7 +159,7 @@ namespace AMDiS { namespace Parallel { subDomainIsLocal = (levelData.getMpiComm(meshLevel + 1) == MPI::COMM_SELF); - if (subdomain == NULL) { + if (subdomain == nullptr) { string subSolverInitStr = name + "->subsolver"; string solverType = "petsc"; Parameters::get(subSolverInitStr, solverType); @@ -1142,7 +1142,7 @@ namespace AMDiS { namespace Parallel { MatComputeExplicitOperator(tmp, &mat_schur_primal); MatDestroy(&tmp); - schurPrimalData.subSolver = NULL; + schurPrimalData.subSolver = nullptr; VecDestroy(&schurPrimalData.tmp_vec_b); VecDestroy(&schurPrimalData.tmp_vec_primal); } @@ -1248,9 +1248,9 @@ namespace AMDiS { namespace Parallel { MatComputeExplicitOperator(tmp, &mat_schur_primal); MatDestroy(&tmp); - schurPrimalAugmentedData.subSolver = NULL; - schurPrimalAugmentedData.mat_lagrange = NULL; - schurPrimalAugmentedData.mat_augmented_lagrange = NULL; + schurPrimalAugmentedData.subSolver = nullptr; + schurPrimalAugmentedData.mat_lagrange = nullptr; + schurPrimalAugmentedData.mat_augmented_lagrange = nullptr; VecDestroy(&schurPrimalAugmentedData.tmp_vec_b0); VecDestroy(&schurPrimalAugmentedData.tmp_vec_b1); VecDestroy(&schurPrimalAugmentedData.tmp_vec_primal); @@ -1265,14 +1265,14 @@ namespace AMDiS { namespace Parallel { if (schurPrimalSolver == 0) { if (augmentedLagrange == false) { - schurPrimalData.subSolver = NULL; + schurPrimalData.subSolver = nullptr; VecDestroy(&schurPrimalData.tmp_vec_b); VecDestroy(&schurPrimalData.tmp_vec_primal); } else { - schurPrimalAugmentedData.subSolver = NULL; - schurPrimalAugmentedData.mat_lagrange = NULL; - schurPrimalAugmentedData.mat_augmented_lagrange = NULL; + schurPrimalAugmentedData.subSolver = nullptr; + schurPrimalAugmentedData.mat_lagrange = nullptr; + schurPrimalAugmentedData.mat_augmented_lagrange = nullptr; VecDestroy(&schurPrimalAugmentedData.tmp_vec_b0); VecDestroy(&schurPrimalAugmentedData.tmp_vec_b1); @@ -1513,7 +1513,7 @@ namespace AMDiS { namespace Parallel { componentSpaces[pressureComponent]; // Create parallel DOF mapping in pressure space. - ParallelDofMapping *massMapping = NULL; + ParallelDofMapping *massMapping = nullptr; if (massMatrixSolver) { massMapping = massMatrixSolver->getDofMapping(); } else { @@ -1671,7 +1671,7 @@ namespace AMDiS { namespace Parallel { // === Destroy FETI-DP solver object. === fetiData.mat_lagrange = PETSC_NULL; - fetiData.subSolver = NULL; + fetiData.subSolver = nullptr; fetiData.ksp_schur_primal = PETSC_NULL; VecDestroy(&fetiData.tmp_vec_b0); @@ -1699,12 +1699,12 @@ namespace AMDiS { namespace Parallel { case FETI_DIRICHLET: KSPDestroy(&ksp_interior); - fetiDirichletPreconData.mat_lagrange_scaled = NULL; - fetiDirichletPreconData.mat_interior_interior = NULL; - fetiDirichletPreconData.mat_duals_duals = NULL; - fetiDirichletPreconData.mat_interior_duals = NULL; - fetiDirichletPreconData.mat_duals_interior = NULL; - fetiDirichletPreconData.ksp_interior = NULL; + fetiDirichletPreconData.mat_lagrange_scaled = nullptr; + fetiDirichletPreconData.mat_interior_interior = nullptr; + fetiDirichletPreconData.mat_duals_duals = nullptr; + fetiDirichletPreconData.mat_interior_duals = nullptr; + fetiDirichletPreconData.mat_duals_interior = nullptr; + fetiDirichletPreconData.ksp_interior = nullptr; VecDestroy(&fetiDirichletPreconData.tmp_vec_b); VecDestroy(&fetiDirichletPreconData.tmp_vec_duals0); @@ -1718,8 +1718,8 @@ namespace AMDiS { namespace Parallel { FetiLumpedPreconData &lumpedData = (stokesMode ? fetiInterfaceLumpedPreconData : fetiLumpedPreconData); - lumpedData.mat_lagrange_scaled = NULL; - lumpedData.mat_duals_duals = NULL; + lumpedData.mat_lagrange_scaled = nullptr; + lumpedData.mat_duals_duals = nullptr; VecDestroy(&lumpedData.tmp_vec_b0); VecDestroy(&lumpedData.tmp_vec_duals0); diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc index a60f874230b89d8d280abd601082737aefe256b4..7f81fe57241dc55d1a98305905fceb74715bf940 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc @@ -818,7 +818,7 @@ namespace AMDiS { namespace Parallel { PeriodicMap &perMap = meshDistributor->getPeriodicMap(); ParallelDofMapping *rowCoarseSpace = - (coarseSpaceMap.size() ? coarseSpaceMap[rowComp] : NULL); + (coarseSpaceMap.size() ? coarseSpaceMap[rowComp] : nullptr); map<DegreeOfFreedom, double> &dirichletValues = vec->getDirichletValues(); diff --git a/AMDiS/src/parallel/PetscSolverNSCH.cc b/AMDiS/src/parallel/PetscSolverNSCH.cc index 5f8be498b90a7998600907dcb763ed3154750010..cbeac6299597696270afba983959053843bc337a 100644 --- a/AMDiS/src/parallel/PetscSolverNSCH.cc +++ b/AMDiS/src/parallel/PetscSolverNSCH.cc @@ -129,16 +129,16 @@ namespace AMDiS { namespace Parallel { massSolutionMode(0), laplaceSolutionMode(0), regularizeLaplace(0), - massMatrixSolverCH(NULL), - laplaceMatrixSolverCH(NULL), - deltaKMatrixSolver(NULL), - massMatrixSolver(NULL), - laplaceMatrixSolver(NULL), - conDifMatrixSolver(NULL), - nu(NULL), - invTau(NULL), - solution(NULL), - phase(NULL) + massMatrixSolverCH(nullptr), + laplaceMatrixSolverCH(nullptr), + deltaKMatrixSolver(nullptr), + massMatrixSolver(nullptr), + laplaceMatrixSolver(nullptr), + conDifMatrixSolver(nullptr), + nu(nullptr), + invTau(nullptr), + solution(nullptr), + phase(nullptr) { Parameters::get(initFileStr + "->use old initial guess", useOldInitialGuess); @@ -290,9 +290,9 @@ namespace AMDiS { namespace Parallel { DOFMatrix conDifMatrix(pressureFeSpace, pressureFeSpace); { Operator conDifOp(pressureFeSpace, pressureFeSpace); - ZeroOrderTerm *conDif0 = NULL; - SecondOrderTerm *conDif1 = NULL; - FirstOrderTerm *conDif2 = NULL, *conDif3 = NULL, *conDif4 = NULL; + ZeroOrderTerm *conDif0 = nullptr; + SecondOrderTerm *conDif1 = nullptr; + FirstOrderTerm *conDif2 = nullptr, *conDif3 = nullptr, *conDif4 = nullptr; vp.interpol(solution->getDOFVector(dim+2)); densityFunctionTau = new LinearInterpolation(*rho1,*rho2,*invTau); @@ -411,13 +411,13 @@ namespace AMDiS { namespace Parallel { deltaKMatrixSolver->destroyVectorData(); delete massMatrixSolverCH; - massMatrixSolverCH = NULL; + massMatrixSolverCH = nullptr; delete laplaceMatrixSolverCH; - laplaceMatrixSolverCH = NULL; + laplaceMatrixSolverCH = nullptr; delete deltaKMatrixSolver; - deltaKMatrixSolver = NULL; + deltaKMatrixSolver = nullptr; massMatrixSolver->destroyMatrixData(); massMatrixSolver->destroyVectorData(); @@ -432,13 +432,13 @@ namespace AMDiS { namespace Parallel { delete massMatrixSolver; - massMatrixSolver = NULL; + massMatrixSolver = nullptr; delete laplaceMatrixSolver; - laplaceMatrixSolver = NULL; + laplaceMatrixSolver = nullptr; delete conDifMatrixSolver; - conDifMatrixSolver = NULL; + conDifMatrixSolver = nullptr; KSPDestroy(&(matShellContext.kspVelocity)); if (regularizeLaplace) diff --git a/AMDiS/src/parallel/PetscSolverNSCH.h b/AMDiS/src/parallel/PetscSolverNSCH.h index 2a6179f434b57fa98d879d79d6e1d7b265645dce..d86a1d59326db03c82f3f10d5e8880a62dde9fe7 100644 --- a/AMDiS/src/parallel/PetscSolverNSCH.h +++ b/AMDiS/src/parallel/PetscSolverNSCH.h @@ -122,7 +122,7 @@ namespace AMDiS { namespace Parallel { } - void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=NULL, double *nu2_=NULL, double *rho1_=NULL, double *rho2_=NULL) + void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=nullptr, double *nu2_=nullptr, double *rho1_=nullptr, double *rho2_=nullptr) { invTau = invTauPtr; solution = vec; diff --git a/AMDiS/src/parallel/PetscSolverNavierStokes.cc b/AMDiS/src/parallel/PetscSolverNavierStokes.cc index 00785d61a1473509066aa5fb9433c8f73954c58a..bc59a696480e724174eaa6d3548800125479fa77 100644 --- a/AMDiS/src/parallel/PetscSolverNavierStokes.cc +++ b/AMDiS/src/parallel/PetscSolverNavierStokes.cc @@ -61,12 +61,12 @@ namespace AMDiS { namespace Parallel { velocitySolutionMode(0), massSolutionMode(0), laplaceSolutionMode(0), - massMatrixSolver(NULL), - laplaceMatrixSolver(NULL), - nu(NULL), - invTau(NULL), - solution(NULL), - phase(NULL) + massMatrixSolver(nullptr), + laplaceMatrixSolver(nullptr), + nu(nullptr), + invTau(nullptr), + solution(nullptr), + phase(nullptr) { Parameters::get(initFileStr + "->navierstokes->pressure component", pressureComponent); @@ -119,7 +119,10 @@ namespace AMDiS { namespace Parallel { MSG("CREATE POS 1: %p\n", &ksp); KSPCreate(domainComm, &ksp); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); - KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); + if (getInfo() >= 10) + KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); + else if (getInfo() >= 20) + KSPMonitorSet(ksp, KSPMonitorTrueResidualNorm, PETSC_NULL, PETSC_NULL); petsc_helper::setSolver(ksp, "ns_", KSPFGMRES, PCNONE, getRelative(), getTolerance(), getMaxIterations()); // Create null space information. @@ -196,7 +199,7 @@ namespace AMDiS { namespace Parallel { DOFMatrix massMatrix(pressureFeSpace, pressureFeSpace); { Operator massOp(pressureFeSpace, pressureFeSpace); - ZeroOrderTerm *massTerm = NULL; + ZeroOrderTerm *massTerm = nullptr; if ((!phase) || (*nu == 0.0)) massTerm = new Simple_ZOT; else @@ -214,7 +217,7 @@ namespace AMDiS { namespace Parallel { DOFMatrix laplaceMatrix(pressureFeSpace, pressureFeSpace); { Operator laplaceOp(pressureFeSpace, pressureFeSpace); - SecondOrderTerm *laplaceTerm = NULL; + SecondOrderTerm *laplaceTerm = nullptr; if ((!phase) || (*nu == 0.0)) laplaceTerm = new Simple_SOT; else @@ -244,9 +247,9 @@ namespace AMDiS { namespace Parallel { { Operator conDifOp(pressureFeSpace, pressureFeSpace); - ZeroOrderTerm *conDif0 = NULL; - SecondOrderTerm *conDif1 = NULL; - FirstOrderTerm *conDif2 = NULL, *conDif3 = NULL, *conDif4 = NULL; + ZeroOrderTerm *conDif0 = nullptr; + SecondOrderTerm *conDif1 = nullptr; + FirstOrderTerm *conDif2 = nullptr, *conDif3 = nullptr, *conDif4 = nullptr; if (!phase) { MSG("INIT WITHOUT PHASE!\n"); @@ -255,14 +258,14 @@ namespace AMDiS { namespace Parallel { conDifOp.addTerm(conDif0); conDif1 = new Simple_SOT(*nu); conDifOp.addTerm(conDif1); - conDif2 = new VecAtQP_FOT(&vx, NULL, 0); + conDif2 = new VecAtQP_FOT(&vx, nullptr, 0); conDifOp.addTerm(conDif2, GRD_PHI); if (dim >= 2) { - conDif3 = new VecAtQP_FOT(&vy, NULL, 1); + conDif3 = new VecAtQP_FOT(&vy, nullptr, 1); conDifOp.addTerm(conDif3, GRD_PHI); } if (dim == 3) { - conDif4 = new VecAtQP_FOT(&vz, NULL, 2); + conDif4 = new VecAtQP_FOT(&vz, nullptr, 2); conDifOp.addTerm(conDif4, GRD_PHI); } } else { // no phase given @@ -270,19 +273,19 @@ namespace AMDiS { namespace Parallel { vp.interpol(phase); if (*nu > 0.0) { - conDif0 = new VecAtQP_ZOT(&vp, NULL, *invTau); + conDif0 = new VecAtQP_ZOT(&vp, nullptr, *invTau); conDifOp.addTerm(conDif0); - conDif1 = new VecAtQP_SOT(&vp, NULL, *nu); + conDif1 = new VecAtQP_SOT(&vp, nullptr, *nu); conDifOp.addTerm(conDif1); - conDif2 = new Vec2AtQP_FOT(&vx, &vp, NULL, 0); + conDif2 = new Vec2AtQP_FOT(&vx, &vp, nullptr, 0); conDifOp.addTerm(conDif2, GRD_PHI); if (dim >= 2) { - conDif3 = new Vec2AtQP_FOT(&vy, &vp, NULL, 1); + conDif3 = new Vec2AtQP_FOT(&vy, &vp, nullptr, 1); conDifOp.addTerm(conDif3, GRD_PHI); } if (dim == 3) { - conDif4 = new Vec2AtQP_FOT(&vz, &vp, NULL, 2); + conDif4 = new Vec2AtQP_FOT(&vz, &vp, nullptr, 2); conDifOp.addTerm(conDif4, GRD_PHI); } } else { @@ -344,7 +347,7 @@ namespace AMDiS { namespace Parallel { KSPRICHARDSON, PCHYPRE, 0.0, 1e-14, 1); break; case 1: - petsc_helper::setSolverWithLu(matShellContext.kspLaplace, "mass_", + petsc_helper::setSolverWithLu(matShellContext.kspLaplace, "laplace_", KSPRICHARDSON, PCLU, MATSOLVERMUMPS, 0.0, 1e-14, 1); break; @@ -376,12 +379,12 @@ namespace AMDiS { namespace Parallel { delete massMatrixSolver; - massMatrixSolver = NULL; + massMatrixSolver = nullptr; delete laplaceMatrixSolver; - laplaceMatrixSolver = NULL; + laplaceMatrixSolver = nullptr; delete conDifMatrixSolver; - conDifMatrixSolver = NULL; + conDifMatrixSolver = nullptr; } } } diff --git a/AMDiS/src/parallel/PetscSolverNavierStokes.h b/AMDiS/src/parallel/PetscSolverNavierStokes.h index c32955f15aed70b081dc69568d2e0dc677a8b2b9..d12f45281c0d05b088a2af9446136b367b13cadb 100644 --- a/AMDiS/src/parallel/PetscSolverNavierStokes.h +++ b/AMDiS/src/parallel/PetscSolverNavierStokes.h @@ -115,7 +115,7 @@ namespace AMDiS { namespace Parallel { void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo); - void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=NULL, double *nu2_=NULL, double *rho1_=NULL, double *rho2_=NULL) + void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=nullptr, double *nu2_=nullptr, double *rho1_=nullptr, double *rho2_=nullptr) { nu = new double; (*nu) = 0.0; diff --git a/AMDiS/src/parallel/ZoltanPartitioner.cc b/AMDiS/src/parallel/ZoltanPartitioner.cc index e57a07dd6eab201498d6aea24892b2d79f8678e6..917f00534fcb7da233b7722561432c2f137f4ca4 100644 --- a/AMDiS/src/parallel/ZoltanPartitioner.cc +++ b/AMDiS/src/parallel/ZoltanPartitioner.cc @@ -31,7 +31,7 @@ namespace AMDiS { namespace Parallel { MPI::Intracomm *comm) : MeshPartitioner(name, comm), zoltan(*comm), - elWeights(NULL) + elWeights(nullptr) {} @@ -158,7 +158,7 @@ namespace AMDiS { namespace Parallel { &import_procs, &import_to_part); zoltan.LB_Free_Part(&export_global_ids, &export_local_ids, &export_procs, &export_to_part); - elWeights = NULL; + elWeights = nullptr; if (err != ZOLTAN_OK) return false; diff --git a/AMDiS/src/reinit/BoundaryElementTopDist.cc b/AMDiS/src/reinit/BoundaryElementTopDist.cc index f4828de3444eabcd0a034edbddf88679f75cab9e..bc4034acb2f55f28f64f9ec3bb036feb4c37b20c 100644 --- a/AMDiS/src/reinit/BoundaryElementTopDist.cc +++ b/AMDiS/src/reinit/BoundaryElementTopDist.cc @@ -104,7 +104,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_2D_boundary(SP_Vec[0], SP_Vec[1], SP_Vec[2], i); } @@ -141,7 +141,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_2D_boundary( (*elIntersecPoints)[edgeUpdateInd][0], @@ -190,7 +190,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_3D_boundary(SP_Vec[0], SP_Vec[1], SP_Vec[2], SP_Vec[3], i); } @@ -210,14 +210,14 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != NULL) + if (velExt != nullptr) { sP1NextEdge = j; sP2NextEdge = (j+1)%3; lambdaNextPt = lambda; } } - // if (velExt != NULL) { + // if (velExt != nullptr) { // sP1NextEdge = j; // sP2NextEdge = (j+1)%3; // lambdaNextPt = lambda; @@ -226,7 +226,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->calcBarycentricCoords_3D_boundary( (*elIntersecPoints)[sP1NextEdge], @@ -246,7 +246,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( lambda); // dist = (dist < h_dist) ? dist : h_dist; -// if (velExt != NULL) { +// if (velExt != nullptr) { // sP1NextEdge = j; // sP2NextEdge = (j+2)%3; // lambdaNextPt = lambda; @@ -254,7 +254,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != NULL) + if (velExt != nullptr) { sP1NextEdge = j; sP2NextEdge = (j+2)%3; @@ -269,7 +269,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( lambda); // dist = (dist < h_dist) ? dist : h_dist; -// if (velExt != NULL) { +// if (velExt != nullptr) { // sP1NextEdge = 1; // sP2NextEdge = 2; // lambdaNextPt = lambda; @@ -277,7 +277,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != NULL) + if (velExt != nullptr) { sP1NextEdge = 1; sP2NextEdge = 2; @@ -291,7 +291,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( lambda); // dist = (dist < h_dist) ? dist : h_dist; -// if (velExt != NULL) { +// if (velExt != nullptr) { // sP1NextEdge = 0; // sP2NextEdge = 3; // lambdaNextPt = lambda; @@ -299,7 +299,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != NULL) + if (velExt != nullptr) { sP1NextEdge = 0; sP2NextEdge = 3; @@ -310,7 +310,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->calcBarycentricCoords_3D_boundary( (*elIntersecPoints)[sP1NextEdge], diff --git a/AMDiS/src/reinit/BoundaryElementTopDist.h b/AMDiS/src/reinit/BoundaryElementTopDist.h index 6bf4dd6df88037fe848fbb0dec4e1cd825db10f3..311d94a4922d8db3c05dc48476d4484b04347cd0 100644 --- a/AMDiS/src/reinit/BoundaryElementTopDist.h +++ b/AMDiS/src/reinit/BoundaryElementTopDist.h @@ -37,7 +37,7 @@ class BoundaryElementTopDist : public BoundaryElementDist public: BoundaryElementTopDist(ElementLevelSet *elLS_, int dim_, - VelocityExt *velExt_ = NULL) + VelocityExt *velExt_ = nullptr) : BoundaryElementDist(elLS_, dim_), velExt(velExt_) {} diff --git a/AMDiS/src/reinit/ElementLevelSet.cc b/AMDiS/src/reinit/ElementLevelSet.cc index 2256d0df29767037dd5e637eecec3b554b799b41..db7173e721116eeea7964edcc42c5f978e19324b 100644 --- a/AMDiS/src/reinit/ElementLevelSet.cc +++ b/AMDiS/src/reinit/ElementLevelSet.cc @@ -28,7 +28,7 @@ ElementLevelSet::createElementLevelSet(const ElInfo *elInfo_, { Element *el = elInfo_->getElement(); - if (elInfo == NULL || el != lastEl) { + if (elInfo == nullptr || el != lastEl) { /** * Element has changed. New calculation. */ diff --git a/AMDiS/src/reinit/ElementLevelSet.h b/AMDiS/src/reinit/ElementLevelSet.h index 1b3b21e67e8d49f08969d50b6d7b0c21de4a9f0b..0bd8358d881402aeca2d31bcacc84c844fe03237 100644 --- a/AMDiS/src/reinit/ElementLevelSet.h +++ b/AMDiS/src/reinit/ElementLevelSet.h @@ -79,8 +79,8 @@ class ElementLevelSet ElementFunction<double> *lSFct_, Mesh *mesh_) : name(name_), - elInfo(NULL), - lastEl(NULL), + elInfo(nullptr), + lastEl(nullptr), level_set_domain(LEVEL_SET_UNDEFINED), numIntersecPoints(0), elStatus(LEVEL_SET_UNDEFINED), diff --git a/AMDiS/src/reinit/ElementUpdate_2d.cc b/AMDiS/src/reinit/ElementUpdate_2d.cc index a0c95284561f6c7b7a90798d3b359b8a0202588f..8c17c1da7892a659a98b33da07e9ef53db759f7e 100644 --- a/AMDiS/src/reinit/ElementUpdate_2d.cc +++ b/AMDiS/src/reinit/ElementUpdate_2d.cc @@ -49,19 +49,19 @@ double ElementUpdate_2d::calcElementUpdate(const FixVec<WorldVector<double> *, V if (c_alpha <= delta) { update = uhVal[0] + norm_xhminusYh; //save barycentric coordinates for calculation of the velocity - if (velExt != NULL) + if (velExt != nullptr) velExt->setBarycentricCoords_2D(1,0,0); } else if (delta <= -c_beta) { update = uhVal[1] + norm_xhminusZh; //save barycentric coordinates for calculation of the velocity - if (velExt != NULL) + if (velExt != nullptr) velExt->setBarycentricCoords_2D(0,1,0); } else { update = uhVal[0] + (c_alpha * delta + sqrt((1 - c_alpha * c_alpha) * (1 - delta * delta))) * norm_xhminusYh; //calculate and save barycentric coordinates for calculation of the velocity - if (velExt != NULL) + if (velExt != nullptr) velExt->calcBarycentricCoords_2D(delta, c_alpha, norm_zhminusYh, norm_xhminusYh); } diff --git a/AMDiS/src/reinit/ElementUpdate_2d.h b/AMDiS/src/reinit/ElementUpdate_2d.h index 6b16e201b32198e6c43bb65936ac9afa31dbbb0d..4d93e1de928d70fe972a28096f312103b2bbe475 100644 --- a/AMDiS/src/reinit/ElementUpdate_2d.h +++ b/AMDiS/src/reinit/ElementUpdate_2d.h @@ -33,7 +33,7 @@ using namespace AMDiS; class ElementUpdate_2d : public ElementUpdate { public: - ElementUpdate_2d(VelocityExt *velExt_ = NULL) + ElementUpdate_2d(VelocityExt *velExt_ = nullptr) : ElementUpdate(velExt_) {} diff --git a/AMDiS/src/reinit/ElementUpdate_3d.cc b/AMDiS/src/reinit/ElementUpdate_3d.cc index ee513d663e4dfd543c6a062939c1a972c66fae05..ff755ace602e22c76c30aef035ef12b60d41e53a 100644 --- a/AMDiS/src/reinit/ElementUpdate_3d.cc +++ b/AMDiS/src/reinit/ElementUpdate_3d.cc @@ -85,7 +85,7 @@ ElementUpdate_3d::calcElementUpdate( case VERT_A: // minimizing point is vertex A update = uhVal[0] + sqrt(*(vert[3]) * *(vert[3])); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_3D(1,0,0,0); } @@ -95,7 +95,7 @@ ElementUpdate_3d::calcElementUpdate( tmpVec = (*(vert[3])) - (*(vert[1])); update = uhVal[1] + sqrt(tmpVec * tmpVec); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_3D(0,1,0,0); } @@ -105,7 +105,7 @@ ElementUpdate_3d::calcElementUpdate( tmpVec = (*(vert[3])) - (*(vert[2])); update = uhVal[2] + sqrt(tmpVec * tmpVec); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_3D(0,0,1,0); } @@ -115,7 +115,7 @@ ElementUpdate_3d::calcElementUpdate( update = calcFaceUpdate(vert[0], vert[1], vert[3], uhVal[0], uhVal[1]); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->copyAndExpandFaceCoords_3D(2,0); } @@ -125,7 +125,7 @@ ElementUpdate_3d::calcElementUpdate( update = calcFaceUpdate(vert[0], vert[2], vert[3], uhVal[0], uhVal[2]); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->copyAndExpandFaceCoords_3D(1,0); } @@ -135,7 +135,7 @@ ElementUpdate_3d::calcElementUpdate( update = calcFaceUpdate(vert[1], vert[2], vert[3], uhVal[1], uhVal[2]); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->copyAndExpandFaceCoords_3D(0,0); } @@ -157,7 +157,7 @@ ElementUpdate_3d::calcElementUpdate( uhVal[0], uhVal[1]); //set barycentric coordinats for calculation of the velocity //save index of element face - if(velExt != NULL) + if(velExt != nullptr) { velExt->copyAndExpandFaceCoords_3D(2,1); velExt->setIndexFaceWithShortestDist(1); @@ -165,14 +165,14 @@ ElementUpdate_3d::calcElementUpdate( tmp_update = calcFaceUpdate(vert[0], vert[2], vert[3], uhVal[0], uhVal[2]); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->copyAndExpandFaceCoords_3D(1,2); } if (tmp_update < update) { update = tmp_update; //save index of element face, if diatance is shorter - if(velExt != NULL) + if(velExt != nullptr) { velExt->setIndexFaceWithShortestDist(2); } @@ -180,14 +180,14 @@ ElementUpdate_3d::calcElementUpdate( tmp_update = calcFaceUpdate(vert[1], vert[2], vert[3], uhVal[1], uhVal[2]); //set barycentric coordinats for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->copyAndExpandFaceCoords_3D(0,3); } if (tmp_update < update) { update = tmp_update; //save index of element face, if distance is shorter - if(velExt != NULL) + if(velExt != nullptr) { velExt->setIndexFaceWithShortestDist(3); } @@ -222,7 +222,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[0] = uhVal[2]; uhVal[2] = tmpVal; //save permutation of vertices - if(velExt != NULL) + if(velExt != nullptr) { velExt->swapVertices(0,2); } @@ -239,7 +239,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[1] = uhVal[2]; uhVal[2] = tmpVal; //save permutation of vertices - if(velExt != NULL) + if(velExt != nullptr) { velExt->swapVertices(0,1); velExt->swapVertices(2,1); @@ -255,7 +255,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[0] = uhVal[1]; uhVal[1] = tmpVal; //save permutation of vertices - if(velExt != NULL) + if(velExt != nullptr) { velExt->swapVertices(0,1); } @@ -275,7 +275,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[2] = uhVal[1]; uhVal[1] = tmpVal; //save permutation of vertices - if(velExt != NULL) + if(velExt != nullptr) { velExt->swapVertices(0,2); velExt->swapVertices(1,2); @@ -291,7 +291,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[1] = uhVal[2]; uhVal[2] = tmpVal; //save permutation of vertices - if(velExt != NULL) + if(velExt != nullptr) { velExt->swapVertices(1,2); } @@ -535,7 +535,7 @@ ElementUpdate_3d::calcPosition(const WorldVector<double> &B2, l_A = 1-l_B2-l_C2; //save barycentric coordinates for calculation of the velocity - if(velExt != NULL) + if(velExt != nullptr) { velExt->setBarycentricCoords_3D(l_A,l_B2,l_C2,0); } diff --git a/AMDiS/src/reinit/ElementUpdate_3d.h b/AMDiS/src/reinit/ElementUpdate_3d.h index 15ae39e28385099dfb4d57d3710ea6c600fa9be9..dd2a06c763ddb963d7e27dd48bba9854f7dc01b6 100644 --- a/AMDiS/src/reinit/ElementUpdate_3d.h +++ b/AMDiS/src/reinit/ElementUpdate_3d.h @@ -34,7 +34,7 @@ using namespace AMDiS; class ElementUpdate_3d : public ElementUpdate { public: - ElementUpdate_3d(VelocityExt *velExt_ = NULL) + ElementUpdate_3d(VelocityExt *velExt_ = nullptr) : ElementUpdate(velExt_) { elUpdate2d = new ElementUpdate_2d(velExt_); diff --git a/AMDiS/src/reinit/HL_SignedDist.cc b/AMDiS/src/reinit/HL_SignedDist.cc index 2e863c8aa91b0152e64dcee8f046cb7b3428394e..52072084cea0ac43a92a89fcc247c54f2f8782af 100644 --- a/AMDiS/src/reinit/HL_SignedDist.cc +++ b/AMDiS/src/reinit/HL_SignedDist.cc @@ -31,7 +31,7 @@ void HL_SignedDist::calcSignedDistFct(AdaptInfo *adaptInfo_, { adaptInfo = adaptInfo_; - if (elFct == NULL) { + if (elFct == nullptr) { TEST_EXIT(lS_DOF_)("illegal level set function !\n"); TEST_EXIT(lS_DOF_->getFeSpace() == sD_DOF_->getFeSpace())("DOF vectors do not have the same FE space!\n"); } @@ -65,7 +65,7 @@ void HL_SignedDist::calcSignedDistFct(AdaptInfo *adaptInfo_, HL_updateIteration(); // ===== Transformation to signed distance function. ===== - if (elFct == NULL) + if (elFct == nullptr) setSign(); // ===== Print calculated signed distance function. ===== @@ -79,7 +79,7 @@ void HL_SignedDist::calcSignedDistFct(AdaptInfo *adaptInfo_, DOFVector<double> * sD_DOF = new DOFVector<double>(lS_DOF_->getFeSpace(), "sD_DOF"); - calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF, NULL); + calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF, nullptr); *lS_DOF_ = *sD_DOF; @@ -102,7 +102,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct || sD_DOF_ != NULL) { + if (calcSDFct || sD_DOF_ != nullptr) { calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF_, elFct); } else { @@ -140,7 +140,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct && elFct == NULL) { + if (calcSDFct && elFct == nullptr) { calcSignedDistFct(adaptInfo_, lS_DOF_); } else { sD_DOF = new DOFVector<double>(vel_DOF_->getFeSpace(), "sD_DOF"); @@ -176,7 +176,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct || sD_DOF_ != NULL) { + if (calcSDFct || sD_DOF_ != nullptr) { calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF_, elFct); } else { @@ -219,7 +219,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct && elFct == NULL) { + if (calcSDFct && elFct == nullptr) { calcSignedDistFct(adaptInfo_, lS_DOF_); } else { sD_DOF = new DOFVector<double>(vel_DOF_[0]->getFeSpace(), "sD_DOF"); @@ -253,7 +253,7 @@ void HL_SignedDist::calcVelocityExtFromVelocityField(AdaptInfo *adaptInfo_, TEST_EXIT(velExtType.isSet(VEL_EXT_FROM_VEL_FIELD)) ("illegal velocity extension type !\n"); TEST_EXIT(velExt)("velExt not defined !\n"); - TEST_EXIT(elFct == NULL)("not implemented yet for elFct != NULL !\n"); + TEST_EXIT(elFct == nullptr)("not implemented yet for elFct != nullptr !\n"); ((VelocityExtFromVelocityField *)(velExt))->setVelocityField(velField_, lS_DOF_, vel_DOF_); @@ -284,7 +284,7 @@ void HL_SignedDist::calcVelocityExtFromVelocityField(AdaptInfo *adaptInfo_, TEST_EXIT(velExtType.isSet(VEL_EXT_FROM_VEL_FIELD)) ("illegal velocity extension type !\n"); TEST_EXIT(velExt)("velExt not defined !\n"); - TEST_EXIT(elFct == NULL)("not implemented yet for elFct != NULL !\n"); + TEST_EXIT(elFct == nullptr)("not implemented yet for elFct != nullptr !\n"); if (calcSDFct) { TEST_EXIT(lS_DOF_)("illegal level set function lS_DOF_ !\n"); @@ -292,7 +292,7 @@ void HL_SignedDist::calcVelocityExtFromVelocityField(AdaptInfo *adaptInfo_, ((VelocityExtFromVelocityField *)(velExt))->setVelocityField(velField_, lS_DOF_, vel_DOF_); - if (calcSDFct && elFct == NULL) { + if (calcSDFct && elFct == nullptr) { calcSignedDistFct(adaptInfo_, lS_DOF_); } else { @@ -325,7 +325,7 @@ void HL_SignedDist::initialize(ElementFunction<double> *elFct) delete phi; // ===== Create ElementLevelSet. ===== - if (elFct == NULL) { + if (elFct == nullptr) { phi = new ElementFunctionDOFVec<double>(lS_DOF); elLS = new ElementLevelSet("ElementLevelSet", phi, feSpace->getMesh()); } else { @@ -355,7 +355,7 @@ void HL_SignedDist::initialize(ElementFunction<double> *elFct) } // ===== Create elUpdate. ===== - TEST_EXIT(velExt == NULL || boundInitFlag == 1) + TEST_EXIT(velExt == nullptr || boundInitFlag == 1) ("velocity extension only works with topological boundary element initialization method !\n"); switch (dim) { diff --git a/AMDiS/src/reinit/HL_SignedDist.h b/AMDiS/src/reinit/HL_SignedDist.h index 9f40242351bb710d3fd00aebf9a9da0674c7ee13..09c0ce703be807cbe5daba30655e2dea3e29c19f 100644 --- a/AMDiS/src/reinit/HL_SignedDist.h +++ b/AMDiS/src/reinit/HL_SignedDist.h @@ -67,17 +67,17 @@ public: bool doVelocityExt = false, Flag velExtType_ = VEL_EXT) : name(name_), - adaptInfo(NULL), + adaptInfo(nullptr), dim(dim_), - lS_DOF(NULL), - sD_DOF(NULL), - bound_DOF(NULL), - feSpace(NULL), - elUpdate(NULL), - bndElDist(NULL), - elLS(NULL), - phi(NULL), - velExt(NULL), + lS_DOF(nullptr), + sD_DOF(nullptr), + bound_DOF(nullptr), + feSpace(nullptr), + elUpdate(nullptr), + bndElDist(nullptr), + elLS(nullptr), + phi(nullptr), + velExt(nullptr), velExtType(velExtType_) { FUNCNAME("HL_SignedDist::HL_SignedDist"); @@ -125,13 +125,13 @@ public: * is stored in sD_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcSignedDistFct(AdaptInfo *adaptInfo_, const DOFVector<double> *lS_DOF_, DOFVector<double> *sD_DOF_, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Calculates the signed distance function for the interface given @@ -150,7 +150,7 @@ public: * stored in sD_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AdaptInfo *adaptInfo_, @@ -159,7 +159,7 @@ public: const DOFVector<double> *lS_DOF_, DOFVector<double> *sD_DOF_, bool calcSDFct, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Calculates the extension of a velocity vel_DOF_ from the interface @@ -170,14 +170,14 @@ public: * anyway, is stored in lS_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AdaptInfo *adaptInfo_, DOFVector<double> *vel_DOF_, DOFVector<double> *lS_DOF_, bool calcSDFct, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Calculates the extension of the velocity vectors in origVel_DOF_ @@ -189,7 +189,7 @@ public: * stored in sD_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AdaptInfo *adaptInfo_, @@ -198,7 +198,7 @@ public: const DOFVector<double> *lS_DOF_, DOFVector<double> *sD_DOF_, bool calcSDFct, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Calculates the extension of the velocity vectors in vel_DOF_ @@ -209,14 +209,14 @@ public: * during the extension of the velocity anyway, is stored in lS_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AdaptInfo *adaptInfo_, std::vector<DOFVector<double> *> vel_DOF_, DOFVector<double> *lS_DOF_, bool calcSDFct, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Calculates the normal velocity for the velocity field velField_ and its @@ -228,7 +228,7 @@ public: * stored in sD_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExtFromVelocityField( @@ -238,7 +238,7 @@ public: const DOFVector<double> *lS_DOF_, DOFVector<double> *sD_DOF_, bool calcSDFct, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Calculates the normal velocity for the velocity field velField_ and its @@ -250,7 +250,7 @@ public: * stored in lS_DOF_. * * Alternative to level set function as DOF vector: - * If elFct != NULL, this ElementFunction is used as level set function. + * If elFct != nullptr, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExtFromVelocityField( @@ -259,7 +259,7 @@ public: DOFVector<double> *vel_DOF_, DOFVector<double> *lS_DOF_, bool calcSDFct, - ElementFunction<double> *elFct = NULL); + ElementFunction<double> *elFct = nullptr); /** * Print initial function: level set function defining the interface. @@ -293,7 +293,7 @@ public: /** * Initialization. */ - virtual void initialize(ElementFunction<double> *elFct = NULL); + virtual void initialize(ElementFunction<double> *elFct = nullptr); /** * Initializes the boundary: calculation of the distance of boundary diff --git a/AMDiS/src/reinit/HL_SignedDistBornemann.h b/AMDiS/src/reinit/HL_SignedDistBornemann.h index a801064c4a5897b13e1be96911ee51d9f8c1873b..724555a5d79028286a6037b071dccc4f9b831061 100644 --- a/AMDiS/src/reinit/HL_SignedDistBornemann.h +++ b/AMDiS/src/reinit/HL_SignedDistBornemann.h @@ -52,7 +52,7 @@ class HL_SignedDistBornemann : public HL_SignedDist public: HL_SignedDistBornemann(const char *name_,int dim_) : HL_SignedDist(name_, dim_), - smiAdapter(NULL) + smiAdapter(nullptr) { FUNCNAME("HL_SignedDistBornemann::HL_SignedDistBornemann"); @@ -324,7 +324,7 @@ public: { sv[i] = 1; } - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),NULL,&nodeIndices,NULL,NULL); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),nullptr,&nodeIndices,nullptr,nullptr); SMI_Set_quantity_values(1,1,2,SMI_TYPE_INT,1,3,nodeIndices,sv); } //if the elemet isn't a boundary-element, but the interface cuts the FE in two nodes @@ -335,7 +335,7 @@ public: if (elVertStatusVec[i] == ElementLevelSet::LEVEL_SET_BOUNDARY && elVertStatusVec[(i+1)%3] ==ElementLevelSet::LEVEL_SET_BOUNDARY) { value = 1; - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),NULL,&nodeIndices,NULL,NULL); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),nullptr,&nodeIndices,nullptr,nullptr); SMI_Set_quantity_values(1,1,2,SMI_TYPE_INT,1,1,const_cast<DegreeOfFreedom*>(&nodeIndices[i]),&value); SMI_Set_quantity_values(1,1,2,SMI_TYPE_INT,1,1,const_cast<DegreeOfFreedom*>(&nodeIndices[(i+1)%3]),&value); @@ -404,7 +404,7 @@ public: for ( int i=0; i<=dim; i++) { - SMI_Get_elems(1,1,1,&neighbour[i],NULL,&nodeIndices, NULL,NULL); + SMI_Get_elems(1,1,1,&neighbour[i],nullptr,&nodeIndices, nullptr,nullptr); SMI_Get_quantity_values(1,1,1,SMI_TYPE_INT,dim+1,1,&neighbour[i],value); SMI_Get_quantity_values(1,1,2,SMI_TYPE_INT,1,1,&nodeIndices[oppVertices[i]],&value_q2); if (value[oppVertices[i]] == 0 && value_q2 == 0) @@ -451,7 +451,7 @@ public: smiAdapter->getNeighbourInfo(ElNum_in, neighbour,oppVertices); //which local node is the node "VertNum_in"? - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_in)),NULL,&nodeIndicesOfElem, NULL, NULL); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_in)),nullptr,&nodeIndicesOfElem, nullptr, nullptr); for (int i=0; i<=dim; i++) { if(nodeIndicesOfElem[i] == VertNum_in) @@ -464,7 +464,7 @@ public: - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_out)),NULL,&nodeIndicesOfElem, NULL, NULL); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_out)),nullptr,&nodeIndicesOfElem, nullptr, nullptr); VertNum_1_out = nodeIndicesOfElem [oppVertices[locVertNum]]; for (int i=0; i<=dim; i++) { @@ -509,7 +509,7 @@ public: SMI_Get_quantity_values(1,1,1,SMI_TYPE_INT,dim+1,1,const_cast<DegreeOfFreedom*>(&ElNum_in),valuesINT); //which locla node is the node VerNum_1_in, which one is the node VertNum_2_in? - SMI_Get_elems (1, 1, 1, &ElNum_in, NULL, &nodeIndices, NULL, NULL); + SMI_Get_elems (1, 1, 1, &ElNum_in, nullptr, &nodeIndices, nullptr, nullptr); for (int i=0; i<=dim; i++) { if(nodeIndices[i] == VertNum_1_in) @@ -575,7 +575,7 @@ public: { int *nodeIndicesOfElem; - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&elem_l_r_in),NULL,&nodeIndicesOfElem, NULL, NULL); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&elem_l_r_in),nullptr,&nodeIndicesOfElem, nullptr, nullptr); for (int i=0; i<=dim; i++) { if(nodeIndicesOfElem[i] != Vert && nodeIndicesOfElem[i] != node_l_r_in) @@ -630,7 +630,7 @@ public: El_Vert = List_El_Vert.front(); Vert = El_Vert.VertNum; - SMI_Get_elems (1, 1, 1, &(El_Vert.ElNum), NULL, &(nodeIndices), NULL, NULL); + SMI_Get_elems (1, 1, 1, &(El_Vert.ElNum), nullptr, &(nodeIndices), nullptr, nullptr); SMI_Get_nodes (1, 1, 3, dim, nodeIndices, coords); counter = 0; diff --git a/AMDiS/src/reinit/HL_SignedDistTraverse.cc b/AMDiS/src/reinit/HL_SignedDistTraverse.cc index 52c556ca8099b6b17be7dcc04d8305ded11b2ad8..0d34d22fdad81cefabc23d351f1db90632bcb7ff 100644 --- a/AMDiS/src/reinit/HL_SignedDistTraverse.cc +++ b/AMDiS/src/reinit/HL_SignedDistTraverse.cc @@ -98,7 +98,7 @@ void HL_SignedDistTraverse::initializeBoundary() if ((*sD_DOF)[locInd[i]] > distVec[i]) { (*sD_DOF)[locInd[i]] = distVec[i]; //If Distance is corrected, calculate new velocity. - if (velExt != NULL) + if (velExt != nullptr) velExt->calcVelocityBoundary(&(locInd[0]), i); } } @@ -179,7 +179,7 @@ void HL_SignedDistTraverse::HL_elementUpdate(ElInfo *elInfo) // ===== Calculate update for non-boundary vertex. ===== if ((*bound_DOF)[locInd[i]] < 1.e-15) { //save permutation of vertexes for calculation of the velocity - if (velExt != NULL) + if (velExt != nullptr) velExt->setPermutation(i, 1); double update = calcElementUpdate(elInfo, i, &(locInd[0])); @@ -193,7 +193,7 @@ void HL_SignedDistTraverse::HL_elementUpdate(ElInfo *elInfo) (*sD_DOF)[locInd[i]] = update; // If Distance is corrected, calculate new velocity. - if(velExt != NULL) + if(velExt != nullptr) velExt->calcVelocity(&(locInd[0]), i); // ---> for test purposes: count number of calculated updates diff --git a/AMDiS/src/reinit/HL_SignedDistTraverse.h b/AMDiS/src/reinit/HL_SignedDistTraverse.h index 534fad708526abded5ae01be9f217b1bab51689d..ec348ef43534108d456e0c9f6da318b67b2d7997 100644 --- a/AMDiS/src/reinit/HL_SignedDistTraverse.h +++ b/AMDiS/src/reinit/HL_SignedDistTraverse.h @@ -46,8 +46,8 @@ public: bool doVelocityExt = false, Flag velExtType_ = VEL_EXT) : HL_SignedDist(name_, dim_, doVelocityExt, velExtType_), - sDOld_DOF(NULL), - update_DOF(NULL), + sDOld_DOF(nullptr), + update_DOF(nullptr), tol_reached(false), elVert(dim_, NO_INIT), uhVal(dim_, NO_INIT) diff --git a/AMDiS/src/reinit/VelocityExtFromVelocityField.h b/AMDiS/src/reinit/VelocityExtFromVelocityField.h index 6f9f21afdae4fc9e9ba4b7151c1c1f92bea106b3..758003703752eb44274fa5917ef9f2fb3675b9d9 100644 --- a/AMDiS/src/reinit/VelocityExtFromVelocityField.h +++ b/AMDiS/src/reinit/VelocityExtFromVelocityField.h @@ -42,9 +42,9 @@ public: VelocityExtFromVelocityField(int dim_) : VelocityExt(dim_), - lSFct(NULL), + lSFct(nullptr), elNormalVel(dim_, NO_INIT), - basFcts(NULL) + basFcts(nullptr) { lSFctVal.change_dim(dim + 1); diff --git a/AMDiS/src/solver/HypreSolver.h b/AMDiS/src/solver/HypreSolver.h index fb0c51340aac4a0dccd4eaebdc4a5ca580110c6a..fe1a6e8558cc7b6abb86c1cd4b8c4c3efc94ddac 100644 --- a/AMDiS/src/solver/HypreSolver.h +++ b/AMDiS/src/solver/HypreSolver.h @@ -37,7 +37,7 @@ namespace AMDiS { - struct Hypre_Runner : MTL4Runner< MTLTypes::MTLMatrix, MTLTypes::MTLVector > + struct Hypre_Runner : public MTL4Runner< MTLTypes::MTLMatrix, MTLTypes::MTLVector > { typedef MTLTypes::MTLMatrix MatrixType; typedef MTLTypes::MTLVector VectorType; @@ -45,7 +45,7 @@ namespace AMDiS { Hypre_Runner(LinearSolver* oemPtr) : oem(*oemPtr), - solver(NULL) + solver(nullptr) { int cycleMode = 1, interpolation = 0; Parameters::get(oem.getName() + "->cycle mode", cycleMode); @@ -62,26 +62,29 @@ namespace AMDiS { { if (solver) { delete solver; - solver = NULL; + solver = nullptr; } } - virtual void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix) + /// Implementation of \ref MTL4Runner::init() + void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix) override { solver = new mtl::HypreSolverWrapper(fullMatrix); } - virtual int solve(const MatrixType& A , VectorType& x, const VectorType& b) + /// Implementation of \ref MTL4Runner::solve() + int solve(const MatrixType& A , VectorType& x, const VectorType& b) override { int error = (*solver)(x, b, config); return error; } - virtual void exit() + /// Implementation of \ref OEMRunner::exit() + void exit() { if (solver) { delete solver; - solver = NULL; + solver = nullptr; } } diff --git a/AMDiS/src/solver/ITL_Preconditioner.h b/AMDiS/src/solver/ITL_Preconditioner.h index 992af0a4de99cb1d709d23458aaf726a868cdf3f..86ac020a32190cd88366f15db2dc787121c2b539 100644 --- a/AMDiS/src/solver/ITL_Preconditioner.h +++ b/AMDiS/src/solver/ITL_Preconditioner.h @@ -95,41 +95,45 @@ namespace AMDiS { } }; - ITL_Preconditioner() : precon(NULL) {} + ITL_Preconditioner() : precon(nullptr) {} ~ITL_Preconditioner() { if (precon) { delete precon; - precon = NULL; + precon = nullptr; } } typedef SolverMatrix<Matrix<DOFMatrix*> > BlockMatrix; - void init(const BlockMatrix& A, const MatrixType& fullMatrix) + /// Implementation of \ref ITL_BasePreconditioner::init() + void init(const BlockMatrix& A, const MatrixType& fullMatrix) override { if (precon) delete precon; precon = new Preconditioner(fullMatrix); } - void exit() + /// Implementation of \ref OEMPreconditioner::exit() + void exit() override { if (precon) { delete precon; - precon = NULL; + precon = nullptr; } } - void solve(const VectorType& vin, VectorType& vout) const + /// Implementation of \ref ITL_BasePreconditioner::solve() + void solve(const VectorType& vin, VectorType& vout) const override { - assert(precon != NULL); + assert(precon != nullptr); precon->solve(vin, vout); } - void adjoint_solve(const VectorType& vin, VectorType& vout) const + /// Implementation of \ref ITL_BasePreconditioner::adjoint_solve() + void adjoint_solve(const VectorType& vin, VectorType& vout) const override { - assert(precon != NULL); + assert(precon != nullptr); precon->adjoint_solve(vin, vout); } diff --git a/AMDiS/src/solver/ITL_Runner.h b/AMDiS/src/solver/ITL_Runner.h index d02631f7cb925d4effe09d0592551ede2339edae..472a40a81b8af46feb98f0bec21af087a82ee9bf 100644 --- a/AMDiS/src/solver/ITL_Runner.h +++ b/AMDiS/src/solver/ITL_Runner.h @@ -42,12 +42,12 @@ namespace AMDiS { /// Pointer to the right preconditioner ITL_BasePreconditioner< MatrixType, VectorType >* r; - PreconPair() : l(NULL), r(NULL) {} + PreconPair() : l(nullptr), r(nullptr) {} }; template< typename ITLSolver, typename MatrixType, typename VectorType > - struct ITL_Runner : MTL4Runner< MatrixType, VectorType > + struct ITL_Runner : public MTL4Runner< MatrixType, VectorType > { typedef MTL4Runner< MatrixType, VectorType > super; @@ -61,21 +61,22 @@ namespace AMDiS { ~ITL_Runner() { - if (preconPair.l != NULL) { + if (preconPair.l != nullptr) { preconPair.l->exit(); delete preconPair.l; - preconPair.l = NULL; + preconPair.l = nullptr; } - if (preconPair.r != NULL) { + if (preconPair.r != nullptr) { preconPair.r->exit(); delete preconPair.r; - preconPair.r = NULL; + preconPair.r = nullptr; } } - virtual void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix) + /// Implementation of \ref MTL4Runner::init() + void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix) override { preconPair.l->init(A, fullMatrix); preconPair.r->init(A, fullMatrix); @@ -83,11 +84,11 @@ namespace AMDiS { /// Implementation of \ref MTL4Runner::solve() - virtual int solve(const MatrixType& A , VectorType& x, const VectorType& b) + int solve(const MatrixType& A , VectorType& x, const VectorType& b) override { FUNCNAME("ITL_Runner::solve()"); - TEST_EXIT(preconPair.l != NULL)("there is no left preconditioner\n"); - TEST_EXIT(preconPair.r != NULL)("there is no right preconditioner\n"); + TEST_EXIT(preconPair.l != nullptr)("there is no left preconditioner\n"); + TEST_EXIT(preconPair.r != nullptr)("there is no right preconditioner\n"); VectorType r(A * x - b); int error = 0; @@ -115,11 +116,11 @@ namespace AMDiS { /// Implementation of \ref MTL4Runner::adjoint_solve() - virtual int adjoint_solve(const MatrixType& A , VectorType& x, const VectorType& b) + int adjoint_solve(const MatrixType& A , VectorType& x, const VectorType& b) override { FUNCNAME("ITL_Runner::adjoint_solve()"); - TEST_EXIT(preconPair.l != NULL)("there is no left preconditioner\n"); - TEST_EXIT(preconPair.r != NULL)("there is no right preconditioner\n"); + TEST_EXIT(preconPair.l != nullptr)("there is no left preconditioner\n"); + TEST_EXIT(preconPair.r != nullptr)("there is no right preconditioner\n"); mtl::matrix::transposed_view<const MatrixType> B(A); VectorType r(B * x - b); @@ -147,20 +148,23 @@ namespace AMDiS { } - virtual void exit() + /// Implementation of \ref OEMRunner::exit() + void exit() override { preconPair.l->exit(); preconPair.r->exit(); } - virtual OEMPreconditioner* getLeftPrecon() + /// Implementation of \ref OEMRunner::getLeftPrecon() + OEMPreconditioner* getLeftPrecon() override { return preconPair.l; } - virtual OEMPreconditioner* getRightPrecon() + /// Implementation of \ref OEMRunner::getRightPrecon() + OEMPreconditioner* getRightPrecon() override { return preconPair.r; } @@ -173,17 +177,17 @@ namespace AMDiS { { FUNCNAME("ITL_Runner::setPrecon()"); /// Creator for the left preconditioner - CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >* leftCreator(NULL); + CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >* leftCreator(nullptr); /// Creator for the right preconditioner - CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >* rightCreator(NULL); + CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >* rightCreator(nullptr); std::string preconType("no"); std::string initFileStr = oem.getName() + "->left precon"; Parameters::get(initFileStr, preconType); leftCreator = dynamic_cast<CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >*>( CreatorMap<ITL_BasePreconditioner<MatrixType, VectorType> >::getCreator(preconType, initFileStr) ); - TEST_EXIT(leftCreator != NULL) + TEST_EXIT(leftCreator != nullptr) ("there is no creator for the given left preconditioner\n"); leftCreator->setName(initFileStr); @@ -192,7 +196,7 @@ namespace AMDiS { Parameters::get(initFileStr, preconType); rightCreator = dynamic_cast<CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >*>( CreatorMap<ITL_BasePreconditioner<MatrixType, VectorType> >::getCreator(preconType, initFileStr) ); - TEST_EXIT(rightCreator != NULL) + TEST_EXIT(rightCreator != nullptr) ("there is no creator for the given right preconditioner\n"); rightCreator->setName(initFileStr); diff --git a/AMDiS/src/solver/KrylovPreconditioner.h b/AMDiS/src/solver/KrylovPreconditioner.h index 5275d53a79715a423b4139cadb19604e75c5a5e9..9f24064db938622ea146c604fa14d7a646a58ffb 100644 --- a/AMDiS/src/solver/KrylovPreconditioner.h +++ b/AMDiS/src/solver/KrylovPreconditioner.h @@ -50,7 +50,7 @@ namespace AMDiS { **/ template< typename MatrixType, typename VectorType > - struct KrylovPreconditioner : ITL_BasePreconditioner< MatrixType, VectorType > + struct KrylovPreconditioner : public ITL_BasePreconditioner< MatrixType, VectorType > { typedef ITL_BasePreconditioner< MatrixType, VectorType > super; @@ -64,7 +64,7 @@ namespace AMDiS { } }; - KrylovPreconditioner(std::string name) : fullMatrix(NULL), solver(NULL), runner(NULL) + KrylovPreconditioner(std::string name) : fullMatrix(nullptr), solver(nullptr), runner(nullptr) { #if defined HAVE_PARALLEL_PETSC @@ -103,24 +103,28 @@ namespace AMDiS { delete solver; } - virtual void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix_) + /// Implementation of \ref ITL_BasePreconditioner::init() + void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix_) override { fullMatrix = &fullMatrix_; runner->init(A, fullMatrix_); } - virtual void exit() + /// Implementation of \ref OEMPreconditioner::init() + void exit() override { runner->exit(); } - virtual void solve(const VectorType& b, VectorType& x) const + /// Implementation of \ref ITL_BasePreconditioner::solve() + void solve(const VectorType& b, VectorType& x) const override { initVector(x); runner->solve(*fullMatrix, x, b); } - virtual void adjoint_solve(const VectorType& b, VectorType& x) const + /// Implementation of \ref ITL_BasePreconditioner::adjoint_solve() + void adjoint_solve(const VectorType& b, VectorType& x) const override { initVector(x); runner->adjoint_solve(*fullMatrix, x, b); diff --git a/AMDiS/src/solver/LinearSolver.h b/AMDiS/src/solver/LinearSolver.h index 555126ce79851b3b723377e62c3d786949bd93c1..416a07c9dd40b276283e70fa4130c7de1632891c 100644 --- a/AMDiS/src/solver/LinearSolver.h +++ b/AMDiS/src/solver/LinearSolver.h @@ -62,12 +62,12 @@ namespace AMDiS { virtual OEMPreconditioner* getLeftPrecon() { - return NULL; + return nullptr; } virtual OEMPreconditioner* getRightPrecon() { - return NULL; + return nullptr; } }; @@ -205,21 +205,21 @@ namespace AMDiS { { FUNCNAME("LinearSolver::getLeftPrecon()"); ERROR_EXIT("no left preconditioner provided!\n"); - return NULL; + return nullptr; } virtual OEMPreconditioner* getRightPrecon() { FUNCNAME("LinearSolver::getRightPrecon()"); ERROR_EXIT("no right preconditioner provided!\n"); - return NULL; + return nullptr; } virtual OEMRunner* getRunner() { FUNCNAME("LinearSolver::getRunner()"); ERROR_EXIT("no runner provided!\n"); - return NULL; + return nullptr; } /** \} */ diff --git a/AMDiS/src/solver/MTL4Solver.h b/AMDiS/src/solver/MTL4Solver.h index 067b68172fb812d318a3bd8690157c50b389cafc..598462aafb264d92fec491bcb21b2051a32c2e53 100644 --- a/AMDiS/src/solver/MTL4Solver.h +++ b/AMDiS/src/solver/MTL4Solver.h @@ -90,32 +90,32 @@ namespace AMDiS { /// Implementation of \ref LinearSolver::getRunner() - virtual OEMRunner* getRunner() + OEMRunner* getRunner() override { return details::getRunner(); } /// Implementation of \ref LinearSolver::getLeftPrecon() - virtual OEMPreconditioner* getLeftPrecon() + OEMPreconditioner* getLeftPrecon() override { return details::getLeftPrecon(); } /// Implementation of \ref LinearSolver::getRightPrecon() - virtual OEMPreconditioner* getRightPrecon() + OEMPreconditioner* getRightPrecon() override { return details::getRightPrecon(); } protected: /// Implementation of \ref LinearSolver::solveLinearSystem() - virtual int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, + int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, SystemVector& x, SystemVector& b, bool createMatrixData, - bool storeMatrixData) + bool storeMatrixData) override { VectorialMapper mapper(A); return details::solve(A, x, b, mapper, createMatrixData, storeMatrixData); diff --git a/AMDiS/src/solver/MatrixStreams.h b/AMDiS/src/solver/MatrixStreams.h index 4b33b5f411c20720b95c18dec246a515e62b0765..7b5861e39136f4f62898c7702eb6c64c566c5d11 100644 --- a/AMDiS/src/solver/MatrixStreams.h +++ b/AMDiS/src/solver/MatrixStreams.h @@ -192,7 +192,7 @@ namespace AMDiS { for (size_t j = 0; j < static_cast<size_t>(A.getNumCols()); j++) { size_t idx = i * A.getNumCols() + j; - if (A[i][j] == NULL + if (A[i][j] == nullptr || num_rows(A[i][j]->getBaseMatrix()) == 0 || num_cols(A[i][j]->getBaseMatrix()) == 0 || A[i][j]->getBaseMatrix().nnz() == 0) { diff --git a/AMDiS/src/solver/SolverMatrix.h b/AMDiS/src/solver/SolverMatrix.h index bae5ba1f9cba701f4722d5e35c01408d72a760b7..48599aefc44944efbb40b61d75f12705f5d7f5fd 100644 --- a/AMDiS/src/solver/SolverMatrix.h +++ b/AMDiS/src/solver/SolverMatrix.h @@ -68,7 +68,7 @@ namespace AMDiS { { public : SolverMatrix<Matrix<DOFMatrix* > >() - : originalMat(NULL) + : originalMat(nullptr) {} void setMatrix(const Matrix<DOFMatrix*>& A) diff --git a/AMDiS/src/solver/UmfPackSolver.h b/AMDiS/src/solver/UmfPackSolver.h index 02f4accafd8ae444de367bd6e0618154c192e0b4..ba79804dd843bb620e4a235054d374ab75da0cce 100644 --- a/AMDiS/src/solver/UmfPackSolver.h +++ b/AMDiS/src/solver/UmfPackSolver.h @@ -34,13 +34,13 @@ namespace AMDiS { template< typename MatrixType, typename VectorType > - struct Umfpack_Runner : MTL4Runner<MatrixType, VectorType> + struct Umfpack_Runner : public MTL4Runner<MatrixType, VectorType> { typedef MTL4Runner<MatrixType, VectorType> super; Umfpack_Runner(LinearSolver* oem_): oem(*oem_), - solver(NULL), + solver(nullptr), store_symbolic(0), symmetric_strategy(0), alloc_init(0.7) @@ -50,20 +50,22 @@ namespace AMDiS { Parameters::get(oem.getName() + "->alloc init", alloc_init); } - void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix) + /// Implementation of \ref MTL4Runner::init() + void init(const typename super::BlockMatrix& A, const MatrixType& fullMatrix) override { - if (solver != NULL) { + if (solver != nullptr) { delete solver; - solver = NULL; + solver = nullptr; } solver = new mtl::matrix::umfpack::solver<MatrixType>(fullMatrix, symmetric_strategy, alloc_init); } - int solve(const MatrixType& A, VectorType& x, const VectorType& b) + /// Implementation of \ref MTL4Runner::solve() + int solve(const MatrixType& A, VectorType& x, const VectorType& b) override { FUNCNAME("Umfpack_Runner::solve()"); - TEST_EXIT(solver != NULL)("The umfpack solver was not initialized\n"); + TEST_EXIT(solver != nullptr)("The umfpack solver was not initialized\n"); int code = (*solver)(x, b); @@ -76,13 +78,14 @@ namespace AMDiS { return code; } - void exit() {} + /// Implementation of \ref OEMRunner::adjoint_solve() + void exit() override {} ~Umfpack_Runner() { - if (solver != NULL) { + if (solver != nullptr) { delete solver; - solver = NULL; + solver = nullptr; } } diff --git a/AMDiS/src/time/RosenbrockStationary.cc b/AMDiS/src/time/RosenbrockStationary.cc index 6911eeb63551268e0bc02df6d7323e1e38d6f2fb..740199579cd7b1d0362ebb2166cfeff6c60197ea 100644 --- a/AMDiS/src/time/RosenbrockStationary.cc +++ b/AMDiS/src/time/RosenbrockStationary.cc @@ -125,7 +125,7 @@ namespace AMDiS { { FUNCNAME("RosenbrockStationary::addOperator()"); - TEST_EXIT(op.getUhOld() == NULL)("UhOld is not allowed to be set!\n"); + TEST_EXIT(op.getUhOld() == nullptr)("UhOld is not allowed to be set!\n"); op.setUhOld(stageSolution->getDOFVector(col)); ProblemStat::addVectorOperator(op, row, factor, estFactor); @@ -137,8 +137,8 @@ namespace AMDiS { { FUNCNAME("RosenbrockStationary::addJacobianOperator()"); - TEST_EXIT(factor == NULL)("Not yet implemented!\n"); - TEST_EXIT(estFactor == NULL)("Not yet implemented!\n"); + TEST_EXIT(factor == nullptr)("Not yet implemented!\n"); + TEST_EXIT(estFactor == nullptr)("Not yet implemented!\n"); ProblemStat::addMatrixOperator(op, row, col, &minusOne, &minusOne); } diff --git a/AMDiS/src/time/RosenbrockStationary.h b/AMDiS/src/time/RosenbrockStationary.h index e075f34e34c8aa0d6cb5827231bc4036256ab6b5..6d68df320617677995a3e807f4aa59c725701162 100644 --- a/AMDiS/src/time/RosenbrockStationary.h +++ b/AMDiS/src/time/RosenbrockStationary.h @@ -55,11 +55,11 @@ namespace AMDiS { : ProblemStat(name), first(true), minusOne(-1.0), - tauPtr(NULL), - tauGamma(NULL), - minusTauGamma(NULL), - invTauGamma(NULL), - minusInvTauGamma(NULL) + tauPtr(nullptr), + tauGamma(nullptr), + minusTauGamma(nullptr), + invTauGamma(nullptr), + minusInvTauGamma(nullptr) {} DOFVector<double>* getUnVec(int i) @@ -100,10 +100,10 @@ namespace AMDiS { } void addOperator(Operator &op, int row, int col, - double *factor = NULL, double *estFactor = NULL); + double *factor = nullptr, double *estFactor = nullptr); void addJacobianOperator(Operator &op, int row, int col, - double *factor = NULL, double *estFactor = NULL); + double *factor = nullptr, double *estFactor = nullptr); void addTimeOperator(int i, int j);