diff --git a/AMDiS/src/AMDiS.cc b/AMDiS/src/AMDiS.cc index a5b3e4440152387dfe84bfe5566c53df33e3c90f..c6be19c44e31aff30fb49e22b12effcf66859e23 100644 --- a/AMDiS/src/AMDiS.cc +++ b/AMDiS/src/AMDiS.cc @@ -38,7 +38,7 @@ namespace AMDiS { using namespace std; #if defined(HAVE_PARALLEL_MTL4) - mtl::par::environment* mtl_environment = nullptr; + mtl::par::environment* mtl_environment = NULL; #endif void init(int argc, char **argv, std::string initFileName) diff --git a/AMDiS/src/AMDiS.h b/AMDiS/src/AMDiS.h index 762b35de9cd50b1b3113a15e727f1942717c06d5..36d4cbca42ce71b87f28b5c38e4f9e3627586091 100644 --- a/AMDiS/src/AMDiS.h +++ b/AMDiS/src/AMDiS.h @@ -141,7 +141,7 @@ #include "solver/ITL_Preconditioner.h" #include "solver/ITL_Solver.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "time/RosenbrockAdaptInstationary.h" #include "time/RosenbrockStationary.h" diff --git a/AMDiS/src/AMDiS_fwd.h b/AMDiS/src/AMDiS_fwd.h index 229f7616bb889209759a59f03cde371a1cc5eb6b..ecbe2de4724794dd253bc75ee849cb0caf25b291 100644 --- a/AMDiS/src/AMDiS_fwd.h +++ b/AMDiS/src/AMDiS_fwd.h @@ -66,7 +66,7 @@ namespace AMDiS { class Marker; class Mesh; class MeshStructure; - class LinearSolver; + class LinearSolverInterface; class Operator; class OperatorTerm; class Parametric; @@ -153,7 +153,7 @@ namespace AMDiS { template<typename T> class DOFVector; template<typename T> class DimVec; template<typename T> class DimMat; -// template<typename ITLSolver> class ITL_LinearSolver; +// template<typename ITLSolver> class ITL_LinearSolverInterface; template<typename T, typename MatT, typename VecT > class ITL_Preconditioner; template<typename T> class Matrix; template<typename T> class MatrixOfFixVecs; diff --git a/AMDiS/src/AdaptBase.h b/AMDiS/src/AdaptBase.h index 03b0e0b7780b96e1a5a92d140e16fa9b094b4a47..672fbb9dec89086571e784f65525fcf834b11d2a 100644 --- a/AMDiS/src/AdaptBase.h +++ b/AMDiS/src/AdaptBase.h @@ -39,8 +39,8 @@ namespace AMDiS { AdaptBase(std::string sname, ProblemIterationInterface *problemIteration_, AdaptInfo *adapt, - ProblemTimeInterface *problemTime_ = nullptr, - AdaptInfo *initialAdaptInfo_ = nullptr) + ProblemTimeInterface *problemTime_ = NULL, + AdaptInfo *initialAdaptInfo_ = NULL) : name(sname), problemIteration(problemIteration_), adaptInfo(adapt), diff --git a/AMDiS/src/Assembler.cc b/AMDiS/src/Assembler.cc index b72b39b868043c7d1ff73adf0f6a33e7d49c933c..addc88debb83ea7146af443dd5323dc1f9d59bb7 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(nullptr), - lastVecEl(nullptr), + lastMatEl(NULL), + lastVecEl(NULL), lastTraverseId(-1) {} @@ -105,7 +105,7 @@ namespace AMDiS { rememberElMat = true; Element *el = smallElInfo->getElement(); - lastVecEl = lastMatEl = nullptr; + lastVecEl = lastMatEl = NULL; if ((el != lastMatEl && el != lastVecEl) || !operat->isOptimized()) initElement(smallElInfo, largeElInfo); @@ -341,7 +341,7 @@ namespace AMDiS { TEST_EXIT(rowFeSpace->getBasisFcts() == colFeSpace->getBasisFcts()) ("Works only for equal basis functions for different components!\n"); - Element *usedEl = nullptr; + Element *usedEl = NULL; if (operat->uhOld->getFeSpace()->getMesh() == auxElInfo->getMesh()) usedEl = auxElInfo->getElement(); else if (operat->uhOld->getFeSpace()->getMesh() == mainElInfo->getMesh()) @@ -428,8 +428,8 @@ namespace AMDiS { void Assembler::finishAssembling() { - lastVecEl = nullptr; - lastMatEl = nullptr; + lastVecEl = NULL; + lastMatEl = NULL; } diff --git a/AMDiS/src/Assembler.h b/AMDiS/src/Assembler.h index 2641298db545f2fc211bc3426fc72c6a0a03c413..7691759bc229d3b869a457d75d6e8d35a64007e1 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 = nullptr); + const FiniteElemSpace *colFeSpace = NULL); /// 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 = nullptr, - Quadrature *quad = nullptr); + const ElInfo *largeElInfo = NULL, + Quadrature *quad = NULL); /// 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 = nullptr); + const FiniteElemSpace *colFeSpace = NULL); }; /** @@ -306,7 +306,7 @@ namespace AMDiS { Quadrature *quad1GrdPhi, Quadrature *quad0, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = nullptr); + const FiniteElemSpace *colFeSpace = NULL); }; } diff --git a/AMDiS/src/BoundaryCondition.h b/AMDiS/src/BoundaryCondition.h index 6ebd386fcf39d9d9beaab9666dc50e65c21d7382..3d08a0b8dda2af9e822f473f860aefe5caaf9ac6 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_ = nullptr) + const FiniteElemSpace *colFeSpace_ = NULL) : boundaryType(type), rowFeSpace(rowFeSpace_), colFeSpace(colFeSpace_) diff --git a/AMDiS/src/BoundaryManager.cc b/AMDiS/src/BoundaryManager.cc index b420e97419bbc08cb9cae75d9b2befd1eee0bc57..c504e67f4bee15c47c3538faf5eca4aa03cc30da 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] == nullptr) + TEST_EXIT(localBCs[type] == NULL) ("There is already a condition for this type %d.\n",type); localBCs[type] = localBC; diff --git a/AMDiS/src/Bubble.cc b/AMDiS/src/Bubble.cc index f31b2f4e3081413ec933eecab8c2d5c75addc7e6..af2694c3c6213314a030f7b702efca4167c021ca 100644 --- a/AMDiS/src/Bubble.cc +++ b/AMDiS/src/Bubble.cc @@ -48,7 +48,7 @@ namespace AMDiS { std::vector<GrdBasFctType*> Bubble::grdPhifunc; // first derivatives std::vector<D2BasFctType*> Bubble::D2Phifunc; // second derivatives - Bubble* Bubble::Singleton = nullptr; + Bubble* Bubble::Singleton = NULL; Bubble::Bubble(int dim, int degree) : BasisFunction(std::string("Bubble"), dim, degree) @@ -72,7 +72,7 @@ namespace AMDiS { for (int i = 0; i < static_cast<int>(bary->size()); i++) if ((*bary)[i]) { delete (*bary)[i]; - (*bary)[i] = nullptr; + (*bary)[i] = NULL; } } @@ -80,7 +80,7 @@ namespace AMDiS { // creates a new FE-Space of this instance Bubble* Bubble::getBubble(int dim, int degree) { - if (Singleton == nullptr) //if their is no instance + if (Singleton == NULL) //if their is no instance { Singleton = new Bubble(dim, degree); } @@ -92,7 +92,7 @@ namespace AMDiS { { if (Singleton) { delete (Singleton); - Singleton = nullptr; + Singleton = NULL; } } @@ -163,7 +163,7 @@ namespace AMDiS { { FUNCNAME_DBG("Bubble::setVertices()"); - TEST_EXIT_DBG(*vertices == nullptr)("vertices != nullptr\n"); + TEST_EXIT_DBG(*vertices == NULL)("vertices != NULL\n"); int dimOfPosition = DIM_OF_INDEX(position, dim); @@ -186,7 +186,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(nullptr) + : vertices(NULL) { FUNCNAME("Bubble::Phi::Phi()"); @@ -235,7 +235,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(nullptr) + : vertices(NULL) { // get relevant vertices Bubble::setVertices(owner->getDim(), @@ -280,7 +280,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(nullptr) + : vertices(NULL) { // get relevant vertices Bubble::setVertices(owner->getDim(), @@ -354,7 +354,7 @@ namespace AMDiS { return &sortedCenter; ERROR_EXIT("should not be reached\n"); - return nullptr; + return NULL; } diff --git a/AMDiS/src/Cholesky.cc b/AMDiS/src/Cholesky.cc index 9410005fcba47fbd90b20eafd06c1da3d407848e..92c5353285e4551fd17003cdf80d90378ff42588 100644 --- a/AMDiS/src/Cholesky.cc +++ b/AMDiS/src/Cholesky.cc @@ -33,7 +33,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 = nullptr; + static Vector<double> *pT = NULL; if (p) { @@ -104,7 +104,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 = nullptr; + static Vector<double> *pT = NULL; if (!p || (p->getSize() != n)) { @@ -158,7 +158,7 @@ bool Cholesky::solve(Matrix<double> *A, Vector<WorldVector<double> > *b, x = new Vector<WorldVector<double> >(n); // Checking vector P. - static Vector<double> *pT = nullptr; + static Vector<double> *pT = NULL; if (!p || (p->getSize() != n)) { diff --git a/AMDiS/src/Cholesky.h b/AMDiS/src/Cholesky.h index 85650fccaa65f8b79da7b9f4d6b2fc58d4e1ff4e..4e946caaa69666c77e00093000c7746e369509a7 100644 --- a/AMDiS/src/Cholesky.h +++ b/AMDiS/src/Cholesky.h @@ -53,16 +53,16 @@ class Cholesky /** \brief * Solves system A*X=B, where A is a positive definite matrix. - * If P=nullptr; A is assumed to be positive definite, and a Cholesky + * If P=NULL; 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 = nullptr); + Vector<double> *p = NULL); static bool solve(Matrix<double> *A, Vector<WorldVector<double> > *b, Vector<WorldVector<double> > *x, - Vector<double> *p = nullptr); + Vector<double> *p = NULL); }; } diff --git a/AMDiS/src/CoarseningManager.h b/AMDiS/src/CoarseningManager.h index 45843bf4bb97d0f49a36ccfadd2355d0ff557010..d78620e1a141555c19b6978914f424742bab7ab9 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(nullptr), - stack(nullptr), + : mesh(NULL), + stack(NULL), doMore(0) {} diff --git a/AMDiS/src/CoarseningManager1d.cc b/AMDiS/src/CoarseningManager1d.cc index 7bc94f0fb54d8163d56171ad803cbcc33d9c47a1..3c63d0321d09674a97b610db80c7a0860efb36f9 100644 --- a/AMDiS/src/CoarseningManager1d.cc +++ b/AMDiS/src/CoarseningManager1d.cc @@ -134,8 +134,8 @@ namespace AMDiS { parent->coarsenElementData(child[0], child[1]); - parent->setFirstChild(nullptr); - parent->setSecondChild(nullptr); + parent->setFirstChild(NULL); + parent->setSecondChild(NULL); mesh->freeElement(child[0]); mesh->freeElement(child[1]); diff --git a/AMDiS/src/CoarseningManager2d.cc b/AMDiS/src/CoarseningManager2d.cc index d999fe2898b55a6bb1c65a450f336ad6eec0f039..1620108d9186954429edd76b6f43163b9350fd52 100644 --- a/AMDiS/src/CoarseningManager2d.cc +++ b/AMDiS/src/CoarseningManager2d.cc @@ -64,8 +64,8 @@ namespace AMDiS { el->coarsenElementData(child[0], child[1]); - el->setFirstChild(nullptr); - el->setSecondChild(nullptr); + el->setFirstChild(NULL); + el->setSecondChild(NULL); mesh->freeElement(child[0]); mesh->freeElement(child[1]); @@ -197,7 +197,7 @@ namespace AMDiS { DegreeOfFreedom *next_edge[2]; RCNeighbourList periodicList; - while (edge[0] != nullptr) { + while (edge[0] != NULL) { 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 42b58852fa45ee3295a27f6056f4e599e93b6021..85ce619cd2f18fead48df15bf50c950104647cca 100644 --- a/AMDiS/src/CoarseningManager3d.cc +++ b/AMDiS/src/CoarseningManager3d.cc @@ -181,7 +181,7 @@ namespace AMDiS { DegreeOfFreedom *next_edge[2]; RCNeighbourList periodicList; - while (edge[0] != nullptr) { + while (edge[0] != NULL) { coarsenList.periodicSplit(edge, next_edge, &n_neigh, &n_neigh_periodic, periodicList); @@ -262,8 +262,8 @@ namespace AMDiS { el->coarsenElementData(child[0], child[1], el_type); - el->setFirstChild(nullptr); - el->setSecondChild(nullptr); + el->setFirstChild(NULL); + el->setSecondChild(NULL); mesh->freeElement(child[0]); mesh->freeElement(child[1]); @@ -309,7 +309,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 == nullptr) + if (neigh == NULL) return true; int opp_v = elInfo->getOppVertex(3 - dir); @@ -445,7 +445,7 @@ namespace AMDiS { Tetrahedron *el = dynamic_cast<Tetrahedron*>(const_cast<Element*>(coarsenList.getElement(0))); - DegreeOfFreedom *dof = nullptr; + DegreeOfFreedom *dof = NULL; TEST_EXIT_DBG(el)("No element!\n"); TEST_EXIT_DBG(el->getChild(0))("No child in element!\n"); @@ -492,7 +492,7 @@ namespace AMDiS { coarsenList.getElement(0)->eraseNewCoord(); for (int i = 0; i < n_neigh; i++) { - coarsenList.getElement(i)->setNewCoord(nullptr); + coarsenList.getElement(i)->setNewCoord(NULL); coarsenTetrahedron(coarsenList, i); } diff --git a/AMDiS/src/ComponentTraverseInfo.cc b/AMDiS/src/ComponentTraverseInfo.cc index e8c384c77ef4a98f337e68d3b81216d26da08e3f..0e2d47a81035c404d9db3aa2ecf0412a614cfe33 100644 --- a/AMDiS/src/ComponentTraverseInfo.cc +++ b/AMDiS/src/ComponentTraverseInfo.cc @@ -32,13 +32,13 @@ namespace AMDiS { void SingleComponentInfo::updateStatus() { - if (rowFeSpace == nullptr) { + if (rowFeSpace == NULL) { status = SingleComponentInfo::EMPTY; return; } - if (colFeSpace == nullptr || - (colFeSpace != nullptr && rowFeSpace->getMesh() == colFeSpace->getMesh())) { + if (colFeSpace == NULL || + (colFeSpace != NULL && 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 != nullptr)("No row FE space!\n"); + TEST_EXIT_DBG(rowFeSpace != NULL)("No row FE space!\n"); for (int i = 0; i < nComponents; i++) { if (matrixComponents[row][i].getColFeSpace() && matrixComponents[row][i].getColFeSpace() != rowFeSpace) @@ -103,7 +103,7 @@ namespace AMDiS { if (vectorComponents[row].getAuxFeSpace() != rowFeSpace) return vectorComponents[row].getAuxFeSpace(); - return nullptr; + return NULL; } } diff --git a/AMDiS/src/ComponentTraverseInfo.h b/AMDiS/src/ComponentTraverseInfo.h index 7e7ae9bfbcf91ee26824f7a23f395ea7b19a074c..991bfe64142d0d87ccdcc8ee7f801c0f0f2aa9f9 100644 --- a/AMDiS/src/ComponentTraverseInfo.h +++ b/AMDiS/src/ComponentTraverseInfo.h @@ -35,12 +35,12 @@ namespace AMDiS { { public: SingleComponentInfo() - : rowFeSpace(nullptr), - colFeSpace(nullptr), + : rowFeSpace(NULL), + colFeSpace(NULL), status(0) {} - void setFeSpace(const FiniteElemSpace *row, const FiniteElemSpace *col = nullptr) + void setFeSpace(const FiniteElemSpace *row, const FiniteElemSpace *col = NULL) { rowFeSpace = row; colFeSpace = col; @@ -58,7 +58,7 @@ namespace AMDiS { bool hasFeSpace() { - return rowFeSpace != nullptr; + return rowFeSpace != NULL; } void updateStatus(); @@ -87,7 +87,7 @@ namespace AMDiS { if (auxFeSpaces.size() == 1) return (*(auxFeSpaces.begin())); - return nullptr; + return NULL; } inline int getStatus() const diff --git a/AMDiS/src/CouplingIterationInterface.cc b/AMDiS/src/CouplingIterationInterface.cc index c329559adcf7d409049ff8fba5bfae14ad1d2724..0cc7f7371b4f02d4b3d9f4edbce58a81b2bbcb2d 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 = nullptr; + ProblemStatBase *probIter = NULL; 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 == nullptr) + if (probIter == NULL) 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 2e805863f17c5570b2c19cdd53c59363aaa19307..0c69f06f79b14a9674a6b69421e67a1946400581 100644 --- a/AMDiS/src/CouplingProblemStat.h +++ b/AMDiS/src/CouplingProblemStat.h @@ -51,8 +51,8 @@ namespace AMDiS { : name(name_), nComponents(0), nMeshes(0), - refinementManager(nullptr), - coarseningManager(nullptr) + refinementManager(NULL), + coarseningManager(NULL) {} /// Destructor @@ -67,12 +67,12 @@ namespace AMDiS { /// Initialisation of the problem. virtual void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = nullptr, + ProblemStatSeq *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING) { FUNCNAME("CouplingProblemStat::initialize()"); // create one refinement-/coarseningmanager for all problems - if (refinementManager != nullptr && coarseningManager != nullptr) { + if (refinementManager != NULL && coarseningManager != NULL) { WARNING("refinement-/coarseningmanager already created\n"); } else { if (!adoptProblem) @@ -83,7 +83,7 @@ namespace AMDiS { } } - if (refinementManager == nullptr || coarseningManager == nullptr) + if (refinementManager == NULL || coarseningManager == NULL) WARNING("no refinement-/coarseningmanager created\n"); // create Meshes and FeSpaces @@ -124,12 +124,12 @@ namespace AMDiS { Parameters::get(problems[i]->getName() + "->polynomial degree[" + boost::lexical_cast<std::string>(j) + "]", degree); - if (feSpaceMap[std::pair<Mesh*, int>(meshByName[meshName], degree)] == nullptr) { + if (feSpaceMap[std::pair<Mesh*, int>(meshByName[meshName], degree)] == NULL) { std::stringstream s; s << problems[i]->getName() << "->feSpace[" << j << "]"; FiniteElemSpace *newFeSpace = - FiniteElemSpace::provideFeSpace(nullptr, Lagrange::getLagrange(dim, degree), + FiniteElemSpace::provideFeSpace(NULL, Lagrange::getLagrange(dim, degree), meshByName[meshName], s.str()); feSpaceMap[std::pair<Mesh*, int>(meshByName[meshName], degree)] = newFeSpace; feSpaces.push_back(newFeSpace); diff --git a/AMDiS/src/CreatorInterface.h b/AMDiS/src/CreatorInterface.h index 05a42010590d2d63eb9cba2e8da1647abb5368cd..00e008ed596653b54de676593aef8fc0a5d01744 100644 --- a/AMDiS/src/CreatorInterface.h +++ b/AMDiS/src/CreatorInterface.h @@ -35,9 +35,9 @@ namespace AMDiS { * The creation of an object of a sub class of BaseClass is deligated * to a corresponding sub class of Creator<BaseClass>. So it is possible to * manage a CreatorMap, which can be extended at run-time. An example is - * the LinearSolverMap: If you write your own LinearSolver sub class and a - * corresponding Creator<LinearSolver<T> >, you can add the creator together - * with a key string to the LinearSolverMap. Then you can create an LinearSolver + * the LinearSolverInterfaceMap: If you write your own LinearSolverInterface sub class and a + * corresponding Creator<LinearSolverInterface<T> >, you can add the creator together + * with a key string to the LinearSolverInterfaceMap. Then you can create an LinearSolverInterface * depending of a key string read from the init file, which can also be * your own new solver. */ @@ -69,7 +69,7 @@ namespace AMDiS { }; /** \brief - * A Creator which creates no object abd returns nullptr instead. + * A Creator which creates no object abd returns NULL instead. * Used together with the key word 'no' in CreatorMap. */ template<typename BaseClass> @@ -78,7 +78,7 @@ namespace AMDiS { /// Creates no object. BaseClass* create() { - return nullptr; + return NULL; } virtual ~NullCreator() {} diff --git a/AMDiS/src/CreatorMap.cc b/AMDiS/src/CreatorMap.cc index 5a88adb91654713a267e15eea6676c9a66d2cce0..d2aa145bb19d03ec0e5e0f5ed852d7a3d0723cdd 100644 --- a/AMDiS/src/CreatorMap.cc +++ b/AMDiS/src/CreatorMap.cc @@ -23,7 +23,7 @@ #include "Bubble.h" #include "CreatorMap.h" #include "MTL4Types.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "solver/ITL_Solver.h" #include "solver/BITL_Solver.h" #include "solver/ITL_Preconditioner.h" @@ -58,7 +58,7 @@ namespace AMDiS { template<> - void CreatorMap<LinearSolver>::addDefaultCreators() + void CreatorMap<LinearSolverInterface>::addDefaultCreators() { LinearSolverCreator *creator; @@ -183,16 +183,17 @@ namespace AMDiS { for (it = params.solverMap.begin(); it!= params.solverMap.end(); it++) { - CreatorMap< LinearSolver >::addCreator("petsc_" + it->first, creator); - CreatorMap< LinearSolver >::addCreator("bpetsc_" + it->first, creator2); + CreatorMap< LinearSolverInterface >::addCreator("petsc_" + it->first, creator); + CreatorMap< LinearSolverInterface >::addCreator("bpetsc_" + it->first, creator2); } #endif } template<> - void CreatorMap<BasePreconditioner>::addDefaultCreators() + void CreatorMap<ITL_PreconditionerBase< MTLTypes::MTLMatrix, MTLTypes::MTLVector > >::addDefaultCreators() { + typedef CreatorInterfaceName<ITL_PreconditionerBase< MTLTypes::MTLMatrix, MTLTypes::MTLVector > > PreconditionCreator; PreconditionCreator *creator; creator = new DiagonalPreconditioner::Creator; @@ -218,7 +219,7 @@ namespace AMDiS { template<> - void CreatorMap<ITL_BasePreconditioner<BlockMTLMatrix, MTLTypes::MTLVector> >::addDefaultCreators() + void CreatorMap<ITL_PreconditionerBase<BlockMTLMatrix, MTLTypes::MTLVector> >::addDefaultCreators() { addCreator("no", new BlockIdentityPreconditioner::Creator); addCreator("diag", new BlockDiagonalPreconditioner::Creator); diff --git a/AMDiS/src/CreatorMap.h b/AMDiS/src/CreatorMap.h index 8da0c1fe7d647a3dcfc755a8454485bbeb946419..298bf325d526ad1945349bf088f1dcb9dc03edc1 100644 --- a/AMDiS/src/CreatorMap.h +++ b/AMDiS/src/CreatorMap.h @@ -34,7 +34,7 @@ namespace AMDiS { /** \ingroup Common * \brief * A CreatorMap is used to construct objects, which types depends on key words - * determined at run time. For example the LinearSolverMap can create the different + * determined at run time. For example the LinearSolverInterfaceMap can create the different * solver types depending on the solver parameter of the init file. The benefit * of such creator maps is, that you can extend them only by writing an creator * class for your own new class and give the creator together with a key word diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc index a4960615119cc1b7ee0e939075a9c6bc56e9c55f..64d4b384424558877e9cc93e3c8e7616d3efab94 100644 --- a/AMDiS/src/DOFMatrix.cc +++ b/AMDiS/src/DOFMatrix.cc @@ -41,13 +41,13 @@ namespace AMDiS { using namespace mtl; DOFMatrix::DOFMatrix() - : rowFeSpace(nullptr), - colFeSpace(nullptr), + : rowFeSpace(NULL), + colFeSpace(NULL), elementMatrix(3, 3), nRow(0), nCol(0), nnzPerRow(0), - inserter(nullptr) + inserter(NULL) {} @@ -59,7 +59,7 @@ namespace AMDiS { name(n), coupleMatrix(false), nnzPerRow(0), - inserter(nullptr) + inserter(NULL) { FUNCNAME("DOFMatrix::DOFMatrix()"); @@ -119,7 +119,7 @@ namespace AMDiS { if (rhs.boundaryManager) boundaryManager = new BoundaryManager(*rhs.boundaryManager); else - boundaryManager = nullptr; + boundaryManager = NULL; nRow = rhs.nRow; nCol = rhs.nCol; @@ -167,7 +167,7 @@ namespace AMDiS { DegreeOfFreedom row = rowIndices[i]; BoundaryCondition *condition = - bound ? boundaryManager->getBoundaryCondition(bound[i]) : nullptr; + bound ? boundaryManager->getBoundaryCondition(bound[i]) : NULL; if (condition && condition->isDirichlet()) { if (condition->applyBoundaryCondition()) @@ -258,14 +258,14 @@ namespace AMDiS { std::vector<double*>::iterator factorIt = operatorFactor.begin(); for (; it != operators.end(); ++it, ++factorIt) if ((*it)->getNeedDualTraverse() == false && - (*factorIt == nullptr || **factorIt != 0.0)) + (*factorIt == NULL || **factorIt != 0.0)) (*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0); if (factor != 1.0) elementMatrix *= factor; if (operators.size()) - addElementMatrix(elementMatrix, bound, elInfo, nullptr); + addElementMatrix(elementMatrix, bound, elInfo, NULL); } @@ -284,7 +284,7 @@ namespace AMDiS { if (factor != 1.0) elementMatrix *= factor; - addElementMatrix(elementMatrix, bound, elInfo, nullptr); + addElementMatrix(elementMatrix, bound, elInfo, NULL); } @@ -360,7 +360,7 @@ namespace AMDiS { if (factor != 1.0) elementMatrix *= factor; - addElementMatrix(elementMatrix, bound, mainElInfo, nullptr); + addElementMatrix(elementMatrix, bound, mainElInfo, NULL); } @@ -500,7 +500,7 @@ namespace AMDiS { { if (inserter) { delete inserter; - inserter = nullptr; + inserter = NULL; } inserter = new inserter_type(matrix, nnz_per_row); diff --git a/AMDiS/src/DOFMatrix.h b/AMDiS/src/DOFMatrix.h index f104cf23ff326579dfbb95eba7f682100f51a2ff..f28f1f29b4fbf6eb8da53d51be5c3aaa372adf1e 100644 --- a/AMDiS/src/DOFMatrix.h +++ b/AMDiS/src/DOFMatrix.h @@ -127,8 +127,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 = nullptr, - double* estFactor = nullptr); + double* factor = NULL, + double* estFactor = NULL); /// void clearOperators(); @@ -173,12 +173,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 - * nullptr). On the elements, information about the row DOFs is accessed by + * NULL). 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 nullptr pointer; if row and column DOFs are the same, the + * minfo->colBas is a NULL 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 nullptr pointer; then the element matrix is + * minfo->boundBas is not a NULL 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 @@ -197,13 +197,13 @@ namespace AMDiS { ElInfo *rowElInfo, ElInfo *colElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, const BoundaryType *bound, - Operator *op = nullptr); + Operator *op = NULL); void assemble2(double factor, ElInfo *mainElInfo, ElInfo *auxElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, const BoundaryType *bound, - Operator *op = nullptr); + Operator *op = NULL); /// 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 f396a8144e3d09dab7d29b46c42dd963d562fd39..b8221de4f9aa8ba3f054b528bfa168f043153fd3 100644 --- a/AMDiS/src/DOFVector.cc +++ b/AMDiS/src/DOFVector.cc @@ -106,10 +106,10 @@ namespace AMDiS { bool inside = false; if (oldElInfo && oldElInfo->getMacroElement()) { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), nullptr, nullptr); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), NULL, NULL); delete oldElInfo; } else - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, nullptr, nullptr, nullptr); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, NULL, NULL, NULL); if (oldElInfo) oldElInfo = elInfo; @@ -129,7 +129,7 @@ namespace AMDiS { } - if (oldElInfo == nullptr) + if (oldElInfo == NULL) delete elInfo; #ifdef HAVE_PARALLEL_DOMAIN_AMDIS @@ -156,10 +156,10 @@ namespace AMDiS { bool inside = false; if (oldElInfo && oldElInfo->getMacroElement()) { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), nullptr, nullptr); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), NULL, NULL); delete oldElInfo; } else - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, nullptr, nullptr, nullptr); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, NULL, NULL, NULL); if (oldElInfo) oldElInfo = elInfo; @@ -174,7 +174,7 @@ namespace AMDiS { ERROR_EXIT("Can not eval DOFVector at point p, because point is outside geometry."); } - if (oldElInfo == nullptr) + if (oldElInfo == NULL) delete elInfo; return value; @@ -230,7 +230,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], nullptr, uh_vec); + this->getVecAtQPs(elInfo, quadSurfaces[face], NULL, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadSurfaces[face]->getWeight(iq) * (uh_vec[iq]); result += det * normT; @@ -300,7 +300,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], nullptr, uh_vec); + this->getVecAtQPs(elInfo, quadSurfaces[face], NULL, 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 @@ -417,7 +417,7 @@ namespace AMDiS { ElementVector sourceLocalCoeffs(nSourceBasisFcts); if (feSpace->getMesh() == sourceFeSpace->getMesh()) { - DimVec<double> *coords = nullptr; + DimVec<double> *coords = NULL; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(feSpace->getMesh(), -1, Mesh::CALL_LEAF_EL | @@ -519,7 +519,7 @@ namespace AMDiS { this->set(nul); - DimVec<double> *coords = nullptr; + DimVec<double> *coords = NULL; const FiniteElemSpace *vFeSpace = v->getFeSpace(); if (feSpace == vFeSpace) @@ -595,7 +595,7 @@ namespace AMDiS { DOFAdmin *admin = feSpace->getAdmin(); // define result vector - static WorldVector<DOFVector<double>*> *result = nullptr; // TODO: REMOVE STATIC + static WorldVector<DOFVector<double>*> *result = NULL; // TODO: REMOVE STATIC if (grad) { result = grad; @@ -603,7 +603,7 @@ namespace AMDiS { if (!result) { result = new WorldVector<DOFVector<double>*>; - result->set(nullptr); + result->set(NULL); } for (int i = 0; i < dow; i++) { if ((*result)[i] && (*result)[i]->getFeSpace() != feSpace) { @@ -694,7 +694,7 @@ namespace AMDiS { TEST_EXIT_DBG(vec)("no vector\n"); int dow = Global::getGeo(WORLD); - static WorldVector<DOFVector<double>*> *result = nullptr; // TODO: REMOVE STATIC + static WorldVector<DOFVector<double>*> *result = NULL; // TODO: REMOVE STATIC if (!res && !result) { result = new WorldVector<DOFVector<double>*>; diff --git a/AMDiS/src/DOFVector.h b/AMDiS/src/DOFVector.h index ddcb293dc5f90021cd5e69638ff87d03540bef6b..3de444693e9b989082039acf1a298fc6dfa6c3f8 100644 --- a/AMDiS/src/DOFVector.h +++ b/AMDiS/src/DOFVector.h @@ -54,9 +54,9 @@ namespace AMDiS { public: DOFVectorBase() - : feSpace(nullptr), + : feSpace(NULL), elementVector(3), - boundaryManager(nullptr), + boundaryManager(NULL), nBasFcts(0) {} @@ -127,13 +127,13 @@ namespace AMDiS { /// element matrix to the current DOF vector. void assemble(T factor, ElInfo *elInfo, const BoundaryType *bound, - Operator *op = nullptr); + Operator *op = NULL); void assemble2(T factor, ElInfo *mainElInfo, ElInfo *auxElInfo, ElInfo *smallElInfo, ElInfo *largeElInfo, const BoundaryType *bound, - Operator *op = nullptr); + Operator *op = NULL); void addElementVector(T sign, const ElementVector& elVec, @@ -150,8 +150,8 @@ namespace AMDiS { void finishAssembling(); inline void addOperator(Operator* op, - double *factor = nullptr, - double *estFactor = nullptr) + double *factor = NULL, + double *estFactor = NULL) { operators.push_back(op); operatorFactor.push_back(factor); @@ -481,7 +481,7 @@ namespace AMDiS { } /// Calculates Integral of this DOFVector - double Int(Quadrature* q = nullptr) const + double Int(Quadrature* q = NULL) const { return Int(-1, q); } @@ -496,12 +496,12 @@ namespace AMDiS { * \param[in] q Quadrature object. If not specified, the function * creates a new quadrature object. */ - double Int(int meshLevel, Quadrature* q = nullptr) const; + double Int(int meshLevel, Quadrature* q = NULL) 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 = nullptr) const + T IntOnBoundary(BoundaryType boundary, Quadrature* q = NULL) const { FUNCNAME("DOFVector::IntOnBoundary())"); TEST_EXIT(false)("Please implement your integration\n"); @@ -511,7 +511,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 = nullptr) const + double IntOnBoundaryNormal(BoundaryType boundary, Quadrature* q = NULL) const { FUNCNAME("DOFVector::IntOnBoundaryNormal())"); TEST_EXIT(false)("Please implement your integration\n"); @@ -519,25 +519,25 @@ namespace AMDiS { } /// Calculates L1 norm of this DOFVector - double L1Norm(Quadrature* q = nullptr) const; + double L1Norm(Quadrature* q = NULL) const; /// Calculates L2 norm of this DOFVector - inline double L2Norm(Quadrature* q = nullptr) const + inline double L2Norm(Quadrature* q = NULL) const { return std::sqrt(L2NormSquare()); } /// Calculates square of L2 norm of this DOFVector - double L2NormSquare(Quadrature* q = nullptr) const; + double L2NormSquare(Quadrature* q = NULL) const; /// Calculates H1 norm of this DOFVector - inline double H1Norm(Quadrature* q = nullptr) const + inline double H1Norm(Quadrature* q = NULL) const { return std::sqrt(H1NormSquare()); } /// Calculates square of H1 norm of this DOFVector - double H1NormSquare(Quadrature* q = nullptr) const; + double H1NormSquare(Quadrature* q = NULL) const; /// Calculates euclidian norm of this DOFVector double nrm2() const; @@ -561,7 +561,7 @@ namespace AMDiS { } /// Calculates doublewell of this DOFVector - double DoubleWell(Quadrature* q = nullptr) const; + double DoubleWell(Quadrature* q = NULL) const; /// Calculates the sum of this DOFVector T sum() const; @@ -607,11 +607,11 @@ namespace AMDiS { void interpol(DOFVector<T> *v, double factor = 1.0); - /// Eval DOFVector at given point p. If oldElInfo != nullptr the search for + /// Eval DOFVector at given point p. If oldElInfo != NULL the search for /// the element, where p is inside, starts from oldElInfo. implemented for: /// double, WorldVector< double > T evalAtPoint(WorldVector<double> &p, - ElInfo *oldElInfo = nullptr) const + ElInfo *oldElInfo = NULL) const { FUNCNAME("DOFVector::evalAtPoint())"); TEST_EXIT(false)("Please implement your evaluation\n"); @@ -622,7 +622,7 @@ namespace AMDiS { /// otherwise. bool getDofIdxAtPoint(WorldVector<double> &p, DegreeOfFreedom &idx, - ElInfo *oldElInfo = nullptr, + ElInfo *oldElInfo = NULL, bool useOldElInfo = false) const; template<typename S> @@ -891,8 +891,8 @@ namespace AMDiS { inline void checkFeSpace(const FiniteElemSpace* feSpace, const std::vector<T>& vec) { FUNCNAME_DBG("checkFeSpace()"); - TEST_EXIT_DBG(feSpace)("feSpace is nullptr\n"); - TEST_EXIT_DBG(feSpace->getAdmin())("admin is nullptr\n"); + TEST_EXIT_DBG(feSpace)("feSpace is NULL\n"); + TEST_EXIT_DBG(feSpace->getAdmin())("admin is NULL\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()); @@ -925,9 +925,9 @@ namespace AMDiS { template<typename TOut, typename T> TOut integrate(const DOFVector<T> &vec, - AbstractFunction<TOut, T> *fct = nullptr) + AbstractFunction<TOut, T> *fct = NULL) { - return fct == nullptr ? vec.Int() : integrate_Vec(vec, fct); + return fct == NULL ? vec.Int() : integrate_Vec(vec, fct); } /** \brief diff --git a/AMDiS/src/DOFVector.hh b/AMDiS/src/DOFVector.hh index 2db1d203c521cbb3c78d3a90351cefa5f32c69ed..e5781650251bd9e25604f4dd956ab63ae3c2f3e4 100644 --- a/AMDiS/src/DOFVector.hh +++ b/AMDiS/src/DOFVector.hh @@ -98,7 +98,7 @@ namespace AMDiS { : feSpace(f), name(n), elementVector(f->getBasisFcts()->getNumber()), - boundaryManager(nullptr) + boundaryManager(NULL) { nBasFcts = feSpace->getBasisFcts()->getNumber(); dim = feSpace->getMesh()->getDim(); @@ -165,7 +165,7 @@ namespace AMDiS { for (int i = 0; i < nBasFcts; i++) { BoundaryCondition *condition = - bound ? this->getBoundaryManager()->getBoundaryCondition(bound[i]) : nullptr; + bound ? this->getBoundaryManager()->getBoundaryCondition(bound[i]) : NULL; if (!(condition && condition->isDirichlet())) { DegreeOfFreedom irow = indices[i]; @@ -364,7 +364,7 @@ namespace AMDiS { { FUNCNAME("DOFVector<T>::print()"); - const DOFAdmin *admin = nullptr; + const DOFAdmin *admin = NULL; const char *format; if (this->feSpace) @@ -468,7 +468,7 @@ namespace AMDiS { } if (!(fct)) { - MSG("function that should be interpolated only pointer to nullptr, "); + MSG("function that should be interpolated only pointer to NULL, "); Msg::print("skipping interpolation\n"); return; } @@ -483,7 +483,7 @@ namespace AMDiS { ElInfo *elInfo = stack.traverseFirst(this->getFeSpace()->getMesh(), -1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); while (elInfo) { - basFct->interpol(elInfo, 0, nullptr, fct, fctInterpolValues); + basFct->interpol(elInfo, 0, NULL, fct, fctInterpolValues); basFct->getLocalIndices(const_cast<Element*>(elInfo->getElement()), admin, myLocalIndices); for (int i = 0; i < nBasFcts; i++) @@ -521,7 +521,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); T normT; nullify(normT); - this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * (uh_vec[iq]); result += det * normT; @@ -701,8 +701,8 @@ namespace AMDiS { -1, -1, traverseFlag, traverseFlag, dualElInfo); while (cont) { - vec1.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, nullptr, qp1); - vec2.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, nullptr, qp2); + vec1.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, NULL, qp1); + vec2.getVecAtQPs(dualElInfo.smallElInfo, dualElInfo.largeElInfo, quad, NULL, qp2); TOut tmp; nullify(tmp); for (int iq = 0; iq < quad->getNumPoints(); iq++) @@ -834,7 +834,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * abs(uh_vec[iq]); result += det * normT; @@ -874,7 +874,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + this->getVecAtQPs(elInfo, NULL, quadFast, uh_vec); for (int iq = 0; iq < nPoints; iq++) normT += quadFast->getWeight(iq) * sqr(uh_vec[iq]); result += det * normT; @@ -916,7 +916,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getGrdAtQPs(elInfo, nullptr, quadFast, grduh_vec); + this->getGrdAtQPs(elInfo, NULL, quadFast, grduh_vec); for (int iq = 0; iq < nPoints; iq++) { double norm2 = 0.0; @@ -960,10 +960,10 @@ namespace AMDiS { bool inside = false; if (oldElInfo && useOldElInfo && oldElInfo->getMacroElement()) { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), nullptr, nullptr); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, oldElInfo->getMacroElement(), NULL, NULL); delete oldElInfo; } else { - inside = mesh->findElInfoAtPoint(p, elInfo, lambda, nullptr, nullptr, nullptr); + inside = mesh->findElInfoAtPoint(p, elInfo, lambda, NULL, NULL, NULL); } if (oldElInfo) @@ -1052,7 +1052,7 @@ namespace AMDiS { this->boundaryManager = new BoundaryManager(*rhs.boundaryManager); } else { - this->boundaryManager = nullptr; + this->boundaryManager = NULL; } return *this; @@ -1065,7 +1065,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator*=(DOFVector<T>& x, T scal)"); TEST_EXIT_DBG(x.getFeSpace() && x.getFeSpace()->getAdmin()) - ("pointer is nullptr: %8X, %8X\n", x.getFeSpace(), x.getFeSpace()->getAdmin()); + ("pointer is NULL: %8X, %8X\n", x.getFeSpace(), x.getFeSpace()->getAdmin()); typename DOFVector<T>::Iterator vecIterator(dynamic_cast<DOFIndexed<T>*>(&x), USED_DOFS); @@ -1082,7 +1082,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator+=(DOFVector<T>& x, const DOFVector<T>& y)"); TEST_EXIT_DBG(x.getFeSpace() && y.getFeSpace()) - ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is NULL: %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", @@ -1105,7 +1105,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator-=(DOFVector<T>& x, const DOFVector<T>& y)"); TEST_EXIT_DBG(x.getFeSpace() && y.getFeSpace()) - ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is NULL: %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", @@ -1128,7 +1128,7 @@ namespace AMDiS { FUNCNAME_DBG("DOFVector<T>::operator*=(DOFVector<T>& x, const DOFVector<T>& y)"); TEST_EXIT_DBG(x.getFeSpace() && y.getFeSpace()) - ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is NULL: %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", @@ -1149,10 +1149,10 @@ namespace AMDiS { T operator*(DOFVector<T>& x, DOFVector<T>& y) { FUNCNAME("DOFVector<T>::operator*(DOFVector<T>& x, DOFVector<T>& y)"); - const DOFAdmin *admin = nullptr; + const DOFAdmin *admin = NULL; TEST_EXIT(x.getFeSpace() && y.getFeSpace()) - ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is NULL: %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()); @@ -1181,7 +1181,7 @@ namespace AMDiS { TEST_EXIT(a.getRowFeSpace() && a.getColFeSpace() && x.getFeSpace() && result.getFeSpace()) - ("getFeSpace() is nullptr: %8X, %8X, %8X, %8X\n", + ("getFeSpace() is NULL: %8X, %8X, %8X, %8X\n", a.getRowFeSpace(), a.getColFeSpace(), x.getFeSpace(), result.getFeSpace()); const DOFAdmin *rowAdmin = a.getRowFeSpace()->getAdmin(); @@ -1238,7 +1238,7 @@ namespace AMDiS { FUNCNAME("DOFVector<T>::axpy()"); TEST_EXIT(x.getFeSpace() && y.getFeSpace()) - ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); const DOFAdmin *admin = x.getFeSpace()->getAdmin(); @@ -1290,7 +1290,7 @@ namespace AMDiS { FUNCNAME("DOFVector<T>::xpay()"); TEST_EXIT(x.getFeSpace() && y.getFeSpace()) - ("feSpace is nullptr: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); + ("feSpace is NULL: %8X, %8X\n", x.getFeSpace(), y.getFeSpace()); const DOFAdmin *admin = x.getFeSpace()->getAdmin(); @@ -1754,7 +1754,7 @@ namespace AMDiS { while (elInfo) { double det = elInfo->getDet(); double normT = 0.0; - this->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + this->getVecAtQPs(elInfo, NULL, 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; @@ -1779,7 +1779,7 @@ namespace AMDiS { const FiniteElemSpace *feSpace = DOFVector<T>::feSpace; // define result vector - static DOFVector<typename GradientType<T>::type> *result = nullptr; // TODO: REMOVE STATIC + static DOFVector<typename GradientType<T>::type> *result = NULL; // TODO: REMOVE STATIC if (grad) { result = grad; @@ -1864,14 +1864,14 @@ namespace AMDiS { int dim = DOFVector<T>::dim; // define result vector - static DOFVector<typename GradientType<T>::type> *vec = nullptr; // TODO: REMOVE STATIC + static DOFVector<typename GradientType<T>::type> *vec = NULL; // TODO: REMOVE STATIC DOFVector<typename GradientType<T>::type> *result = grad; if (!result) { if (vec && vec->getFeSpace() != feSpace) { delete vec; - vec = nullptr; + vec = NULL; } if (!vec) vec = new DOFVector<typename GradientType<T>::type>(feSpace, "gradient"); @@ -1942,7 +1942,7 @@ namespace AMDiS { TEST_EXIT_DBG(vec)("no vector\n"); - static std::vector<DOFVector<double>*> *result = nullptr; // TODO: REMOVE STATIC + static std::vector<DOFVector<double>*> *result = NULL; // TODO: REMOVE STATIC int len = num_rows(GradientType<T>::getValues((*vec)[0])); @@ -1950,8 +1950,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] == nullptr) { - res->resize(len, nullptr); + } else if (res->size() == 0 || (*res)[0] == NULL) { + res->resize(len, NULL); 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 6c476240d770102abf8175ee7282e8f2986f1364..85f3bf1d49289564303600cda82801dc2868412c 100644 --- a/AMDiS/src/Debug.cc +++ b/AMDiS/src/Debug.cc @@ -234,7 +234,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return nullptr; + return NULL; } @@ -249,7 +249,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return nullptr; + return NULL; } @@ -264,7 +264,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return nullptr; + return NULL; } @@ -280,7 +280,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return nullptr; + return NULL; } @@ -295,7 +295,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return nullptr; + return NULL; } @@ -312,7 +312,7 @@ namespace AMDiS { elInfo = stack.traverseNext(elInfo); } - return nullptr; + return NULL; } diff --git a/AMDiS/src/DirichletBC.cc b/AMDiS/src/DirichletBC.cc index 7ebef93f67fb54e725a6b5f1e7a35aa685b9fbe7..e92c249f70ff8261a8b728bf193aa1c925b8feeb 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(nullptr), + dofVec(NULL), applyBC(apply) {} @@ -43,7 +43,7 @@ namespace AMDiS { DOFVectorBase<double> *vec, bool apply) : BoundaryCondition(type, vec->getFeSpace(), vec->getFeSpace()), - f(nullptr), + f(NULL), dofVec(vec), applyBC(apply) {} diff --git a/AMDiS/src/DirichletBC.h b/AMDiS/src/DirichletBC.h index 2fd06e49ba8307eb68ddd4ce86a2ab70ead1d956..deef6f05862643363499665e5ba298d0b1ad1b4f 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 = nullptr, + const FiniteElemSpace *colFeSpace = NULL, bool apply = true); /// Constructor. diff --git a/AMDiS/src/DualTraverse.cc b/AMDiS/src/DualTraverse.cc index 8ea4aea9f0adf803d1c3a833b62dd1eb216dd8cf..c1be056c8b26b754f77a49cee33c4b97b5264f1e 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 != nullptr && skipEl1(*elInfo1)) { + while (*elInfo1 != NULL && skipEl1(*elInfo1)) { *elInfo1 = stack1.traverseNext(*elInfo1); } *elInfo2 = stack2.traverseFirst(mesh2, level2, flag2); - while (*elInfo2 != nullptr && skipEl2(*elInfo2)) { + while (*elInfo2 != NULL && skipEl2(*elInfo2)) { *elInfo2 = stack2.traverseNext(*elInfo2); } // finished ? - if (*elInfo1 == nullptr || *elInfo2 == nullptr) { + if (*elInfo1 == NULL || *elInfo2 == NULL) { 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 != nullptr && skipEl1(*elInfo1)); + } while(*elInfo1 != NULL && skipEl1(*elInfo1)); } if (inc2) { do { *elInfo2 = stack2.traverseNext(*elInfo2); - } while (*elInfo2 != nullptr && skipEl2(*elInfo2)); + } while (*elInfo2 != NULL && skipEl2(*elInfo2)); } // finished ? - if (*elInfo1 == nullptr || *elInfo2 == nullptr) { + if (*elInfo1 == NULL || *elInfo2 == NULL) { TEST_EXIT(*elInfo1 == *elInfo2)("invalid dual traverse\n"); return false; } // finished ? - if (*elInfo1 == nullptr || *elInfo2 == nullptr) { + if (*elInfo1 == NULL || *elInfo2 == NULL) { TEST_EXIT(*elInfo1 == *elInfo2)("invalid dual traverse\n"); return false; } diff --git a/AMDiS/src/DualTraverse.h b/AMDiS/src/DualTraverse.h index 97e44e232dd39d93948c7afb6260286ad3b851a3..64d84f0a35d875e51ed8acc49f0cf75be4c43893 100644 --- a/AMDiS/src/DualTraverse.h +++ b/AMDiS/src/DualTraverse.h @@ -49,7 +49,7 @@ namespace AMDiS { public: DualTraverse() : fillSubElemMat(false), - basisFcts(nullptr) + basisFcts(NULL) {} virtual ~DualTraverse() {} diff --git a/AMDiS/src/ElInfo.cc b/AMDiS/src/ElInfo.cc index b5b91f7af2a106562157315ee941e8dc3c80a045..e594269fa50fa8b8e1f04a247b9df4831b079168 100644 --- a/AMDiS/src/ElInfo.cc +++ b/AMDiS/src/ElInfo.cc @@ -41,9 +41,9 @@ namespace AMDiS { ElInfo::ElInfo(Mesh *aMesh) : mesh(aMesh), - element(nullptr), - parent(nullptr), - macroElement(nullptr), + element(NULL), + parent(NULL), + macroElement(NULL), level(0), elType(0), iChild(0), @@ -58,7 +58,7 @@ namespace AMDiS { refinementPath(0), refinementPathLength(0) { - projection.set(nullptr); + projection.set(NULL); 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 4b8eb44a6687dfc2bb2c3a4044e6ef8cf2df7c8a..4fb5d6a49fce5300ea1e6420d1e7250671fc6319 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 nullptr for an interior edge/face. + * a NULL 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 nullptr for boundary edges/faces. + /// It is a NULL 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 nullptr. + /// oppVertex[i] is undefined if neighbour[i] is a pointer to NULL. /// 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 139d0737efc4e07341e55207b3b3331de858784e..d1e9b076e9b4dfb0e867969257d18c9251518847 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 = nullptr; + parent = NULL; 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 = nullptr; + nb = NULL; 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 nullptr\n"); + TEST_EXIT_DBG(lambda)("lambda must not be NULL\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 5b373e1039ead2abccb2f7e81acea50ed4346679..83864e3d261467058c105ae6b5cfb082306f0526 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 = nullptr; + parent = NULL; level = 0; if (fillFlag.isSet(Mesh::FILL_COORDS) || @@ -323,7 +323,7 @@ namespace AMDiS { } } } else { - neighbour[i] = nullptr; + neighbour[i] = NULL; } } } @@ -596,10 +596,10 @@ namespace AMDiS { } else { // boundary projection if (ichild == 0) { projection[0] = elInfoOld->getProjection(2); - projection[1] = nullptr; + projection[1] = NULL; projection[2] = elInfoOld->getProjection(1); } else { - projection[0] = nullptr; + projection[0] = NULL; 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 nullptr\n"); + TEST_EXIT_DBG(lambda)("lambda must not be NULL\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 3fda43f4d2c07d6ec75e6e30a1ae6b8d92aeb200..f12d656a35b67b2e6d68089081a8b4ed43a2edbd 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 = nullptr; + parent = NULL; level = 0; elType = const_cast<MacroElement*>(mel)->getElType(); @@ -239,7 +239,7 @@ namespace AMDiS { } } } else { - neighbour[i] = nullptr; + neighbour[i] = NULL; } } } @@ -338,7 +338,7 @@ namespace AMDiS { static DimVec<double> vec(mesh->getDim(), NO_INIT); - TEST_EXIT_DBG(lambda)("lambda must not be nullptr\n"); + TEST_EXIT_DBG(lambda)("lambda must not be NULL\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 = nullptr; /* cv = child_vertex[el_type][ichild] */ - const int (*cvg)[4] = nullptr; /* cvg = child_vertex[el_type] */ + int *cv = NULL; /* cv = child_vertex[el_type][ichild] */ + const int (*cvg)[4] = NULL; /* 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] = nullptr; + (*neigh_local)[0] = NULL; } @@ -700,7 +700,7 @@ namespace AMDiS { ichild, elOld->getIndex(), elInfoOld->getMacroElement()->getIndex()); } } else { - (*neigh_local)[i] = nullptr; + (*neigh_local)[i] = NULL; } } /* end for i */ @@ -740,7 +740,7 @@ namespace AMDiS { projection[0] = elInfoOld->getProjection(0); } else { // boundary projection - projection[0] = nullptr; + projection[0] = NULL; 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 a01178046b461a4e9421e78a5feb3ed7cf7cfcdc..ca37629ee67c6f2cf270543a0af392e15d5de91f 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] = nullptr; - child[1] = nullptr; - newCoord = nullptr; - elementData = nullptr; + child[0] = NULL; + child[1] = NULL; + newCoord = NULL; + elementData = NULL; mark = 0; if (mesh) createNewDofPtrs(); else - dof = nullptr; + dof = NULL; } @@ -119,7 +119,7 @@ namespace AMDiS { ElementData *tmp = elementData; elementData = elementData->getDecorated(); delete tmp; - tmp = nullptr; + tmp = NULL; return true; } else { return elementData->deleteDecorated(typeID); @@ -168,11 +168,11 @@ namespace AMDiS { Element *el; if (isLine()) { - el = new Line(nullptr); + el = new Line(NULL); } else if (isTriangle()) { - el = new Triangle(nullptr); + el = new Triangle(NULL); } else { - el = new Tetrahedron(nullptr); + el = new Tetrahedron(NULL); } el->mesh = mesh; @@ -200,10 +200,10 @@ namespace AMDiS { if (ndof > 0) { for (int i = 0; i < mesh->getGeo(position); i++) { - if (dof[j] != nullptr) { + if (dof[j] != NULL) { std::pair<DegreeOfFreedom, int> idx = std::make_pair(dof[j][0], pos); - if (Mesh::serializedDOFs[idx] == nullptr) { + if (Mesh::serializedDOFs[idx] == NULL) { 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] = nullptr; + el->dof[j] = NULL; } j++; } @@ -398,9 +398,9 @@ namespace AMDiS { void Element::eraseNewCoord() { - if (newCoord != nullptr) { + if (newCoord != NULL) { delete newCoord; - newCoord = nullptr; + newCoord = NULL; } } @@ -413,7 +413,7 @@ namespace AMDiS { child[0]->serialize(out); child[1]->serialize(out); } else { - out << "nullptr\n"; + out << "NULL\n"; } // write dofs @@ -421,10 +421,10 @@ namespace AMDiS { int nodes = mesh->getNumberOfNodes(); int j = 0; SerUtil::serialize(out, nodes); - int dofValid = (dof != nullptr ? 1 : 0); + int dofValid = (dof != NULL ? 1 : 0); SerUtil::serialize(out, dofValid); - if (dof != nullptr) { + if (dof != NULL) { 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] != nullptr) { + if (dof[j] != NULL) { // 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] == nullptr) { + if (Mesh::serializedDOFs[idx] == NULL) { 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 << "nullptr\n"; + out << "NULL\n"; } // write element data @@ -481,7 +481,7 @@ namespace AMDiS { out << elementData->getTypeName() << "\n"; elementData->serialize(out); } else { - out << "nullptr\n"; + out << "NULL\n"; } } @@ -496,16 +496,16 @@ namespace AMDiS { in >> typeName; in.get(); - if (typeName != "nullptr") { + if (typeName != "NULL") { if (typeName == "Line") { - child[0] = new Line(nullptr); - child[1] = new Line(nullptr); + child[0] = new Line(NULL); + child[1] = new Line(NULL); }else if (typeName == "Triangle") { - child[0] = new Triangle(nullptr); - child[1] = new Triangle(nullptr); + child[0] = new Triangle(NULL); + child[1] = new Triangle(NULL); } else if (typeName == "Tetrahedron") { - child[0] = new Tetrahedron(nullptr); - child[1] = new Tetrahedron(nullptr); + child[0] = new Tetrahedron(NULL); + child[1] = new Tetrahedron(NULL); } 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] = nullptr; + child[0] = child[1] = NULL; } // 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] : nullptr); + dof = (dofValid ? new DegreeOfFreedom*[nodes] : NULL); 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] != nullptr) { + if (Mesh::serializedDOFs[idx] != NULL) { 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] = nullptr; + dof[i] = NULL; } } } @@ -572,7 +572,7 @@ namespace AMDiS { in >> typeName; in.get(); - if (typeName != "nullptr") { + if (typeName != "NULL") { if (typeName == "WorldVector") { newCoord = new WorldVector<double>; newCoord->deserialize(in); @@ -580,14 +580,14 @@ namespace AMDiS { ERROR_EXIT("unexpected type name\n"); } } else { - newCoord = nullptr; + newCoord = NULL; } // read element data in >> typeName; in.get(); - if (typeName != "nullptr") { + if (typeName != "NULL") { elementData = CreatorMap<ElementData>::getCreator(typeName, "deserializetion from file")->create(); @@ -596,7 +596,7 @@ namespace AMDiS { else ERROR_EXIT("unexpected type name\n"); } else { - elementData = nullptr; + elementData = NULL; } } @@ -662,7 +662,7 @@ namespace AMDiS { getNodeDofs(feSpace, bound, dofs, baseDofPtr); - if (dofGeoIndex != nullptr) { + if (dofGeoIndex != NULL) { // 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 521374d9f37d9121a89c2b8047591a9ee4b88c91..d2b641a9da5d7740ac34c76d352ed687173743bc 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] == nullptr), returns + /// Returns true if Element is a leaf element (\ref child[0] == NULL), returns /// false otherwise. inline bool isLeaf() const { - return (child[0] == nullptr); + return (child[0] == NULL); } /// 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 != nullptr)("DOFs are not valid in element %d!\n", index); + TEST_EXIT_DBG(dof != NULL)("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 != nullptr)("DOFs are not valid in element %d!\n", index); + TEST_EXIT_DBG(dof != NULL)("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 != nullptr)("DOFs are not valid in element %d!\n", index); + TEST_EXIT_DBG(dof != NULL)("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 = nullptr\n"); + TEST_EXIT_DBG(newCoord)("newCoord = NULL\n"); return (*newCoord)[i]; } @@ -279,7 +279,7 @@ namespace AMDiS { void delDofPtr() { delete [] dof; - dof = nullptr; + dof = NULL; } /// 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, - std::vector<GeoIndex>* dofGeoIndex = nullptr) const = 0; + std::vector<GeoIndex>* dofGeoIndex = NULL) 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, - std::vector<GeoIndex>* dofGeoIndex = nullptr); + std::vector<GeoIndex>* dofGeoIndex = NULL); virtual void getSubBoundary(BoundaryObject bound, std::vector<BoundaryObject> &subBound) const = 0; @@ -484,13 +484,13 @@ namespace AMDiS { if (childData) { childData->coarsenElementData(this, child1, child2, elType); delete childData; - child1->setElementData(nullptr); + child1->setElementData(NULL); } childData = child2->getElementData(); if (childData) { childData->coarsenElementData(this, child2, child1, elType); delete childData; - child2->setElementData(nullptr); + child2->setElementData(NULL); } } @@ -506,7 +506,7 @@ namespace AMDiS { if (elementData) return elementData->getElementData(typeID); - return nullptr; + return NULL; } /// 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 != nullptr); + return (newCoord != NULL); } /// Frees memory for \ref newCoord @@ -561,7 +561,7 @@ namespace AMDiS { protected: /// Pointers to the two children of interior elements of the tree. Pointers - /// to nullptr for leaf elements. + /// to NULL 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 nullptr pointer. Thus coordinate + /// of the element, otherwise it is a NULL 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 5fe48b4aa4ffee0589979b92b4e2d26be540a027..35da52ff09c79ab43d1cb749b85cfee57e2b20c6 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 = nullptr; + decorated = NULL; } } @@ -42,7 +42,7 @@ namespace AMDiS { ElementData *tmp = decorated; decorated = decorated->decorated; delete tmp; - tmp = nullptr; + tmp = NULL; return true; } else { return decorated->deleteDecorated(typeID); @@ -71,23 +71,23 @@ namespace AMDiS { out << decoratedType << "\n"; decorated->serialize(out); } else { - out << "nullptr\n"; + out << "NULL\n"; } } void ElementData::deserialize(std::istream& in) { - TEST_EXIT(decorated == nullptr) + TEST_EXIT(decorated == NULL) ("there are already decorated element data\n"); std::string decoratedType; in >> decoratedType; in.get(); - if (decoratedType != "nullptr") { + if (decoratedType != "NULL") { decorated = CreatorMap<ElementData>::getCreator(decoratedType, "deserialization from file")->create(); decorated->deserialize(in); } else { - decorated = nullptr; + decorated = NULL; } } diff --git a/AMDiS/src/ElementData.h b/AMDiS/src/ElementData.h index 0cfad5f810d4a616415ab5318f8ac78f7033cf1d..6b3fd6667f6ae3db19646ee4478e7549ca45b84c 100644 --- a/AMDiS/src/ElementData.h +++ b/AMDiS/src/ElementData.h @@ -46,7 +46,7 @@ namespace AMDiS { { public: /// constructor - ElementData(ElementData *dec = nullptr) + ElementData(ElementData *dec = NULL) : decorated(dec) {} @@ -84,7 +84,7 @@ namespace AMDiS { if (decorated) return decorated->clone(); - return nullptr; + return NULL; } /// Returns the id of element data type. @@ -114,7 +114,7 @@ namespace AMDiS { if (decorated) return decorated->getElementData(typeID); } - return nullptr; + return NULL; } inline ElementData *getDecorated(int typeID) @@ -122,7 +122,7 @@ namespace AMDiS { if (decorated) return decorated->getElementData(typeID); - return nullptr; + return NULL; } /** \ref @@ -142,7 +142,7 @@ namespace AMDiS { inline void setDecorated(ElementData *d) { if (getTypeID() == 1) - if (d != nullptr) + if (d != NULL) std::cout << "leafdata decorated with nonzero" << std::endl; decorated = d; diff --git a/AMDiS/src/ElementFunction.h b/AMDiS/src/ElementFunction.h index c755cdcceaa9729e388e41f0b42f33dd1dd5f01c..39b034dc3dd2888fc5e5ace81557e12aa9cf9400 100644 --- a/AMDiS/src/ElementFunction.h +++ b/AMDiS/src/ElementFunction.h @@ -38,7 +38,7 @@ namespace AMDiS { public: /// constructor. ElementFunction() - : elInfo(nullptr) + : elInfo(NULL) {} /// destructor. diff --git a/AMDiS/src/ElementRegion_ED.h b/AMDiS/src/ElementRegion_ED.h index 759e480a77bfae4a3814dcca5d0c5830a24ac691..0bfcd86d851acedc1d7aa711dfb3e37d100bee7b 100644 --- a/AMDiS/src/ElementRegion_ED.h +++ b/AMDiS/src/ElementRegion_ED.h @@ -49,7 +49,7 @@ namespace AMDiS { } }; - ElementRegion_ED(ElementData *decorated = nullptr) + ElementRegion_ED(ElementData *decorated = NULL) : ElementData(decorated), region(-1) {} diff --git a/AMDiS/src/EmptyElementData.h b/AMDiS/src/EmptyElementData.h index 738af556c537ab8221ed39944e0fee1e73c4ddaf..f4e5e04718adba207f043fbcf3208d9f9f795ebe 100644 --- a/AMDiS/src/EmptyElementData.h +++ b/AMDiS/src/EmptyElementData.h @@ -52,7 +52,7 @@ namespace AMDiS { } }; - EmptyElementData(ElementData *decorated = nullptr) + EmptyElementData(ElementData *decorated = NULL) : ElementData(decorated) {} diff --git a/AMDiS/src/Error.h b/AMDiS/src/Error.h index 4411f6a8646a6b08d2db275aeee56a04c977a63b..3929acff2895838e12aa483f233f01871f8adaec 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 = 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> 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> 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 7817fd6561ca16701f1c44125256c7b351dc67ee..6cf4fded93dc39b18398ec270d1847c1e8045b5d 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, nullptr); - errUh->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + u_vec = quadFast->getQuadrature()->fAtQp(errU, NULL); + errUh->getVecAtQPs(elInfo, NULL, 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 = nullptr; + Quadrature *q = NULL; 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, nullptr); + grdu_vec = quadFast->getQuadrature()->grdFAtQp(grdErrU, NULL); det = elInfo->getDet(); - errUh->getGrdAtQPs(elinfo, nullptr, quadFast, grduh_vec); + errUh->getGrdAtQPs(elinfo, NULL, 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 = nullptr; + Quadrature *q = NULL; writeInLeafData = writeLeafData; component = comp; @@ -257,7 +257,7 @@ namespace AMDiS { elinfo = elInfo; quadFast->getQuadrature()->fAtQp(errU, u_vec); - errUh->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + errUh->getVecAtQPs(elInfo, NULL, 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 = nullptr; + Quadrature *q = NULL; writeInLeafData = writeLeafData; component = comp; @@ -364,7 +364,7 @@ namespace AMDiS { elinfo = elInfo; quadFast->getQuadrature()->fAtQp(errU, u_vec); - errUh->getVecAtQPs(elInfo, nullptr, quadFast, uh_vec); + errUh->getVecAtQPs(elInfo, NULL, 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 e65ab96a623dd68b2a9326f08573a74b5488f62c..46a78d5826a4b6fe88b77de4bab2556cdd83396e 100644 --- a/AMDiS/src/FiniteElemSpace.cc +++ b/AMDiS/src/FiniteElemSpace.cc @@ -47,8 +47,8 @@ namespace AMDiS { TEST_EXIT(basFcts)("No basis functions!\n"); if (!admin) { - const DOFAdmin *admin_local = nullptr; - const DimVec<int> *ndof = nullptr; + const DOFAdmin *admin_local = NULL; + const DimVec<int> *ndof = NULL; ndof = basFcts->getNumberOfDofs(); TEST_EXIT(ndof)("no n_dof or basFcts->n_dof\n"); @@ -61,7 +61,7 @@ namespace AMDiS { break; if (j > mesh->getDim()) break; - admin_local = nullptr; + admin_local = NULL; } if (!admin_local) @@ -133,7 +133,7 @@ namespace AMDiS { ERROR_EXIT("FE space not found!\n"); - return nullptr; + return NULL; } #endif @@ -151,7 +151,7 @@ namespace AMDiS { for (unsigned int i = 0; i < feSpaces.size(); i++) { if (feSpaces[i]) { delete feSpaces[i]; - feSpaces[i] = nullptr; + feSpaces[i] = NULL; } } } diff --git a/AMDiS/src/FirstOrderAssembler.cc b/AMDiS/src/FirstOrderAssembler.cc index 8af857ef576cc4c054fe946f9021d3023fa7390c..7759886f17dd965f12e942ad3d8d7c78d7f5e437 100644 --- a/AMDiS/src/FirstOrderAssembler.cc +++ b/AMDiS/src/FirstOrderAssembler.cc @@ -80,7 +80,7 @@ namespace AMDiS { // check if a assembler is needed at all if (opTerms.size() == 0) - return nullptr; + return NULL; sort(opTerms.begin(), opTerms.end()); diff --git a/AMDiS/src/FirstOrderTerm.cc b/AMDiS/src/FirstOrderTerm.cc index d6f8abb2002254f2860c389487a53d6e19f41092..9c4fb1a8e7f91057c7d82f2903488a9f80655e49 100644 --- a/AMDiS/src/FirstOrderTerm.cc +++ b/AMDiS/src/FirstOrderTerm.cc @@ -755,13 +755,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 nullptr!\n"); + TEST_EXIT(vecs[i])("One vector is NULL!\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 nullptr!\n"); + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -856,13 +856,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 nullptr!\n"); + TEST_EXIT(vecs[i])("One vector is NULL!\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 nullptr!\n"); + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } diff --git a/AMDiS/src/FirstOrderTerm.h b/AMDiS/src/FirstOrderTerm.h index dcc253a18814a1e2f0b7709ad057a9add0fb8bb1..3915ee6ffede5e236bce29562f4b7ea5ae001f76 100644 --- a/AMDiS/src/FirstOrderTerm.h +++ b/AMDiS/src/FirstOrderTerm.h @@ -276,13 +276,13 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -326,7 +326,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FistOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -365,7 +365,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FistOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -405,7 +405,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -444,7 +444,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -485,7 +485,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FistOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -523,13 +523,13 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -575,7 +575,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -616,7 +616,7 @@ namespace AMDiS { void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); void getLb(const ElInfo *elInfo, std::vector<mtl::dense_vector<double> >& Lb) const; @@ -649,7 +649,7 @@ namespace AMDiS { WorldVector<double> *b_); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); void getLb(const ElInfo *elInfo, std::vector<mtl::dense_vector<double> >& Lb) const; @@ -686,7 +686,7 @@ namespace AMDiS { int bIdx); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); void getLb(const ElInfo *elInfo, std::vector<mtl::dense_vector<double> >& Lb) const; @@ -721,7 +721,7 @@ namespace AMDiS { int b); void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); void getLb(const ElInfo *elInfo, std::vector<mtl::dense_vector<double> >& Lb) const; @@ -761,7 +761,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo*, SubAssembler* , - Quadrature *quad= nullptr); + Quadrature *quad= NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, @@ -806,7 +806,7 @@ namespace AMDiS { std::vector<WorldVector<double> > > *f); /// Implementation of \ref OperatorTerm::initElement(). - void initElement(const ElInfo*, SubAssembler*, Quadrature *quad = nullptr); + void initElement(const ElInfo*, SubAssembler*, Quadrature *quad = NULL); /// Implements FirstOrderTerm::getLb(). void getLb(const ElInfo *elInfo, diff --git a/AMDiS/src/Global.cc b/AMDiS/src/Global.cc index beae250a82f4080d4e8410b99f08b2dadb9e4574..3457a8a0d29c8b4594c2a257aa11fce5dd22a2ca 100644 --- a/AMDiS/src/Global.cc +++ b/AMDiS/src/Global.cc @@ -34,25 +34,25 @@ #endif namespace AMDiS { - const char *funcName = nullptr; + const char *funcName = NULL; #ifdef HAVE_PARALLEL_DOMAIN_AMDIS bool Msg::outputMainRank = true; #endif - ThreadPrivate<const char *> Msg::oldFuncName(nullptr); - std::ostream* Msg::out = nullptr; - std::ostream* Msg::error = nullptr; + ThreadPrivate<const char *> Msg::oldFuncName(NULL); + std::ostream* Msg::out = NULL; + std::ostream* Msg::error = NULL; int Global::dimOfWorld = 0; std::vector<std::vector<int> > Global::geoIndexTable; int Msg::msgInfo = 10; bool Msg::msgWait = true; Element *Global::referenceElement[4] = - { nullptr, - new Line(nullptr), - new Triangle(nullptr), - new Tetrahedron(nullptr) + { NULL, + new Line(NULL), + new Triangle(NULL), + new Tetrahedron(NULL) }; diff --git a/AMDiS/src/Global.h b/AMDiS/src/Global.h index af3a26599a71b15bb880657945dab78dfeef490d..a15e0e91e307740fc7fffe997629e2b7a9f7ba9a 100644 --- a/AMDiS/src/Global.h +++ b/AMDiS/src/Global.h @@ -43,9 +43,6 @@ #if (defined BOOST_NO_CXX11_OVERRIDE) || __cplusplus <= 199711L || ((defined _MSC_VER) && _MSC_VER < 1100) #define override #endif -#if (defined BOOST_NO_CXX11_NULLPTR) || __cplusplus <= 199711L - #define nullptr NULL -#endif #if !((defined BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_DECLTYPE)) #define HAS_CPP11_DECLTYPE #endif diff --git a/AMDiS/src/GlobalDOFNumbering.cc b/AMDiS/src/GlobalDOFNumbering.cc index 3cbe993c5eca126d716d652ea89ad96e33e45cbc..f686f4616c97b46607ca1ce6a3e1cfbd3375f61f 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] != nullptr) { + if(meshCodes[rank] != NULL) { firstRankUsed = rank; break; } @@ -93,11 +93,11 @@ namespace AMDiS { recursiveCodes[rank] = meshCodes[rank]; cont = true; } else { - recursiveCodes[rank] = nullptr; + recursiveCodes[rank] = NULL; } meshCodes[rank]->nextElement(); } else { - recursiveCodes[rank] = nullptr; + recursiveCodes[rank] = NULL; } } diff --git a/AMDiS/src/Initfile.cc b/AMDiS/src/Initfile.cc index b89ca585b97fa8def48ee8e27fa1e32262b93cdb..466829830c2ed62021eccc9939f2acdbd902fe5a 100644 --- a/AMDiS/src/Initfile.cc +++ b/AMDiS/src/Initfile.cc @@ -52,7 +52,7 @@ namespace AMDiS { }; - Initfile* Initfile::singlett = nullptr; + Initfile* Initfile::singlett = NULL; std::set<std::string> Initfile::fn_include_list; diff --git a/AMDiS/src/Initfile.h b/AMDiS/src/Initfile.h index 74fe21bc76cd2c60c75751a1b4826592bbf636db..a0657cc8e9af82ef057f99572a308ba24cff38af 100644 --- a/AMDiS/src/Initfile.h +++ b/AMDiS/src/Initfile.h @@ -409,7 +409,7 @@ namespace AMDiS { */ static void init(std::string in); - static void init(int print, std::string filename, const char *flags = nullptr) + static void init(int print, std::string filename, const char *flags = NULL) { WARNING("Parameters::init(int,std::string,const char*) is depreciated. " "Use Parameters::init(std::string) instead!\n"); @@ -562,21 +562,21 @@ else if(error_code == TAG_NOT_FOUND_BREAK) /// Returns specified info level static int getMsgInfo() { - return (singlett != nullptr) ? singlett->msgInfo : 0; + return (singlett != NULL) ? singlett->msgInfo : 0; } /// Returns specified wait value static int getMsgWait() { - return (singlett != nullptr) ? singlett->msgWait : 0; + return (singlett != NULL) ? singlett->msgWait : 0; } /// Checks whether parameters are initialized. if not, call init() static bool initialized() { - return (singlett != nullptr); + return (singlett != NULL); } @@ -617,7 +617,7 @@ protected: static void initIntern() { - if (singlett == nullptr) + if (singlett == NULL) singlett = new Initfile; } diff --git a/AMDiS/src/Lagrange.cc b/AMDiS/src/Lagrange.cc index dd96a33572ad89698c4069d9afe3a8aab6e1b9ed..283c32bee7ce847ed559a047967b57c999eb030c 100644 --- a/AMDiS/src/Lagrange.cc +++ b/AMDiS/src/Lagrange.cc @@ -73,7 +73,7 @@ namespace AMDiS { for (int i = 0; i < static_cast<int>(bary->size()); i++) if ((*bary)[i]) { delete (*bary)[i]; - (*bary)[i] = nullptr; + (*bary)[i] = NULL; } } @@ -97,7 +97,7 @@ namespace AMDiS { it != allBasFcts.end(); it++) if (*it) { delete *it; - *it = nullptr; + *it = NULL; } } @@ -142,13 +142,13 @@ namespace AMDiS { case 1: refineInter_fct = refineInter1; coarseRestr_fct = coarseRestr1; - coarseInter_fct = nullptr; // not yet implemented + coarseInter_fct = NULL; // not yet implemented break; case 2: switch (dim) { case 1: refineInter_fct = refineInter2_1d; - coarseRestr_fct = nullptr; // not yet implemented + coarseRestr_fct = NULL; // not yet implemented coarseInter_fct = coarseInter2_1d; break; case 2: @@ -246,7 +246,7 @@ namespace AMDiS { { FUNCNAME_DBG("Lagrange::setVertices()"); - TEST_EXIT_DBG(*vertices == nullptr)("vertices != nullptr\n"); + TEST_EXIT_DBG(*vertices == NULL)("vertices != NULL\n"); int dimOfPosition = DIM_OF_INDEX(position, dim); @@ -282,7 +282,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(nullptr) + : vertices(NULL) { FUNCNAME("Lagrange::Phi::Phi()"); @@ -414,7 +414,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(nullptr) + : vertices(NULL) { // get relevant vertices Lagrange::setVertices(owner->getDim(), @@ -541,7 +541,7 @@ namespace AMDiS { GeoIndex position, int positionIndex, int nodeIndex) - : vertices(nullptr) + : vertices(NULL) { // get relevant vertices Lagrange::setVertices(owner->getDim(), @@ -668,7 +668,7 @@ namespace AMDiS { void Lagrange::createCoords(int* coordInd, int numCoords, int dimIndex, int rest, DimVec<double>* vec) { - if (vec == nullptr) + if (vec == NULL) vec = new DimVec<double>(dim, DEFAULT_VALUE, 0.0); if (dimIndex == numCoords - 1) { @@ -789,7 +789,7 @@ namespace AMDiS { return &sortedCenterDeg4; ERROR_EXIT("should not be reached\n"); - return nullptr; + return NULL; } void Lagrange::getBound(const ElInfo* elInfo, BoundaryType* bound) const diff --git a/AMDiS/src/Lagrange.h b/AMDiS/src/Lagrange.h index e201c38fa2b1444b052d11a8be5a959d98e043d7..c956038309e535e16ca4331c5c275d93168f07bd 100644 --- a/AMDiS/src/Lagrange.h +++ b/AMDiS/src/Lagrange.h @@ -164,7 +164,7 @@ namespace AMDiS { /// Recursive calculation of coordinates. Used by \ref setBary void createCoords(int* coordInd, int numCoords, int dimIndex, int rest, - DimVec<double>* vec = nullptr); + DimVec<double>* vec = NULL); /// Used by \ref setBary int** getIndexPermutations(int numIndices) const; diff --git a/AMDiS/src/LeafData.cc b/AMDiS/src/LeafData.cc index a34957dd7fb8ea0ce018139cda2ac09b8428348c..d73bfca97348dceb329ebb0374d869d41da989d9 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] = {nullptr, nullptr}; + LeafDataPeriodic *ld[2] = {NULL, NULL}; 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 = nullptr; + periodicCoords = NULL; } } @@ -313,7 +313,7 @@ namespace AMDiS { : periodicMode(mode), type(t), elementSide(side), - periodicCoords(nullptr) + periodicCoords(NULL) { if (coords) { int dim = coords->getSize() - 1; @@ -350,7 +350,7 @@ namespace AMDiS { if (periodicCoords) delete periodicCoords; if (size == 0) { - periodicCoords = nullptr; + periodicCoords = NULL; } 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 78b73563f4e0998578fe697dfd06ab98a9d8783e..8a8e7422a4ec1bc78f8f1b256d1bb7de32dff418 100644 --- a/AMDiS/src/LeafData.h +++ b/AMDiS/src/LeafData.h @@ -64,7 +64,7 @@ namespace AMDiS { }; /// constructor - LeafDataEstimatable(ElementData *decorated = nullptr) + LeafDataEstimatable(ElementData *decorated = NULL) : ElementData(decorated), errorEstimate(0.0) {} @@ -97,7 +97,7 @@ namespace AMDiS { virtual ElementData *clone() const { // create new estimatable leaf data - LeafDataEstimatable *newObj = new LeafDataEstimatable(nullptr); + LeafDataEstimatable *newObj = new LeafDataEstimatable(NULL); newObj->errorEstimate = errorEstimate; @@ -148,7 +148,7 @@ namespace AMDiS { } /// constructor - LeafDataEstimatableVec(ElementData *decorated = nullptr) + LeafDataEstimatableVec(ElementData *decorated = NULL) : ElementData(decorated) {} @@ -180,7 +180,7 @@ namespace AMDiS { { // create new estimatable leaf data LeafDataEstimatableVec *newObj = - new LeafDataEstimatableVec(nullptr); + new LeafDataEstimatableVec(NULL); newObj->errorEstimate = errorEstimate; @@ -242,7 +242,7 @@ namespace AMDiS { } /// constructor - LeafDataCoarsenable(ElementData *decorated = nullptr) + LeafDataCoarsenable(ElementData *decorated = NULL) : ElementData(decorated), coarseningError(0.00) {} @@ -266,7 +266,7 @@ namespace AMDiS { inline ElementData *clone() const { // create new estimatable leaf data - LeafDataCoarsenable *newObj = new LeafDataCoarsenable(nullptr); + LeafDataCoarsenable *newObj = new LeafDataCoarsenable(NULL); // clone decorated element data (=> deep copy) newObj->decorated = ElementData::clone(); @@ -328,7 +328,7 @@ namespace AMDiS { } /// constructor - LeafDataCoarsenableVec(ElementData *decorated = nullptr) + LeafDataCoarsenableVec(ElementData *decorated = NULL) : ElementData(decorated) {} @@ -337,7 +337,7 @@ namespace AMDiS { { // create new estimatable leaf data LeafDataCoarsenableVec *newObj = - new LeafDataCoarsenableVec(nullptr); + new LeafDataCoarsenableVec(NULL); newObj->coarseningError = coarseningError; @@ -417,7 +417,7 @@ namespace AMDiS { { public: PeriodicInfo() - : periodicCoords(nullptr) + : periodicCoords(NULL) {} PeriodicInfo(int mode, @@ -448,7 +448,7 @@ namespace AMDiS { public: /// constructor - LeafDataPeriodic(ElementData *decorated = nullptr) + LeafDataPeriodic(ElementData *decorated = NULL) : ElementData(decorated) {} diff --git a/AMDiS/src/MacroElement.cc b/AMDiS/src/MacroElement.cc index 4050e4d9939dad44185fa531d2ec1da06163e78b..dc5d6451968eefd36696a878ea89ec349726139d 100644 --- a/AMDiS/src/MacroElement.cc +++ b/AMDiS/src/MacroElement.cc @@ -32,7 +32,7 @@ namespace AMDiS { MacroElement::MacroElement(int dim) - : element(nullptr), + : element(NULL), 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(nullptr) + deserializedNeighbourIndices(NULL) { - neighbour.set(nullptr); - projection.set(nullptr); + neighbour.set(NULL); + projection.set(NULL); } @@ -127,11 +127,11 @@ namespace AMDiS { TEST_EXIT(typeName == element->getTypeName())("wrong element type name\n"); } else { if (typeName == "Line") - element = new Line(nullptr); + element = new Line(NULL); if (typeName == "Triangle") - element = new Triangle(nullptr); + element = new Triangle(NULL); if (typeName == "Tetrahedron") - element = new Tetrahedron(nullptr); + element = new Tetrahedron(NULL); } 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) : nullptr; + projection[i] = (id != -1) ? Projection::getProjection(id) : NULL; } // === Read neighbour indices. === @@ -183,7 +183,7 @@ namespace AMDiS { for (int i = 0; i < size; i++) SerUtil::deserialize(in, (*deserializedNeighbourIndices)[i]); - deserializedNeighbourIndices = nullptr; + deserializedNeighbourIndices = NULL; // read oppVertex oppVertex.deserialize(in); diff --git a/AMDiS/src/Marker.cc b/AMDiS/src/Marker.cc index 961099800daae073994cbad807ea592ad9b558ea..5cecbb63ea8855562ea35ee554b4743403a060b9 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 = nullptr; + Marker *marker = NULL; switch (strategy) { case 0: @@ -209,7 +209,7 @@ namespace AMDiS { markRLimit = GERSGamma * estMax; TraverseStack stack; - ElInfo *elInfo = nullptr; + ElInfo *elInfo = NULL; 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 = nullptr; + ElInfo *elInfo = NULL; 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 18cd3b04b6bdf0404478b7162d55359164d1e701..f7c7b06a50e4b393d510c08c62c4eea7af365464 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(nullptr) + valArray(NULL) { if (size == 0) - valArray = nullptr; + valArray = NULL; else valArray = new T[size]; } inline bool used() const { - return (valArray != nullptr); + return (valArray != NULL); } /// Change the size of the vector to newSize. inline void resize(int newSize) { if (size != newSize) { - if (valArray != nullptr) + if (valArray != NULL) delete [] valArray; valArray = new T[newSize]; size = newSize; @@ -79,9 +79,9 @@ namespace AMDiS { /// Destructor. virtual ~Vector() { - if (valArray != nullptr) { + if (valArray != NULL) { delete [] valArray; - valArray = nullptr; + valArray = NULL; } } diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 32cf1e0e23243579b828049d692fd75a2e84c28b..31796081dd3109cd73cf0454e55a69ba8a0ca06f 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -97,17 +97,17 @@ namespace AMDiS { nEdges(0), nLeaves(0), nElements(0), - parametric(nullptr), + parametric(NULL), preserveCoarseDOFs(false), nDofEl(0), nDof(dimension, DEFAULT_VALUE, 0), nNodeEl(0), node(dimension, DEFAULT_VALUE, 0), - elementPrototype(nullptr), - elementDataPrototype(nullptr), + elementPrototype(NULL), + elementDataPrototype(NULL), elementIndex(-1), initialized(false), - macroFileInfo(nullptr), + macroFileInfo(NULL), changeIndex(0), final_lambda(dimension, DEFAULT_VALUE, 0.0) { @@ -142,7 +142,7 @@ namespace AMDiS { { deleteMeshStructure(); - if (macroFileInfo != nullptr) + if (macroFileInfo != NULL) delete macroFileInfo; if (elementPrototype) delete elementPrototype; @@ -168,7 +168,7 @@ namespace AMDiS { nFaces = m.nFaces; maxEdgeNeigh = m.maxEdgeNeigh; diam = m.diam; - parametric = nullptr; + parametric = NULL; 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)!=nullptr) { + if((*it)->getNeighbour(i)!=NULL) { 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 == nullptr)("TODO\n"); - TEST_EXIT(m.parametric == nullptr)("TODO\n"); + TEST_EXIT(elementDataPrototype == NULL)("TODO\n"); + TEST_EXIT(m.parametric == NULL)("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, nullptr); + (*macroIt)->getNeighbour(i)->setNeighbour(j, NULL); Element *mel = (*macroIt)->getElement(); @@ -357,8 +357,8 @@ namespace AMDiS { delete mel->getChild(0); delete mel->getChild(1); - mel->child[0] = nullptr; - mel->child[1] = nullptr; + mel->child[0] = NULL; + mel->child[1] = NULL; mel->setElementData(elementDataPrototype->clone()); } @@ -532,7 +532,7 @@ namespace AMDiS { int ndof = getNumberOfDofs(position); if (ndof <= 0) - return nullptr; + return NULL; DegreeOfFreedom *dof = new DegreeOfFreedom[ndof]; @@ -557,11 +557,11 @@ namespace AMDiS { DegreeOfFreedom **Mesh::createDofPtrs() { if (nNodeEl <= 0) - return nullptr; + return NULL; DegreeOfFreedom **ptrs = new DegreeOfFreedom*[nNodeEl]; for (int i = 0; i < nNodeEl; i++) - ptrs[i] = nullptr; + ptrs[i] = NULL; return ptrs; } @@ -571,7 +571,7 @@ namespace AMDiS { { FUNCNAME_DBG("Mesh::freeDofPtrs()"); - TEST_EXIT_DBG(ptrs)("ptrs is nullptr!\n"); + TEST_EXIT_DBG(ptrs)("ptrs is NULL!\n"); if (nNodeEl <= 0) return; @@ -595,7 +595,7 @@ namespace AMDiS { const DOFAdmin* Mesh::getVertexAdmin() const { - const DOFAdmin *localAdmin = nullptr; + const DOFAdmin *localAdmin = NULL; for (unsigned int i = 0; i < admin.size(); i++) { if (admin[i]->getNumberOfDofs(VERTEX)) { @@ -618,9 +618,9 @@ namespace AMDiS { ("unknown position %d\n", position); if (nDof[position]) { - TEST_EXIT_DBG(dof != nullptr)("dof = nullptr, but ndof = %d\n", nDof[position]); + TEST_EXIT_DBG(dof != NULL)("dof = NULL, but ndof = %d\n", nDof[position]); } else { - TEST_EXIT_DBG(dof == nullptr)("dof != nullptr, but ndof = 0\n"); + TEST_EXIT_DBG(dof == NULL)("dof != NULL, but ndof = 0\n"); } TEST_EXIT_DBG(nDof[position] <= MAX_DOF) @@ -658,7 +658,7 @@ namespace AMDiS { if (!parent && elementDataPrototype) el->setElementData(elementDataPrototype->clone()); else - el->setElementData(nullptr); // must be done in ElementData::refineElementData() + el->setElementData(NULL); // must be done in ElementData::refineElementData() return el; } @@ -680,7 +680,7 @@ namespace AMDiS { break; default: ERROR_EXIT("invalid dim [%d]\n",dim); - return nullptr; + return NULL; } } @@ -692,14 +692,14 @@ namespace AMDiS { const WorldVector<double> *xy0, double *sp) { - static const MacroElement *mel = nullptr; + static const MacroElement *mel = NULL; DimVec<double> lambda(dim, NO_INIT); ElInfo *mel_info = createNewElInfo(); - if (start_mel != nullptr) + if (start_mel != NULL) mel = start_mel; else - if (mel == nullptr || mel->getElement()->getMesh() != this) + if (mel == NULL || mel->getElement()->getMesh() != this) mel = *(macroElements.begin()); mel_info->setFillFlag(Mesh::FILL_COORDS); @@ -1157,7 +1157,7 @@ namespace AMDiS { int size; SerUtil::deserialize(in, size); - admin.resize(size, nullptr); + admin.resize(size, NULL); for (int i = 0; i < size; i++) { if (!admin[i]) admin[i] = new DOFAdmin(this); @@ -1200,7 +1200,7 @@ namespace AMDiS { macroElements[i]->setNeighbour(j, macroElements[index]); } else { - macroElements[i]->setNeighbour(j, nullptr); + macroElements[i]->setNeighbour(j, NULL); } } } @@ -1505,7 +1505,7 @@ namespace AMDiS { { macroFileInfo->clear(); delete macroFileInfo; - macroFileInfo = nullptr; + macroFileInfo = NULL; } diff --git a/AMDiS/src/Mesh.h b/AMDiS/src/Mesh.h index f0463f3705ef069f3bc78c229e79dd4def385d6a..9df196c5f4a4d4cd7832e1c9a95bd26b6d407480 100644 --- a/AMDiS/src/Mesh.h +++ b/AMDiS/src/Mesh.h @@ -371,7 +371,7 @@ namespace AMDiS { /** \} */ /// Creates a new Element by cloning \ref elementPrototype - Element* createNewElement(Element *parent = nullptr); + Element* createNewElement(Element *parent = NULL); /// Creates a new ElInfo dependent of \ref dim of the mesh ElInfo* createNewElInfo(); @@ -428,17 +428,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 nullptr - * \param xy0 start point from a characteristic method, see below, or nullptr + * \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 sp return address for relative distance to domain boundary in a - * characteristic method, see below, or nullptr + * characteristic method, see below, or NULL * \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!=nullptr are supplied: *sp is set to the value s such that + * pointer sp!=NULL 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. @@ -752,7 +752,7 @@ namespace AMDiS { /// Diameter of the mesh in the DIM_OF_WORLD directions WorldVector<double> diam; - /// Is pointer to nullptr if mesh contains no parametric elements else pointer + /// Is pointer to NULL if mesh contains no parametric elements else pointer /// to a Parametric object containing coefficients of the parameterization /// and related information Parametric *parametric; diff --git a/AMDiS/src/MeshStructure.cc b/AMDiS/src/MeshStructure.cc index 1769425ba7ce3811338ffbb909ae1d76e7f3f739..e55235397718218ae819886cb0e9f0f89b8471fb 100644 --- a/AMDiS/src/MeshStructure.cc +++ b/AMDiS/src/MeshStructure.cc @@ -322,7 +322,7 @@ namespace AMDiS { // decorate leaf data reset(); TraverseStack stack; - ElInfo *elInfo = nullptr; + ElInfo *elInfo = NULL; if (macroElIndex == -1) elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); else @@ -375,7 +375,7 @@ namespace AMDiS { elInfo = stack.traverseFirstOneMacro(mesh, macroElIndex, -1, Mesh::CALL_LEAF_EL); while (elInfo) { Element *element = elInfo->getElement(); - if (element->getElementData(MESH_STRUCTURE) != nullptr) { + if (element->getElementData(MESH_STRUCTURE) != NULL) { element->setMark(1); finished = false; } else { diff --git a/AMDiS/src/MeshStructure.h b/AMDiS/src/MeshStructure.h index 9869fb2b29061c5fbbd392cfe2a3c7135517a6b8..d8ab6efdd029bb22036f73cbada1f195a487918c 100644 --- a/AMDiS/src/MeshStructure.h +++ b/AMDiS/src/MeshStructure.h @@ -86,11 +86,11 @@ namespace AMDiS { reset(); } - bool skipBranch(MeshStructure *insert = nullptr); + bool skipBranch(MeshStructure *insert = NULL); ElInfo *skipBranch(ElInfo *elInfo, TraverseStack *stack); - bool nextElement(MeshStructure *insert = nullptr); + bool nextElement(MeshStructure *insert = NULL); int lookAhead(unsigned int n = 1); diff --git a/AMDiS/src/MeshStructure_ED.h b/AMDiS/src/MeshStructure_ED.h index 55c1b201f9449303bccd7a781632819c77efac92..0024821bcfbf7b6dec4e6e6d30045300dc3fb63f 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 = nullptr) + MeshStructure_ED(ElementData *decorated = NULL) : ElementData(decorated), - structure(nullptr) + structure(NULL) {} virtual ~MeshStructure_ED() diff --git a/AMDiS/src/Operator.cc b/AMDiS/src/Operator.cc index e6f6faf349c3a468e12bc79feeaca401b292258d..b6aa72b22bca2e71654d6726fb13cadae5daa48b 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(nullptr), - uhOld(nullptr), + assembler(NULL), + uhOld(NULL), optimized(true) { secondOrder.resize(0); @@ -60,7 +60,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(nullptr, nullptr, nullptr, nullptr); + initAssembler(NULL, NULL, NULL, NULL); assembler.get()->calculateElementMatrix(elInfo, userMat, factor); } @@ -73,7 +73,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(nullptr, nullptr, nullptr, nullptr); + initAssembler(NULL, NULL, NULL, NULL); assembler.get()->calculateElementMatrix(rowElInfo, colElInfo, smallElInfo, largeElInfo, @@ -87,7 +87,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(nullptr, nullptr, nullptr, nullptr); + initAssembler(NULL, NULL, NULL, NULL); assembler.get()->calculateElementVector(elInfo, userVec, factor); } @@ -99,7 +99,7 @@ namespace AMDiS { double factor) { if (!assembler.get()) - initAssembler(nullptr, nullptr, nullptr, nullptr); + initAssembler(NULL, NULL, NULL, NULL); assembler.get()->calculateElementVector(mainElInfo, auxElInfo, smallElInfo, largeElInfo, @@ -128,7 +128,7 @@ namespace AMDiS { int Operator::getQuadratureDegree(int order, FirstOrderType firstOrderType) { - std::vector<OperatorTerm*>* terms = nullptr; + std::vector<OperatorTerm*>* terms = NULL; switch(order) { case 0: @@ -171,7 +171,7 @@ namespace AMDiS { Assembler* Operator::getAssembler() { if (!assembler.get()) - initAssembler(nullptr, nullptr, nullptr, nullptr); + initAssembler(NULL, NULL, NULL, NULL); return assembler.get(); } diff --git a/AMDiS/src/Operator.h b/AMDiS/src/Operator.h index 51b3d0b5f28f1d95d9ecf8efd9be859f29ba77cf..6f8f2c7d9b323c6e26394041d6ef816ba2812fa5 100644 --- a/AMDiS/src/Operator.h +++ b/AMDiS/src/Operator.h @@ -55,7 +55,7 @@ namespace AMDiS { public: /// Constructs an empty Operator of type operatorType for the given FiniteElemSpace. Operator(const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = nullptr); + const FiniteElemSpace *colFeSpace = NULL); /// Destructor. virtual ~Operator() {} diff --git a/AMDiS/src/OperatorTerm.h b/AMDiS/src/OperatorTerm.h index b6c05389e2a34c2f5995dce9e29eaa35c945b164..532155125f70dc64a077f090d008f3de33e4b330 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 = nullptr) + Quadrature *quad = NULL) {} virtual void initElement(const ElInfo* largeElInfo, const ElInfo* smallElInfo, SubAssembler*, - Quadrature *quad = nullptr) + Quadrature *quad = NULL) {} diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc index b9ce8cc754e07c9c77afa9a5e3e065bb9b24d8fb..7638b350b41b9b1cfb98543c3f88a0125b910321 100644 --- a/AMDiS/src/PeriodicBC.cc +++ b/AMDiS/src/PeriodicBC.cc @@ -74,7 +74,7 @@ namespace AMDiS { { FUNCNAME("PeriodicDOFMapping::getDOFPermutation()"); - if (dofPermutation[vertexPermutation] == nullptr) { + if (dofPermutation[vertexPermutation] == NULL) { 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, nullptr), - masterMatrix(nullptr) + : BoundaryCondition(type, rowSpace, NULL), + masterMatrix(NULL) { if (rowFeSpace->getMesh()->getDim() > 1) periodicDOFMapping = PeriodicDOFMapping::providePeriodicDOFMapping(rowFeSpace->getBasisFcts()); else - periodicDOFMapping = nullptr; + periodicDOFMapping = NULL; } @@ -217,7 +217,7 @@ namespace AMDiS { TEST_EXIT(associated)("No associated vector!\n"); if (matrix == masterMatrix) - masterMatrix = nullptr; + masterMatrix = NULL; using namespace mtl; diff --git a/AMDiS/src/PeriodicConnection.h b/AMDiS/src/PeriodicConnection.h index c9ab6a89a94a13253470e87415ec4be7a7efd52f..e441e44da7b14c54dcf31cd3d2ee77b71d38bf06 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] = nullptr; + child_[0] = child_[1] = NULL; }; ~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] = nullptr; - return (el_[abs(index-1)] == nullptr); + el_[index] = NULL; + return (el_[abs(index-1)] == NULL); }; bool refineElement(int index, @@ -93,8 +93,8 @@ TEST_EXIT(child_[0] && child_[1]) ("only one child\n"); - TEST_EXIT(el_[abs(index-1)] == nullptr) - ("connection already refined but other element != nullptr\n"); + TEST_EXIT(el_[abs(index-1)] == NULL) + ("connection already refined but other element != NULL\n"); *child0 = child_[0]; *child1 = child_[1]; diff --git a/AMDiS/src/ProblemInstat.cc b/AMDiS/src/ProblemInstat.cc index 43e51a434139c376ef8f2e2d840b7ec1191d5de5..de493c6ea83cb172a5647d02964403254a58b1de 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(nullptr) + oldSolution(NULL) {} ProblemInstat::ProblemInstat(string sname, ProblemStatSeq &prob) - : ProblemInstatBase(sname, nullptr), + : ProblemInstatBase(sname, NULL), problemStat(&prob), - oldSolution(nullptr) + oldSolution(NULL) {} diff --git a/AMDiS/src/ProblemInstat.h b/AMDiS/src/ProblemInstat.h index 757db148b006e0fa05fc5a918ffcb6aa0ddee021..f4ddb443d41d37db699c1c9a60b40806b8e72fb8 100644 --- a/AMDiS/src/ProblemInstat.h +++ b/AMDiS/src/ProblemInstat.h @@ -54,7 +54,7 @@ namespace AMDiS { /// Initialisation of the problem. #if 0 virtual void initialize(Flag initFlag, - ProblemInstat *adoptProblem = nullptr, + ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING) {} #endif @@ -158,7 +158,7 @@ namespace AMDiS { /// Constructs a ProblemInstatVec with prob as its stationary problem. ProblemInstat(std::string name, ProblemStatSeq *prob, - ProblemStatBase *initialProb = nullptr); + ProblemStatBase *initialProb = NULL); ProblemInstat(std::string name, ProblemStatSeq &prob); @@ -169,7 +169,7 @@ namespace AMDiS { /// Initialisation of the problem. virtual void initialize(Flag initFlag, - ProblemInstat *adoptProblem = nullptr, + ProblemInstat *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). diff --git a/AMDiS/src/ProblemIterationInterface.h b/AMDiS/src/ProblemIterationInterface.h index f9c75f8a29d79973e5d489de83addb82cc4990c9..81a63a14b3b4ddd9d7315ca5fb201e3d9065813e 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 nullptr; + return NULL; } /// Returns the name of the problem. diff --git a/AMDiS/src/ProblemStat.cc b/AMDiS/src/ProblemStat.cc index 1e767bcccf8c7c2c1369ba3019b6d9a22d2fe0cd..6b19ef52616ebef21b0b1c97b79446c7a3714f77 100644 --- a/AMDiS/src/ProblemStat.cc +++ b/AMDiS/src/ProblemStat.cc @@ -36,7 +36,7 @@ #include "RefinementManager.h" #include "DualTraverse.h" #include "Mesh.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "DirichletBC.h" #include "RobinBC.h" #include "PeriodicBC.h" @@ -61,13 +61,13 @@ namespace AMDiS { nComponents(-1), nMeshes(0), traverseInfo(0), - solver(nullptr), - solution(nullptr), - rhs(nullptr), - systemMatrix(nullptr), + solver(NULL), + solution(NULL), + rhs(NULL), + systemMatrix(NULL), useGetBound(true), - refinementManager(nullptr), - coarseningManager(nullptr), + refinementManager(NULL), + coarseningManager(NULL), info(10), deserialized(false), computeExactError(false), @@ -79,8 +79,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, nullptr); - marker.resize(nComponents, nullptr); + estimator.resize(nComponents, NULL); + marker.resize(nComponents, NULL); assembleMatrixOnlyOnce.resize(nComponents); assembledMatrix.resize(nComponents); @@ -117,39 +117,39 @@ namespace AMDiS { { if (rhs) delete rhs; - rhs = nullptr; + rhs = NULL; if (solution) delete solution; - solution = nullptr; + solution = NULL; 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] = nullptr; + (*systemMatrix)[i][j] = NULL; } delete systemMatrix; - systemMatrix = nullptr; + systemMatrix = NULL; } for (unsigned int i = 0; i < meshes.size(); i++) if (meshes[i]) { // delete meshes[i]; -// meshes[i] = nullptr; +// meshes[i] = NULL; } for (unsigned int i = 0; i < estimator.size(); i++) if (estimator[i]) { delete estimator[i]; - estimator[i] = nullptr; + estimator[i] = NULL; } for (unsigned int i = 0; i < marker.size(); i++) if (marker[i]) { delete marker[i]; - marker[i] = nullptr; + marker[i] = NULL; } } @@ -192,7 +192,7 @@ namespace AMDiS { WARNING("no mesh created\n"); // === create refinement/corasening-manager === - if (refinementManager != nullptr && coarseningManager != nullptr) { + if (refinementManager != NULL && coarseningManager != NULL) { WARNING("refinement-/coarseningmanager already created\n"); } else { if (initFlag.isSet(CREATE_MESH) || @@ -209,7 +209,7 @@ namespace AMDiS { } } - if (refinementManager == nullptr || coarseningManager == nullptr) + if (refinementManager == NULL || coarseningManager == NULL) WARNING("no refinement-/coarseningmanager created\n"); // === create fespace === @@ -218,7 +218,7 @@ namespace AMDiS { } else { if (initFlag.isSet(INIT_FE_SPACE) || (initFlag.isSet(INIT_SYSTEM) && !adoptFlag.isSet(INIT_FE_SPACE))) - createFeSpace(nullptr); + createFeSpace(NULL); if (adoptProblem && (adoptFlag.isSet(INIT_FE_SPACE) || adoptFlag.isSet(INIT_SYSTEM))) { @@ -397,7 +397,7 @@ namespace AMDiS { if (refSet < 0) refSet = 0; - if (meshForRefinementSet[refSet] == nullptr) { + if (meshForRefinementSet[refSet] == NULL) { Mesh *newMesh = new Mesh(meshName, dim); meshForRefinementSet[refSet] = newMesh; meshes.push_back(newMesh); @@ -445,11 +445,11 @@ namespace AMDiS { Parameters::get(name + "->dim", dim); TEST_EXIT(dim != -1)("no problem dimension specified!\n"); - componentSpaces.resize(nComponents, nullptr); + componentSpaces.resize(nComponents, NULL); traverseInfo.resize(nComponents); for (int i = 0; i < nComponents; i++) { - TEST_EXIT(componentSpaces[i] == nullptr)("feSpace already created\n"); + TEST_EXIT(componentSpaces[i] == NULL)("feSpace already created\n"); string componentString = "[" + boost::lexical_cast<string>(i) + "]"; string feSpaceName = ""; @@ -514,7 +514,7 @@ namespace AMDiS { // === create vectors and system matrix === systemMatrix = new Matrix<DOFMatrix*>(nComponents, nComponents); - systemMatrix->set(nullptr); + systemMatrix->set(NULL); rhs = new SystemVector("rhs", componentSpaces, nComponents); solution = new SystemVector("solution", componentSpaces, nComponents); @@ -564,7 +564,7 @@ namespace AMDiS { // === create solver === LinearSolverCreator *solverCreator = - dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolver>::getCreator(solverType, initFileStr)); + dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolverInterface>::getCreator(solverType, initFileStr)); TEST_EXIT(solverCreator) ("No valid solver type found in parameter \"%s\"\n", initFileStr.c_str()); solverCreator->setName(initFileStr); @@ -582,7 +582,7 @@ namespace AMDiS { (new LeafDataEstimatableVec(new LeafDataCoarsenableVec)); for (int i = 0; i < nComponents; i++) { - TEST_EXIT(estimator[i] == nullptr)("estimator already created\n"); + TEST_EXIT(estimator[i] == NULL)("estimator already created\n"); string estName = name + "->estimator[" + boost::lexical_cast<string>(i) + "]"; @@ -885,7 +885,7 @@ namespace AMDiS { // The DOFMatrix which should be assembled (or not, if assembleMatrix // will be set to false). DOFMatrix *matrix = - (asmMatrix ? (*systemMatrix)[rowComponent][colComponent] : nullptr); + (asmMatrix ? (*systemMatrix)[rowComponent][colComponent] : NULL); if (writeAsmInfo && matrix) { MSG(" -> matrix has %d operators\n", matrix->getOperators().size()); @@ -946,10 +946,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 : nullptr, + assembleMatrix ? matrix : NULL, ((rowComponent == colComponent) && asmVector) ? rhs->getDOFVector(rowComponent) : - nullptr); + NULL); // #pragma omp barrier @@ -1056,7 +1056,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] : nullptr); + DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL); if (writeAsmInfo && matrix) { for (vector<Operator*>::iterator it = matrix->getOperatorsBegin(); @@ -1113,7 +1113,7 @@ namespace AMDiS { const BasisFunction *basisFcts = componentSpaces[0]->getBasisFcts(); BoundaryType *bound = - useGetBound ? new BoundaryType[basisFcts->getNumber()] : nullptr; + useGetBound ? new BoundaryType[basisFcts->getNumber()] : NULL; DualTraverse dualTraverse; DualElInfo dualElInfo; @@ -1131,21 +1131,21 @@ namespace AMDiS { for (int i = 0; i < nComponents; i++) { for (int j = 0; j < nComponents; j++) { - DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : nullptr); + DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL); if (!matrix) continue; if (traverseInfo.eqSpaces(i, j)) { - ElInfo *elInfo = nullptr; + ElInfo *elInfo = NULL; if (componentMeshes[i] == meshes[0] && newEl0) elInfo = dualElInfo.rowElInfo; if (componentMeshes[i] == meshes[1] && newEl1) elInfo = dualElInfo.colElInfo; - if (elInfo != nullptr) { + if (elInfo != NULL) { if (useGetBound) basisFcts->getBound(elInfo, bound); @@ -1218,7 +1218,7 @@ namespace AMDiS { for (int i = 0; i < nComponents; i++) { for (int j = 0; j < nComponents; j++) { - DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : nullptr); + DOFMatrix *matrix = (asmMatrix ? (*systemMatrix)[i][j] : NULL); if (!matrix) continue; @@ -1509,7 +1509,7 @@ namespace AMDiS { boundaryConditionSet = true; RobinBC *robin = - new RobinBC(type, nullptr, op, componentSpaces[row], componentSpaces[col]); + new RobinBC(type, NULL, op, componentSpaces[row], componentSpaces[col]); if (systemMatrix && (*systemMatrix)[row][col]) (*systemMatrix)[row][col]->getBoundaryManager()->addBoundaryCondition(robin); @@ -1522,7 +1522,7 @@ namespace AMDiS { boundaryConditionSet = true; RobinBC *robin = - new RobinBC(type, op, nullptr, componentSpaces[row]); + new RobinBC(type, op, NULL, componentSpaces[row]); if (rhs) rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(robin); @@ -1540,7 +1540,7 @@ namespace AMDiS { TraverseStack stack; BoundaryType *bound = - useGetBound ? new BoundaryType[basisFcts->getNumber()] : nullptr; + useGetBound ? new BoundaryType[basisFcts->getNumber()] : NULL; if (matrix) matrix->startInsertion(matrix->getNnz()); @@ -1563,7 +1563,7 @@ namespace AMDiS { } if (vector) - vector->assemble(1.0, elInfo, bound, nullptr); + vector->assemble(1.0, elInfo, bound, NULL); elInfo = stack.traverseNext(elInfo); } diff --git a/AMDiS/src/ProblemStat.h b/AMDiS/src/ProblemStat.h index 055bb53ff6635907d65d54c223f36370f4262b57..03544cbc185bd4393043c40eb81f5f3f0b80f668 100644 --- a/AMDiS/src/ProblemStat.h +++ b/AMDiS/src/ProblemStat.h @@ -68,14 +68,14 @@ namespace AMDiS { public: /// Constructor ProblemStatSeq(std::string nameStr, - ProblemIterationInterface *problemIteration = nullptr); + ProblemIterationInterface *problemIteration = NULL); /// Destructor virtual ~ProblemStatSeq(); /// Initialisation of the problem. virtual void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = nullptr, + ProblemStatSeq *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). @@ -183,19 +183,19 @@ namespace AMDiS { /// Adds an operator to \ref A. void addMatrixOperator(Operator *op, int i, int j, - double *factor = nullptr, double *estFactor = nullptr); + double *factor = NULL, double *estFactor = NULL); /// Adds an operator to \ref A. void addMatrixOperator(Operator &op, int i, int j, - double *factor = nullptr, double *estFactor = nullptr); + double *factor = NULL, double *estFactor = NULL); /// Adds an operator to \ref rhs. void addVectorOperator(Operator *op, int i, - double *factor = nullptr, double *estFactor = nullptr); + double *factor = NULL, double *estFactor = NULL); /// Adds an operator to \ref rhs. void addVectorOperator(Operator &op, int i, - double *factor = nullptr, double *estFactor = nullptr); + double *factor = NULL, double *estFactor = NULL); /// Adds a Dirichlet boundary condition, where the rhs is given by an /// abstract function. @@ -368,7 +368,7 @@ namespace AMDiS { } /// Returns \ref solver. - inline LinearSolver* getSolver() + inline LinearSolverInterface* getSolver() { return solver; } @@ -458,7 +458,7 @@ namespace AMDiS { } /// Sets \ref solver. - inline void setSolver(LinearSolver* sol) + inline void setSolver(LinearSolverInterface* sol) { solver = sol; } @@ -604,7 +604,7 @@ namespace AMDiS { std::vector<Estimator*> estimator; /// Linear solver of this problem. Used in \ref solve(). - LinearSolver *solver; + LinearSolverInterface *solver; /// System vector storing the calculated solution of the problem. SystemVector *solution; diff --git a/AMDiS/src/ProblemStatDbg.h b/AMDiS/src/ProblemStatDbg.h index 8f6b7bd932b92debf102ebfd93e7cd6b367d48b9..5f4d1d65ba4c79a61dc6b966e83d8b7a7bdda25c 100644 --- a/AMDiS/src/ProblemStatDbg.h +++ b/AMDiS/src/ProblemStatDbg.h @@ -33,7 +33,7 @@ namespace AMDiS { { public: ProblemStatDbg(std::string nameStr, - ProblemIterationInterface *problemIteration = nullptr) + ProblemIterationInterface *problemIteration = NULL) : ProblemStatSeq(nameStr, problemIteration) {} diff --git a/AMDiS/src/Projection.h b/AMDiS/src/Projection.h index 51beaff830efd92aa4c8f29a6f6640da7736b234..6d0ac2b3142a669297dacb96fbd678e2a41b8d0b 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] == nullptr) + TEST_EXIT(projectionMap[id] == NULL) ("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 nullptr otherwise. + /// Returns the projection with the given id, if existing. Returns NULL otherwise. static Projection* getProjection(int id) { return projectionMap[id]; diff --git a/AMDiS/src/QPInfo.cc b/AMDiS/src/QPInfo.cc index cca315ec82f76f2526fa8c49b2e7feb97060078f..41094ee03d35906e9a75b7f002c0dede8123fde8 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_(nullptr), - coordsAtQPs_(nullptr), + currentElInfo_(NULL), + coordsAtQPs_(NULL), coordsNumPointsValid_(0), - elementNormalAtQPs_(nullptr), - elementNormalConst_(nullptr), + elementNormalAtQPs_(NULL), + elementNormalConst_(NULL), elementNormalNumPointsValid_(0), - grdLambdaAtQPs_(nullptr), - grdLambdaConst_(nullptr), + grdLambdaAtQPs_(NULL), + grdLambdaConst_(NULL), grdLambdaNumPointsValid_(0) { numPoints_ = quadrature_->getNumPoints(); @@ -121,7 +121,7 @@ namespace AMDiS { } // create new info if necessary - if (vecQPInfos_[vec] == nullptr) + if (vecQPInfos_[vec] == NULL) vecQPInfos_[vec] = new VecQPInfo; VecQPInfo *localVecQPInfo = vecQPInfos_[vec]; @@ -157,7 +157,7 @@ namespace AMDiS { } // create new info if necessary - if (vecQPInfos_[vec] == nullptr) + if (vecQPInfos_[vec] == NULL) vecQPInfos_[vec] = new VecQPInfo; VecQPInfo *localVecQPInfo = vecQPInfos_[vec]; @@ -193,7 +193,7 @@ namespace AMDiS { } // create new info if necessary - if (vecQPInfos_[vec] == nullptr) + if (vecQPInfos_[vec] == NULL) vecQPInfos_[vec] = new VecQPInfo; VecQPInfo *localVecQPInfo = vecQPInfos_[vec]; @@ -311,7 +311,7 @@ namespace AMDiS { qpInfos_[quad] = newQPInfo; return newQPInfo; } else { - return nullptr; + return NULL; } } diff --git a/AMDiS/src/QPInfo.h b/AMDiS/src/QPInfo.h index 218a942318c4bc3b3dfbc903ebf81e56a78ccce7..b99ad5bdf9ade59d53e3e879fe0f16e3b0f4fbae 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 = nullptr); + const FastQuadrature *quadFast = NULL); /** \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 = nullptr); + const FastQuadrature *quadFast = NULL); /** \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 = nullptr); + const FastQuadrature *quadFast = NULL); /// Returns element normals at quadrature points. diff --git a/AMDiS/src/QPsiPhi.cc b/AMDiS/src/QPsiPhi.cc index e3c18c590e932d3d59dd0a5ae966ec5e1fe496ad..b6b155ef91192c8578b5756a3ea823af33f428f7 100644 --- a/AMDiS/src/QPsiPhi.cc +++ b/AMDiS/src/QPsiPhi.cc @@ -58,10 +58,10 @@ namespace AMDiS { : psi(ps), phi(ph), quadrature(quadrat), - nrEntries(nullptr), - values(nullptr), - k(nullptr), - l(nullptr) + nrEntries(NULL), + values(NULL), + k(NULL), + l(NULL) { FUNCNAME_DBG("Q11PsiPhi::Q11PsiPhi()"); @@ -197,7 +197,7 @@ namespace AMDiS { { std::list<Q11PsiPhi*>::iterator list; - if (!ps && !ph) return nullptr; + if (!ps && !ph) return NULL; if (!ps) ps = ph; if (!ph) ph = ps; @@ -243,9 +243,9 @@ namespace AMDiS { if (!psi && !phi) { - nrEntries=nullptr; - k=nullptr; - values=nullptr; + nrEntries=NULL; + k=NULL; + values=NULL; } if (!psi) psi = phi; @@ -357,7 +357,7 @@ namespace AMDiS { { std::list<Q10PsiPhi*>::iterator list; - if (!ps && !ph) return nullptr; + if (!ps && !ph) return NULL; if (!ps) ps = ph; if (!ph) ph = ps; @@ -401,9 +401,9 @@ namespace AMDiS { if (!psi && !phi) { - nrEntries=nullptr; - l=nullptr; - values=nullptr; + nrEntries=NULL; + l=NULL; + values=NULL; } if (!psi) psi = phi; @@ -517,7 +517,7 @@ namespace AMDiS { { std::list<Q01PsiPhi*>::iterator list; - if (!ps && !ph) return nullptr; + if (!ps && !ph) return NULL; 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 nullptr; + return NULL; } @@ -577,7 +577,7 @@ namespace AMDiS { int numPoints = quadrature->getNumPoints(); if (!psi && !phi) { - values=nullptr; + values=NULL; } if (!psi) psi = phi; @@ -638,7 +638,7 @@ namespace AMDiS { { std::list<Q00PsiPhi*>::iterator list; - if (!ps && !ph) return nullptr; + if (!ps && !ph) return NULL; if (!ps) ps = ph; if (!ph) ph = ps; @@ -677,7 +677,7 @@ namespace AMDiS { int numPoints = quadrature->getNumPoints(); if (!psi) - values = nullptr; + values = NULL; if (!quadrature) quadrature = Quadrature::provideQuadrature(psi->getDim(), 2*psi->getDegree()); @@ -714,7 +714,7 @@ namespace AMDiS { { std::list<Q0Psi*>::iterator list; - if (!ps) return nullptr; + if (!ps) return NULL; 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(nullptr),values(nullptr),k(nullptr) + : psi(ps), quadrature(quadrat),nrEntries(NULL),values(NULL),k(NULL) { FUNCNAME_DBG("Q1Psi::Q1Psi"); const FastQuadrature *q_psi; @@ -838,7 +838,7 @@ namespace AMDiS { { std::list<Q1Psi*>::iterator list; - if (!ps) return nullptr; + if (!ps) return NULL; if (!quadrat) quadrat = Quadrature::provideQuadrature(ps->getDim(), diff --git a/AMDiS/src/QPsiPhi.h b/AMDiS/src/QPsiPhi.h index 8ce025d48a037800c6c50f0a7973afc36ad7877e..f9fcb675487196dbe19b4108a76949c4c378238e 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 nullptr; + return NULL; } /// Returns \ref k[i][j] @@ -191,7 +191,7 @@ namespace AMDiS { if (k && k[i] && k[i][j]) return k[i][j]; - return nullptr; + return NULL; } /// Returns \ref l[i][j] @@ -200,7 +200,7 @@ namespace AMDiS { if (l && l[i] && l[i][j]) return l[i][j]; - return nullptr; + return NULL; } protected: @@ -330,7 +330,7 @@ namespace AMDiS { if (values && values[i] && values[i][j]) return values[i][j]; - return nullptr; + return NULL; } /// Returns \ref k[i][j] @@ -339,7 +339,7 @@ namespace AMDiS { if (k && k[i] && k[i][j]) return k[i][j]; - return nullptr; + return NULL; } protected: @@ -457,7 +457,7 @@ namespace AMDiS { if (values && values[i] && values[i][j]) return values[i][j]; - return nullptr; + return NULL; } /// Returns \ref k[i][j] @@ -466,7 +466,7 @@ namespace AMDiS { if (l && l[i] && l[i][j]) return l[i][j]; - return nullptr; + return NULL; } /// Returns \ref k[i][j][v] @@ -706,7 +706,7 @@ namespace AMDiS { if (k && k[i]) return k[i]; - return nullptr; + return NULL; } /// Returns \values[i] @@ -715,7 +715,7 @@ namespace AMDiS { if (values && values[i]) return values[i]; - return nullptr; + return NULL; } protected: diff --git a/AMDiS/src/Quadrature.cc b/AMDiS/src/Quadrature.cc index 023b88d409866d203589f070f09d7e6a1fdfa9aa..314be5047b56d6c4b0bdbe0b0d85241806f30c4f 100644 --- a/AMDiS/src/Quadrature.cc +++ b/AMDiS/src/Quadrature.cc @@ -60,7 +60,7 @@ namespace AMDiS { DimVec<double> >& f, WorldVector<double>* vec) const { - static WorldVector<double> *quad_vec_d = nullptr; + static WorldVector<double> *quad_vec_d = NULL; static size_t size = 0; WorldVector<double> *val; WorldVector<double> grd; @@ -91,7 +91,7 @@ namespace AMDiS { const double *Quadrature::fAtQp(const AbstractFunction<double, DimVec<double> >& f, double *vec) const { - static double *quad_vec = nullptr; + static double *quad_vec = NULL; static size_t size = 0; double *val; @@ -124,7 +124,7 @@ namespace AMDiS { VectorOfFixVecs<DimVec<double> > *Quadrature::x_0d; double *Quadrature::w_0d; - VectorOfFixVecs<DimVec<double> > *Quadrature::x0_1d = nullptr; + VectorOfFixVecs<DimVec<double> > *Quadrature::x0_1d = NULL; VectorOfFixVecs<DimVec<double> > *Quadrature::x1_1d; VectorOfFixVecs<DimVec<double> > *Quadrature::x2_1d; VectorOfFixVecs<DimVec<double> > *Quadrature::x3_1d; @@ -187,7 +187,7 @@ namespace AMDiS { void Quadrature::initStaticQuadratures() { - TEST_EXIT(x0_1d == nullptr)("static quadratures already initialized\n"); + TEST_EXIT(x0_1d == NULL)("static quadratures already initialized\n"); #define zero 0.0 #define one 1.0 @@ -1445,7 +1445,7 @@ namespace AMDiS { ERROR_EXIT("invalid dim\n"); } - if (x0_1d == nullptr) + if (x0_1d == NULL) initStaticQuadratures(); return (quad_nd[dim_][degree_]); @@ -1481,7 +1481,7 @@ namespace AMDiS { const Quadrature& quad, Flag init_flag) { - FastQuadrature *quad_fast = nullptr; + FastQuadrature *quad_fast = NULL; // #pragma omp critical { @@ -1635,6 +1635,6 @@ namespace AMDiS { const VectorOfFixVecs<DimMat<double> > *FastQuadrature::getSecDer(int q) const { - return D2Phi ? (&((*D2Phi)[q])) : nullptr; + return D2Phi ? (&((*D2Phi)[q])) : NULL; } } diff --git a/AMDiS/src/Quadrature.h b/AMDiS/src/Quadrature.h index 318365bb81d29c47a05a91146266c07d6c8e4d2b..2835ae07563e6d76498ed1064ca2a53353484e3f 100644 --- a/AMDiS/src/Quadrature.h +++ b/AMDiS/src/Quadrature.h @@ -135,7 +135,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 nullptr, the values are + * , evaluated in barycentric coordinates; if vec is not NULL, the values are * stored in this vector, otherwise the values are stored in some static * local vector, which is overwritten on the next call */ @@ -147,7 +147,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 nullptr, the values are stored in this vector, otherwise the + * if vec is not NULL, the values are stored in this vector, otherwise the * values are stored in some local static vector, which is overwritten on the * next call */ @@ -318,7 +318,7 @@ namespace AMDiS { FastQuadrature(BasisFunction* basFcts, Quadrature* quad, Flag flag) : init_flag(flag), phi(0, 0), - D2Phi(nullptr), + D2Phi(NULL), quadrature(quad), basisFunctions(basFcts) {} @@ -350,7 +350,7 @@ namespace AMDiS { return (!grdPhi.empty()); if (flag == INIT_D2_PHI) - return (D2Phi != nullptr); + return (D2Phi != NULL); ERROR_EXIT("invalid flag\n"); return false; diff --git a/AMDiS/src/Quadrature.hh b/AMDiS/src/Quadrature.hh index ac9c95e1d4949f7e15b64f7af7cfa606e7365b6d..15b2e55ea77af14cd53bf127a9425043c9e3a9d7 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 = nullptr; + static T *quadVec = NULL; 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 = nullptr; + static GrdT *quadVec = NULL; 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 = nullptr; + static D2T *quadVec = NULL; static int size = 0; D2T *val; const VectorOfFixVecs<DimMat<double> > *D2Phil; diff --git a/AMDiS/src/RCNeighbourList.cc b/AMDiS/src/RCNeighbourList.cc index d8a9e0f6ef9f68d897b8eece436aeb7f5e297634..585a6808145c4a96aacc715b41e4afd06db909a8 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] = nullptr; + rclist[i]->neigh[dir] = NULL; 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] = nullptr; + rclist[i]->neigh[dir] = NULL; 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 = nullptr; + RCListElement *neighbour = NULL; Mesh *coarse_mesh = coarseningManager->getMesh(); RCListElement *coarse_list = rclist[elIndex]; @@ -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, nullptr); + rclist[i]->el->setDof(node + j, NULL); } if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); for (int i = 0; i < n_neigh; i++) { mesh->freeDof(const_cast<DegreeOfFreedom*>(rclist[i]->el->getDof(node)), CENTER); - rclist[i]->el->setDof(node, nullptr); + rclist[i]->el->setDof(node, NULL); } } } @@ -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, nullptr); + el->setDof(node + j, NULL); } if (mesh->getNumberOfDofs(FACE)) { @@ -325,13 +325,13 @@ namespace AMDiS { mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(node + 3)), FACE); for (int j = 0; j < faces; j++) - el->setDof(node + j, nullptr); + el->setDof(node + j, NULL); } if (mesh->getNumberOfDofs(CENTER)) { int node = mesh->getNode(CENTER); mesh->freeDof(const_cast<DegreeOfFreedom*>(el->getDof(node)), CENTER); - el->setDof(node, nullptr); + el->setDof(node, NULL); } } @@ -350,8 +350,8 @@ namespace AMDiS { bool secondPart = false; bool firstSplit = true; - nextEdge[0] = nullptr; - nextEdge[1] = nullptr; + nextEdge[0] = NULL; + nextEdge[1] = NULL; 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 350dfa9e241ce415d2f931eae7462323a0d07806..69b7b5e04e0f757ca81b4453188644724958a61d 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 nullptr pointer + /// If \ref rclist[i].neigh[j] is not a NULL 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 nullptr pointer + /// If \ref rclist[i].neigh[j] is not a NULL pointer /// \ref rclist[i].neigh[j]->el will be returned. Otherwise the return value - /// is nullptr + /// is NULL inline Element* getNeighbourElement(int i, int j) const { - return rclist[i]->neigh[j] ? rclist[i]->neigh[j]->el : nullptr; + return rclist[i]->neigh[j] ? rclist[i]->neigh[j]->el : NULL; } /// Returns \ref rclist[i].el inline Element* getElement(int i) const { if (static_cast<int>(rclist.size()) <= i) - return nullptr; + return NULL; 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 nullptr pointer in the case of a boundary face (only 3d) + /// of the edge, or a NULL 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 3ff50077f97dcbc1dcde727ff0b598c424f9d553..128049e1a9eb1f4f7644f3a2f1c0d2261ed71953 100644 --- a/AMDiS/src/Recovery.cc +++ b/AMDiS/src/Recovery.cc @@ -35,7 +35,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (coords) { delete coords; - coords = nullptr; + coords = NULL; } } @@ -46,7 +46,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (A) { delete A; - A = nullptr; + A = NULL; } } @@ -57,7 +57,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (rec_uh) { delete rec_uh; - rec_uh = nullptr; + rec_uh = NULL; } } @@ -68,7 +68,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (rec_grdUh) { delete rec_grdUh; - rec_grdUh = nullptr; + rec_grdUh = NULL; } } @@ -79,7 +79,7 @@ RecoveryStructure& RecoveryStructure::operator=(const RecoveryStructure& rhs) } else { if (neighbors) { delete neighbors; - neighbors = nullptr; + neighbors = NULL; } } @@ -161,7 +161,7 @@ void Recovery::set_feSpace(const FiniteElemSpace *fe_space) if (!feSpace || feSpace != fe_space) { if (struct_vec) { delete struct_vec; - struct_vec = nullptr; + struct_vec = NULL; } feSpace = fe_space; @@ -299,14 +299,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, nullptr, uhAtQP); + aux_vec->getVecAtQPs(elInfo, quad, NULL, uhAtQP); else - uh->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); + uh->getVecAtQPs(elInfo, quad, NULL, uhAtQP); } // Get gradient at quadrature points mtl::dense_vector<WorldVector<double> > grdAtQP(n_points); - uh->getGrdAtQPs(elInfo, quad, nullptr, grdAtQP); + uh->getGrdAtQPs(elInfo, quad, NULL, grdAtQP); vec_sum = 0.0; for (int k = 0; k < n_points; k++) { elInfo->coordToWorld(quad->getLambda(k), quad_pts); @@ -322,7 +322,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, nullptr, uhAtQP); + uh->getVecAtQPs(elInfo, quad, NULL, uhAtQP); double sum = 0.0; for (int k = 0; k < n_points; k++) { elInfo->coordToWorld(quad->getLambda(k), quad_pts); @@ -367,13 +367,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, nullptr, uhAtQP); + aux_vec->getVecAtQPs(elInfo, quad, NULL, uhAtQP); else - uh->getVecAtQPs(elInfo, quad, nullptr, uhAtQP); + uh->getVecAtQPs(elInfo, quad, NULL, uhAtQP); } // Get gradient at quadrature points - uh->getGrdAtQPs(elInfo, quad, nullptr, grdAtQP); + uh->getGrdAtQPs(elInfo, quad, NULL, grdAtQP); vec_sum = 0.0; for (int k = 0; k < n_points; k++) { elInfo->coordToWorld(quad->getLambda(k), quad_pts); @@ -507,7 +507,7 @@ void Recovery::fill_struct_vec(DOFVector<double> *uh, // Variables for passing information to integration routines. int degree = basis_fcts->getDegree(); - Quadrature *quad = nullptr; + Quadrature *quad = NULL; if (gradient && !method) quad = Quadrature::provideQuadrature(Global::getGeo(WORLD), degree); @@ -797,13 +797,13 @@ Recovery::recoveryUh(DOFVector<double> *uh, const FiniteElemSpace *fe_space) } // define result vector - static DOFVector<double> *vec = nullptr;// TODO: REMOVE STATIC - DOFVector<double> *result = nullptr; + static DOFVector<double> *vec = NULL;// TODO: REMOVE STATIC + DOFVector<double> *result = NULL; // Allocate memory for result vector if (vec && vec->getFeSpace() != feSpace) { delete vec; - vec = nullptr; + vec = NULL; } if (!vec) @@ -870,13 +870,13 @@ Recovery::recovery(DOFVector<double> *uh, const FiniteElemSpace *fe_space, } // define result vector - static DOFVector<WorldVector<double> > *vec = nullptr;// TODO: REMOVE STATIC - DOFVector<WorldVector<double> > *result = nullptr; + static DOFVector<WorldVector<double> > *vec = NULL;// TODO: REMOVE STATIC + DOFVector<WorldVector<double> > *result = NULL; // Allocate memory for result vector if (vec && vec->getFeSpace() != feSpace) { delete vec; - vec = nullptr; + vec = NULL; } if (!vec) @@ -922,13 +922,13 @@ Recovery::recovery(DOFVector<double> *uh, const FiniteElemSpace *fe_space = uh->getFeSpace(); // define result vector - static DOFVector<WorldVector<double> > *vec = nullptr;// TODO: REMOVE STATIC - DOFVector<WorldVector<double> > *result = nullptr; + static DOFVector<WorldVector<double> > *vec = NULL;// TODO: REMOVE STATIC + DOFVector<WorldVector<double> > *result = NULL; // Allocate memory for result vector if (vec && vec->getFeSpace() != fe_space) { delete vec; - vec = nullptr; + vec = NULL; } if (!vec) diff --git a/AMDiS/src/Recovery.h b/AMDiS/src/Recovery.h index f8375a14d0e5e81963e7bdf611e559bde1c2f17e..468e601074e4fb3fe691526107b282f35ec545e1 100644 --- a/AMDiS/src/Recovery.h +++ b/AMDiS/src/Recovery.h @@ -67,11 +67,11 @@ namespace AMDiS { { public: RecoveryStructure() - : coords(nullptr), - A(nullptr), - rec_uh(nullptr), - rec_grdUh(nullptr), - neighbors(nullptr) + : coords(NULL), + A(NULL), + rec_uh(NULL), + rec_grdUh(NULL), + neighbors(NULL) {} ~RecoveryStructure() @@ -80,11 +80,11 @@ namespace AMDiS { } RecoveryStructure(const RecoveryStructure& rhs) - : coords(nullptr), - A(nullptr), - rec_uh(nullptr), - rec_grdUh(nullptr), - neighbors(nullptr) + : coords(NULL), + A(NULL), + rec_uh(NULL), + rec_grdUh(NULL), + neighbors(NULL) { *this = rhs; } @@ -94,29 +94,29 @@ namespace AMDiS { /// Clear recovery structure inline void clear() { - if (coords != nullptr) { + if (coords != NULL) { delete coords; - coords = nullptr; + coords = NULL; } - if (A != nullptr) { + if (A != NULL) { delete A; - A = nullptr; + A = NULL; } - if (rec_uh != nullptr) { + if (rec_uh != NULL) { delete rec_uh; - rec_uh = nullptr; + rec_uh = NULL; } - if (rec_grdUh != nullptr) { + if (rec_grdUh != NULL) { delete rec_grdUh; - rec_grdUh = nullptr; + rec_grdUh = NULL; } - if (neighbors != nullptr) { + if (neighbors != NULL) { delete neighbors; - neighbors = nullptr; + neighbors = NULL; } } @@ -151,9 +151,9 @@ namespace AMDiS { { public: Recovery(int norm, int method_) - : struct_vec(nullptr), - feSpace(nullptr), - matrix_fcts(nullptr), + : struct_vec(NULL), + feSpace(NULL), + matrix_fcts(NULL), 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 = nullptr, - AbstractFunction<double, double> *f_scal = nullptr, - DOFVector<double> *aux_vec = nullptr); + AbstractFunction<double, WorldVector<double> > *f_vec = NULL, + AbstractFunction<double, double> *f_scal = NULL, + DOFVector<double> *aux_vec = NULL); DOFVector<WorldVector<double> >* recovery(DOFVector<double> *uh, const FiniteElemSpace *fe_space, - AbstractFunction<double, WorldVector<double> > *f_vec = nullptr, - AbstractFunction<double, double> *f_scal = nullptr, - DOFVector<double> *aux_vec = nullptr); + AbstractFunction<double, WorldVector<double> > *f_vec = NULL, + AbstractFunction<double, double> *f_scal = NULL, + DOFVector<double> *aux_vec = NULL); /// 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 = nullptr, - AbstractFunction<double, double> *f = nullptr, - DOFVector<double> *aux_vec = nullptr); + AbstractFunction<double, WorldVector<double> > *f_vec = NULL, + AbstractFunction<double, double> *f = NULL, + DOFVector<double> *aux_vec = NULL); /// 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 = nullptr, - AbstractFunction<double, double> *f_scal = nullptr, - DOFVector<double> *aux_vec = nullptr); + AbstractFunction<double, WorldVector<double> > *f_vec = NULL, + AbstractFunction<double, double> *f_scal = NULL, + DOFVector<double> *aux_vec = NULL); /// 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 = nullptr, - AbstractFunction<double, double> *f_scal = nullptr, - DOFVector<double> *aux_vec = nullptr); + AbstractFunction<double, WorldVector<double> > *f_vec = NULL, + AbstractFunction<double, double> *f_scal = NULL, + DOFVector<double> *aux_vec = NULL); 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 f2675b0e79c3716baf471780bab5110a0967d5e2..ce280be89c2641f51bb8a13d7409187f19b3a2db 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(nullptr), + : mesh(NULL), newCoords(false), - stack(nullptr) + stack(NULL) {} /// Destructor @@ -93,7 +93,7 @@ namespace AMDiS { { FUNCNAME("RefinementManager::refineFunction()"); ERROR_EXIT("called for base class!\n"); - return nullptr; + return NULL; } inline void setMesh(Mesh *m) diff --git a/AMDiS/src/RefinementManager1d.cc b/AMDiS/src/RefinementManager1d.cc index 9199adee5b21321cf865b97a4ebbcc926873552e..e72922111baf27553360234c17389e7c8148a904 100644 --- a/AMDiS/src/RefinementManager1d.cc +++ b/AMDiS/src/RefinementManager1d.cc @@ -112,7 +112,7 @@ namespace AMDiS { if (!mesh->queryCoarseDOFs() && mesh->getNumberOfDofs(CENTER)) { mesh->freeDof(const_cast<DegreeOfFreedom*>( el->getDof(mesh->getNode(CENTER))), CENTER); - el->setDof(mesh->getNode(CENTER), nullptr); + el->setDof(mesh->getNode(CENTER), NULL); } } diff --git a/AMDiS/src/RefinementManager2d.cc b/AMDiS/src/RefinementManager2d.cc index 9c1c49c2234b8eb0561f98afe8bc49c9ae779e1c..14823eb98b3ec74e3f08c330ad8a35ea871b15a2 100644 --- a/AMDiS/src/RefinementManager2d.cc +++ b/AMDiS/src/RefinementManager2d.cc @@ -69,9 +69,9 @@ namespace AMDiS { // === Check for periodic boundary === - DegreeOfFreedom *next_edge[2] = {nullptr, nullptr}; + DegreeOfFreedom *next_edge[2] = {NULL, NULL}; DegreeOfFreedom *first_edge[2] = {edge[0], edge[1]}; - DegreeOfFreedom *last_edge[2] = {nullptr, nullptr}; + DegreeOfFreedom *last_edge[2] = {NULL, NULL}; int n_neigh_periodic; DegreeOfFreedom newDOF = -1; @@ -80,7 +80,7 @@ namespace AMDiS { RCNeighbourList periodicList; - while (edge[0] != nullptr) { + while (edge[0] != NULL) { 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] = {nullptr, nullptr, nullptr}; + DegreeOfFreedom *dof[3] = {NULL, NULL, NULL}; Triangle *el = dynamic_cast<Triangle*>(const_cast<Element*>(refineList.getElement(0))); Triangle *neigh = diff --git a/AMDiS/src/RefinementManager3d.cc b/AMDiS/src/RefinementManager3d.cc index b4c76cc75071bd2ba8d9163f7407e5135c941016..15a099e0f563c6f6824bc9aeaa0e91bbaf611160 100644 --- a/AMDiS/src/RefinementManager3d.cc +++ b/AMDiS/src/RefinementManager3d.cc @@ -337,7 +337,7 @@ namespace AMDiS { Tetrahedron *el = dynamic_cast<Tetrahedron*>(const_cast<Element*>(refineList.getElement(0))); /* first element in the list */ - DegreeOfFreedom *dof[3] = {nullptr, nullptr, nullptr}; + DegreeOfFreedom *dof[3] = {NULL, NULL, NULL}; /****************************************************************************/ /* get new dof's in the refinement edge */ @@ -417,7 +417,7 @@ namespace AMDiS { Tetrahedron *el = dynamic_cast<Tetrahedron*>(const_cast<Element*>((*elInfo)->getElement())); - if ((*elInfo)->getNeighbour(localNeighbour) == nullptr) + if ((*elInfo)->getNeighbour(localNeighbour) == NULL) return true; int oppVertex = (*elInfo)->getOppVertex(localNeighbour); @@ -762,9 +762,9 @@ namespace AMDiS { // ============ Check for periodic boundary ============ - DegreeOfFreedom *next_edge[2] = {nullptr, nullptr}; + DegreeOfFreedom *next_edge[2] = {NULL, NULL}; DegreeOfFreedom *first_edge[2] = {edge[0], edge[1]}; - DegreeOfFreedom *last_edge[2] = {nullptr, nullptr}; + DegreeOfFreedom *last_edge[2] = {NULL, NULL}; int n_neigh_periodic = 0; DegreeOfFreedom lastNewDof = -1; @@ -772,7 +772,7 @@ namespace AMDiS { RCNeighbourList periodicList; - while (edge[0] != nullptr) { + while (edge[0] != NULL) { refineList.periodicSplit(edge, next_edge, &n_neigh, &n_neigh_periodic, periodicList); diff --git a/AMDiS/src/RobinBC.cc b/AMDiS/src/RobinBC.cc index f73fff2f2edbc41c23ad5fd32408beccee8bb73f..a277d4ba3a0810083db277cf08fd6eb4cd8dfbb9 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(nullptr), - robinOperators(nullptr) + neumannOperators(NULL), + robinOperators(NULL) { int dim = rowFeSpace->getMesh()->getDim(); @@ -89,8 +89,8 @@ namespace AMDiS { const FiniteElemSpace *rowFeSpace_, const FiniteElemSpace *colFeSpace_) : BoundaryCondition(type, rowFeSpace_, colFeSpace_), - neumannOperators(nullptr), - robinOperators(nullptr) + neumannOperators(NULL), + robinOperators(NULL) { int dim = rowFeSpace->getMesh()->getDim(); @@ -112,7 +112,7 @@ namespace AMDiS { if (j) { Operator *jOp = new Operator(rowFeSpace); - jOp->addZeroOrderTerm(new VecAtQP_ZOT(j, nullptr)); + jOp->addZeroOrderTerm(new VecAtQP_ZOT(j, NULL)); 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, nullptr)); + alphaOp->addZeroOrderTerm(new VecAtQP_ZOT(alpha, NULL)); 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(nullptr), - robinOperators(nullptr) + neumannOperators(NULL), + robinOperators(NULL) { 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, nullptr, uhAtQp); + dv->getVecAtQPs(elInfo, quadrature, NULL, uhAtQp); ElementVector f(nPoints); f = 0.0; diff --git a/AMDiS/src/RobinBC.h b/AMDiS/src/RobinBC.h index 4c582b2aa07dd58407a9023ba4c1e90cc1f4c8d1..9cadf4f12fbd7087e9eef3f8bff96b7c9bd2f978 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 = nullptr); + const FiniteElemSpace *colFeSpace = NULL); /// 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 = nullptr); + const FiniteElemSpace *colFeSpace = NULL); /// 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 = nullptr); + const FiniteElemSpace *colFeSpace = NULL); /// 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 = nullptr) - : RobinBC(type, j, nullptr, rowFeSpace, colFeSpace) + const FiniteElemSpace *colFeSpace = NULL) + : RobinBC(type, j, NULL, rowFeSpace, colFeSpace) {} NeumannBC(BoundaryType type, DOFVectorBase<double> *j, const FiniteElemSpace *rowFeSpace, - const FiniteElemSpace *colFeSpace = nullptr) - : RobinBC(type, j, nullptr, rowFeSpace, colFeSpace) + const FiniteElemSpace *colFeSpace = NULL) + : RobinBC(type, j, NULL, rowFeSpace, colFeSpace) {} }; diff --git a/AMDiS/src/ScalableQuadrature.h b/AMDiS/src/ScalableQuadrature.h index fb69fbdb35a1993235f1c9be8b96a9af69459981..0d352efabc928db2bc159a5b4e9750ae263d3852 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 nullptr; + return NULL; } } diff --git a/AMDiS/src/SecondOrderAssembler.cc b/AMDiS/src/SecondOrderAssembler.cc index 2122446ceedc25379192caebc0cb4c3ced56f22c..7b6bdf3b6224876a74013415e022acadc6f1d308 100644 --- a/AMDiS/src/SecondOrderAssembler.cc +++ b/AMDiS/src/SecondOrderAssembler.cc @@ -55,7 +55,7 @@ namespace AMDiS { { // check if a assembler is needed at all if (op->secondOrder.size() == 0) - return nullptr; + return NULL; SecondOrderAssembler *newAssembler; diff --git a/AMDiS/src/SecondOrderTerm.cc b/AMDiS/src/SecondOrderTerm.cc index 5138b7b3dd96baf618d939bc9009d446dbb7c958..78d469e661fefe891bdcae4446aba9469ce0d3da 100644 --- a/AMDiS/src/SecondOrderTerm.cc +++ b/AMDiS/src/SecondOrderTerm.cc @@ -925,13 +925,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 nullptr!\n"); + TEST_EXIT(vecs[i])("One vector is NULL!\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 nullptr!\n"); + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -1058,13 +1058,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 nullptr!\n"); + TEST_EXIT(vecs[i])("One vector is NULL!\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 nullptr!\n"); + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } diff --git a/AMDiS/src/SecondOrderTerm.h b/AMDiS/src/SecondOrderTerm.h index 0ba96dc117f7e859b827cb5c60c59fc06ba1422a..b8dfb1b7700bd3614bc35f8e5af8543f9072f62e 100644 --- a/AMDiS/src/SecondOrderTerm.h +++ b/AMDiS/src/SecondOrderTerm.h @@ -195,7 +195,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -360,18 +360,18 @@ namespace AMDiS { { public: /// Constructor. - VecAtQP_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af = nullptr, + VecAtQP_SOT(DOFVectorBase<double> *dv, AbstractFunction<double, double> *af = NULL, double factor_ = 1.0); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -415,12 +415,12 @@ namespace AMDiS { /// Constructor. Vec2AtQP_SOT(DOFVectorBase<double> *dv1, DOFVectorBase<double> *dv2, - BinaryAbstractFunction<double, double, double> *af = nullptr, + BinaryAbstractFunction<double, double, double> *af = NULL, double factor_ = 1.0); /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -470,7 +470,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -516,13 +516,13 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implementation of \ref OperatorTerm::initElement() for multilpe meshes. void initElement(const ElInfo* smallElInfo, const ElInfo* largeElInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -579,7 +579,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -629,7 +629,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -685,7 +685,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -735,7 +735,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::eval(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -786,7 +786,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -834,7 +834,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -884,7 +884,7 @@ namespace AMDiS { bool symmetric); /// Implementation of \ref OperatorTerm::initElement(). - void initElement(const ElInfo*, SubAssembler*, Quadrature *quad= nullptr); + void initElement(const ElInfo*, SubAssembler*, Quadrature *quad= NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -942,7 +942,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo*, SubAssembler* , - Quadrature *quad= nullptr); + Quadrature *quad= NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -1002,7 +1002,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). @@ -1053,7 +1053,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -1107,7 +1107,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -1154,7 +1154,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; @@ -1206,7 +1206,7 @@ namespace AMDiS { /// Implementation of \ref OperatorTerm::initElement(). void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, - Quadrature *quad = nullptr); + Quadrature *quad = NULL); /// Implements SecondOrderTerm::getLALt(). void getLALt(const ElInfo *elInfo, std::vector<mtl::dense2D<double> > &LALt) const; diff --git a/AMDiS/src/Serializer.h b/AMDiS/src/Serializer.h index e6c9fa4462dd2bce8a26440e864597f8c2309b5f..8f104c6b926a28e8e2cd8c5cba678526c93e2d3c 100644 --- a/AMDiS/src/Serializer.h +++ b/AMDiS/src/Serializer.h @@ -91,7 +91,7 @@ namespace AMDiS { bool force, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = nullptr) + bool (*writeElem)(ElInfo*) = NULL) { FUNCNAME("Serializer::writeFiles()"); diff --git a/AMDiS/src/SubAssembler.cc b/AMDiS/src/SubAssembler.cc index 750963ac3288354b788e0d8189c16e94d502c65d..59b68ce2fe3645afa9b14b6dd415988f30797be1 100644 --- a/AMDiS/src/SubAssembler.cc +++ b/AMDiS/src/SubAssembler.cc @@ -44,8 +44,8 @@ namespace AMDiS { nCol(0), coordsNumAllocated(0), quadrature(quadrat), - psiFast(nullptr), - phiFast(nullptr), + psiFast(NULL), + phiFast(NULL), symmetric(true), opt(optimized), firstCall(true), @@ -135,7 +135,7 @@ namespace AMDiS { // calls initElement of each term for (vector<OperatorTerm*>::iterator it = terms.begin(); it != terms.end(); ++it) { - if (largeElInfo == nullptr) + if (largeElInfo == NULL) (*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 e3ae7cb9aa5da6244dee30ae829c53f7c557f459..9a3f1791c0a36fae7e836a802ef30568917062f6 100644 --- a/AMDiS/src/SubAssembler.h +++ b/AMDiS/src/SubAssembler.h @@ -153,8 +153,8 @@ namespace AMDiS { /// \ref calculateElementVector() is called for the first time for this /// Element. virtual void initElement(const ElInfo *smallElInfo, - const ElInfo *largeElInfo = nullptr, - Quadrature *quad = nullptr); + const ElInfo *largeElInfo = NULL, + Quadrature *quad = NULL); /// Returns \ref psiFast. const FastQuadrature *getPsiFast() const @@ -201,9 +201,9 @@ namespace AMDiS { /// Used for \ref getVectorAtQPs() and \ref getGradientsAtQPs(). struct ValuesAtQPs { ValuesAtQPs() - : valid(false), quad(nullptr) + : valid(false), quad(NULL) {} - ValuesAtQPs(boost::any values_, bool valid_, Quadrature* quad_=nullptr) + ValuesAtQPs(boost::any values_, bool valid_, Quadrature* quad_=NULL) : values(values_), valid(valid_), quad(quad_) {} diff --git a/AMDiS/src/SubAssembler.hh b/AMDiS/src/SubAssembler.hh index eddc22d593ec4bbfc51279bcc59d216f29052b29..94f2deb416f8a4a5fbf89d3f96c4651d7c5cf343 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, nullptr, psiFast, values); + vec->getVecAtQPs(elInfo, NULL, psiFast, values); } else if (phiFast->getBasisFunctions() == basFcts) { - vec->getVecAtQPs(elInfo, nullptr, phiFast, values); + vec->getVecAtQPs(elInfo, NULL, phiFast, values); } else { - vec->getVecAtQPs(elInfo, localQuad, nullptr, values); + vec->getVecAtQPs(elInfo, localQuad, NULL, values); } } else { - vec->getVecAtQPs(elInfo, localQuad, nullptr, values); + vec->getVecAtQPs(elInfo, localQuad, NULL, 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, nullptr, values); + vec->getVecAtQPs(smallElInfo, largeElInfo, localQuad, NULL, values); vecAtQPs = values; } @@ -166,13 +166,13 @@ namespace AMDiS { if (opt && !quad && sameFeSpaces) { if (psiFast->getBasisFunctions() == basFcts) - vec->getGrdAtQPs(elInfo, nullptr, psiFast, values); + vec->getGrdAtQPs(elInfo, NULL, psiFast, values); else if (phiFast->getBasisFunctions() == basFcts) - vec->getGrdAtQPs(elInfo, nullptr, phiFast, values); + vec->getGrdAtQPs(elInfo, NULL, phiFast, values); else - vec->getGrdAtQPs(elInfo, nullptr, phiFast, values); + vec->getGrdAtQPs(elInfo, NULL, phiFast, values); } else { - vec->getGrdAtQPs(elInfo, localQuad, nullptr, values); + vec->getGrdAtQPs(elInfo, localQuad, NULL, 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, nullptr, values); + vec->getGrdAtQPs(smallElInfo, largeElInfo, localQuad, NULL, values); grdAtQPs = values; } @@ -256,13 +256,13 @@ namespace AMDiS { if (opt && !quad && sameFeSpaces) { if (psiFast->getBasisFunctions() == basFcts) - vec->getDerivativeAtQPs(elInfo, nullptr, psiFast, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, NULL, psiFast, comp, grdAtQPs); else if (phiFast->getBasisFunctions() == basFcts) - vec->getDerivativeAtQPs(elInfo, nullptr, phiFast, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, NULL, phiFast, comp, grdAtQPs); else - vec->getDerivativeAtQPs(elInfo, nullptr, phiFast, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, NULL, phiFast, comp, grdAtQPs); } else { - vec->getDerivativeAtQPs(elInfo, localQuad, nullptr, comp, grdAtQPs); + vec->getDerivativeAtQPs(elInfo, localQuad, NULL, comp, grdAtQPs); } } @@ -289,7 +289,7 @@ namespace AMDiS { return; } - vec->getDerivativeAtQPs(smallElInfo, largeElInfo, localQuad, nullptr, comp, grdAtQPs); + vec->getDerivativeAtQPs(smallElInfo, largeElInfo, localQuad, NULL, comp, grdAtQPs); } } diff --git a/AMDiS/src/SubQuadrature.h b/AMDiS/src/SubQuadrature.h index a0a8d5ea22c72622eee530fbf1619fca188829c2..d53d20c06442266a309c88e05d9af1c70e092250 100644 --- a/AMDiS/src/SubQuadrature.h +++ b/AMDiS/src/SubQuadrature.h @@ -39,7 +39,7 @@ namespace AMDiS { quad->getDegree(), dim_, quad->getNumPoints(), - nullptr, + NULL, quad->getWeight()), quad_(quad), subDim_(quad_->getDim()) diff --git a/AMDiS/src/SurfaceAssembler.h b/AMDiS/src/SurfaceAssembler.h index 2b502114eef8663a70a8ceb7dacaaa7b70a2897a..e8dd38a9f8d6c64c58dac1c5be75cd75a3baa9b8 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_, nullptr); + rowQPInfo11_ = colQPInfo11_ = QPInfo::provideQPInfo(rowQuad11_, NULL); } if (rowQuad10_) { subQuadrature = new SubQuadrature(rowQuad10_, rowDim_); rowQuad10_ = colQuad10_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo10_ = colQPInfo10_ = QPInfo::provideQPInfo(rowQuad10_, nullptr); + rowQPInfo10_ = colQPInfo10_ = QPInfo::provideQPInfo(rowQuad10_, NULL); } if (rowQuad01_) { subQuadrature = new SubQuadrature(rowQuad01_, rowDim_); rowQuad01_ = colQuad01_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo01_ = colQPInfo01_ = QPInfo::provideQPInfo(rowQuad01_, nullptr); + rowQPInfo01_ = colQPInfo01_ = QPInfo::provideQPInfo(rowQuad01_, NULL); } if (rowQuad00_) { subQuadrature = new SubQuadrature(rowQuad00_, rowDim_); rowQuad00_ = colQuad00_ = subQuadrature; subQuadrature->scaleQuadrature(coords_); - rowQPInfo00_ = colQPInfo00_ = QPInfo::provideQPInfo(rowQuad00_, nullptr); + rowQPInfo00_ = colQPInfo00_ = QPInfo::provideQPInfo(rowQuad00_, NULL); } } diff --git a/AMDiS/src/SurfaceOperator.h b/AMDiS/src/SurfaceOperator.h index bc5b9ebe34559b8c1563e06cc3dadd32d46ad341..d8c9accabe991b2dbe20aa334b149c5df0e47586 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(nullptr), - quad1GrdPsi(nullptr), - quad1GrdPhi(nullptr), - quad0(nullptr) + quad2(NULL), + quad1GrdPsi(NULL), + quad1GrdPhi(NULL), + quad0(NULL) { - assembler = nullptr; + assembler = NULL; int dim = rowFeSpace->getMesh()->getDim(); int degree; diff --git a/AMDiS/src/SurfaceQuadrature.cc b/AMDiS/src/SurfaceQuadrature.cc index 4eb9d381b162b35c73c8a8372467383e5b863aa7..49eb47da89fb4e8a9ed44df4e60869387f547a72 100644 --- a/AMDiS/src/SurfaceQuadrature.cc +++ b/AMDiS/src/SurfaceQuadrature.cc @@ -32,7 +32,7 @@ namespace AMDiS { q->getDegree(), q->getDim() + 1, q->getNumPoints(), - nullptr, + NULL, q->getWeight()), quad(q), coords(c) diff --git a/AMDiS/src/SurfaceRegion_ED.h b/AMDiS/src/SurfaceRegion_ED.h index 5b295f34084e67fcafd7c9afc5844dea378b9466..2045993e009714234a9f2475a059673c67f2ecc9 100644 --- a/AMDiS/src/SurfaceRegion_ED.h +++ b/AMDiS/src/SurfaceRegion_ED.h @@ -49,7 +49,7 @@ namespace AMDiS { } }; - SurfaceRegion_ED(ElementData *decorated = nullptr) + SurfaceRegion_ED(ElementData *decorated = NULL) : ElementData(decorated), side(-1), region(-1) diff --git a/AMDiS/src/Tetrahedron.cc b/AMDiS/src/Tetrahedron.cc index 77125357fdc6ccfcb5412e27e1bc90c0ef6b16b0..25f0d711c50a3f7c1ec0d7cf5cb52d0b77d7f2e2 100644 --- a/AMDiS/src/Tetrahedron.cc +++ b/AMDiS/src/Tetrahedron.cc @@ -134,9 +134,9 @@ namespace AMDiS { void Tetrahedron::sortFaceIndices(int face, FixVec<int,WORLD> &vec) const { // TODO: REMOVE STATIC - static MatrixOfFixVecs<FixVec<int,WORLD> > *sorted_3d = nullptr; + static MatrixOfFixVecs<FixVec<int,WORLD> > *sorted_3d = NULL; - if (sorted_3d == nullptr) { + if (sorted_3d == NULL) { sorted_3d = new MatrixOfFixVecs<FixVec<int,WORLD> >(3, 4, 7, NO_INIT); (*sorted_3d)[0][0][0] = (*sorted_3d)[0][0][1] = @@ -420,7 +420,7 @@ namespace AMDiS { if (elDofIter.getCurrentPos() == 1 && elDofIter.getCurrentElementPos() == bound.ithObj) { dofs.push_back(elDofIter.getBaseDof()); - if (dofGeoIndex != nullptr) + if (dofGeoIndex != NULL) dofGeoIndex->push_back(EDGE); } } while (elDofIter.nextStrict()); @@ -430,7 +430,7 @@ namespace AMDiS { elDofIter.getCurrentElementPos() == bound.ithObj) { dofs.push_back(elDofIter.getDofPtr()); - if (dofGeoIndex != nullptr) + if (dofGeoIndex != NULL) dofGeoIndex->push_back(EDGE); } } while (elDofIter.next()); @@ -518,7 +518,7 @@ namespace AMDiS { else dofs.push_back(elDofIter.getDofPtr()); - if (dofGeoIndex != nullptr) + if (dofGeoIndex != NULL) dofGeoIndex->push_back(elDofIter.getPosIndex()); } diff --git a/AMDiS/src/Tetrahedron.h b/AMDiS/src/Tetrahedron.h index f8f1caea7e929a4737bdb96e38634aafe9e23582..692fd62dffe324e479e75a0abdab42cbb310fd70 100644 --- a/AMDiS/src/Tetrahedron.h +++ b/AMDiS/src/Tetrahedron.h @@ -156,7 +156,7 @@ namespace AMDiS { BoundaryObject bound, DofContainer& dofs, bool baseDofPtr = false, - std::vector<GeoIndex>* dofGeoIndex = nullptr) const; + std::vector<GeoIndex>* dofGeoIndex = NULL) const; void getSubBoundary(BoundaryObject bound, std::vector<BoundaryObject> &subBound) const; diff --git a/AMDiS/src/TimedObject.h b/AMDiS/src/TimedObject.h index 4c7dea05a132c93ef0cb6196a787982915013ad2..7f7ae2d80ba5131d6fd074d5d91bfbd326f0a55a 100644 --- a/AMDiS/src/TimedObject.h +++ b/AMDiS/src/TimedObject.h @@ -38,7 +38,7 @@ namespace AMDiS { public: /// Constructor. TimedObject() - : timePtr(nullptr) + : timePtr(NULL) {} /// Sets the time pointer. diff --git a/AMDiS/src/TransformDOF.h b/AMDiS/src/TransformDOF.h index f20717e6e8a73dc7522d9881240c31b2f9c19bfd..0764e21179633f543c0a3862e150f078b90bc538 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 = nullptr; + DimVec<double> *coords = NULL; 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 ae96ef65a0a58bce194a6f072c32213547c8f97b..5d8499257f22806f96c084e1ee6ddb6d1918b2a7 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 = nullptr; + traverse_mel = NULL; stack_used = 0; - return traverseNext(nullptr); + return traverseNext(NULL); } @@ -89,7 +89,7 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseNext()"); - ElInfo *elinfo = nullptr; + ElInfo *elinfo = NULL; 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 == nullptr)("invalid old elinfo != nil\n"); + TEST_EXIT_DBG(elinfo_old == NULL)("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, nullptr); + elinfo_stack.resize(new_stack_size, NULL); // create new elinfos for (int i = stack_size; i < new_stack_size; i++) { - TEST_EXIT_DBG(elinfo_stack[i] == nullptr)("???\n"); + TEST_EXIT_DBG(elinfo_stack[i] == NULL)("???\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, nullptr); + save_elinfo_stack.resize(new_stack_size, NULL); // create new elinfos for (int i = stack_size; i < new_stack_size; i++) { - TEST_EXIT_DBG(save_elinfo_stack[i] == nullptr)("???\n"); + TEST_EXIT_DBG(save_elinfo_stack[i] == NULL)("???\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 = nullptr; + Element *el = NULL; if (stack_used == 0) { /* first call */ currentMacro = traverse_mesh->firstMacroElement(); @@ -185,7 +185,7 @@ namespace AMDiS { } if (currentMacro == traverse_mesh->endOfMacroElements()) - return nullptr; + return NULL; 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 == nullptr || el->getFirstChild() == nullptr) + if (el == NULL || el->getFirstChild() == NULL) 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() == nullptr))) { + ((info_stack[stack_used] >= 2) || (el->getFirstChild() == NULL))) { 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 nullptr; + return NULL; do { currentMacro++; @@ -216,7 +216,7 @@ namespace AMDiS { ((*currentMacro)->getIndex() % maxThreads != myThreadId)); if (currentMacro == traverse_mesh->endOfMacroElements()) - return nullptr; + return NULL; 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 == nullptr || el->getFirstChild() == nullptr) + if (el == NULL || el->getFirstChild() == NULL) return elinfo_stack[stack_used]; } } @@ -257,7 +257,7 @@ namespace AMDiS { ERROR_EXIT("not yet implemented\n"); - return nullptr; + return NULL; } @@ -266,7 +266,7 @@ namespace AMDiS { ElInfo *elInfo; do { elInfo = traverseEveryElementPreorder(); - } while (elInfo != nullptr && elInfo->getLevel() != traverse_level); + } while (elInfo != NULL && 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 == nullptr) - return nullptr; + if (traverse_mel == NULL) + return NULL; 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()==nullptr))) { + ((info_stack[stack_used] >= 2) || (el->getFirstChild()==NULL))) { 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 nullptr; + return NULL; traverse_mel = *currentMacro; stack_used = 1; @@ -363,8 +363,8 @@ namespace AMDiS { } traverse_mel = *currentMacro; - if (traverse_mel == nullptr) - return nullptr; + if (traverse_mel == NULL) + return NULL; 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() == nullptr)) { + (info_stack[stack_used] >= 2 || el->getFirstChild() == NULL)) { 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 nullptr; + return NULL; currentMacro++; if (currentMacro == traverse_mesh->endOfMacroElements()) - return nullptr; + return NULL; traverse_mel = *currentMacro; stack_used = 1; @@ -430,7 +430,7 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseEveryElementInorder"); ERROR_EXIT("not yet implemented\n"); - return nullptr; + return NULL; } @@ -450,7 +450,7 @@ namespace AMDiS { } if (currentMacro == traverse_mesh->endOfMacroElements()) - return nullptr; + return NULL; 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() == nullptr)) { + (info_stack[stack_used] >= 3 || el->getFirstChild() == NULL)) { 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 nullptr; + return NULL; currentMacro++; if (currentMacro == traverse_mesh->endOfMacroElements()) - return nullptr; + return NULL; traverse_mel = *currentMacro; stack_used = 1; @@ -522,7 +522,7 @@ namespace AMDiS { default: ERROR_EXIT("invalid dim\n"); } - return nullptr; + return NULL; } @@ -530,8 +530,8 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseNeighbour3d()"); - Element *el2 = nullptr; - ElInfo *elinfo2 = nullptr; + Element *el2 = NULL; + ElInfo *elinfo2 = NULL; int stack2_used = 0; int sav_neighbour = neighbour; @@ -614,8 +614,8 @@ namespace AMDiS { int i = traverse_mel->getOppVertex(nb); traverse_mel = traverse_mel->getNeighbour(nb); - if (traverse_mel == nullptr) - return nullptr; + if (traverse_mel == NULL) + return NULL; if (nb < 2 && save_stack_used > 1) { // go down one level in OLD hierarchy @@ -794,8 +794,8 @@ namespace AMDiS { { FUNCNAME("TraverseStack::traverseNeighbour2d()"); -// Triangle *el2 = nullptr; -// ElInfo *elinfo2 = nullptr; +// Triangle *el2 = NULL; +// ElInfo *elinfo2 = NULL; int stack2_used = 0; int sav_neighbour = neighbour; @@ -896,8 +896,8 @@ namespace AMDiS { int i = traverse_mel->getOppVertex(nb); traverse_mel = traverse_mel->getNeighbour(nb); - if (traverse_mel == nullptr) - return nullptr; + if (traverse_mel == NULL) + return NULL; nb = i; stack_used = 1; diff --git a/AMDiS/src/Traverse.h b/AMDiS/src/Traverse.h index 64ed13039a1fced1c7bb38f940c34bcaf0ce4f59..e68a5f63a2bb9d4aec4bd9ee216712b715dc6408 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(nullptr), + traverse_mel(NULL), 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 nullptr is returned, the traversal is finished. + /// If NULL 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 nullptr; + return NULL; 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 5a32ed2c3561fa145de3c5a3c10b56afd6d9e73d..1a36b2d72e537bb89550c2a621d0d5ae77889d6f 100644 --- a/AMDiS/src/Triangle.cc +++ b/AMDiS/src/Triangle.cc @@ -65,9 +65,9 @@ namespace AMDiS { void Triangle::sortFaceIndices(int face, FixVec<int, WORLD> &vec) const { // TODO: REMOVE STATIC - static MatrixOfFixVecs<FixVec<int, WORLD> > *sorted_2d = nullptr; + static MatrixOfFixVecs<FixVec<int, WORLD> > *sorted_2d = NULL; - if (sorted_2d == nullptr) { + if (sorted_2d == NULL) { sorted_2d = new MatrixOfFixVecs<FixVec<int, WORLD> >(2, 3, 2, NO_INIT); (*sorted_2d)[1][0][1] = (*sorted_2d)[1][1][0] = @@ -265,13 +265,13 @@ namespace AMDiS { if (bound.reverseMode) { for (int i = addDofs.size() - 1; i >= 0; i--) { dofs.push_back(addDofs[i]); - if (dofGeoIndex != nullptr) + if (dofGeoIndex != NULL) dofGeoIndex->push_back(EDGE); } } else { for (unsigned int i = 0; i < addDofs.size(); i++) { dofs.push_back(addDofs[i]); - if (dofGeoIndex != nullptr) + if (dofGeoIndex != NULL) dofGeoIndex->push_back(EDGE); } } diff --git a/AMDiS/src/Triangle.h b/AMDiS/src/Triangle.h index 910e9b03fff3bf5ca741cc1e7f92f3e1e6af9c28..4fe58078ea155fbbcf442eefb56f7eef89f93935 100644 --- a/AMDiS/src/Triangle.h +++ b/AMDiS/src/Triangle.h @@ -205,7 +205,7 @@ namespace AMDiS { BoundaryObject bound, DofContainer& dofs, bool baseDofPtr = false, - std::vector<GeoIndex>* dofGeoIndex = nullptr) const; + std::vector<GeoIndex>* dofGeoIndex = NULL) const; void prepareNextBound(BoundaryObject &bound, int ithChild) const; diff --git a/AMDiS/src/VertexVector.cc b/AMDiS/src/VertexVector.cc index e884c4396f6cc8b4dcbfaab00dc611a7d86feaaf..37fe2461d38b38c0d8f27550e20b276fed6cbfb4 100644 --- a/AMDiS/src/VertexVector.cc +++ b/AMDiS/src/VertexVector.cc @@ -29,7 +29,7 @@ namespace AMDiS { : DOFVectorDOF() { name = n; - feSpace = nullptr; + feSpace = NULL; admin = a; const_cast<DOFAdmin*>(admin)->addDOFIndexed(this); const_cast<DOFAdmin*>(admin)->addDOFContainer(this); diff --git a/AMDiS/src/ZeroOrderAssembler.cc b/AMDiS/src/ZeroOrderAssembler.cc index 26570b8969ee21e15ba8e4798170a73255675da7..803eac07a79d169b5a4d526d512873aa2e0aac16 100644 --- a/AMDiS/src/ZeroOrderAssembler.cc +++ b/AMDiS/src/ZeroOrderAssembler.cc @@ -55,7 +55,7 @@ namespace AMDiS { { // check if an assembler is needed at all if (op->zeroOrder.size() == 0) - return nullptr; + return NULL; ZeroOrderAssembler *newAssembler; diff --git a/AMDiS/src/ZeroOrderTerm.cc b/AMDiS/src/ZeroOrderTerm.cc index b385b95c3b8b7bb3ce1ef675dd7703e7210552b4..9120ba435bf2f729260e6b7bda8bf6bada02c44c 100644 --- a/AMDiS/src/ZeroOrderTerm.cc +++ b/AMDiS/src/ZeroOrderTerm.cc @@ -598,7 +598,7 @@ namespace AMDiS { vecsAtQPs.resize(vecs.size()); for (unsigned int i = 0; i < dv.size(); i++) { - TEST_EXIT(dv[i])("One vector is nullptr!\n"); + TEST_EXIT(dv[i])("One vector is NULL!\n"); auxFeSpaces.insert(dv[i]->getFeSpace()); } @@ -657,7 +657,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 nullptr!\n"); + TEST_EXIT(dv[i])("One vector is NULL!\n"); auxFeSpaces.insert(dv[i]->getFeSpace()); } @@ -775,7 +775,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 nullptr!\n"); + TEST_EXIT(dv[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(dv[i]->getFeSpace()); } @@ -926,13 +926,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 nullptr!\n"); + TEST_EXIT(vecs[i])("One vector is NULL!\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 nullptr!\n"); + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } @@ -1006,13 +1006,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 nullptr!\n"); + TEST_EXIT(vecs[i])("One vector is NULL!\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 nullptr!\n"); + TEST_EXIT(grads[i])("One gradient vector is NULL!\n"); auxFeSpaces.insert(grads[i]->getFeSpace()); } diff --git a/AMDiS/src/compositeFEM/CFE_Integration.h b/AMDiS/src/compositeFEM/CFE_Integration.h index 4bc168772f2e3f61d0ae2500e943267d1300bf79..fd64a0b3f3215e55c84ff188af3f97be16714bef 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 = nullptr); + Quadrature *q = NULL); /** * 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 = nullptr); + Quadrature *q = NULL); 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 d42cb369cd945254c175843d03fdc6cebe6a3d19..04aeadab454b56a94b1fa3210273a9b54353053c 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, nullptr, dofAtQPs); + dofVec->getVecAtQPs(elInfo, q, NULL, 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, nullptr, dofAtQPs); + dofVec->getVecAtQPs(elInfo, q, NULL, 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, nullptr, grdDofAtQPs); + dofVec->getGrdAtQPs(elInfo, q, NULL, 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, nullptr, uhAtQPs); + uh->getVecAtQPs(elInfo, q, NULL, 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, nullptr, grdUhAtQPs); + uh->getGrdAtQPs(elInfo, q, NULL, 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 8974ecd74c52d48807f6ff5b9c0ff3c913533cb5..3f8061ecedf5781e59baf8602424cc599e05bd5a 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 = nullptr); + Quadrature* q = NULL); static double L2Norm_Analyt(AbstractFunction<double, WorldVector<double> > *f, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double L2NormSquare_Analyt(AbstractFunction<double, WorldVector<double> > *f, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double H1Norm_Analyt(AbstractFunction<WorldVector<double>, WorldVector<double> > *grd, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double H1NormSquare_Analyt(AbstractFunction<WorldVector<double>, WorldVector<double> > *grd, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double L1Norm_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 1, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double L2Norm_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double L2NormSquare_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 2, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double H1Norm_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = nullptr); + Quadrature* q = NULL); static double H1NormSquare_DOF(DOFVector<double> *dof, ElementLevelSet *elLS, int domainFlag, int deg = 0, - Quadrature* q = nullptr); + Quadrature* q = NULL); // ======================================================================== // Calculation of error between @@ -379,7 +379,7 @@ namespace AMDiS { int domainFlag, int relErr = 0, int deg = 2, - Quadrature *q = nullptr); + Quadrature *q = NULL); 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 = nullptr); + Quadrature *q = NULL); /** * Get absolute L2 error. diff --git a/AMDiS/src/compositeFEM/CompositeFEMOperator.cc b/AMDiS/src/compositeFEM/CompositeFEMOperator.cc index a52bb65b7ed5face9d43ef103fba366cd613e2e6..7c7cebc50d06122757f4720d270a4da4e01168d9 100644 --- a/AMDiS/src/compositeFEM/CompositeFEMOperator.cc +++ b/AMDiS/src/compositeFEM/CompositeFEMOperator.cc @@ -36,8 +36,8 @@ void CompositeFEMOperator::getElementMatrix(const ElInfo *elInfo, { FUNCNAME("CompositeFEMOperator::getElementMatrix"); - VectorOfFixVecs<DimVec<double> > *intersecPoints = nullptr; - SubPolytope *subPolytope = nullptr; + VectorOfFixVecs<DimVec<double> > *intersecPoints = NULL; + SubPolytope *subPolytope = NULL; double levelSetSubPolytope; DimVec<double> subElVertexBarCoords(elInfo->getMesh()->getDim()); @@ -134,7 +134,7 @@ void CompositeFEMOperator::getElementMatrix(const ElInfo *elInfo, set_to_zero(subPolMat2); if (!assembler.get()) { - Assembler *aptr = new StandardAssembler(this, nullptr, nullptr, nullptr, nullptr, rowFeSpace, colFeSpace); + Assembler *aptr = new StandardAssembler(this, NULL, NULL, NULL, NULL, rowFeSpace, colFeSpace); assembler.set(aptr); } @@ -171,8 +171,8 @@ void CompositeFEMOperator::getElementVector(const ElInfo *elInfo, { FUNCNAME("CompositeFEMOperator::getElementVector"); - VectorOfFixVecs<DimVec<double> >*intersecPoints = nullptr; - SubPolytope *subPolytope = nullptr; + VectorOfFixVecs<DimVec<double> >*intersecPoints = NULL; + SubPolytope *subPolytope = NULL; double levelSetSubPolytope; DimVec<double> subElVertexBarCoords(elInfo->getMesh()->getDim()); @@ -265,7 +265,7 @@ void CompositeFEMOperator::getElementVector(const ElInfo *elInfo, set_to_zero(subPolVec2); if (!assembler.get()) { - Assembler *aptr = new StandardAssembler(this, nullptr, nullptr, nullptr, nullptr, rowFeSpace, colFeSpace); + Assembler *aptr = new StandardAssembler(this, NULL, NULL, NULL, NULL, rowFeSpace, colFeSpace); assembler.set(aptr); } diff --git a/AMDiS/src/compositeFEM/CompositeFEMOperator.h b/AMDiS/src/compositeFEM/CompositeFEMOperator.h index 1fef3c19b24b42f91647e788c6b7fde945c18c15..3bc358ae18958c93b7b07188c237ddd75b4cc15c 100644 --- a/AMDiS/src/compositeFEM/CompositeFEMOperator.h +++ b/AMDiS/src/compositeFEM/CompositeFEMOperator.h @@ -61,10 +61,10 @@ public: /// Constructor. CompositeFEMOperator(ElementLevelSet *elLS_, const FiniteElemSpace *rowFeSpace_, - const FiniteElemSpace *colFeSpace_ = nullptr) + const FiniteElemSpace *colFeSpace_ = NULL) : Operator(rowFeSpace_, colFeSpace_), elLS(elLS_), - subElementAssembler(nullptr), + subElementAssembler(NULL), elStatus(ElementLevelSet::LEVEL_SET_UNDEFINED) {} diff --git a/AMDiS/src/compositeFEM/ElementLevelSet.cc b/AMDiS/src/compositeFEM/ElementLevelSet.cc index cf983f87496650fa2ee4921da18e0cd11521caa7..c79d3c4d7b63c0bf20ee9c0e358aa85d20131687 100644 --- a/AMDiS/src/compositeFEM/ElementLevelSet.cc +++ b/AMDiS/src/compositeFEM/ElementLevelSet.cc @@ -33,7 +33,7 @@ ElementLevelSet::createElementLevelSet(const ElInfo *elInfo_, { Element *el = elInfo_->getElement(); - if (elInfo == nullptr || el != lastEl) { + if (elInfo == NULL || el != lastEl) { /** * Element has changed. New calculation. */ diff --git a/AMDiS/src/compositeFEM/ElementLevelSet.h b/AMDiS/src/compositeFEM/ElementLevelSet.h index 73f5fe77b2f8fd1937da51ffaa0c2cc6dd3c9f9f..dae07cc87ceb9067a13de56095e6534e975b0119 100644 --- a/AMDiS/src/compositeFEM/ElementLevelSet.h +++ b/AMDiS/src/compositeFEM/ElementLevelSet.h @@ -87,8 +87,8 @@ public: ElementFunction<double> *lSFct_, Mesh *mesh_) : name(name_), - elInfo(nullptr), - lastEl(nullptr), + elInfo(NULL), + lastEl(NULL), 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 7c799fef19e1eaa6c4a6e6a589e000314a2e28d2..d32597fcf6f57a82af76ccd5ecd8e5710da7f085 100644 --- a/AMDiS/src/compositeFEM/PenaltyOperator.cc +++ b/AMDiS/src/compositeFEM/PenaltyOperator.cc @@ -45,7 +45,7 @@ PenaltyOperator::getElementMatrix(const ElInfo *elInfo, ElementMatrix& userMat, double factor) { - VectorOfFixVecs<DimVec<double> > *intersecPoints = nullptr; + VectorOfFixVecs<DimVec<double> > *intersecPoints = NULL; double penaltyCoeff = getPenaltyCoeff(elInfo); /** @@ -161,7 +161,7 @@ PenaltyOperator::getElementVector(const ElInfo *elInfo, ElementVector& userVec, double factor) { - VectorOfFixVecs<DimVec<double> > *intersecPoints = nullptr; + VectorOfFixVecs<DimVec<double> > *intersecPoints = NULL; double penaltyCoeff = getPenaltyCoeff(elInfo); /** diff --git a/AMDiS/src/compositeFEM/PenaltyOperator.h b/AMDiS/src/compositeFEM/PenaltyOperator.h index aed02f00b24039e6bccfb3f2e1cdfb0b9db1e5f7..388ed58486a8db22fdcc547ea225106529389ee8 100644 --- a/AMDiS/src/compositeFEM/PenaltyOperator.h +++ b/AMDiS/src/compositeFEM/PenaltyOperator.h @@ -49,13 +49,13 @@ public: double factor_, bool penaltyCoeffFlag_, FiniteElemSpace *rowFeSpace_, - FiniteElemSpace *colFeSpace_ = nullptr) + FiniteElemSpace *colFeSpace_ = NULL) : Operator(rowFeSpace_, colFeSpace_), elLS(elLS_), elStatus(ElementLevelSet::LEVEL_SET_UNDEFINED), factor(factor_), penaltyCoeffFlag(penaltyCoeffFlag_), - surfaceOp(nullptr), + surfaceOp(NULL), dim(getRowFeSpace()->getMesh()->getDim()), degree(getRowFeSpace()->getBasisFcts()->getDegree()) { diff --git a/AMDiS/src/compositeFEM/SubElementAssembler.cc b/AMDiS/src/compositeFEM/SubElementAssembler.cc index 3a5bf7cddc48d05b9dc893f7d074fb3312352301..0744e0f17d3f2c57584590b3806306c91ad0d9b9 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, nullptr, nullptr, nullptr, nullptr, rowFeSpace_, colFeSpace_) + : StandardAssembler(op, NULL, NULL, NULL, NULL, 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 = nullptr; + zeroOrderScalableQuadrature = NULL; } if (firstOrderAssemblerGrdPsi) { @@ -52,7 +52,7 @@ namespace AMDiS { new ScalableQuadrature(firstOrderAssemblerGrdPsi->getQuadrature()); firstOrderAssemblerGrdPsi->setQuadrature(firstOrderGrdPsiScalableQuadrature); } else { - firstOrderGrdPsiScalableQuadrature = nullptr; + firstOrderGrdPsiScalableQuadrature = NULL; } if (firstOrderAssemblerGrdPhi) { @@ -61,7 +61,7 @@ namespace AMDiS { new ScalableQuadrature(firstOrderAssemblerGrdPhi->getQuadrature()); firstOrderAssemblerGrdPhi->setQuadrature(firstOrderGrdPhiScalableQuadrature); } else { - firstOrderGrdPhiScalableQuadrature = nullptr; + firstOrderGrdPhiScalableQuadrature = NULL; } if (secondOrderAssembler) { @@ -70,7 +70,7 @@ namespace AMDiS { new ScalableQuadrature(secondOrderAssembler->getQuadrature()); secondOrderAssembler->setQuadrature(secondOrderScalableQuadrature); } else { - secondOrderScalableQuadrature = nullptr; + secondOrderScalableQuadrature = NULL; } } diff --git a/AMDiS/src/compositeFEM/SubElementAssembler.h b/AMDiS/src/compositeFEM/SubElementAssembler.h index a77e3cea2f2234e2e158e4edaffb282b6e1990c7..86d807c1c067239f2151e775b7b30e707ae618c3 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 = nullptr); + const FiniteElemSpace *colFeSpace = NULL); virtual ~SubElementAssembler() { diff --git a/AMDiS/src/deprecated/ProblemImplicit.cc b/AMDiS/src/deprecated/ProblemImplicit.cc index fe01dd4397a578074c7e6e82970e6c190fba1f95..8c705626ae82249eb128ff96fa6db4d2e8a2bb06 100644 --- a/AMDiS/src/deprecated/ProblemImplicit.cc +++ b/AMDiS/src/deprecated/ProblemImplicit.cc @@ -59,10 +59,10 @@ namespace AMDiS { DOFVector<double>* phi2 = getPhi2(implMesh, comp); DOFVector<double>* levelSet = getLevelset(implMesh, comp); - 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"); + 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"); 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 != 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"); + 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"); 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 != 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"); + 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"); 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 nullptr; + return NULL; 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 nullptr; + return NULL; 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 nullptr; + return NULL; 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 nullptr; + return NULL; 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, nullptr); - phi1[p].resize(nImplMeshes, nullptr); - phi2[p].resize(nImplMeshes, nullptr); - levelSet[p].resize(nImplMeshes, nullptr); + r[p].resize(nImplMeshes, NULL); + phi1[p].resize(nImplMeshes, NULL); + phi2[p].resize(nImplMeshes, NULL); + levelSet[p].resize(nImplMeshes, NULL); 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] != nullptr)("the mesh was not created\n"); + TEST_EXIT(meshes[comp] != NULL)("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] != nullptr) + if ( r[p][i] != NULL) delete r[p][i]; for ( unsigned int i(0); i < phi1[p].size(); ++i ) - if ( phi1[p][i] != nullptr) + if ( phi1[p][i] != NULL) delete phi1[p][i]; for ( unsigned int i(0); i < phi2[p].size(); ++i ) - if ( phi2[p][i] != nullptr) + if ( phi2[p][i] != NULL) delete phi2[p][i]; for ( unsigned int i(0); i < levelSet[p].size(); ++i ) - if ( levelSet[p][i] != nullptr) + if ( levelSet[p][i] != NULL) delete levelSet[p][i]; } diff --git a/AMDiS/src/deprecated/ProblemImplicit.h b/AMDiS/src/deprecated/ProblemImplicit.h index b372fcf3c28aae297748eaab6d45ce1e231d9f63..3ca818f5413f7d37d59336cf28040a5afe3ed394 100644 --- a/AMDiS/src/deprecated/ProblemImplicit.h +++ b/AMDiS/src/deprecated/ProblemImplicit.h @@ -38,7 +38,7 @@ namespace AMDiS { { public: ProblemImplicit(std::string name, - ProblemIterationInterface* problem = nullptr) + ProblemIterationInterface* problem = NULL) : ProblemStat(name, problem), r(0), phi1(0), @@ -51,7 +51,7 @@ namespace AMDiS { virtual void createMesh(); virtual void initialize(Flag initFlag, - ProblemStatSeq* adoptProblem = nullptr, + ProblemStatSeq* adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); bool createImplicitMesh(); diff --git a/AMDiS/src/est/Estimator.cc b/AMDiS/src/est/Estimator.cc index 63e54ff2f6b6db8995d9f909713cac417ebfc473..c723a2d39ac8f0f4990be0e0034c289004ac8c29 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(nullptr), - auxMesh(nullptr), + mesh(NULL), + auxMesh(NULL), traverseInfo(0) { Parameters::get(name + "->error norm", norm); @@ -58,7 +58,7 @@ namespace AMDiS { if (!dualTraverse) { mesh = uh[row == -1 ? 0 : row]->getFeSpace()->getMesh(); - auxMesh = nullptr; + auxMesh = NULL; } else { const FiniteElemSpace *mainFeSpace = traverseInfo.getRowFeSpace(row); const FiniteElemSpace *auxFeSpace = traverseInfo.getNonRowFeSpace(row); @@ -76,7 +76,7 @@ namespace AMDiS { // mesh = uh[row == -1 ? 0 : row]->getFeSpace()->getMesh(); -// auxMesh = nullptr; +// auxMesh = NULL; init(ts); diff --git a/AMDiS/src/est/Estimator.h b/AMDiS/src/est/Estimator.h index f7d0697a543cf3f429fc7861f113698c99073319..a0ffa938b2d0a6b169d498d8d3c4ede6f3171576 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 = nullptr) =0; + virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL) =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_ = nullptr) + DOFVector<double> *uhOld_ = NULL) { 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] == nullptr)("There is already an uhOld!\n"); + TEST_EXIT(uhOld[system] == NULL)("There is already an uhOld!\n"); uhOld[system] = uhOld_; } @@ -268,7 +268,7 @@ namespace AMDiS { { public: /// constructor - EstimatorCreator() : row(-1), uh(nullptr) {} + EstimatorCreator() : row(-1), uh(NULL) {} /// destructor virtual ~EstimatorCreator() {} diff --git a/AMDiS/src/est/RecoveryEstimator.cc b/AMDiS/src/est/RecoveryEstimator.cc index 9fba5d9d25a663f684e931b11e42810ee6ecdd06..e790bbd63a469ae089017a67e9f40da6f2ec7df5 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(nullptr), - f_vec(nullptr), - f_scal(nullptr), - aux_vec(nullptr), - rec_struct(nullptr) + feSpace(NULL), + f_vec(NULL), + f_scal(NULL), + aux_vec(NULL), + rec_struct(NULL) { FUNCNAME("RecoveryEstimator::constructor()"); @@ -55,7 +55,7 @@ namespace AMDiS { } else { degree = uh_->getFeSpace()->getBasisFcts()->getDegree() + 1; feSpace = - FiniteElemSpace::provideFeSpace(nullptr, + FiniteElemSpace::provideFeSpace(NULL, 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, nullptr, quadFast, grdAtQP); - rec_grd->getVecAtQPs(elInfo, nullptr, rec_quadFast, recoveryGrdAtQP); + uh->getGrdAtQPs(elInfo, NULL, quadFast, grdAtQP); + rec_grd->getVecAtQPs(elInfo, NULL, rec_quadFast, recoveryGrdAtQP); if (f_scal) { if (aux_vec) - aux_vec->getVecAtQPs(elInfo, nullptr, quadFast, uhAtQP); + aux_vec->getVecAtQPs(elInfo, NULL, quadFast, uhAtQP); else - uh->getVecAtQPs(elInfo, nullptr, quadFast, uhAtQP); + uh->getVecAtQPs(elInfo, NULL, quadFast, uhAtQP); } // calc h1 error @@ -186,8 +186,8 @@ namespace AMDiS { } } else { // get vector and recovery vector at quadrature points - uh->getVecAtQPs(elInfo, nullptr, quadFast, uhAtQP); - rec_uh->getVecAtQPs(elInfo, nullptr, rec_quadFast, recoveryUhAtQP); + uh->getVecAtQPs(elInfo, NULL, quadFast, uhAtQP); + rec_uh->getVecAtQPs(elInfo, NULL, 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 e84801c3f055664b07acf911156964318f67fc93..b3582481e16d4e3e68edfa9c8790aa7c6e89ab69 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 = nullptr); + virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL); /// 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 e647f3bbf5ed8c0541d517e2b91cbaace83914c2..d7288938807d92bd80e9032cde297d89fbc68e81 100644 --- a/AMDiS/src/est/ResidualEstimator.cc +++ b/AMDiS/src/est/ResidualEstimator.cc @@ -156,7 +156,7 @@ namespace AMDiS { for (int system = 0; system < nSystems; system++) { secondOrderTerms[system] = false; - if (matrix[system] == nullptr) + if (matrix[system] == NULL) continue; for (std::vector<Operator*>::iterator it = matrix[system]->getOperators().begin(); @@ -225,7 +225,7 @@ namespace AMDiS { stdMpiDet.getSendData(it->first).push_back(detNeigh); for (int system = 0; system < nSystems; system++) { - if (matrix[system] == nullptr || secondOrderTerms[system] == false) + if (matrix[system] == NULL || secondOrderTerms[system] == false) continue; uh[system]->getLocalVector(el, uhNeigh[system]); @@ -336,7 +336,7 @@ namespace AMDiS { // === Init assemblers. === for (int system = 0; system < nSystems; system++) { - if (matrix[system] == nullptr) + if (matrix[system] == NULL) continue; DOFMatrix *dofMat = const_cast<DOFMatrix*>(matrix[system]); @@ -344,7 +344,7 @@ namespace AMDiS { for (it = dofMat->getOperatorsBegin(), itfac = dofMat->getOperatorEstFactorBegin(); it != dofMat->getOperatorsEnd(); ++it, ++itfac) - if (*itfac == nullptr || **itfac != 0.0) { + if (*itfac == NULL || **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) @@ -355,7 +355,7 @@ namespace AMDiS { dualElInfo->largeElInfo, quad); else - (*it)->getAssembler()->initElement(elInfo, nullptr, quad); + (*it)->getAssembler()->initElement(elInfo, NULL, quad); } if (C0 > 0.0) @@ -365,7 +365,7 @@ namespace AMDiS { dualElInfo->largeElInfo, quad); else - (*it)->getAssembler()->initElement(elInfo, nullptr, quad); + (*it)->getAssembler()->initElement(elInfo, NULL, quad); } } @@ -400,7 +400,7 @@ namespace AMDiS { riq = 0.0; for (int system = 0; system < nSystems; system++) { - if (matrix[system] == nullptr) + if (matrix[system] == NULL) continue; if (timestep && uhOld[system]) { @@ -410,8 +410,8 @@ namespace AMDiS { // === Compute time error. === if (C0 > 0.0 || C3 > 0.0) { - uh[system]->getVecAtQPs(elInfo, nullptr, quadFast[system], uhQP); - uhOld[system]->getVecAtQPs(elInfo, nullptr, quadFast[system], uhOldQP); + uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP); + uhOld[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhOldQP); if (C3 > 0.0 && system == std::max(row, 0)) { double result = 0.0; @@ -433,18 +433,18 @@ namespace AMDiS { for (it = dofMat->getOperatorsBegin(), itfac = dofMat->getOperatorEstFactorBegin(); it != dofMat->getOperatorsEnd(); ++it, ++itfac) { - if (*itfac == nullptr || **itfac != 0.0) { + if (*itfac == NULL || **itfac != 0.0) { if ((*it)->zeroOrderTerms()) { uhQP.change_dim(nPoints); - uh[system]->getVecAtQPs(elInfo, nullptr, quadFast[system], uhQP); + uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP); } if ((*it)->firstOrderTermsGrdPsi() || (*it)->firstOrderTermsGrdPhi()) { grdUhQp.change_dim(nPoints); - uh[system]->getGrdAtQPs(elInfo, nullptr, quadFast[system], grdUhQp); + uh[system]->getGrdAtQPs(elInfo, NULL, quadFast[system], grdUhQp); } if (degree > 2 && (*it)->secondOrderTerms()) { D2UhQp.change_dim(nPoints); - uh[system]->getD2AtQPs(elInfo, nullptr, quadFast[system], D2UhQp); + uh[system]->getD2AtQPs(elInfo, NULL, quadFast[system], D2UhQp); } } } @@ -498,7 +498,7 @@ namespace AMDiS { bool parallelMode = false; #ifdef HAVE_PARALLEL_DOMAIN_AMDIS - if (neigh == nullptr) { + if (neigh == NULL) { BoundaryObject testObj(el, elInfo->getType(), EDGE, face); if (elBoundDet.count(testObj)) { @@ -583,7 +583,7 @@ namespace AMDiS { jump[iq].set(0.0); for (int system = 0; system < nSystems; system++) { - if (matrix[system] == nullptr || secondOrderTerms[system] == false) + if (matrix[system] == NULL || secondOrderTerms[system] == false) continue; uh[system]->getLocalVector(el, uhEl[system]); @@ -620,7 +620,7 @@ namespace AMDiS { for (it = mat->getOperatorsBegin(), fac = mat->getOperatorEstFactorBegin(); it != mat->getOperatorsEnd(); ++it, ++fac) { - if (*fac == nullptr || **fac != 0.0) { + if (*fac == NULL || **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 7ae1020e367e8517c14bc366007eebc79cfdc195..a5f469b1e6cd26b90525dce9b8611d83d78f5741 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 = nullptr); + void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL); void exit(bool output = true); diff --git a/AMDiS/src/est/SimpleResidualEstimator.cc b/AMDiS/src/est/SimpleResidualEstimator.cc index 311cb00c0f77c7d167a9770d0364da88126a2df3..fcceef79cc525038a311443b9651139f8ae84316 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 == nullptr || **itfac != 0.0) - (*it)->getAssembler()->initElement(elInfo, nullptr, quad); + if (*itfac == NULL || **itfac != 0.0) + (*it)->getAssembler()->initElement(elInfo, NULL, 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, nullptr, quad); + (*it)->getAssembler()->initElement(elInfo, NULL, 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 == nullptr || **itfac != 0.0) { + if (*itfac == NULL || **itfac != 0.0) { if ((*it)->zeroOrderTerms()) { uhQP.change_dim(nPoints); - uh[0]->getVecAtQPs(elInfo, nullptr, quadFast, uhQP); + uh[0]->getVecAtQPs(elInfo, NULL, quadFast, uhQP); } if (degree > 2 && (*it)->secondOrderTerms()) { D2UhQp.change_dim(nPoints); - uh[0]->getD2AtQPs(elInfo, nullptr, quadFast, D2UhQp); + uh[0]->getD2AtQPs(elInfo, NULL, quadFast, D2UhQp); } } } @@ -297,7 +297,7 @@ namespace AMDiS { for (it = mat->getOperatorsBegin(), fac = mat->getOperatorEstFactorBegin(); it != mat->getOperatorsEnd(); ++it, ++fac) { - if (*fac == nullptr || **fac != 0.0) { + if (*fac == NULL || **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 68fea1c60dbffa8abb786436be8eba0c5d5bfaaf..41b08c59ff2dbc3726b2a7341114e7af6431e88a 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 = nullptr); + void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL); /// Finalize the error estimator, i.e., delete all temporary data structures. void exit(bool output = true); diff --git a/AMDiS/src/io/Arh2Reader.cc b/AMDiS/src/io/Arh2Reader.cc index 91bd00ae8907856058f2106f0824426e74f69555..ec49fb6b86ba6b7f417449735f7f706ce01e6ab1 100644 --- a/AMDiS/src/io/Arh2Reader.cc +++ b/AMDiS/src/io/Arh2Reader.cc @@ -49,7 +49,7 @@ namespace AMDiS { namespace io { { vector<DOFVector<double>*> vecs(0); vecs.push_back(vec); - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs, true); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs, true); } void readByName(string filename, @@ -57,7 +57,7 @@ namespace AMDiS { namespace io { bool writeParallel, int nProcs) { - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs, true); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs, true); } void readByName(string filename, @@ -70,7 +70,7 @@ namespace AMDiS { namespace io { { vecs.push_back(sysVec->getDOFVector(i)); } - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs, true); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs, true); } void readFile(string filename, @@ -83,7 +83,7 @@ namespace AMDiS { namespace io { { vecs.push_back(sysVec->getDOFVector(i)); } - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs); } void readFile(string filename, @@ -102,7 +102,7 @@ namespace AMDiS { namespace io { if(vec2) vecs.push_back(vec2); - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs); } void readFile(string filename, @@ -110,7 +110,7 @@ namespace AMDiS { namespace io { bool writeParallel, int nProcs) { - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs); } void readFile(string filename, @@ -235,7 +235,7 @@ namespace AMDiS { namespace io { { FUNCNAME("Arh2Reader::readMeta()"); - Mesh* mesh = nullptr; + Mesh* mesh = NULL; for (size_t i = 0; i < vecs.size(); i++) { if(vecs[i]) diff --git a/AMDiS/src/io/Arh2Reader.h b/AMDiS/src/io/Arh2Reader.h index 744617bd1172c9254796e5e514d5c7471dd3c080..a5c33cfddae91944c20f12c8e34416257c22a9e9 100644 --- a/AMDiS/src/io/Arh2Reader.h +++ b/AMDiS/src/io/Arh2Reader.h @@ -35,7 +35,7 @@ namespace AMDiS { namespace io { * You should notice these: * 1. DOFVectors in SystemVector are not allowed to have identical name. * 2. The length of DOFVectors in SystemVector is less than the length of values in the file. - * 3. Nullptr of DOFVector is allowed in SystemVector. But all the non-null DOFvector have the same fespace + * 3. NULL of DOFVector is allowed in SystemVector. But all the non-null DOFvector have the same fespace * (number of Dofs per position) as the correspond value in the file. * * \param writeParallel @@ -70,9 +70,9 @@ namespace AMDiS { namespace io { /// Read MeshStructure, refine the mesh and read dof values to vec0, vec1 and vec2 by order. /// the behavior is equal to readFile(string filename, SystemVector* sysVec). void readFile(std::string filename, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr, + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL, bool writeParallel = WRITE_PARALLEL, int nProcs = -1); @@ -82,7 +82,7 @@ namespace AMDiS { namespace io { bool writeParallel = WRITE_PARALLEL, int nProcs = -1) { - readFile(filename, &vec0, nullptr, nullptr, writeParallel, nProcs); + readFile(filename, &vec0, NULL, NULL, writeParallel, nProcs); } /// Read MeshStructure, refine the mesh and read dof values to vecs by order. @@ -148,9 +148,9 @@ namespace AMDiS { namespace io { /// the behavior is equal to readMeta(string filename, vector(DOFvector*) vecs). void readMeta(std::string filename, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr); + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL); /** * \brief first read a meta ARH file and get \ref elInRank. And then uses the elInRank map diff --git a/AMDiS/src/io/Arh2Writer.h b/AMDiS/src/io/Arh2Writer.h index 4eab6f3005f62acc5c7efcd2c431ad0fac01bb51..1aca4c4403c6595fb4251a4c70adcf254e85f342 100644 --- a/AMDiS/src/io/Arh2Writer.h +++ b/AMDiS/src/io/Arh2Writer.h @@ -50,7 +50,7 @@ namespace AMDiS { namespace io { std::vector<DOFVector<double>*> vecs; for (int i = 0; i < sysVec->getSize(); i++) vecs.push_back(sysVec->getDOFVector(i)); - detail::write(filename, nullptr, vecs, writeParallel); + detail::write(filename, NULL, vecs, writeParallel); } inline void writeFile(SystemVector &sysVec, @@ -68,7 +68,7 @@ namespace AMDiS { namespace io { { std::vector<DOFVector<double>*> vecs; vecs.push_back(vec0); - detail::write(filename, nullptr, vecs, writeParallel); + detail::write(filename, NULL, vecs, writeParallel); } /// write the meshstructure and the dof values of DOFVectors in vec0 @@ -86,7 +86,7 @@ namespace AMDiS { namespace io { std::string filename, bool writeParallel = true) { - detail::write(filename, nullptr, vecs, writeParallel); + detail::write(filename, NULL, vecs, writeParallel); } /// write the meshstructure of the mesh to arh file. diff --git a/AMDiS/src/io/ArhReader.cc b/AMDiS/src/io/ArhReader.cc index 6a269658012f8b615109f3b731dd15173dcc4019..3960a10c53f97fce50d9d6e6346a3013d58c420c 100644 --- a/AMDiS/src/io/ArhReader.cc +++ b/AMDiS/src/io/ArhReader.cc @@ -52,7 +52,7 @@ namespace AMDiS { namespace io { if (vec2) vecs.push_back(vec2); - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs); } void readFile(string filename, @@ -60,7 +60,7 @@ namespace AMDiS { namespace io { bool writeParallel, int nProcs) { - detail::readFile(filename, nullptr, vecs, writeParallel, nProcs); + detail::readFile(filename, NULL, vecs, writeParallel, nProcs); } void readFile(string filename, @@ -92,7 +92,7 @@ namespace AMDiS { namespace io { { FUNCNAME("ArhReader::readMeta()"); - Mesh* mesh = nullptr; + Mesh* mesh = NULL; for(size_t i = 0; i < vecs.size(); i++) { if(vecs[i]) @@ -244,7 +244,7 @@ namespace AMDiS { namespace io { if (nValueVectors > 2) vecs.push_back(vec2); for (uint32_t i = 3; i < nValueVectors; i++) - vecs.push_back(nullptr); + vecs.push_back(NULL); readFromMemoryBlock(data, mesh, vecs, writeParallel, nProcs); } diff --git a/AMDiS/src/io/ArhReader.h b/AMDiS/src/io/ArhReader.h index e16090ee4d303d8c7831751d2a5649480c9c4aa2..bf2d60f57954fa6c01e0373edfe81a2ca50d9e4c 100644 --- a/AMDiS/src/io/ArhReader.h +++ b/AMDiS/src/io/ArhReader.h @@ -49,9 +49,9 @@ namespace AMDiS { namespace io { /// Read a file to 1-3 \ref DOFVector. Using container pointers. void readFile(std::string filename, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr, + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL, bool writeParallel = WRITE_PARALLEL, int nProcs = -1); @@ -63,7 +63,7 @@ namespace AMDiS { namespace io { bool writeParallel = WRITE_PARALLEL, int nProcs = -1) { - readFile(filename, &vec0, nullptr, nullptr, writeParallel, nProcs); + readFile(filename, &vec0, NULL, NULL, writeParallel, nProcs); } @@ -115,9 +115,9 @@ namespace AMDiS { namespace io { * \param vec2 the third \ref DOFVector you want to read to. */ void readMeta(std::string filename, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr); + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL); /// read a meta ARH file and the corresponding parallel ARH files to a vector @@ -148,9 +148,9 @@ namespace AMDiS { namespace io { /// Reader like readFile, but reads to data from the block \ref data. void readFromMemoryBlock(std::vector<char> &data, Mesh *mesh, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr, + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL, bool writeParallel = WRITE_PARALLEL, int nProcs = -1); @@ -175,9 +175,9 @@ namespace AMDiS { namespace io { void read(std::string filename, Mesh *mesh, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr, + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL, bool writeParallel = WRITE_PARALLEL, int nProcs = -1); @@ -202,9 +202,9 @@ namespace AMDiS { namespace io { void readMeta(std::string filename, Mesh* mesh, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr); + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL); } // end namespace ArhReader } } // end namespace io, AMDiS diff --git a/AMDiS/src/io/ArhWriter.h b/AMDiS/src/io/ArhWriter.h index 61591f28459ab5a6a4d218348638806961ff28ff..5352b32d2563c9f5aacbe6e6d6baa27df662afc0 100644 --- a/AMDiS/src/io/ArhWriter.h +++ b/AMDiS/src/io/ArhWriter.h @@ -80,9 +80,9 @@ namespace AMDiS { namespace io { inline void write(std::string filename, Mesh *mesh, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr) + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL) { FUNCNAME("ArhWriter::write()"); WARNING("this function is obsolete.\n"); diff --git a/AMDiS/src/io/DataCollector.h b/AMDiS/src/io/DataCollector.h index 2197c5022482c9b960b438b80fb229d8d285c500..5c4f1908cd967aa75511b7d43fb75f1b7958bdfe 100644 --- a/AMDiS/src/io/DataCollector.h +++ b/AMDiS/src/io/DataCollector.h @@ -48,10 +48,10 @@ namespace AMDiS { public: /// Constructor DataCollector(const FiniteElemSpace *feSpace, - DOFVector<T> *values = nullptr, + DOFVector<T> *values = NULL, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = nullptr); + bool (*writeElem)(ElInfo*) = NULL); ~DataCollector(); diff --git a/AMDiS/src/io/ElementFileWriter.cc b/AMDiS/src/io/ElementFileWriter.cc index 02488c41dff957e5c2f9f7a7fbe892fe86994d92..6af82a971ac8484c056951151dcf02bc6a88c849 100644 --- a/AMDiS/src/io/ElementFileWriter.cc +++ b/AMDiS/src/io/ElementFileWriter.cc @@ -55,7 +55,7 @@ namespace AMDiS { namespace io { timestepNumber(-1), mesh(mesh_), vec(&mapvec), - vecs(nullptr) + vecs(NULL) { if (name != "") { Parameters::get(name + "->output->filename", filename); @@ -89,7 +89,7 @@ namespace AMDiS { namespace io { tsModulo(1), timestepNumber(-1), mesh(mesh_), - vec(nullptr), + vec(NULL), vecs(&mapvec) { if (name != "") { @@ -294,7 +294,7 @@ namespace AMDiS { namespace io { { FUNCNAME("ElementFileWriter::writeVtkValues()"); - TEST_EXIT((vec!=nullptr || vecs!=nullptr) && (vec==nullptr || vecs==nullptr)) + TEST_EXIT((vec!=NULL || vecs!=NULL) && (vec==NULL || vecs==NULL)) ("Ether vec or vecs must be given, not both and not nothing!"); #if HAVE_PARALLEL_DOMAIN_AMDIS @@ -402,9 +402,9 @@ namespace AMDiS { namespace io { file << " </DataArray>\n"; file << " </Cells>\n"; - 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); + 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); 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 { namespace io { int idx = elInfo->getElement()->getIndex(); for (int j = 0; j < nComponents; j++) { - double val = (vec != nullptr ? (*vec)[idx] : (static_cast<int>((*vecs)[idx].size())==dataLength ? (*vecs)[idx][i*nComponents+j] : 0.0)); + double val = (vec != NULL ? (*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 { namespace io { if (j < nComponents-1) file << " "; } - if (writeAs3dVector && writeAsVector && vecs != nullptr) { + if (writeAs3dVector && writeAsVector && vecs != NULL) { for (int j = nComponents; j < 3; j++) file << " 0.0"; } diff --git a/AMDiS/src/io/MacroInfo.cc b/AMDiS/src/io/MacroInfo.cc index bf64f1d7b9e0c1b71097bd52d2f0a8ce84f0ed4e..5645c1834f937ff0705027d810de6dafe408153c 100644 --- a/AMDiS/src/io/MacroInfo.cc +++ b/AMDiS/src/io/MacroInfo.cc @@ -76,11 +76,11 @@ namespace AMDiS { delete [] mel_vertex; delete [] coords; - coords = nullptr; + coords = NULL; delete [] dof; - dof = nullptr; + dof = NULL; - mesh = nullptr; + mesh = NULL; neigh_set = false; nElements = 0; @@ -167,7 +167,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 = nullptr; + DimVec<int> *ind = NULL; TEST_EXIT(filename != "")("No filename specified!\n"); diff --git a/AMDiS/src/io/MacroWriter.h b/AMDiS/src/io/MacroWriter.h index 8dd665a2a57ba65cf8575f9ccc8c727b871f1b95..48209ca5d404f22b865e04eefe5086af6bc5727a 100644 --- a/AMDiS/src/io/MacroWriter.h +++ b/AMDiS/src/io/MacroWriter.h @@ -54,7 +54,7 @@ namespace AMDiS { namespace io { double time = 0.0, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = nullptr); + bool (*writeElem)(ElInfo*) = NULL); /// 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 2e95baadb6cd7c13992bc3a11067873f8c542747..96807c0ebde56a2be82cf60e4ce0450761f1ba71 100644 --- a/AMDiS/src/io/PngReader.cc +++ b/AMDiS/src/io/PngReader.cc @@ -50,17 +50,17 @@ namespace AMDiS { namespace io { int bytesPerPixel = 0; // Open files and create the png data structures. - if ((fp = fopen(filename.c_str(), "rb")) == nullptr) { + if ((fp = fopen(filename.c_str(), "rb")) == NULL) { TEST_EXIT(0)("ERROR: file can not >be opened\n"); } - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (png_ptr == nullptr) { + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (png_ptr == NULL) { TEST_EXIT(0)("ERROR in png_create_read_struct\n"); } info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == nullptr) { + if (info_ptr == NULL) { TEST_EXIT(0)("ERROR in png_create_info_struct\n"); } @@ -72,7 +72,7 @@ namespace AMDiS { namespace io { 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, nullptr); + png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); bytesPerPixel = info_ptr->rowbytes / info_ptr->width; @@ -120,7 +120,7 @@ namespace AMDiS { namespace io { elInfo = stack.traverseNext(elInfo); } - png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); } diff --git a/AMDiS/src/io/PngWriter.cc b/AMDiS/src/io/PngWriter.cc index a053b026dc0c951227c004433850eb8daeb5c3be..4d4d10970e74092895c1923219366fe6c40e2cb2 100644 --- a/AMDiS/src/io/PngWriter.cc +++ b/AMDiS/src/io/PngWriter.cc @@ -64,7 +64,7 @@ namespace AMDiS { namespace io { int imageY = static_cast<int>(maxY / pointdist) + 1; png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, - nullptr, nullptr, nullptr); + NULL, NULL, NULL); if (!png_ptr) return 0; @@ -120,7 +120,7 @@ namespace AMDiS { namespace io { png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, (png_infopp)nullptr); + png_destroy_write_struct(&png_ptr, (png_infopp)NULL); return 0; } diff --git a/AMDiS/src/io/PovrayWriter.cc b/AMDiS/src/io/PovrayWriter.cc index 5aaf2ea5b1cb66352d0a49c1b493056c050e22fd..957128fed484f7c5eaa5173f2cc0883a1a02f6bf 100644 --- a/AMDiS/src/io/PovrayWriter.cc +++ b/AMDiS/src/io/PovrayWriter.cc @@ -40,7 +40,7 @@ namespace AMDiS { namespace io { // free the memory for the bounding box if (bBox) { delete bBox; - bBox = nullptr; + bBox = NULL; } } @@ -111,7 +111,7 @@ namespace AMDiS { namespace io { // problems in simulations with changing geometries BoundingBox* PovrayWriter::getBoundingBox(ofstream &out) { - if (bBox != nullptr) + if (bBox != NULL) return bBox; DOFVector< std::list<VertexInfo> > *vertexInfos = dataCollector->getVertexInfos(); diff --git a/AMDiS/src/io/PovrayWriter.h b/AMDiS/src/io/PovrayWriter.h index 8c65ce0468e3059cc4852e1525d806de6f179a74..6f4bb8412b7cd53eb016782f4721d950ab744d58 100644 --- a/AMDiS/src/io/PovrayWriter.h +++ b/AMDiS/src/io/PovrayWriter.h @@ -54,7 +54,7 @@ namespace AMDiS { namespace io { class PovrayWriter { public: - PovrayWriter(DataCollector<> *dc) : dataCollector(dc), bBox(nullptr) { } + PovrayWriter(DataCollector<> *dc) : dataCollector(dc), bBox(NULL) { } ~PovrayWriter(); diff --git a/AMDiS/src/io/ValueWriter.h b/AMDiS/src/io/ValueWriter.h index f5b6d4a9333fb36f8339e4f076dc2d5733e6c95c..b7f3546bdbacdb79d27aecb7700609e079e1d788 100644 --- a/AMDiS/src/io/ValueWriter.h +++ b/AMDiS/src/io/ValueWriter.h @@ -48,7 +48,7 @@ namespace AMDiS { namespace io { void writeValues(DataCollector<> *dc, std::string filename, double time = 0.0, int level = -1, Flag traverseFlag = Mesh::CALL_LEAF_EL, - bool (*writeElem)(ElInfo*) = nullptr); + bool (*writeElem)(ElInfo*) = NULL); } // end namespace ValueWriter } } // end namespace io, AMDiS diff --git a/AMDiS/src/io/detail/Arh2Reader.cc b/AMDiS/src/io/detail/Arh2Reader.cc index 2c4fd48c777a8d169364636f34f6750cc64723c0..d13a9d39783a95cbe58c797d3869f868ec21c6ef 100644 --- a/AMDiS/src/io/detail/Arh2Reader.cc +++ b/AMDiS/src/io/detail/Arh2Reader.cc @@ -199,7 +199,7 @@ namespace AMDiS { namespace io { it != mesh->getMacroElements().end(); ++it) macroInMesh.insert((*it)->getIndex()); - RefinementManager *refManager = nullptr; + RefinementManager *refManager = NULL; switch (mesh->getDim()) { case 1: refManager = new RefinementManager1d(); @@ -304,7 +304,7 @@ namespace AMDiS { namespace io { { vector<DOFVector<double>*> tmpVecs = vecs; vecs.clear(); - vecs.resize(nValueVectors, nullptr); + vecs.resize(nValueVectors, NULL); for(size_t k = 0; k < tmpVecs.size(); k++) { @@ -436,7 +436,7 @@ namespace AMDiS { namespace io { while(!vecs.empty()) { - if(vecs.back() == nullptr) + if(vecs.back() == NULL) vecs.pop_back(); else break; diff --git a/AMDiS/src/io/detail/Arh2Writer.cc b/AMDiS/src/io/detail/Arh2Writer.cc index 8257d4d3c661ebeb638c52b62dd4e72bdf0b5818..5b79c0162715bc508afcbcf666acfe973973203a 100644 --- a/AMDiS/src/io/detail/Arh2Writer.cc +++ b/AMDiS/src/io/detail/Arh2Writer.cc @@ -30,14 +30,14 @@ namespace AMDiS { namespace io { bool writeParallel) { vector<DOFVector<double>*> vecs(0); - if (vec0 != nullptr) + if (vec0 != NULL) vecs.push_back(vec0); - if (vec1 != nullptr) + if (vec1 != NULL) vecs.push_back(vec1); - if (vec2 != nullptr) + if (vec2 != NULL) vecs.push_back(vec2); - write(filename, nullptr, vecs, writeParallel); + write(filename, NULL, vecs, writeParallel); } void write(std::string filename, @@ -52,7 +52,7 @@ namespace AMDiS { namespace io { for(size_t i = 0; i < vecs.size(); i++) { - TEST_EXIT(vecs[i] != nullptr)("Vecs[%i] is NULL. Please check.\n", i); + TEST_EXIT(vecs[i] != NULL)("Vecs[%i] is NULL. Please check.\n", i); ret = nameSet.insert(vecs[i]->getName()); TEST_EXIT(ret.second)("DOFVectors in vecs cannot have idential name. Please check.\n"); } diff --git a/AMDiS/src/io/detail/Arh2Writer.h b/AMDiS/src/io/detail/Arh2Writer.h index a12ccf954f707705754acbaca87e7fa60b270678..90e6612936d4d07bb4f9dffa634bdea8cd45e2b7 100644 --- a/AMDiS/src/io/detail/Arh2Writer.h +++ b/AMDiS/src/io/detail/Arh2Writer.h @@ -15,9 +15,9 @@ namespace AMDiS { namespace io { { //Maybe remove this later void write(std::string filename, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr, + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL, bool writeParallel = true); /** diff --git a/AMDiS/src/io/detail/ArhReader.cc b/AMDiS/src/io/detail/ArhReader.cc index 368a9df03a20dc80c9a79117eeac96316c7d3954..045de439d4c136a7b7f23cc157e4020e10690b3d 100644 --- a/AMDiS/src/io/detail/ArhReader.cc +++ b/AMDiS/src/io/detail/ArhReader.cc @@ -55,7 +55,7 @@ namespace AMDiS { namespace io { macroInMesh.insert((*it)->getIndex()); - RefinementManager *refManager = nullptr; + RefinementManager *refManager = NULL; switch (mesh->getDim()) { case 1: refManager = new RefinementManager1d(); @@ -116,7 +116,7 @@ namespace AMDiS { namespace io { for (unsigned int j = 0; j < nValueVectors; j++) { vector<double> values(nValuesPerVector); file.read(reinterpret_cast<char*>(&(values[0])), 8 * nValuesPerVector); - if (vecs[j] != nullptr) { + if (vecs[j] != NULL) { if (macroInMesh.count(elIndex)) setDofValues(elIndex, mesh, values, vecs[j]); } @@ -143,7 +143,7 @@ namespace AMDiS { namespace io { macroInMesh.insert((*it)->getIndex()); - RefinementManager *refManager = nullptr; + RefinementManager *refManager = NULL; switch (mesh->getDim()) { case 2: refManager = new RefinementManager2d(); @@ -203,7 +203,7 @@ namespace AMDiS { namespace io { vector<double> values(nValuesPerVector); memcpy(reinterpret_cast<char*>(&values[0]), &data[mem_index], 8 * nValuesPerVector); mem_index += 8 * nValuesPerVector; - if (vecs[j] != nullptr) { + if (vecs[j] != NULL) { if (macroInMesh.count(elIndex) == 1) setDofValues(elIndex, mesh, values, vecs[j]); } diff --git a/AMDiS/src/io/detail/ArhWriter.cc b/AMDiS/src/io/detail/ArhWriter.cc index 1140f284fc8b3580779683281ece3c408c953a73..72c82f8ff1dab4ca5ce83df0bc2274baf9f9c11e 100644 --- a/AMDiS/src/io/detail/ArhWriter.cc +++ b/AMDiS/src/io/detail/ArhWriter.cc @@ -21,11 +21,11 @@ namespace AMDiS { namespace io { DOFVector<double>* vec2) { vector<DOFVector<double>*> vecs(0); - if (vec0 != nullptr) + if (vec0 != NULL) vecs.push_back(vec0); - if (vec1 != nullptr) + if (vec1 != NULL) vecs.push_back(vec1); - if (vec2 != nullptr) + if (vec2 != NULL) vecs.push_back(vec2); write(filename, mesh, vecs); diff --git a/AMDiS/src/io/detail/ArhWriter.h b/AMDiS/src/io/detail/ArhWriter.h index 713596855173808d7db2b770062680b05d182bb1..afa88993923fff4765a020087da0a38bde8ad6b7 100644 --- a/AMDiS/src/io/detail/ArhWriter.h +++ b/AMDiS/src/io/detail/ArhWriter.h @@ -13,9 +13,9 @@ namespace AMDiS { namespace io { namespace detail { void write(std::string filename, Mesh *mesh, - DOFVector<double>* vec0 = nullptr, - DOFVector<double>* vec1 = nullptr, - DOFVector<double>* vec2 = nullptr); + DOFVector<double>* vec0 = NULL, + DOFVector<double>* vec1 = NULL, + DOFVector<double>* vec2 = NULL); void write(std::string filename, Mesh *mesh, std::vector<DOFVector<double>*> vecs, diff --git a/AMDiS/src/io/detail/VtkReader.h b/AMDiS/src/io/detail/VtkReader.h index 5d3b52333362c1951f4e8f55fe5ead14c2856f77..310aca401c25244b367db5a882b563f9e63793c3 100644 --- a/AMDiS/src/io/detail/VtkReader.h +++ b/AMDiS/src/io/detail/VtkReader.h @@ -114,8 +114,8 @@ namespace AMDiS using namespace std; - char* tmp = nullptr; - int* ptr = nullptr; + char* tmp = NULL; + int* ptr = NULL; int nBytes = 0; string header = "", body = "", data = ""; diff --git a/AMDiS/src/nonlin/Newton.h b/AMDiS/src/nonlin/Newton.h index f8f377dbe655247a766633e1560f1cc1e13ddaa4..5b222e99700282e6709d41338eb0655b3b1cf9c9 100644 --- a/AMDiS/src/nonlin/Newton.h +++ b/AMDiS/src/nonlin/Newton.h @@ -27,7 +27,7 @@ #include "CreatorInterface.h" #include "NonLinSolver.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "io/VtkWriter.h" namespace AMDiS { @@ -56,9 +56,9 @@ namespace AMDiS { }; /// Calls constructor of base class NonLinSolver - Newton(const std::string& name, LinearSolver *linSolver) + Newton(const std::string& name, LinearSolverInterface *linSolver) : NonLinSolver(name, linSolver), - b(nullptr), + b(NULL), buildCycle(1) { @@ -77,7 +77,7 @@ namespace AMDiS { { FUNCNAME("Newton::nlsolve()"); - if (b == nullptr) + if (b == NULL) 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 != nullptr) { + if (b != NULL) { delete b; - b = nullptr; + b = NULL; } } diff --git a/AMDiS/src/nonlin/NewtonArmijo.h b/AMDiS/src/nonlin/NewtonArmijo.h index 49d286a59b8377925cb1da789aaa7dd871242c81..4c6c4e688a46880fceed64bb6f4ad128d331593c 100644 --- a/AMDiS/src/nonlin/NewtonArmijo.h +++ b/AMDiS/src/nonlin/NewtonArmijo.h @@ -28,7 +28,7 @@ #include "CreatorInterface.h" #include "NonLinSolver.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "io/VtkWriter.h" namespace AMDiS { @@ -57,9 +57,9 @@ namespace AMDiS { }; /// Calls constructor of base class NonLinSolver - NewtonArmijo(const std::string& name, LinearSolver *linSolver) + NewtonArmijo(const std::string& name, LinearSolverInterface *linSolver) : NonLinSolver(name, linSolver), - b(nullptr), + b(NULL), 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 == nullptr) + if (b == NULL) 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 != nullptr) { + if (b != NULL) { delete b; - b = nullptr; + b = NULL; } } diff --git a/AMDiS/src/nonlin/NonLinSolver.h b/AMDiS/src/nonlin/NonLinSolver.h index bae37e9728f4862968dc1e9e5f96ed73916e76f7..bae4625c8e2a263de46b521716db4ed72c9b7a9e 100644 --- a/AMDiS/src/nonlin/NonLinSolver.h +++ b/AMDiS/src/nonlin/NonLinSolver.h @@ -31,7 +31,7 @@ #include "CreatorInterface.h" #include "MatrixVector.h" #include "DOFMatrix.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "ProblemStat.h" #ifdef HAVE_PARALLEL_DOMAIN_AMDIS @@ -54,7 +54,7 @@ namespace AMDiS { * * \param name Name of this solver */ - NonLinSolver(const std::string &name, LinearSolver *solver) + NonLinSolver(const std::string &name, LinearSolverInterface *solver) : name(name), linSolver(solver), tolerance(1.e-8), @@ -98,7 +98,7 @@ namespace AMDiS { return tolerance; } - inline LinearSolver* getLinearSolver() + inline LinearSolverInterface* getLinearSolverInterface() { return linSolver; } @@ -131,7 +131,7 @@ namespace AMDiS { std::string name; /// Linear solver object. - LinearSolver *linSolver; + LinearSolverInterface *linSolver; /// Solver tolerance. double tolerance; @@ -164,7 +164,7 @@ namespace AMDiS { name = n; } - void setLinearSolver(LinearSolver *solver) + void setLinearSolverInterface(LinearSolverInterface *solver) { linearSolver = solver; } @@ -172,7 +172,7 @@ namespace AMDiS { protected: std::string name; - LinearSolver *linearSolver; + LinearSolverInterface *linearSolver; }; } diff --git a/AMDiS/src/nonlin/ProblemNonLin.cc b/AMDiS/src/nonlin/ProblemNonLin.cc index 7d9e6820723bce15dcf3d272ebac9b95de5f3497..2ee50160d66dae840696f33ac1090dd2c38bf531 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 /*= nullptr*/, + ProblemStatSeq *adoptProblem /*= NULL*/, Flag adoptFlag /*= INIT_NOTHING*/) { FUNCNAME("ProblemNonLin::initialize()"); @@ -43,12 +43,12 @@ namespace AMDiS { createNonLinSolver(); if (adoptProblem && adoptFlag.isSet(INIT_NONLIN_SOLVER)) { - TEST_EXIT(nonLinSolver == nullptr)("Nonlinear solver already created!\n"); + TEST_EXIT(nonLinSolver == NULL)("Nonlinear solver already created!\n"); nonLinSolver = dynamic_cast<ProblemNonLin*>(adoptProblem)->getNonLinSolver(); } } - if (nonLinSolver == nullptr) + if (nonLinSolver == NULL) WARNING("No nonlinear solver created!\n"); } @@ -63,7 +63,7 @@ namespace AMDiS { NonLinSolverCreator *nonLinSolverCreator = dynamic_cast<NonLinSolverCreator*>(CreatorMap<NonLinSolver>::getCreator(nonLinSolverType, initFileStr)); - nonLinSolverCreator->setLinearSolver(solver); + nonLinSolverCreator->setLinearSolverInterface(solver); nonLinSolverCreator->setName(name + "->nonlin solver"); nonLinSolver = nonLinSolverCreator->create(); } diff --git a/AMDiS/src/nonlin/ProblemNonLin.h b/AMDiS/src/nonlin/ProblemNonLin.h index b0888eb0f7a5236a7d1f98ebeede23da53cf9005..360681c75990b5316343c2acf0ed6152fcc7576c 100644 --- a/AMDiS/src/nonlin/ProblemNonLin.h +++ b/AMDiS/src/nonlin/ProblemNonLin.h @@ -49,11 +49,11 @@ namespace AMDiS { /// Constructs a ProblemNonLin with given name. ProblemNonLin(const std::string& name_) : ProblemStat(name_), - nonLinSolver(nullptr) + nonLinSolver(NULL) { u0.resize(nComponents); for (int i = 0; i < nComponents; i++) - u0[i] = nullptr; + u0[i] = NULL; } /// Sets \ref u0 and interpolates it to \ref solution. @@ -73,7 +73,7 @@ namespace AMDiS { /// Initialization of the problem. virtual void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = nullptr, + ProblemStatSeq *adoptProblem = NULL, Flag adoptFlag = INIT_NOTHING); /// Used in \ref initialize(). diff --git a/AMDiS/src/parallel/BddcMlSolver.h b/AMDiS/src/parallel/BddcMlSolver.h index be6f05941d1ba1a7cb25051b9c81043ea300e155..0c13914342e1d5b8e7e8d16bd3701e9dbf2c386f 100644 --- a/AMDiS/src/parallel/BddcMlSolver.h +++ b/AMDiS/src/parallel/BddcMlSolver.h @@ -42,7 +42,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new BddcMlSolver(this->name); } @@ -52,7 +52,7 @@ namespace AMDiS { namespace Parallel { : ParallelSolver(name, true) {} protected: - /// Implementation of \ref LinearSolver::solveLinearSystem() + /// Implementation of \ref LinearSolverInterface::solveLinearSystem() virtual int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, SystemVector& x, SystemVector& b, diff --git a/AMDiS/src/parallel/CheckerPartitioner.cc b/AMDiS/src/parallel/CheckerPartitioner.cc index 4b814bac9d133e078e85c96e10d1d8b664e226e7..3fbe81f881db9795245ee2afe04b1a5453160070 100644 --- a/AMDiS/src/parallel/CheckerPartitioner.cc +++ b/AMDiS/src/parallel/CheckerPartitioner.cc @@ -265,7 +265,7 @@ namespace AMDiS { namespace Parallel { TEST_EXIT(localDofs.size() == 3)("Should not happen!\n"); - while (mel != nullptr) { + while (mel != NULL) { 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 24583648d1478bbacfeb405873348967178f18de..550adde7cfd91d40bed3bb16549098b442d4569a 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 != nullptr) { + if (traverseFeSpace != NULL) { if ((dataIter->second.count(traverseFeSpace) == 0)) return false; diff --git a/AMDiS/src/parallel/DofComm.h b/AMDiS/src/parallel/DofComm.h index a89e80d4c6ea2d2df1e2e41e86faf76f8d1b9b13..40e290ef2a030a35c92578027382dfbc914632ac 100644 --- a/AMDiS/src/parallel/DofComm.h +++ b/AMDiS/src/parallel/DofComm.h @@ -102,7 +102,7 @@ namespace AMDiS { namespace Parallel { { public: Iterator(DataType &d, - const FiniteElemSpace *fe = nullptr) + const FiniteElemSpace *fe = NULL) : data(d), dofCounter(-1), traverseFeSpace(fe), @@ -141,9 +141,9 @@ namespace AMDiS { namespace Parallel { } } - inline void beginDofIter(const FiniteElemSpace *fe = nullptr) + inline void beginDofIter(const FiniteElemSpace *fe = NULL) { - if (fe != nullptr) { + if (fe != NULL) { feMapIter = dataIter->second.begin(); while (feMapIter->first != fe && diff --git a/AMDiS/src/parallel/ElementObjectDatabase.cc b/AMDiS/src/parallel/ElementObjectDatabase.cc index 250f06062752f17703b8a8b9206f43005a670f2b..238aabbb32d963b933a6c1687c73ce5a36d21efc 100644 --- a/AMDiS/src/parallel/ElementObjectDatabase.cc +++ b/AMDiS/src/parallel/ElementObjectDatabase.cc @@ -584,7 +584,7 @@ namespace AMDiS { namespace Parallel { edgeReverseMode.clear(); faceReverseMode.clear(); - macroElementRankMap = nullptr; + macroElementRankMap = NULL; macroElIndexMap.clear(); macroElIndexTypeMap.clear(); } diff --git a/AMDiS/src/parallel/ElementObjectDatabase.h b/AMDiS/src/parallel/ElementObjectDatabase.h index c9954b9472f2123d5a1c2b28b5561e9295e7e036..2e5fed1bf0f4e75a54b72fdb2b67db2196667bcc 100644 --- a/AMDiS/src/parallel/ElementObjectDatabase.h +++ b/AMDiS/src/parallel/ElementObjectDatabase.h @@ -101,11 +101,11 @@ namespace AMDiS { namespace Parallel { class ElementObjectDatabase { public: ElementObjectDatabase() - : feSpace(nullptr), - mesh(nullptr), + : feSpace(NULL), + mesh(NULL), iterGeoPos(CENTER), - macroElementRankMap(nullptr), - levelData(nullptr) + macroElementRankMap(NULL), + levelData(NULL) {} void setFeSpace(const FiniteElemSpace *fe) diff --git a/AMDiS/src/parallel/InteriorBoundary.cc b/AMDiS/src/parallel/InteriorBoundary.cc index 71c9496f925cf95319c26d00a9f5f878f61a5ffc..bfdfc94da8ca14f5ae86975234840b835e7f3a08 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 = nullptr; + bound.neighObj.el = NULL; } } } diff --git a/AMDiS/src/parallel/MatrixNnzStructure.cc b/AMDiS/src/parallel/MatrixNnzStructure.cc index 0c514c7bf3f77348d9ca1c589a8dc4f30878340e..a4ee9eb8868305cb278077703d3055f5f5c6bca2 100644 --- a/AMDiS/src/parallel/MatrixNnzStructure.cc +++ b/AMDiS/src/parallel/MatrixNnzStructure.cc @@ -39,12 +39,12 @@ namespace AMDiS { namespace Parallel { { if (dnnz) { delete [] dnnz; - dnnz = nullptr; + dnnz = NULL; } if (onnz) { delete [] onnz; - onnz = nullptr; + onnz = NULL; } } @@ -91,7 +91,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 = nullptr; + const FiniteElemSpace* feSpace = NULL; for (int j = 0; j < nComponents; j++) if (mat[i][j]) feSpace = mat[i][j]->getRowFeSpace(); @@ -110,7 +110,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 = nullptr; + const FiniteElemSpace* feSpace = NULL; 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 4368c524aa9f666b1656b2db62bcb81eca9ac9ae..0bf3ef7ee9cb44327e3ea4a26fc7ae59c5980329 100644 --- a/AMDiS/src/parallel/MatrixNnzStructure.h +++ b/AMDiS/src/parallel/MatrixNnzStructure.h @@ -34,8 +34,8 @@ namespace AMDiS { namespace Parallel { class MatrixNnzStructure { public: MatrixNnzStructure() - : dnnz(nullptr), - onnz(nullptr) + : dnnz(NULL), + onnz(NULL) {} ~MatrixNnzStructure(); diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index d57739321f31c65dcf5bf605b428ecdd2bfe2b0f..eda979bffe035fea7e88891cfaf1fb31023e6766 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -71,7 +71,7 @@ namespace AMDiS { namespace Parallel { using namespace boost::filesystem; using namespace std; - MeshDistributor* MeshDistributor::globalMeshDistributor = nullptr; + MeshDistributor* MeshDistributor::globalMeshDistributor = NULL; const Flag MeshDistributor::BOUNDARY_SUBOBJ_SORTED = 0X01L; const Flag MeshDistributor::BOUNDARY_FILL_INFO_SEND_DOFS = 0X02L; @@ -86,10 +86,10 @@ namespace AMDiS { namespace Parallel { : problemStat(0), initialized(false), name("parallel"), - mesh(nullptr), - refineManager(nullptr), - partitioner(nullptr), - initialPartitioner(nullptr), + mesh(NULL), + refineManager(NULL), + partitioner(NULL), + initialPartitioner(NULL), deserialized(false), writeSerializationFile(false), repartitioningAllowed(false), @@ -183,7 +183,7 @@ namespace AMDiS { namespace Parallel { { if (partitioner) { delete partitioner; - partitioner = nullptr; + partitioner = NULL; } } @@ -300,8 +300,8 @@ namespace AMDiS { namespace Parallel { int neighIndex = (*it)->getNeighbour(i)->getIndex(); - (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), nullptr); - (*it)->setNeighbour(i, nullptr); + (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), NULL); + (*it)->setNeighbour(i, NULL); (*it)->setBoundary(i, 0); macroElementNeighbours[(*it)->getIndex()][i] = -1; @@ -318,8 +318,8 @@ namespace AMDiS { namespace Parallel { int neighIndex = (*it)->getNeighbour(i)->getIndex(); - (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), nullptr); - (*it)->setNeighbour(i, nullptr); + (*it)->getNeighbour(i)->setNeighbour((*it)->getOppVertex(i), NULL); + (*it)->setNeighbour(i, NULL); (*it)->setBoundary(i, 0); macroElementNeighbours[(*it)->getIndex()][i] = -1; @@ -533,7 +533,7 @@ namespace AMDiS { namespace Parallel { // === Add mesh of stationary problem and create a corresponding === // === refinement manager object. === - if (mesh != nullptr) { + if (mesh != NULL) { TEST_EXIT(mesh == probStat->getMesh()) ("Does not yet support for different meshes! %s\n", probStat->getMesh()->getName().c_str()); } else { @@ -641,7 +641,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("MeshDistributor::addProblemStatGlobal()"); - if (globalMeshDistributor == nullptr) + if (globalMeshDistributor == NULL) globalMeshDistributor = new MeshDistributor(); globalMeshDistributor->addProblemStat(probStat); @@ -1658,7 +1658,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, nullptr); + mel->setNeighbour(i, NULL); // Create new DOFs for the macro element. mel->getElement()->createNewDofPtrs(true); @@ -1742,7 +1742,7 @@ namespace AMDiS { namespace Parallel { if (neighIndex == -1 || partitioner->getElementInRank()[neighIndex] == false) { - (*it)->setNeighbour(i, nullptr); + (*it)->setNeighbour(i, NULL); } else { TEST_EXIT_DBG(elIndexMap.count(neighIndex) == 1) ("Should not happen!\n"); @@ -1913,7 +1913,7 @@ namespace AMDiS { namespace Parallel { int neighIndex = macroElementNeighbours[elIndex][i]; if (neighIndex == -1) - mel->setNeighbour(i, nullptr); + mel->setNeighbour(i, NULL); else { TEST_EXIT_DBG(elIndexMap.count(neighIndex) == 1) ("Should not happen!\n"); @@ -2122,7 +2122,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("MeshDistributor::createBoundaryDofs()"); - Timer *t = nullptr; + Timer *t = NULL; if (printTimings) t = new Timer(); @@ -2310,7 +2310,7 @@ namespace AMDiS { namespace Parallel { { FUNCNAME("MeshDistributor::updateParallelDofMappings()"); - Timer *t = nullptr; + Timer *t = NULL; if (printTimings) t = new Timer(); diff --git a/AMDiS/src/parallel/MeshManipulation.cc b/AMDiS/src/parallel/MeshManipulation.cc index fce566c7e9f75813fd0e356d5361baff87bbebd5..3e93ef6d63fe39eb971a887ab40aa5621384ccb8 100644 --- a/AMDiS/src/parallel/MeshManipulation.cc +++ b/AMDiS/src/parallel/MeshManipulation.cc @@ -502,7 +502,7 @@ namespace AMDiS { namespace Parallel { elInfo = pstack->traverseNext(elInfo); } while (elInfo && elInfo->getElement() != child1); - TEST_EXIT_DBG(elInfo != nullptr)("This should not happen!\n"); + TEST_EXIT_DBG(elInfo != NULL)("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 b742a2c7557d990e1f10f6d691c2b127b32edc10..d245c23e52ea6fe27ba7c4f9c548035e0df4bd06 100644 --- a/AMDiS/src/parallel/MeshPartitioner.h +++ b/AMDiS/src/parallel/MeshPartitioner.h @@ -56,9 +56,9 @@ namespace AMDiS { namespace Parallel { MeshPartitioner(std::string name, MPI::Intracomm *comm) : initFileStr(name), mpiComm(comm), - mesh(nullptr), + mesh(NULL), boxPartitioning(false), - mapLocalGlobal(nullptr) + mapLocalGlobal(NULL) {} virtual ~MeshPartitioner() {} diff --git a/AMDiS/src/parallel/MtlFetiPrimalSolver.h b/AMDiS/src/parallel/MtlFetiPrimalSolver.h index 6f6c7c8f1aeeb0ef51e2cefd422f42c4aa429b61..20cde99a1f511138b727373066ccb95b7ba18586 100644 --- a/AMDiS/src/parallel/MtlFetiPrimalSolver.h +++ b/AMDiS/src/parallel/MtlFetiPrimalSolver.h @@ -25,7 +25,7 @@ #include "AMDiS_fwd.h" -#include "LinearSolver.h" +#include "LinearSolverInterface.h" #include "parallel/PetscSolver.h" @@ -43,7 +43,7 @@ class MtlFetiPrimalSolver virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new MtlFetiPrimalSolver(this->name); } @@ -51,7 +51,7 @@ class MtlFetiPrimalSolver /// Constructor of FETI-DP solver class. explicit MtlFetiPrimalSolver(string name) - : LinearSolver(name) + : LinearSolverInterface(name) {} }; diff --git a/AMDiS/src/parallel/PITL_Solver.h b/AMDiS/src/parallel/PITL_Solver.h index 0836c788f2b504f4483b6ebc030297601e37d670..de347f469cc807a1af4b3ef947e770b9387e6e22 100644 --- a/AMDiS/src/parallel/PITL_Solver.h +++ b/AMDiS/src/parallel/PITL_Solver.h @@ -27,7 +27,7 @@ #ifdef HAVE_PARALLEL_MTL4 #include "solver/ITL_Solver.h" -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" #include "MTL4Types.h" namespace AMDiS @@ -37,10 +37,10 @@ namespace AMDiS using namespace MTLTypes; template< typename SolverType > - struct PITL_Solver : MTL4Solver< PMTLMatrix, PMTLVector, ITL_Runner< SolverType, PMTLMatrix, PMTLVector > > + struct PITL_Solver : LinearSolver< PMTLMatrix, PMTLVector, ITL_Runner< SolverType, PMTLMatrix, PMTLVector > > { PITL_Solver(std::string name) - : MTL4Solver< PMTLMatrix, PMTLVector, ITL_Runner< SolverType, PMTLMatrix, PMTLVector > >(name) {} + : LinearSolver< PMTLMatrix, PMTLVector, ITL_Runner< SolverType, PMTLMatrix, PMTLVector > >(name) {} }; typedef PITL_Solver< cg_solver_type > P_CGSolver; @@ -58,7 +58,7 @@ namespace AMDiS typedef PITL_Solver< fgmres_type > P_FGMResSolver; typedef PITL_Solver< preonly_type > P_PreOnly; - typedef ITL_BasePreconditioner< PMTLMatrix, PMTLVector > ParallelPreconditioner; + typedef ITL_PreconditionerBase< PMTLMatrix, PMTLVector > ParallelPreconditioner; typedef CreatorInterface< ParallelPreconditioner > ParallelPreconditionCreator; typedef ITL_Preconditioner<itl::pc::diagonal<PMTLMatrix>, PMTLMatrix, PMTLVector > P_DiagonalPreconditioner; diff --git a/AMDiS/src/parallel/ParMetisPartitioner.cc b/AMDiS/src/parallel/ParMetisPartitioner.cc index 85278f190882b2d28be0c6607dd6d6477f22c6e3..bbf9e088dda1ee146a3b55cf0e71d36d0d3a7785 100644 --- a/AMDiS/src/parallel/ParMetisPartitioner.cc +++ b/AMDiS/src/parallel/ParMetisPartitioner.cc @@ -72,7 +72,7 @@ namespace AMDiS { namespace Parallel { if (dim == dow) xyz = new float[nElements * dim]; else - xyz = nullptr; + xyz = NULL; eptr[0] = 0; @@ -324,7 +324,7 @@ namespace AMDiS { namespace Parallel { parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), &(wgts[0]), - nullptr, + NULL, &wgtflag, &numflag, &ncon, @@ -346,7 +346,7 @@ namespace AMDiS { namespace Parallel { parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), &(wgts[0]), - nullptr, + NULL, &(vsize[0]), &wgtflag, &numflag, @@ -366,7 +366,7 @@ namespace AMDiS { namespace Parallel { parMetisGraph.getXAdj(), parMetisGraph.getAdjncy(), &(wgts[0]), - nullptr, + NULL, &wgtflag, &numflag, &ncon, @@ -525,7 +525,7 @@ namespace AMDiS { namespace Parallel { } delete parMetisMesh; - parMetisMesh = nullptr; + parMetisMesh = NULL; delete [] rankElements; delete [] nPartitionElements; diff --git a/AMDiS/src/parallel/ParMetisPartitioner.h b/AMDiS/src/parallel/ParMetisPartitioner.h index 3bf4c18b061698f5d114d8d9bca52c6f8c9f5300..44a521f781b4156af979958d5cec7fc4a1376013 100644 --- a/AMDiS/src/parallel/ParMetisPartitioner.h +++ b/AMDiS/src/parallel/ParMetisPartitioner.h @@ -170,7 +170,7 @@ namespace AMDiS { namespace Parallel { public: ParMetisPartitioner(std::string name, MPI::Intracomm *comm) : MeshPartitioner(name, comm), - parMetisMesh(nullptr), + parMetisMesh(NULL), itr(1000000.0) {} diff --git a/AMDiS/src/parallel/ParallelCoarseSpaceSolver.h b/AMDiS/src/parallel/ParallelCoarseSpaceSolver.h index 44bd6b404d7de268d3216c0f8821d5c2d0e42d17..472c81e79e49aa3c75b72215d8937e31aebb2e45 100644 --- a/AMDiS/src/parallel/ParallelCoarseSpaceSolver.h +++ b/AMDiS/src/parallel/ParallelCoarseSpaceSolver.h @@ -34,7 +34,7 @@ #include "parallel/MeshDistributor.h" #include "parallel/MatrixNnzStructure.h" #include "parallel/ParallelSolver.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" namespace AMDiS { diff --git a/AMDiS/src/parallel/ParallelDofMapping.cc b/AMDiS/src/parallel/ParallelDofMapping.cc index 57aa4ce3301b73965e47e22811895df19a043daa..6ae8be433a06ee95f26f680a1e54bf8307e8b536 100644 --- a/AMDiS/src/parallel/ParallelDofMapping.cc +++ b/AMDiS/src/parallel/ParallelDofMapping.cc @@ -47,8 +47,8 @@ namespace AMDiS { namespace Parallel { ComponentDofMap::ComponentDofMap() - : dofComm(nullptr), - feSpace(nullptr), + : dofComm(NULL), + feSpace(NULL), globalMapping(false) { clear(); @@ -212,7 +212,7 @@ namespace AMDiS { namespace Parallel { ParallelDofMapping::ParallelDofMapping(DofMappingMode mode, bool matIndexFromGlobal) - : dofComm(nullptr), + : dofComm(NULL), globalMapping(true), needMatIndexFromGlobal(matIndexFromGlobal), nRankDofs(1), @@ -399,7 +399,7 @@ namespace AMDiS { namespace Parallel { if (!globalMapping) continue; - TEST_EXIT_DBG(dofComm != nullptr)("No communicator given!\n"); + TEST_EXIT_DBG(dofComm != NULL)("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 e60202bd37861e289cb890093ac9ed2f5541ab2a..5353dc280519dba4b45c65e3c0ce5f3ae078f4e7 100644 --- a/AMDiS/src/parallel/ParallelProblemStat.cc +++ b/AMDiS/src/parallel/ParallelProblemStat.cc @@ -25,7 +25,7 @@ #include "parallel/MpiHelper.h" #include "parallel/ParallelMapper.h" -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #ifdef HAVE_PARALLEL_MTL4 #include "parallel/PITL_Solver.h" @@ -53,7 +53,7 @@ namespace AMDiS { namespace Parallel { ParallelProblemStat::ParallelProblemStat(std::string nameStr, ProblemIterationInterface *problemIteration) : ProblemStatSeq(nameStr, problemIteration), - meshDistributor(nullptr) + meshDistributor(NULL) { 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 != nullptr) + TEST_EXIT(parallelSolver != NULL) ("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 != nullptr) + TEST_EXIT(MeshDistributor::globalMeshDistributor != NULL) ("No Meshdistributor! Should not happen!\n"); MeshDistributor::globalMeshDistributor->checkMeshChange(); @@ -117,73 +117,73 @@ namespace AMDiS { namespace Parallel { #if defined HAVE_PARALLEL_MTL4 creator = new P_CGSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_cg", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_cg", creator); creator = new P_CGSSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_cgs", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_cgs", creator); // creator = new P_BiCGSolver::Creator; -// CreatorMap< LinearSolver >::addCreator("p_mtl_bicg", creator); +// CreatorMap< LinearSolverInterface >::addCreator("p_mtl_bicg", creator); creator = new P_BiCGStabSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_bicgstab", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_bicgstab", creator); creator = new P_BiCGStab2Solver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_bicgstab2", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_bicgstab2", creator); creator = new P_BiCGStabEllSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_bicgstab_ell", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_bicgstab_ell", creator); creator = new P_QMRSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_qmr", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_qmr", creator); creator = new P_TFQMRSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_tfqmr", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_tfqmr", creator); creator = new P_GMResSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_gmres", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_gmres", creator); creator = new P_FGMResSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_fgmres", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_fgmres", creator); creator = new P_IDRsSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_idr_s", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_idr_s", creator); creator = new P_MinResSolver::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_minres", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_minres", creator); creator = new P_PreOnly::Creator; - CreatorMap< LinearSolver >::addCreator("p_mtl_preonly", creator); - CreatorMap< LinearSolver >::addCreator("p_mtl_richardson", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_preonly", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_mtl_richardson", creator); #elif defined HAVE_PARALLEL_PETSC creator = new PetscSolverGlobalMatrix::Creator; - CreatorMap< LinearSolver >::addCreator("p_petsc_petsc", creator); // standard PETSc creator + CreatorMap< LinearSolverInterface >::addCreator("p_petsc_petsc", creator); // standard PETSc creator std::map<std::string,std::string>::iterator it; PetscParameters params; for (it = params.solverMap.begin(); it!= params.solverMap.end(); it++) { - CreatorMap< LinearSolver >::addCreator("p_petsc_" + it->first, creator); + CreatorMap< LinearSolverInterface >::addCreator("p_petsc_" + it->first, creator); } creator = new PetscSolverSchur::Creator; - CreatorMap< LinearSolver >::addCreator("p_petsc_petsc-schur", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_petsc_petsc-schur", creator); creator = new PetscSolverGlobalBlockMatrix::Creator; - CreatorMap< LinearSolver >::addCreator("p_petsc_petsc-block", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_petsc_petsc-block", creator); creator = new PetscSolverFeti::Creator; - CreatorMap< LinearSolver >::addCreator("p_petsc_petsc-feti", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_petsc_petsc-feti", creator); creator = new PetscSolverNavierStokes::Creator; - CreatorMap< LinearSolver >::addCreator("p_petsc_petsc-navierstokes", creator); - CreatorMap< LinearSolver >::addCreator("petsc-navierstokes", creator); + CreatorMap< LinearSolverInterface >::addCreator("p_petsc_petsc-navierstokes", creator); + CreatorMap< LinearSolverInterface >::addCreator("petsc-navierstokes", creator); #elif defined HAVE_BDDC_ML creator = new BddcMlSolver::Creator; - CreatorMap< LinearSolver >::addCreator("bddcml", creator); + CreatorMap< LinearSolverInterface >::addCreator("bddcml", creator); #endif } } diff --git a/AMDiS/src/parallel/ParallelProblemStat.h b/AMDiS/src/parallel/ParallelProblemStat.h index 5bf478d4417463e6ad9b7c627dda85bc87b8125d..aaee530fa184e8515ec1aec9e91cd1f3974a3dd0 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 = nullptr); + ProblemIterationInterface *problemIteration = NULL); virtual ~ParallelProblemStat() {} @@ -52,7 +52,7 @@ namespace AMDiS bool assembleVector = true); void initialize(Flag initFlag, - ProblemStatSeq *adoptProblem = nullptr, + ProblemStatSeq *adoptProblem = NULL, 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 f2e4f3664af8a10c0d42c3f7ea3ea95c1fb76e05..11b318d9e9bdfad7d74a5252c9a138c61d1d24f8 100644 --- a/AMDiS/src/parallel/ParallelSolver.cc +++ b/AMDiS/src/parallel/ParallelSolver.cc @@ -24,11 +24,11 @@ namespace AMDiS { namespace Parallel { ParallelSolver::ParallelSolver(std::string name, bool globalIndices) - : LinearSolver(name), - interiorMap(nullptr), + : LinearSolverInterface(name), + interiorMap(NULL), dofMap(FESPACE_WISE, globalIndices), parallelDofMappingsRegistered(false), - meshDistributor(nullptr), + meshDistributor(NULL), meshLevel(0) { setDofMapping(&dofMap); diff --git a/AMDiS/src/parallel/ParallelSolver.h b/AMDiS/src/parallel/ParallelSolver.h index 22a7136fbf6ae81169a2e9b796b48a3d13205580..4d5ff96561c9081106730800a6b01430e2468404 100644 --- a/AMDiS/src/parallel/ParallelSolver.h +++ b/AMDiS/src/parallel/ParallelSolver.h @@ -26,7 +26,7 @@ #include <mpi.h> #include <vector> -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "AMDiS_fwd.h" namespace AMDiS @@ -39,7 +39,7 @@ namespace AMDiS * \brief * base class for all parallel solvers, e.g. \ref PetscSolver, or \ref PMTL4Solver */ - class ParallelSolver : public LinearSolver + class ParallelSolver : public LinearSolverInterface { public: // methods diff --git a/AMDiS/src/parallel/PetscSolver.cc b/AMDiS/src/parallel/PetscSolver.cc index 3f00e4e4503b260503647943796b863c85cf3373..17471c2d50e8d55d64bf7182c366f39838af11cb 100644 --- a/AMDiS/src/parallel/PetscSolver.cc +++ b/AMDiS/src/parallel/PetscSolver.cc @@ -74,7 +74,7 @@ namespace AMDiS { namespace Parallel { super::init(fe0, fe1, createGlobalMapping); } - /// see seq::MTL4Solver::solveLinearSystem(...) + /// see seq::LinearSolver::solveLinearSystem(...) int PetscSolver::solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, SystemVector& x, SystemVector& b, @@ -96,7 +96,7 @@ namespace AMDiS { namespace Parallel { INFO(info, 8)("creation of parallel data structures needed %.5f seconds\n", t.elapsed()); - solvePetscMatrix(x, nullptr); + solvePetscMatrix(x, NULL); if (!storeMatrixData) { destroyVectorData(); diff --git a/AMDiS/src/parallel/PetscSolver.h b/AMDiS/src/parallel/PetscSolver.h index 92885664558edc024cd52f1a5589c574cde9d78f..82a4aec4e050b57344c6d45e76c2201db0dc9de7 100644 --- a/AMDiS/src/parallel/PetscSolver.h +++ b/AMDiS/src/parallel/PetscSolver.h @@ -149,7 +149,7 @@ namespace AMDiS } protected: - /// Implementation of \ref LinearSolver::solveLinearSystem() + /// Implementation of \ref LinearSolverInterface::solveLinearSystem() int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, SystemVector& x, SystemVector& b, diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard.cc b/AMDiS/src/parallel/PetscSolverCahnHilliard.cc index ae6352b2b9a9b05df8268fc371f2e114d4d1bca4..80c5f033b527ad50bcf12891fd6a6656456c6b2f 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard.cc +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard.cc @@ -69,14 +69,14 @@ namespace AMDiS { namespace Parallel { PetscSolverCahnHilliard::PetscSolverCahnHilliard(string name, double *epsPtr, double *deltaPtr) : PetscSolverGlobalBlockMatrix(name), - massMatrixSolver(nullptr), - laplaceMatrixSolver(nullptr), - deltaKMatrixSolver(nullptr), + massMatrixSolver(NULL), + laplaceMatrixSolver(NULL), + deltaKMatrixSolver(NULL), useOldInitialGuess(false), - phase(nullptr), + phase(NULL), eps(epsPtr), delta(deltaPtr), - tau(nullptr) + tau(NULL) { Parameters::get(initFileStr + "->use old initial guess", useOldInitialGuess); } @@ -134,12 +134,12 @@ namespace AMDiS { namespace Parallel { Operator laplaceOp2(feSpace, feSpace); if (phase) { - VecAtQP_ZOT zot(phase, nullptr); + VecAtQP_ZOT zot(phase, NULL); massOp.addTerm(&zot); laplaceOp.addTerm(&zot); // M - VecAtQP_SOT sot2(phase, nullptr, (*eps)*sqrt(*delta)); + VecAtQP_SOT sot2(phase, NULL, (*eps)*sqrt(*delta)); laplaceOp.addTerm(&sot2); // eps*sqrt(delta)*K - VecAtQP_SOT sot(phase, nullptr, -(*delta)); + VecAtQP_SOT sot(phase, NULL, -(*delta)); laplaceOp2.addTerm(&sot); // -delta*K massMatrix.assembleOperator(massOp); massMatrixSolver = createSubSolver(0, "mass_"); @@ -246,13 +246,13 @@ namespace AMDiS { namespace Parallel { delete massMatrixSolver; - massMatrixSolver = nullptr; + massMatrixSolver = NULL; delete laplaceMatrixSolver; - laplaceMatrixSolver = nullptr; + laplaceMatrixSolver = NULL; delete deltaKMatrixSolver; - deltaKMatrixSolver = nullptr; + deltaKMatrixSolver = NULL; if (tau) { delete delta; diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard.h b/AMDiS/src/parallel/PetscSolverCahnHilliard.h index a5745bc4bf0066dcef5adf918e5348c27ce262bf..dbe82b1a047b4a53de0ebeabab6d0a3c8d8788ae 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard.h +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard.h @@ -48,22 +48,22 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverCahnHilliard(this->name); } }; - PetscSolverCahnHilliard(std::string name, double *epsPtr = nullptr, double *deltaPtr = nullptr); + PetscSolverCahnHilliard(std::string name, double *epsPtr = NULL, double *deltaPtr = NULL); - void setChData(double *epsPtr, double *deltaPtr, DOFVector<double> *p=nullptr) + void setChData(double *epsPtr, double *deltaPtr, DOFVector<double> *p=NULL) { eps = epsPtr; delta = deltaPtr; // gamma*tau phase = p; } - void setChData2(double *epsPtr, double *gammaPtr, double *tauPtr, DOFVector<double> *p=nullptr) + void setChData2(double *epsPtr, double *gammaPtr, double *tauPtr, DOFVector<double> *p=NULL) { eps = epsPtr; gamma = gammaPtr; diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc b/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc index f901be28b1fd4eadf6b74181114345463df7898f..ab066a69c99b39700e1b31c6cbf83d2a25e13e77 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard2.cc @@ -95,14 +95,14 @@ namespace AMDiS { namespace Parallel { : PetscSolverGlobalMatrix(name), useOldInitialGuess(false), laplaceSolutionMode(0), - massMatrixSolver(nullptr), - laplaceMatrixSolver(nullptr), - deltaKMatrixSolver(nullptr), - eps(nullptr), - delta(nullptr), - tau(nullptr), - solution(nullptr), - phase(nullptr) + massMatrixSolver(NULL), + laplaceMatrixSolver(NULL), + deltaKMatrixSolver(NULL), + eps(NULL), + delta(NULL), + tau(NULL), + solution(NULL), + phase(NULL) { Parameters::get(initFileStr + "->use old initial guess", useOldInitialGuess); @@ -247,13 +247,13 @@ namespace AMDiS { namespace Parallel { deltaKMatrixSolver->destroyVectorData(); delete massMatrixSolver; - massMatrixSolver = nullptr; + massMatrixSolver = NULL; delete laplaceMatrixSolver; - laplaceMatrixSolver = nullptr; + laplaceMatrixSolver = NULL; delete deltaKMatrixSolver; - deltaKMatrixSolver = nullptr; + deltaKMatrixSolver = NULL; if (tau) { diff --git a/AMDiS/src/parallel/PetscSolverCahnHilliard2.h b/AMDiS/src/parallel/PetscSolverCahnHilliard2.h index f8a6ad6fd832dafdaabc506f69457bc9dc92d00a..1ffaca3359c65410a49e164ff7f0822bc81e4f8f 100644 --- a/AMDiS/src/parallel/PetscSolverCahnHilliard2.h +++ b/AMDiS/src/parallel/PetscSolverCahnHilliard2.h @@ -46,7 +46,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverCahnHilliard2(this->name); } @@ -60,7 +60,7 @@ namespace AMDiS { namespace Parallel { delta = deltaPtr; } - void setChData2(double *epsPtr, double *tauPtr, SystemVector* vec=nullptr) + void setChData2(double *epsPtr, double *tauPtr, SystemVector* vec=NULL) { eps = epsPtr; tau = tauPtr; diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index ef54c0621e9e36079aea14265bda8da76211613f..10571d3b3902784b73685db4b7dda57952354855 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(nullptr), - massMatrixSolver(nullptr), + subdomain(NULL), + massMatrixSolver(NULL), printTimings(false), augmentedLagrange(false), nRankEdges(0), @@ -159,13 +159,13 @@ namespace AMDiS { namespace Parallel { subDomainIsLocal = (levelData.getMpiComm(meshLevel + 1) == MPI::COMM_SELF); - if (subdomain == nullptr) { + if (subdomain == NULL) { string subSolverInitStr = name + "->subsolver"; string solverType = "petsc"; Parameters::get(subSolverInitStr, solverType); solverType = "p_" + solverType; LinearSolverCreator *solverCreator = - dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolver>::getCreator(solverType, name)); + dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolverInterface>::getCreator(solverType, name)); TEST_EXIT(solverCreator) ("No valid solver type found in parameter \"%s\"\n", name.c_str()); @@ -1149,7 +1149,7 @@ namespace AMDiS { namespace Parallel { MatComputeExplicitOperator(tmp, &mat_schur_primal); MatDestroy(&tmp); - schurPrimalData.subSolver = nullptr; + schurPrimalData.subSolver = NULL; VecDestroy(&schurPrimalData.tmp_vec_b); VecDestroy(&schurPrimalData.tmp_vec_primal); } @@ -1255,9 +1255,9 @@ namespace AMDiS { namespace Parallel { MatComputeExplicitOperator(tmp, &mat_schur_primal); MatDestroy(&tmp); - schurPrimalAugmentedData.subSolver = nullptr; - schurPrimalAugmentedData.mat_lagrange = nullptr; - schurPrimalAugmentedData.mat_augmented_lagrange = nullptr; + schurPrimalAugmentedData.subSolver = NULL; + schurPrimalAugmentedData.mat_lagrange = NULL; + schurPrimalAugmentedData.mat_augmented_lagrange = NULL; VecDestroy(&schurPrimalAugmentedData.tmp_vec_b0); VecDestroy(&schurPrimalAugmentedData.tmp_vec_b1); VecDestroy(&schurPrimalAugmentedData.tmp_vec_primal); @@ -1272,14 +1272,14 @@ namespace AMDiS { namespace Parallel { if (schurPrimalSolver == 0) { if (augmentedLagrange == false) { - schurPrimalData.subSolver = nullptr; + schurPrimalData.subSolver = NULL; VecDestroy(&schurPrimalData.tmp_vec_b); VecDestroy(&schurPrimalData.tmp_vec_primal); } else { - schurPrimalAugmentedData.subSolver = nullptr; - schurPrimalAugmentedData.mat_lagrange = nullptr; - schurPrimalAugmentedData.mat_augmented_lagrange = nullptr; + schurPrimalAugmentedData.subSolver = NULL; + schurPrimalAugmentedData.mat_lagrange = NULL; + schurPrimalAugmentedData.mat_augmented_lagrange = NULL; VecDestroy(&schurPrimalAugmentedData.tmp_vec_b0); VecDestroy(&schurPrimalAugmentedData.tmp_vec_b1); @@ -1530,7 +1530,7 @@ namespace AMDiS { namespace Parallel { componentSpaces[pressureComponent]; // Create parallel DOF mapping in pressure space. - ParallelDofMapping *massMapping = nullptr; + ParallelDofMapping *massMapping = NULL; if (massMatrixSolver) { massMapping = massMatrixSolver->getDofMapping(); } else { @@ -1691,7 +1691,7 @@ namespace AMDiS { namespace Parallel { // === Destroy FETI-DP solver object. === fetiData.mat_lagrange = PETSC_NULL; - fetiData.subSolver = nullptr; + fetiData.subSolver = NULL; fetiData.ksp_schur_primal = PETSC_NULL; VecDestroy(&fetiData.tmp_vec_b0); @@ -1719,12 +1719,12 @@ namespace AMDiS { namespace Parallel { case FETI_DIRICHLET: KSPDestroy(&ksp_interior); - 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; + 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; VecDestroy(&fetiDirichletPreconData.tmp_vec_b); VecDestroy(&fetiDirichletPreconData.tmp_vec_duals0); @@ -1738,8 +1738,8 @@ namespace AMDiS { namespace Parallel { FetiLumpedPreconData &lumpedData = (stokesMode ? fetiInterfaceLumpedPreconData : fetiLumpedPreconData); - lumpedData.mat_lagrange_scaled = nullptr; - lumpedData.mat_duals_duals = nullptr; + lumpedData.mat_lagrange_scaled = NULL; + lumpedData.mat_duals_duals = NULL; VecDestroy(&lumpedData.tmp_vec_b0); VecDestroy(&lumpedData.tmp_vec_duals0); diff --git a/AMDiS/src/parallel/PetscSolverFeti.h b/AMDiS/src/parallel/PetscSolverFeti.h index 9933201612f7e8dd1801d759e5e3bdf52ff61860..4e240aa5ee6992870907751d1cfed0aa36995603 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.h +++ b/AMDiS/src/parallel/PetscSolverFeti.h @@ -54,7 +54,7 @@ namespace AMDiS virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverFeti(this->name); } diff --git a/AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.h b/AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.h index 1a33b0bf54b8d454fa28bad6228bd8127001713a..40e8bb15080832947b8f1c6c5d336727d67fc1d5 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.h +++ b/AMDiS/src/parallel/PetscSolverGlobalBlockMatrix.h @@ -48,7 +48,7 @@ namespace AMDiS virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverGlobalBlockMatrix(this->name); } diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc index 6cb8273f6795b81607f4fc125e5a262e231cc89c..0d5909a2082344cad7461cbe80d1185d0dcca249 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc @@ -838,7 +838,7 @@ namespace AMDiS { namespace Parallel { PeriodicMap &perMap = meshDistributor->getPeriodicMap(); ParallelDofMapping *rowCoarseSpace = - (coarseSpaceMap.size() ? coarseSpaceMap[rowComp] : nullptr); + (coarseSpaceMap.size() ? coarseSpaceMap[rowComp] : NULL); map<DegreeOfFreedom, double> &dirichletValues = vec->getDirichletValues(); diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h index 8e9dd5285a0782560ebcb850b67c423c31d20c6f..a2a9a0343fb02da1d243fbbaeea02f776a0ce168 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h @@ -50,7 +50,7 @@ namespace AMDiS virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverGlobalMatrix(this->name); } diff --git a/AMDiS/src/parallel/PetscSolverNSCH.cc b/AMDiS/src/parallel/PetscSolverNSCH.cc index 2e6a142edaead8ba565f31363c8b2515e72edf25..de5cec017f23c536f749a89a780e3cbe6357fb60 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(nullptr), - laplaceMatrixSolverCH(nullptr), - deltaKMatrixSolver(nullptr), - massMatrixSolver(nullptr), - laplaceMatrixSolver(nullptr), - conDifMatrixSolver(nullptr), - nu(nullptr), - invTau(nullptr), - solution(nullptr), - phase(nullptr) + massMatrixSolverCH(NULL), + laplaceMatrixSolverCH(NULL), + deltaKMatrixSolver(NULL), + massMatrixSolver(NULL), + laplaceMatrixSolver(NULL), + conDifMatrixSolver(NULL), + nu(NULL), + invTau(NULL), + solution(NULL), + phase(NULL) { Parameters::get(initFileStr + "->use old initial guess", useOldInitialGuess); @@ -294,9 +294,9 @@ namespace AMDiS { namespace Parallel { DOFMatrix conDifMatrix(pressureFeSpace, pressureFeSpace); { Operator conDifOp(pressureFeSpace, pressureFeSpace); - ZeroOrderTerm *conDif0 = nullptr; - SecondOrderTerm *conDif1 = nullptr; - FirstOrderTerm *conDif2 = nullptr, *conDif3 = nullptr, *conDif4 = nullptr; + ZeroOrderTerm *conDif0 = NULL; + SecondOrderTerm *conDif1 = NULL; + FirstOrderTerm *conDif2 = NULL, *conDif3 = NULL, *conDif4 = NULL; vp.interpol(solution->getDOFVector(dim+2)); densityFunctionTau = new LinearInterpolation(*rho1,*rho2,*invTau); @@ -424,13 +424,13 @@ namespace AMDiS { namespace Parallel { deltaKMatrixSolver->destroyVectorData(); delete massMatrixSolverCH; - massMatrixSolverCH = nullptr; + massMatrixSolverCH = NULL; delete laplaceMatrixSolverCH; - laplaceMatrixSolverCH = nullptr; + laplaceMatrixSolverCH = NULL; delete deltaKMatrixSolver; - deltaKMatrixSolver = nullptr; + deltaKMatrixSolver = NULL; massMatrixSolver->destroyMatrixData(); massMatrixSolver->destroyVectorData(); @@ -445,13 +445,13 @@ namespace AMDiS { namespace Parallel { delete massMatrixSolver; - massMatrixSolver = nullptr; + massMatrixSolver = NULL; delete laplaceMatrixSolver; - laplaceMatrixSolver = nullptr; + laplaceMatrixSolver = NULL; delete conDifMatrixSolver; - conDifMatrixSolver = nullptr; + conDifMatrixSolver = NULL; KSPDestroy(&(matShellContext.kspVelocity)); if (regularizeLaplace) diff --git a/AMDiS/src/parallel/PetscSolverNSCH.h b/AMDiS/src/parallel/PetscSolverNSCH.h index f1f5851b71639e892d9093a42a203489485ddeef..ebe44f2fdd92771e39eaafefbea00ac77e331ff7 100644 --- a/AMDiS/src/parallel/PetscSolverNSCH.h +++ b/AMDiS/src/parallel/PetscSolverNSCH.h @@ -103,7 +103,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverNSCH(this->name); } @@ -120,7 +120,7 @@ namespace AMDiS { namespace Parallel { } - void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=nullptr, double *nu2_=nullptr, double *rho1_=nullptr, double *rho2_=nullptr) + void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=NULL, double *nu2_=NULL, double *rho1_=NULL, double *rho2_=NULL) { invTau = invTauPtr; solution = vec; diff --git a/AMDiS/src/parallel/PetscSolverNavierStokes.h b/AMDiS/src/parallel/PetscSolverNavierStokes.h index b77893480cd65555aef79c4c022539f8706b33c1..8f4466d149308bc2d1870ff4fa771257841c7674 100644 --- a/AMDiS/src/parallel/PetscSolverNavierStokes.h +++ b/AMDiS/src/parallel/PetscSolverNavierStokes.h @@ -103,7 +103,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverNavierStokes(this->name); } @@ -113,7 +113,7 @@ namespace AMDiS { namespace Parallel { void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo); - void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=nullptr, double *nu2_=nullptr, double *rho1_=nullptr, double *rho2_=nullptr) + void setStokesData(double *invTauPtr, SystemVector *vec, double *nu1_=NULL, double *nu2_=NULL, double *rho1_=NULL, double *rho2_=NULL) { nu = new double; (*nu) = 0.0; diff --git a/AMDiS/src/parallel/PetscSolverSchur.h b/AMDiS/src/parallel/PetscSolverSchur.h index 1e40859864fa0082ecfd1b02362a7df59178879e..ef35972b1e63dd404b0413363bc9dbd59066a5d9 100644 --- a/AMDiS/src/parallel/PetscSolverSchur.h +++ b/AMDiS/src/parallel/PetscSolverSchur.h @@ -46,7 +46,7 @@ namespace AMDiS virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverSchur(this->name); } diff --git a/AMDiS/src/parallel/ZoltanPartitioner.cc b/AMDiS/src/parallel/ZoltanPartitioner.cc index 16146a0163a76dec46ff4f9acf3fb956e472016a..8d01c2a76906ff3610d820ea26fec0de49a23bb4 100644 --- a/AMDiS/src/parallel/ZoltanPartitioner.cc +++ b/AMDiS/src/parallel/ZoltanPartitioner.cc @@ -34,7 +34,7 @@ namespace AMDiS { namespace Parallel { MPI::Intracomm *comm) : MeshPartitioner(name, comm), zoltan(*comm), - elWeights(nullptr) + elWeights(NULL) { /* Read configuration for Zoltan * format in initfile: @@ -229,7 +229,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 = nullptr; + elWeights = NULL; if (err != ZOLTAN_OK) return false; diff --git a/AMDiS/src/reinit/BoundaryElementTopDist.cc b/AMDiS/src/reinit/BoundaryElementTopDist.cc index 7d191c62e97baa1ee95f64c1d1779b25e01347aa..b9e4541d4cf680a7100cddc53938f57f7ef807bc 100644 --- a/AMDiS/src/reinit/BoundaryElementTopDist.cc +++ b/AMDiS/src/reinit/BoundaryElementTopDist.cc @@ -106,7 +106,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != nullptr) + if(velExt != NULL) { velExt->setBarycentricCoords_2D_boundary(SP_Vec[0], SP_Vec[1], SP_Vec[2], i); } @@ -143,7 +143,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != nullptr) + if(velExt != NULL) { velExt->setBarycentricCoords_2D_boundary( (*elIntersecPoints)[edgeUpdateInd][0], @@ -192,7 +192,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != nullptr) + if(velExt != NULL) { velExt->setBarycentricCoords_3D_boundary(SP_Vec[0], SP_Vec[1], SP_Vec[2], SP_Vec[3], i); } @@ -212,14 +212,14 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != nullptr) + if (velExt != NULL) { sP1NextEdge = j; sP2NextEdge = (j+1)%3; lambdaNextPt = lambda; } } - // if (velExt != nullptr) { + // if (velExt != NULL) { // sP1NextEdge = j; // sP2NextEdge = (j+1)%3; // lambdaNextPt = lambda; @@ -228,7 +228,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != nullptr) + if(velExt != NULL) { velExt->calcBarycentricCoords_3D_boundary( (*elIntersecPoints)[sP1NextEdge], @@ -248,7 +248,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( lambda); // dist = (dist < h_dist) ? dist : h_dist; -// if (velExt != nullptr) { +// if (velExt != NULL) { // sP1NextEdge = j; // sP2NextEdge = (j+2)%3; // lambdaNextPt = lambda; @@ -256,7 +256,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != nullptr) + if (velExt != NULL) { sP1NextEdge = j; sP2NextEdge = (j+2)%3; @@ -271,7 +271,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( lambda); // dist = (dist < h_dist) ? dist : h_dist; -// if (velExt != nullptr) { +// if (velExt != NULL) { // sP1NextEdge = 1; // sP2NextEdge = 2; // lambdaNextPt = lambda; @@ -279,7 +279,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != nullptr) + if (velExt != NULL) { sP1NextEdge = 1; sP2NextEdge = 2; @@ -293,7 +293,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( lambda); // dist = (dist < h_dist) ? dist : h_dist; -// if (velExt != nullptr) { +// if (velExt != NULL) { // sP1NextEdge = 0; // sP2NextEdge = 3; // lambdaNextPt = lambda; @@ -301,7 +301,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( if(h_dist<dist) { dist = h_dist; - if (velExt != nullptr) + if (velExt != NULL) { sP1NextEdge = 0; sP2NextEdge = 3; @@ -312,7 +312,7 @@ BoundaryElementTopDist::calcDistOnBoundaryElement( dVec[i] = dist; //save barycentric coordinates of intersection point, //for calculation of the velocity - if(velExt != nullptr) + if(velExt != NULL) { velExt->calcBarycentricCoords_3D_boundary( (*elIntersecPoints)[sP1NextEdge], diff --git a/AMDiS/src/reinit/BoundaryElementTopDist.h b/AMDiS/src/reinit/BoundaryElementTopDist.h index d15724967b0f1e0e6ddb3fbb353bb597208a1652..04a7049271759ead2ec249c082732bf217f49660 100644 --- a/AMDiS/src/reinit/BoundaryElementTopDist.h +++ b/AMDiS/src/reinit/BoundaryElementTopDist.h @@ -39,7 +39,7 @@ class BoundaryElementTopDist : public BoundaryElementDist public: BoundaryElementTopDist(ElementLevelSet *elLS_, int dim_, - VelocityExt *velExt_ = nullptr) + VelocityExt *velExt_ = NULL) : BoundaryElementDist(elLS_, dim_), velExt(velExt_) {} diff --git a/AMDiS/src/reinit/ElementLevelSet.cc b/AMDiS/src/reinit/ElementLevelSet.cc index af96399b5def4610411b9fe489076bd82abae836..5ad72859388f12dc2ae17e53bc0802a3b0f26a18 100644 --- a/AMDiS/src/reinit/ElementLevelSet.cc +++ b/AMDiS/src/reinit/ElementLevelSet.cc @@ -31,7 +31,7 @@ ElementLevelSet::createElementLevelSet(const ElInfo *elInfo_, { Element *el = elInfo_->getElement(); - if (elInfo == nullptr || el != lastEl) { + if (elInfo == NULL || el != lastEl) { /** * Element has changed. New calculation. */ diff --git a/AMDiS/src/reinit/ElementLevelSet.h b/AMDiS/src/reinit/ElementLevelSet.h index 62e69b3bac275f33fd440c67b762c799ac54aa46..bbf42b44017a4a7f9e71e59f2bf0eb31bc817614 100644 --- a/AMDiS/src/reinit/ElementLevelSet.h +++ b/AMDiS/src/reinit/ElementLevelSet.h @@ -80,8 +80,8 @@ class ElementLevelSet ElementFunction<double> *lSFct_, Mesh *mesh_) : name(name_), - elInfo(nullptr), - lastEl(nullptr), + elInfo(NULL), + lastEl(NULL), 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 2eba2a50a68fb3784fcb900b53712f3486f52399..bdd5a4da17f290e9656157498a00e468701190df 100644 --- a/AMDiS/src/reinit/ElementUpdate_2d.cc +++ b/AMDiS/src/reinit/ElementUpdate_2d.cc @@ -53,19 +53,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 != nullptr) + if (velExt != NULL) 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 != nullptr) + if (velExt != NULL) 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 != nullptr) + if (velExt != NULL) 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 29df3b1c9c4799894eeb74fc8d6c85a18dcbe919..b4d38400be8c05363af0b3f7b7dc00b65d828d67 100644 --- a/AMDiS/src/reinit/ElementUpdate_2d.h +++ b/AMDiS/src/reinit/ElementUpdate_2d.h @@ -35,7 +35,7 @@ using namespace AMDiS; class ElementUpdate_2d : public ElementUpdate { public: - ElementUpdate_2d(VelocityExt *velExt_ = nullptr) + ElementUpdate_2d(VelocityExt *velExt_ = NULL) : ElementUpdate(velExt_) {} diff --git a/AMDiS/src/reinit/ElementUpdate_3d.cc b/AMDiS/src/reinit/ElementUpdate_3d.cc index 93cf44663dd3beb2172c3051bb1d51fda10fcb96..f0239cc27b2602aa24544e870061463220feacbe 100644 --- a/AMDiS/src/reinit/ElementUpdate_3d.cc +++ b/AMDiS/src/reinit/ElementUpdate_3d.cc @@ -89,7 +89,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 != nullptr) + if(velExt != NULL) { velExt->setBarycentricCoords_3D(1,0,0,0); } @@ -99,7 +99,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 != nullptr) + if(velExt != NULL) { velExt->setBarycentricCoords_3D(0,1,0,0); } @@ -109,7 +109,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 != nullptr) + if(velExt != NULL) { velExt->setBarycentricCoords_3D(0,0,1,0); } @@ -119,7 +119,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 != nullptr) + if(velExt != NULL) { velExt->copyAndExpandFaceCoords_3D(2,0); } @@ -129,7 +129,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 != nullptr) + if(velExt != NULL) { velExt->copyAndExpandFaceCoords_3D(1,0); } @@ -139,7 +139,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 != nullptr) + if(velExt != NULL) { velExt->copyAndExpandFaceCoords_3D(0,0); } @@ -161,7 +161,7 @@ ElementUpdate_3d::calcElementUpdate( uhVal[0], uhVal[1]); //set barycentric coordinats for calculation of the velocity //save index of element face - if(velExt != nullptr) + if(velExt != NULL) { velExt->copyAndExpandFaceCoords_3D(2,1); velExt->setIndexFaceWithShortestDist(1); @@ -169,14 +169,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 != nullptr) + if(velExt != NULL) { velExt->copyAndExpandFaceCoords_3D(1,2); } if (tmp_update < update) { update = tmp_update; //save index of element face, if diatance is shorter - if(velExt != nullptr) + if(velExt != NULL) { velExt->setIndexFaceWithShortestDist(2); } @@ -184,14 +184,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 != nullptr) + if(velExt != NULL) { velExt->copyAndExpandFaceCoords_3D(0,3); } if (tmp_update < update) { update = tmp_update; //save index of element face, if distance is shorter - if(velExt != nullptr) + if(velExt != NULL) { velExt->setIndexFaceWithShortestDist(3); } @@ -226,7 +226,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[0] = uhVal[2]; uhVal[2] = tmpVal; //save permutation of vertices - if(velExt != nullptr) + if(velExt != NULL) { velExt->swapVertices(0,2); } @@ -243,7 +243,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[1] = uhVal[2]; uhVal[2] = tmpVal; //save permutation of vertices - if(velExt != nullptr) + if(velExt != NULL) { velExt->swapVertices(0,1); velExt->swapVertices(2,1); @@ -259,7 +259,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[0] = uhVal[1]; uhVal[1] = tmpVal; //save permutation of vertices - if(velExt != nullptr) + if(velExt != NULL) { velExt->swapVertices(0,1); } @@ -279,7 +279,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[2] = uhVal[1]; uhVal[1] = tmpVal; //save permutation of vertices - if(velExt != nullptr) + if(velExt != NULL) { velExt->swapVertices(0,2); velExt->swapVertices(1,2); @@ -295,7 +295,7 @@ ElementUpdate_3d::sortAndTranslateElement( uhVal[1] = uhVal[2]; uhVal[2] = tmpVal; //save permutation of vertices - if(velExt != nullptr) + if(velExt != NULL) { velExt->swapVertices(1,2); } @@ -539,7 +539,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 != nullptr) + if(velExt != NULL) { 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 5365df71b9d9afd49a81a17f701af1dd478bc88c..0358ccf55eb5010a1a08627010653eff2c34590a 100644 --- a/AMDiS/src/reinit/ElementUpdate_3d.h +++ b/AMDiS/src/reinit/ElementUpdate_3d.h @@ -36,7 +36,7 @@ using namespace AMDiS; class ElementUpdate_3d : public ElementUpdate { public: - ElementUpdate_3d(VelocityExt *velExt_ = nullptr) + ElementUpdate_3d(VelocityExt *velExt_ = NULL) : ElementUpdate(velExt_) { elUpdate2d = new ElementUpdate_2d(velExt_); diff --git a/AMDiS/src/reinit/HL_SignedDist.cc b/AMDiS/src/reinit/HL_SignedDist.cc index 70ed3c73996b70db3b96ff42132ad642796afa26..fd4f71ea8cf8b4d717e647e20a860dff8dea75f6 100644 --- a/AMDiS/src/reinit/HL_SignedDist.cc +++ b/AMDiS/src/reinit/HL_SignedDist.cc @@ -35,7 +35,7 @@ void HL_SignedDist::calcSignedDistFct(AdaptInfo *adaptInfo_, { adaptInfo = adaptInfo_; - if (elFct == nullptr) { + if (elFct == NULL) { 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"); } @@ -69,7 +69,7 @@ void HL_SignedDist::calcSignedDistFct(AdaptInfo *adaptInfo_, HL_updateIteration(); // ===== Transformation to signed distance function. ===== - if (elFct == nullptr) + if (elFct == NULL) setSign(); // ===== Print calculated signed distance function. ===== @@ -83,7 +83,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, nullptr); + calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF, NULL); *lS_DOF_ = *sD_DOF; @@ -106,7 +106,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct || sD_DOF_ != nullptr) { + if (calcSDFct || sD_DOF_ != NULL) { calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF_, elFct); } else { @@ -144,7 +144,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct && elFct == nullptr) { + if (calcSDFct && elFct == NULL) { calcSignedDistFct(adaptInfo_, lS_DOF_); } else { sD_DOF = new DOFVector<double>(vel_DOF_->getFeSpace(), "sD_DOF"); @@ -180,7 +180,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct || sD_DOF_ != nullptr) { + if (calcSDFct || sD_DOF_ != NULL) { calcSignedDistFct(adaptInfo_, lS_DOF_, sD_DOF_, elFct); } else { @@ -223,7 +223,7 @@ void HL_SignedDist::calcVelocityExt(AdaptInfo *adaptInfo_, velExt->printOrigVelDOF(adaptInfo_); - if (calcSDFct && elFct == nullptr) { + if (calcSDFct && elFct == NULL) { calcSignedDistFct(adaptInfo_, lS_DOF_); } else { sD_DOF = new DOFVector<double>(vel_DOF_[0]->getFeSpace(), "sD_DOF"); @@ -257,7 +257,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 == nullptr)("not implemented yet for elFct != nullptr !\n"); + TEST_EXIT(elFct == NULL)("not implemented yet for elFct != NULL !\n"); ((VelocityExtFromVelocityField *)(velExt))->setVelocityField(velField_, lS_DOF_, vel_DOF_); @@ -288,7 +288,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 == nullptr)("not implemented yet for elFct != nullptr !\n"); + TEST_EXIT(elFct == NULL)("not implemented yet for elFct != NULL !\n"); if (calcSDFct) { TEST_EXIT(lS_DOF_)("illegal level set function lS_DOF_ !\n"); @@ -296,7 +296,7 @@ void HL_SignedDist::calcVelocityExtFromVelocityField(AdaptInfo *adaptInfo_, ((VelocityExtFromVelocityField *)(velExt))->setVelocityField(velField_, lS_DOF_, vel_DOF_); - if (calcSDFct && elFct == nullptr) { + if (calcSDFct && elFct == NULL) { calcSignedDistFct(adaptInfo_, lS_DOF_); } else { @@ -329,7 +329,7 @@ void HL_SignedDist::initialize(ElementFunction<double> *elFct) delete phi; // ===== Create ElementLevelSet. ===== - if (elFct == nullptr) { + if (elFct == NULL) { phi = new ElementFunctionDOFVec<double>(lS_DOF); elLS = new ElementLevelSet("ElementLevelSet", phi, feSpace->getMesh()); } else { @@ -359,7 +359,7 @@ void HL_SignedDist::initialize(ElementFunction<double> *elFct) } // ===== Create elUpdate. ===== - TEST_EXIT(velExt == nullptr || boundInitFlag == 1) + TEST_EXIT(velExt == NULL || 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 2c3b555b50aae518d95d7783a151f42e5d4d4e17..7acc958bcb7f9a6df70da4eb597415978a747be0 100644 --- a/AMDiS/src/reinit/HL_SignedDist.h +++ b/AMDiS/src/reinit/HL_SignedDist.h @@ -67,17 +67,17 @@ public: bool doVelocityExt = false, AMDiS::Flag velExtType_ = VEL_EXT) : name(name_), - adaptInfo(nullptr), + adaptInfo(NULL), dim(dim_), - lS_DOF(nullptr), - sD_DOF(nullptr), - bound_DOF(nullptr), - feSpace(nullptr), - elUpdate(nullptr), - bndElDist(nullptr), - elLS(nullptr), - phi(nullptr), - velExt(nullptr), + lS_DOF(NULL), + sD_DOF(NULL), + bound_DOF(NULL), + feSpace(NULL), + elUpdate(NULL), + bndElDist(NULL), + elLS(NULL), + phi(NULL), + velExt(NULL), 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcSignedDistFct(AMDiS::AdaptInfo *adaptInfo_, const AMDiS::DOFVector<double> *lS_DOF_, AMDiS::DOFVector<double> *sD_DOF_, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AMDiS::AdaptInfo *adaptInfo_, @@ -159,7 +159,7 @@ public: const AMDiS::DOFVector<double> *lS_DOF_, AMDiS::DOFVector<double> *sD_DOF_, bool calcSDFct, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AMDiS::AdaptInfo *adaptInfo_, AMDiS::DOFVector<double> *vel_DOF_, AMDiS::DOFVector<double> *lS_DOF_, bool calcSDFct, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AMDiS::AdaptInfo *adaptInfo_, @@ -198,7 +198,7 @@ public: const AMDiS::DOFVector<double> *lS_DOF_, AMDiS::DOFVector<double> *sD_DOF_, bool calcSDFct, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, this ElementFunction is used as level set function. * In this case: only calculation of distance function (positive sign) ! */ void calcVelocityExt(AMDiS::AdaptInfo *adaptInfo_, std::vector<AMDiS::DOFVector<double> *> vel_DOF_, AMDiS::DOFVector<double> *lS_DOF_, bool calcSDFct, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, 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 AMDiS::DOFVector<double> *lS_DOF_, AMDiS::DOFVector<double> *sD_DOF_, bool calcSDFct, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 != nullptr, this ElementFunction is used as level set function. + * If elFct != NULL, 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: AMDiS::DOFVector<double> *vel_DOF_, AMDiS::DOFVector<double> *lS_DOF_, bool calcSDFct, - AMDiS::ElementFunction<double> *elFct = nullptr); + AMDiS::ElementFunction<double> *elFct = NULL); /** * Print initial function: level set function defining the interface. @@ -293,7 +293,7 @@ public: /** * Initialization. */ - virtual void initialize(AMDiS::ElementFunction<double> *elFct = nullptr); + virtual void initialize(AMDiS::ElementFunction<double> *elFct = NULL); /** * 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 1c8e4aa261ee90315d64d54ee31f8d928e198eaf..2ab07a9e79670c85765192bd9b9b47f3baef30e2 100644 --- a/AMDiS/src/reinit/HL_SignedDistBornemann.h +++ b/AMDiS/src/reinit/HL_SignedDistBornemann.h @@ -54,7 +54,7 @@ class HL_SignedDistBornemann : public HL_SignedDist public: HL_SignedDistBornemann(const char *name_,int dim_) : HL_SignedDist(name_, dim_), - smiAdapter(nullptr) + smiAdapter(NULL) { FUNCNAME("HL_SignedDistBornemann::HL_SignedDistBornemann"); @@ -319,7 +319,7 @@ public: { sv[i] = 1; } - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),nullptr,&nodeIndices,nullptr,nullptr); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),NULL,&nodeIndices,NULL,NULL); 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 @@ -330,7 +330,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),nullptr,&nodeIndices,nullptr,nullptr); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&ElNum),NULL,&nodeIndices,NULL,NULL); 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); @@ -399,7 +399,7 @@ public: for ( int i=0; i<=dim; i++) { - SMI_Get_elems(1,1,1,&neighbour[i],nullptr,&nodeIndices, nullptr,nullptr); + SMI_Get_elems(1,1,1,&neighbour[i],NULL,&nodeIndices, NULL,NULL); 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) @@ -446,7 +446,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)),nullptr,&nodeIndicesOfElem, nullptr, nullptr); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_in)),NULL,&nodeIndicesOfElem, NULL, NULL); for (int i=0; i<=dim; i++) { if(nodeIndicesOfElem[i] == VertNum_in) @@ -459,7 +459,7 @@ public: - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_out)),nullptr,&nodeIndicesOfElem, nullptr, nullptr); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&(ElNum_out)),NULL,&nodeIndicesOfElem, NULL, NULL); VertNum_1_out = nodeIndicesOfElem [oppVertices[locVertNum]]; for (int i=0; i<=dim; i++) { @@ -504,7 +504,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, nullptr, &nodeIndices, nullptr, nullptr); + SMI_Get_elems (1, 1, 1, &ElNum_in, NULL, &nodeIndices, NULL, NULL); for (int i=0; i<=dim; i++) { if(nodeIndices[i] == VertNum_1_in) @@ -570,7 +570,7 @@ public: { int *nodeIndicesOfElem; - SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&elem_l_r_in),nullptr,&nodeIndicesOfElem, nullptr, nullptr); + SMI_Get_elems(1,1,1,const_cast<DegreeOfFreedom*>(&elem_l_r_in),NULL,&nodeIndicesOfElem, NULL, NULL); for (int i=0; i<=dim; i++) { if(nodeIndicesOfElem[i] != Vert && nodeIndicesOfElem[i] != node_l_r_in) @@ -625,7 +625,7 @@ public: El_Vert = List_El_Vert.front(); Vert = El_Vert.VertNum; - SMI_Get_elems (1, 1, 1, &(El_Vert.ElNum), nullptr, &(nodeIndices), nullptr, nullptr); + SMI_Get_elems (1, 1, 1, &(El_Vert.ElNum), NULL, &(nodeIndices), NULL, NULL); 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 88bd1c2c4e088ea4306648855fd9210babde0a99..23f8cf75cd8fa874997e7739d2c0a6e59a1ed386 100644 --- a/AMDiS/src/reinit/HL_SignedDistTraverse.cc +++ b/AMDiS/src/reinit/HL_SignedDistTraverse.cc @@ -100,7 +100,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 != nullptr) + if (velExt != NULL) velExt->calcVelocityBoundary(&(locInd[0]), i); } } @@ -181,7 +181,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 != nullptr) + if (velExt != NULL) velExt->setPermutation(i, 1); double update = calcElementUpdate(elInfo, i, &(locInd[0])); @@ -195,7 +195,7 @@ void HL_SignedDistTraverse::HL_elementUpdate(ElInfo *elInfo) (*sD_DOF)[locInd[i]] = update; // If Distance is corrected, calculate new velocity. - if(velExt != nullptr) + if(velExt != NULL) 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 5fbe713ec09ea002f47c8afea727bc4057af1f56..90950aafddc59305e0fcc928be917d9d8691f1d6 100644 --- a/AMDiS/src/reinit/HL_SignedDistTraverse.h +++ b/AMDiS/src/reinit/HL_SignedDistTraverse.h @@ -48,8 +48,8 @@ public: bool doVelocityExt = false, Flag velExtType_ = VEL_EXT) : HL_SignedDist(name_, dim_, doVelocityExt, velExtType_), - sDOld_DOF(nullptr), - update_DOF(nullptr), + sDOld_DOF(NULL), + update_DOF(NULL), 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 685cd9a49e16310afa453b69f76b82598da39bef..578223a22a759bf29abe171c3e7345e38f99f3fe 100644 --- a/AMDiS/src/reinit/VelocityExtFromVelocityField.h +++ b/AMDiS/src/reinit/VelocityExtFromVelocityField.h @@ -44,9 +44,9 @@ public: VelocityExtFromVelocityField(int dim_) : VelocityExt(dim_), - lSFct(nullptr), + lSFct(NULL), elNormalVel(dim_, NO_INIT), - basFcts(nullptr) + basFcts(NULL) { lSFctVal.change_dim(dim + 1); diff --git a/AMDiS/src/solver/BITL_Solver.h b/AMDiS/src/solver/BITL_Solver.h index bbffa4b9fd4028db9049f7bbe567e66ccd7eb83e..f953eacded698b84371d61cd768fb4fa6a0df0e1 100644 --- a/AMDiS/src/solver/BITL_Solver.h +++ b/AMDiS/src/solver/BITL_Solver.h @@ -26,7 +26,7 @@ #include "solver/BlockMTLMatrix.h" -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" #include "solver/ITL_Runner.h" #include "solver/ITL_Solver.h" #include "MTL4Types.h" @@ -44,58 +44,68 @@ namespace AMDiS { * */ template< typename SolverType > - struct BITL_Solver : MTL4Solver< BlockMTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, BlockMTLMatrix, MTLTypes::MTLVector > > + struct BITL_Solver : LinearSolver< BlockMTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, BlockMTLMatrix, MTLTypes::MTLVector > > { BITL_Solver(std::string name) - : MTL4Solver< BlockMTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, BlockMTLMatrix, MTLTypes::MTLVector > >(name) {} + : LinearSolver< BlockMTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, BlockMTLMatrix, MTLTypes::MTLVector > >(name) + { } }; + - // =================================================================================== + // =========================================================================== + // using typedefs to specify the krylov-subspace algorithm for the solvers typedef BITL_Solver< cg_solver_type > B_CGSolver; typedef BITL_Solver< cgs_solver_type > B_CGSSolver; -// typedef BITL_Solver< bicg_solver_type > B_BiCGSolver; // uses adjoint(A) typedef BITL_Solver< bicgstab_type > B_BiCGStabSolver; -// typedef BITL_Solver< bicgstab2_type > B_BiCGStab2Solver; // ERROR -// typedef BITL_Solver< qmr_solver_type > B_QMRSolver; // uses trans(A) typedef BITL_Solver< tfqmr_solver_type > B_TFQMRSolver; -// typedef BITL_Solver< bicgstab_ell_type > B_BiCGStabEllSolver; // ERROR typedef BITL_Solver< gmres_type > B_GMResSolver; -// typedef BITL_Solver< idr_s_type > B_IDRsSolver; // ERROR typedef BITL_Solver< minres_solver_type> B_MinResSolver; typedef BITL_Solver< gcr_type > B_GcrSolver; typedef BITL_Solver< fgmres_type > B_FGMResSolver; typedef BITL_Solver< preonly_type > B_PreOnly; - // =================================================================================== + // typedef BITL_Solver< bicg_solver_type > B_BiCGSolver; // uses adjoint(A) + // typedef BITL_Solver< bicgstab2_type > B_BiCGStab2Solver; // ERROR + // typedef BITL_Solver< qmr_solver_type > B_QMRSolver; // uses trans(A) + // typedef BITL_Solver< bicgstab_ell_type > B_BiCGStabEllSolver; // ERROR + // typedef BITL_Solver< idr_s_type > B_IDRsSolver; // ERROR + + + // =========================================================================== + // using typedefs to specify some available preconditioners for block systems typedef ITL_Preconditioner<itl::pc::diagonal<BlockMTLMatrix>, BlockMTLMatrix, MTLTypes::MTLVector > BlockDiagonalPreconditioner; typedef ITL_Preconditioner<itl::pc::identity<BlockMTLMatrix>, BlockMTLMatrix, MTLTypes::MTLVector > BlockIdentityPreconditioner; + + /// Function to initialize the creatormap for arbitrary matrix-types template<typename MatrixType> void initCreatorMap(std::string backend) { - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<cg_solver_type, MatrixType, MTLTypes::MTLVector> > MatCgSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<cgs_solver_type, MatrixType, MTLTypes::MTLVector> > MatCgsSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<bicgstab_type, MatrixType, MTLTypes::MTLVector> > MatBicgstabSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<tfqmr_solver_type, MatrixType, MTLTypes::MTLVector> > MatTfqmrSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<gmres_type, MatrixType, MTLTypes::MTLVector> > MatGmresSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<minres_solver_type, MatrixType, MTLTypes::MTLVector> > MatMinresSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<gcr_type, MatrixType, MTLTypes::MTLVector> > MatGcrSolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<preonly_type, MatrixType, MTLTypes::MTLVector> > MatPreonlySolver; - typedef MTL4Solver<MatrixType, MTLTypes::MTLVector, ITL_Runner<fgmres_type, MatrixType, MTLTypes::MTLVector> > MatFgmresSolver; + using namespace MTLTypes; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<cg_solver_type, MatrixType, MTLVector> > MatCgSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<cgs_solver_type, MatrixType, MTLVector> > MatCgsSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<bicgstab_type, MatrixType, MTLVector> > MatBicgstabSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<tfqmr_solver_type, MatrixType, MTLVector> > MatTfqmrSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<gmres_type, MatrixType, MTLVector> > MatGmresSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<minres_solver_type, MatrixType, MTLVector> > MatMinresSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<gcr_type, MatrixType, MTLVector> > MatGcrSolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<preonly_type, MatrixType, MTLVector> > MatPreonlySolver; + typedef LinearSolver<MatrixType, MTLVector, ITL_Runner<fgmres_type, MatrixType, MTLVector> > MatFgmresSolver; - CreatorMap<LinearSolver>::addCreator(backend + "_cg", new typename MatCgSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_cgs", new typename MatCgsSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_bicgstab", new typename MatBicgstabSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_tfqmr", new typename MatTfqmrSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_gmres", new typename MatGmresSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_minres", new typename MatMinresSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_gcr", new typename MatGcrSolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_preconly", new typename MatPreonlySolver::Creator); - CreatorMap<LinearSolver>::addCreator(backend + "_fgmres", new typename MatFgmresSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_cg", new typename MatCgSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_cgs", new typename MatCgsSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_bicgstab", new typename MatBicgstabSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_tfqmr", new typename MatTfqmrSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_gmres", new typename MatGmresSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_minres", new typename MatMinresSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_gcr", new typename MatGcrSolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_preconly", new typename MatPreonlySolver::Creator); + CreatorMap<LinearSolverInterface>::addCreator(backend + "_fgmres", new typename MatFgmresSolver::Creator); } -} // namespace AMDiS + +} // end namespace AMDiS #endif // AMDIS_BITL_SOLVER diff --git a/AMDiS/src/solver/BlockMTLMatrix.h b/AMDiS/src/solver/BlockMTLMatrix.h index 78742d5aa4a3e0bf53f6cff578f8fc2204925945..e615ce41a065bc8d15c004ce29f75b2fe53a220d 100644 --- a/AMDiS/src/solver/BlockMTLMatrix.h +++ b/AMDiS/src/solver/BlockMTLMatrix.h @@ -28,8 +28,7 @@ #include "solver/Mapper.h" #include "MTL4Types.h" -namespace AMDiS -{ +namespace AMDiS { /// A wrapper for AMDiS::SolverMatrix to be used in MTL/ITL solvers struct BlockMTLMatrix diff --git a/AMDiS/src/solver/BlockPreconditioner.h b/AMDiS/src/solver/BlockPreconditioner.h index 483a29fb671062842741ea4049a5517f1754397c..e11f8c1068153d6048d784f2b5fd3edece14e4f4 100644 --- a/AMDiS/src/solver/BlockPreconditioner.h +++ b/AMDiS/src/solver/BlockPreconditioner.h @@ -30,11 +30,10 @@ namespace AMDiS { /// Basis preconditioner structure for block-preconditioners - template<typename MatrixType> - struct BlockPreconditioner : ITL_BasePreconditioner<MatrixType, MTLTypes::MTLVector> + template< typename MatrixType > + struct BlockPreconditioner : ITL_PreconditionerBase<MatrixType, MTLTypes::MTLVector> { - typedef SolverMatrix<Matrix<DOFMatrix*> > BlockMatrix; - typedef ITL_BasePreconditioner<MatrixType, MTLTypes::MTLVector> super; + typedef ITL_PreconditionerBase<MatrixType, MTLTypes::MTLVector> super; typedef BlockPreconditioner<MatrixType> self; BlockPreconditioner() @@ -86,7 +85,9 @@ namespace AMDiS { } template<typename SolverType, typename RunnerType> - static void createSubSolver(std::string param, SolverType*& solver, RunnerType*& runner, std::string solverType = "0", std::string preconType = "no", int max_iter = 100, double tol = 1.e-8) + static void createSubSolver(std::string param, SolverType*& solver, RunnerType*& runner, + std::string solverType = "0", std::string preconType = "no", + int max_iter = 100, double tol = 1.e-8) { // definition of standard-backends #if defined HAVE_PARALLEL_PETSC @@ -123,7 +124,7 @@ namespace AMDiS { solverType = backend + "_" + solverType; LinearSolverCreator *solverCreator = - dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolver>::getCreator(solverType, initFileStr)); + dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolverInterface>::getCreator(solverType, initFileStr)); TEST_EXIT(solverCreator) ("No valid solver type found in parameter \"%s\"\n", initFileStr.c_str()); solverCreator->setName(initFileStr); diff --git a/AMDiS/src/solver/CombinedPreconditioner.h b/AMDiS/src/solver/CombinedPreconditioner.h index 43e0ef7ba544f70f3dbfdb93b37a70c41eb34787..814d9914026d53b27a05d08d33d9b789dc67455e 100644 --- a/AMDiS/src/solver/CombinedPreconditioner.h +++ b/AMDiS/src/solver/CombinedPreconditioner.h @@ -33,7 +33,7 @@ namespace AMDiS { struct CombinedPreconditioner : BlockPreconditioner<MatrixType> { typedef BlockPreconditioner<MatrixType> super; - typedef ITL_BasePreconditioner<MatrixType, MTLTypes::MTLVector> precon_base; + typedef ITL_PreconditionerBase<MatrixType, MTLTypes::MTLVector> precon_base; typedef CombinedPreconditioner<MatrixType> self; class Creator : public CreatorInterfaceName<precon_base> diff --git a/AMDiS/src/solver/HypreSolver.h b/AMDiS/src/solver/HypreSolver.h index ffe32a7fe552069d878eb90394fd5337c7811361..a8ec0464282ab689a1d45e9570631649916ea0ee 100644 --- a/AMDiS/src/solver/HypreSolver.h +++ b/AMDiS/src/solver/HypreSolver.h @@ -27,7 +27,7 @@ #ifdef MTL_HAS_HYPRE -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" #include "solver/ITL_Preconditioner.h" #include "MTL4Types.h" #include "solver/itl/hypre.hpp" @@ -37,11 +37,11 @@ namespace AMDiS { - struct Hypre_Runner : public MTL4Runner< MTLTypes::MTLMatrix, MTLTypes::MTLVector > + struct Hypre_Runner : public RunnerBase< MTLTypes::MTLMatrix, MTLTypes::MTLVector > { - typedef MTLTypes::MTLMatrix MatrixType; - typedef MTLTypes::MTLVector VectorType; - typedef MTL4Runner< MatrixType, VectorType > super; + typedef MTLTypes::MTLMatrix MatrixType; + typedef MTLTypes::MTLVector VectorType; + typedef RunnerBase< MatrixType, VectorType > super; /** Interface to the HYPRE BoomerAMG solver [...] * Parameters provided by AMDiS: @@ -84,10 +84,10 @@ namespace AMDiS { * 6...hybrid symmetric Gauss-Seidel or SSOR * 9...Gaussian elimination (only on coarsest level) * */ - Hypre_Runner(LinearSolver* oemPtr) - : oem(*oemPtr), - useTransposed(false), - solverCreated(false) + Hypre_Runner(LinearSolverInterface* oemPtr) + : oem(*oemPtr), + useTransposed(false), + solverCreated(false) { int cycleMode = -1, interpolation = -1, relaxation = -1; Parameters::get(oem.getName() + "->cycle mode", cycleMode); @@ -107,8 +107,8 @@ namespace AMDiS { exit(); } - /// Implementation of \ref MTL4Runner::init() - void init(const typename super::BlockMatrix& A, const MatrixType& mtlMatrix) override + /// Implementation of \ref RunnerBase::init() + void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& mtlMatrix) override { setTransposed(typename MatrixType::orientation()); // TODO: copy matrix directly from DOFMatrix to HYPRE matrix (?) @@ -123,7 +123,7 @@ namespace AMDiS { solverCreated = true; } - /// Implementation of \ref MTL4Runner::solve() + /// Implementation of \ref RunnerBase::solve() int solve(const MatrixType& A , VectorType& mtlX, const VectorType& mtlB) override { mtl::HypreParVector x(mtlX); @@ -148,7 +148,7 @@ namespace AMDiS { return error; } - /// Implementation of \ref OEMRunner::exit() + /// Implementation of \ref RunnerInterface::exit() void exit() { if (solverCreated) @@ -168,7 +168,7 @@ namespace AMDiS { } protected: - LinearSolver& oem; + LinearSolverInterface& oem; private: HYPRE_Solver solver; @@ -188,7 +188,7 @@ namespace AMDiS { * \brief * Wrapper for the external HYPRE-AMG solver */ - typedef MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, Hypre_Runner > HypreSolver; + typedef LinearSolver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, Hypre_Runner > HypreSolver; } // namespace AMDiS diff --git a/AMDiS/src/solver/ITL_Preconditioner.h b/AMDiS/src/solver/ITL_Preconditioner.h index 8106043d1241acbae4f07e0cd0ebccb2731ca8f6..8c798fb2a9eb65ffff0aec89b98192854be4ebca 100644 --- a/AMDiS/src/solver/ITL_Preconditioner.h +++ b/AMDiS/src/solver/ITL_Preconditioner.h @@ -24,7 +24,7 @@ #ifndef AMDIS_ITL_PRECONDITIONER_H #define AMDIS_ITL_PRECONDITIONER_H -#include "solver/LinearSolver.h" +#include "solver/LinearSolverInterface.h" #include "MTL4Types.h" #include "DOFMatrix.h" #include "CreatorInterface.h" @@ -43,108 +43,100 @@ namespace AMDiS { * * \brief Common base class for wrappers to use ITL preconditioners in AMDiS. */ - template< class MatrixT, class VectorT > - struct ITL_BasePreconditioner : public OEMPreconditioner + template< class MatrixType, class VectorType > + struct ITL_PreconditionerBase : public PreconditionerInterface { - typedef MatrixT MatrixType; - typedef VectorT VectorType; - - virtual ~ITL_BasePreconditioner() {} + virtual ~ITL_PreconditionerBase() {} virtual void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) = 0; + virtual void solve(const VectorType& x, VectorType& y) const = 0; + virtual void adjoint_solve(const VectorType& x, VectorType& y) const = 0; }; + template< typename MatrixType, typename VectorType > - inline //VectorType - itl::pc::solver<ITL_BasePreconditioner< MatrixType, VectorType >, VectorType, false> - solve(const ITL_BasePreconditioner< MatrixType, VectorType >& P, const VectorType& vin) + inline itl::pc::solver<ITL_PreconditionerBase< MatrixType, VectorType >, VectorType, false> + solve(const ITL_PreconditionerBase< MatrixType, VectorType >& P, const VectorType& vin) { - return itl::pc::solver<ITL_BasePreconditioner< MatrixType, VectorType >, VectorType, false>(P, vin); + return itl::pc::solver<ITL_PreconditionerBase< MatrixType, VectorType >, VectorType, false>(P, vin); } template< typename MatrixType, typename VectorType > - inline //VectorType - itl::pc::solver<ITL_BasePreconditioner< MatrixType, VectorType >, VectorType, true> - adjoint_solve(const ITL_BasePreconditioner< MatrixType, VectorType >& P, const VectorType& vin) + inline itl::pc::solver<ITL_PreconditionerBase< MatrixType, VectorType >, VectorType, true> + adjoint_solve(const ITL_PreconditionerBase< MatrixType, VectorType >& P, const VectorType& vin) { - return itl::pc::solver<ITL_BasePreconditioner< MatrixType, VectorType >, VectorType, true>(P, vin); + return itl::pc::solver<ITL_PreconditionerBase< MatrixType, VectorType >, VectorType, true>(P, vin); } + /** * \ingroup Solver * * \brief Wrapper for using ITL preconditioners in AMDiS. */ template < typename Preconditioner, typename MatrixType, typename VectorType > - class ITL_Preconditioner : public ITL_BasePreconditioner< MatrixType, VectorType > + class ITL_Preconditioner : public ITL_PreconditionerBase< MatrixType, VectorType > { public: + typedef ITL_PreconditionerBase<MatrixType, VectorType> precon_base; + typedef ITL_Preconditioner<Preconditioner, MatrixType, VectorType> self; /// Creator class - class Creator : public CreatorInterfaceName< ITL_BasePreconditioner< MatrixType, VectorType > > + struct Creator : CreatorInterfaceName<precon_base> { - public: virtual ~Creator() {} - - /** \brief - * Creates an ITL preconditioner - */ - ITL_BasePreconditioner< MatrixType, VectorType >* create() { - return new ITL_Preconditioner<Preconditioner, MatrixType, VectorType>(); - } + precon_base* create() { return new self(); } }; - ITL_Preconditioner() : precon(nullptr) {} + ITL_Preconditioner() + : precon(NULL) + { } ~ITL_Preconditioner() { if (precon) { delete precon; - precon = nullptr; + precon = NULL; } } - typedef SolverMatrix<Matrix<DOFMatrix*> > BlockMatrix; - /// Implementation of \ref ITL_BasePreconditioner::init() - void init(const BlockMatrix& A, const MatrixType& fullMatrix) override + /// Implementation of \ref ITL_PreconditionerBase::init() + void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) override { if (precon) delete precon; precon = new Preconditioner(fullMatrix); } - /// Implementation of \ref OEMPreconditioner::exit() + /// Implementation of \ref PreconditionerInterface::exit() void exit() override { if (precon) { delete precon; - precon = nullptr; + precon = NULL; } } - /// Implementation of \ref ITL_BasePreconditioner::solve() + /// Implementation of \ref ITL_PreconditionerBase::solve() void solve(const VectorType& vin, VectorType& vout) const override { - assert(precon != nullptr); + assert(precon != NULL); precon->solve(vin, vout); } - /// Implementation of \ref ITL_BasePreconditioner::adjoint_solve() + /// Implementation of \ref ITL_PreconditionerBase::adjoint_solve() void adjoint_solve(const VectorType& vin, VectorType& vout) const override { - assert(precon != nullptr); + assert(precon != NULL); precon->adjoint_solve(vin, vout); } private: Preconditioner* precon; }; - - typedef ITL_BasePreconditioner< MTLTypes::MTLMatrix, MTLTypes::MTLVector > BasePreconditioner; - typedef CreatorInterfaceName< BasePreconditioner > PreconditionCreator; - + /** * \ingroup Solver diff --git a/AMDiS/src/solver/ITL_Runner.h b/AMDiS/src/solver/ITL_Runner.h index 036198a39683be007ab6af4215cf4710c0eaeee4..00c8f550f57ff515d6f834536bfc123be19a752e 100644 --- a/AMDiS/src/solver/ITL_Runner.h +++ b/AMDiS/src/solver/ITL_Runner.h @@ -25,7 +25,7 @@ #ifndef AMDIS_ITL_RUNNER_H #define AMDIS_ITL_RUNNER_H -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" #include "solver/ITL_Preconditioner.h" #include <boost/numeric/itl/itl.hpp> @@ -37,12 +37,14 @@ namespace AMDiS { struct PreconPair { /// Pointer to the left preconditioner - ITL_BasePreconditioner< MatrixType, VectorType >* l; + ITL_PreconditionerBase<MatrixType, VectorType>* l; /// Pointer to the right preconditioner - ITL_BasePreconditioner< MatrixType, VectorType >* r; + ITL_PreconditionerBase<MatrixType, VectorType>* r; - PreconPair() : l(nullptr), r(nullptr) {} + PreconPair() + : l(NULL), r(NULL) + { } }; @@ -53,35 +55,34 @@ namespace AMDiS { * are parametrized by Matrix- and VectorType. **/ template< typename ITLSolver, typename MatrixType, typename VectorType > - struct ITL_Runner : public MTL4Runner< MatrixType, VectorType > + struct ITL_Runner : public RunnerBase< MatrixType, VectorType > { - typedef MTL4Runner< MatrixType, VectorType > super; + typedef RunnerBase< MatrixType, VectorType > super; - ITL_Runner(LinearSolver* oemPtr) - : oem(*oemPtr), - solver(oem.getName()) + ITL_Runner(LinearSolverInterface* oemPtr) + : oem(*oemPtr), + solver(oem.getName()) { setPrecon(preconPair); } - ~ITL_Runner() { - if (preconPair.l != nullptr) { + if (preconPair.l != NULL) { preconPair.l->exit(); delete preconPair.l; - preconPair.l = nullptr; + preconPair.l = NULL; } - if (preconPair.r != nullptr) { + if (preconPair.r != NULL) { preconPair.r->exit(); delete preconPair.r; - preconPair.r = nullptr; + preconPair.r = NULL; } } - /// Implementation of \ref MTL4Runner::init() + /// Implementation of \ref RunnerBase::init() void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) override { preconPair.l->init(A, fullMatrix); @@ -89,12 +90,12 @@ namespace AMDiS { } - /// Implementation of \ref MTL4Runner::solve() + /// Implementation of \ref RunnerBase::solve() int solve(const MatrixType& A , VectorType& x, const VectorType& b) override { FUNCNAME("ITL_Runner::solve()"); - TEST_EXIT(preconPair.l != nullptr)("there is no left preconditioner\n"); - TEST_EXIT(preconPair.r != nullptr)("there is no right preconditioner\n"); + TEST_EXIT(preconPair.l != NULL)("there is no left preconditioner\n"); + TEST_EXIT(preconPair.r != NULL)("there is no right preconditioner\n"); typedef typename mtl::Collection<MatrixType>::value_type value_type; @@ -131,12 +132,12 @@ namespace AMDiS { } - /// Implementation of \ref MTL4Runner::adjoint_solve() + /// Implementation of \ref RunnerBase::adjoint_solve() int adjoint_solve(const MatrixType& A , VectorType& x, const VectorType& b) override { FUNCNAME("ITL_Runner::adjoint_solve()"); - TEST_EXIT(preconPair.l != nullptr)("there is no left preconditioner\n"); - TEST_EXIT(preconPair.r != nullptr)("there is no right preconditioner\n"); + TEST_EXIT(preconPair.l != NULL)("there is no left preconditioner\n"); + TEST_EXIT(preconPair.r != NULL)("there is no right preconditioner\n"); #if 0 typedef typename mtl::Collection<MatrixType>::value_type value_type; @@ -168,7 +169,7 @@ namespace AMDiS { } - /// Implementation of \ref OEMRunner::exit() + /// Implementation of \ref RunnerInterface::exit() void exit() override { preconPair.l->exit(); @@ -176,21 +177,21 @@ namespace AMDiS { } - /// Implementation of \ref OEMRunner::getLeftPrecon() - OEMPreconditioner* getLeftPrecon() override + /// Implementation of \ref RunnerInterface::getLeftPrecon() + PreconditionerInterface* getLeftPrecon() override { return preconPair.l; } - /// Implementation of \ref OEMRunner::getRightPrecon() - OEMPreconditioner* getRightPrecon() override + /// Implementation of \ref RunnerInterface::getRightPrecon() + PreconditionerInterface* getRightPrecon() override { return preconPair.r; } protected: - LinearSolver& oem; + LinearSolverInterface& oem; ITLSolver solver; /// create left/right preconditioners from parameters given in the init-file @@ -198,26 +199,26 @@ namespace AMDiS { { FUNCNAME("ITL_Runner::setPrecon()"); // Creator for the left preconditioner - CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >* leftCreator(nullptr); + CreatorInterfaceName< ITL_PreconditionerBase<MatrixType, VectorType> >* leftCreator(NULL); // Creator for the right preconditioner - CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >* rightCreator(nullptr); + CreatorInterfaceName< ITL_PreconditionerBase<MatrixType, VectorType> >* rightCreator(NULL); 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 != nullptr) + leftCreator = dynamic_cast<CreatorInterfaceName< ITL_PreconditionerBase<MatrixType, VectorType> >*>( + CreatorMap<ITL_PreconditionerBase<MatrixType, VectorType> >::getCreator(preconType, initFileStr) ); + TEST_EXIT(leftCreator != NULL) ("There is no creator for the given left preconditioner '%s'\n", preconType.c_str()); leftCreator->setName(initFileStr); preconType = "no"; initFileStr = oem.getName() + "->right precon"; Parameters::get(initFileStr, preconType); - rightCreator = dynamic_cast<CreatorInterfaceName< ITL_BasePreconditioner<MatrixType, VectorType> >*>( - CreatorMap<ITL_BasePreconditioner<MatrixType, VectorType> >::getCreator(preconType, initFileStr) ); - TEST_EXIT(rightCreator != nullptr) + rightCreator = dynamic_cast<CreatorInterfaceName< ITL_PreconditionerBase<MatrixType, VectorType> >*>( + CreatorMap<ITL_PreconditionerBase<MatrixType, VectorType> >::getCreator(preconType, initFileStr) ); + TEST_EXIT(rightCreator != NULL) ("There is no creator for the given right preconditioner '%s'\n", preconType.c_str()); rightCreator->setName(initFileStr); diff --git a/AMDiS/src/solver/ITL_Solver.h b/AMDiS/src/solver/ITL_Solver.h index ffbf90da7b77dd61818925ee85e786da4d671f64..66e4ff9592c9b74c4aac95b06190cb59762f3840 100644 --- a/AMDiS/src/solver/ITL_Solver.h +++ b/AMDiS/src/solver/ITL_Solver.h @@ -24,7 +24,7 @@ #ifndef AMDIS_ITL_SOLVER_H #define AMDIS_ITL_SOLVER_H -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" #include "solver/ITL_Runner.h" #include "MTL4Types.h" @@ -73,10 +73,11 @@ namespace AMDiS { * - @ref PreOnly "preonly" (solver that implements pure preconditioning applied to the rhs) */ template< typename SolverType > - struct ITL_Solver : MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, MTLTypes::MTLMatrix, MTLTypes::MTLVector > > + struct ITL_Solver : LinearSolver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, MTLTypes::MTLMatrix, MTLTypes::MTLVector > > { ITL_Solver(std::string name) - : MTL4Solver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >(name) {} + : LinearSolver< MTLTypes::MTLMatrix, MTLTypes::MTLVector, ITL_Runner< SolverType, MTLTypes::MTLMatrix, MTLTypes::MTLVector > >(name) + { } }; // =================================================================================== @@ -438,7 +439,7 @@ namespace AMDiS { -} // namespace AMDiS +} // end namespace AMDiS #endif // AMDIS_ITL_SOLVER diff --git a/AMDiS/src/solver/KrylovPreconditioner.h b/AMDiS/src/solver/KrylovPreconditioner.h index 53bec1dd52ae0b3dffac545cc82db1c8735289bb..2b314aecce555829d05dfe6db6d577275317c814 100644 --- a/AMDiS/src/solver/KrylovPreconditioner.h +++ b/AMDiS/src/solver/KrylovPreconditioner.h @@ -30,7 +30,6 @@ #endif namespace AMDiS { - /** * \ingroup Solver @@ -51,21 +50,25 @@ namespace AMDiS { **/ template< typename MatrixType, typename VectorType > - struct KrylovPreconditioner : public ITL_BasePreconditioner< MatrixType, VectorType > + struct KrylovPreconditioner : ITL_PreconditionerBase< MatrixType, VectorType > { - typedef ITL_BasePreconditioner< MatrixType, VectorType > super; + typedef ITL_PreconditionerBase< MatrixType, VectorType > precon_base; + typedef KrylovPreconditioner< MatrixType, VectorType > self; - class Creator : public CreatorInterfaceName< super > + class Creator : public CreatorInterfaceName<precon_base> { public: virtual ~Creator() {} - super* create() { - return new KrylovPreconditioner(this->name); + precon_base* create() { + return new self(this->name); } }; - KrylovPreconditioner(std::string name) : fullMatrix(nullptr), solver(nullptr), runner(nullptr) + KrylovPreconditioner(std::string name) + : fullMatrix(NULL), + solver(NULL), + runner(NULL) { #if defined HAVE_PARALLEL_PETSC @@ -90,13 +93,13 @@ namespace AMDiS { solverType = backend + "_" + solverType; LinearSolverCreator *solverCreator = - dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolver>::getCreator(solverType, initFileStr)); + dynamic_cast<LinearSolverCreator*>(CreatorMap<LinearSolverInterface>::getCreator(solverType, initFileStr)); TEST_EXIT(solverCreator) ("No valid solver type found in parameter \"%s\"\n", initFileStr.c_str()); solverCreator->setName(initFileStr); solver = solverCreator->create(); - runner = dynamic_cast<MTL4Runner< MatrixType, VectorType >*>(solver->getRunner()); + runner = dynamic_cast<RunnerBase< MatrixType, VectorType >*>(solver->getRunner()); } virtual ~KrylovPreconditioner() @@ -104,27 +107,27 @@ namespace AMDiS { delete solver; } - /// Implementation of \ref ITL_BasePreconditioner::init() + /// Implementation of \ref ITL_PreconditionerBase::init() void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix_) override { fullMatrix = &fullMatrix_; runner->init(A, fullMatrix_); } - /// Implementation of \ref OEMPreconditioner::init() + /// Implementation of \ref PreconditionerInterface::init() void exit() override { runner->exit(); } - /// Implementation of \ref ITL_BasePreconditioner::solve() + /// Implementation of \ref ITL_PreconditionerBase::solve() void solve(const VectorType& b, VectorType& x) const override { initVector(x); runner->solve(*fullMatrix, x, b); } - /// Implementation of \ref ITL_BasePreconditioner::adjoint_solve() + /// Implementation of \ref ITL_PreconditionerBase::adjoint_solve() void adjoint_solve(const VectorType& b, VectorType& x) const override { initVector(x); @@ -155,8 +158,8 @@ namespace AMDiS { const MatrixType* fullMatrix; - LinearSolver* solver; - MTL4Runner< MatrixType, VectorType >* runner; + LinearSolverInterface* solver; + RunnerBase< MatrixType, VectorType >* runner; }; diff --git a/AMDiS/src/solver/LinearSolver.h b/AMDiS/src/solver/LinearSolver.h index e3f3e8924a884983ae5fafe7c52fe3d4937d54c1..28cb628ea113f40901ff07a9b91954cf28c901ea 100644 --- a/AMDiS/src/solver/LinearSolver.h +++ b/AMDiS/src/solver/LinearSolver.h @@ -21,307 +21,214 @@ /** \file LinearSolver.h */ -/** - * \defgroup Solver Solver module - * @{ <img src="solver.png"> @} - * - * \brief - * Contains all classes needed for solving linear and non linear equation - * systems. - */ - -#ifndef AMDIS_OEM_SOLVER_H -#define AMDIS_OEM_SOLVER_H - -#include "Global.h" -#include "AMDiS_fwd.h" -#include "Initfile.h" -#include "solver/SolverMatrix.h" -#include "DOFVector.h" -#include "SystemVector.h" -#include "DOFMatrix.h" -#include "Mapper.h" -#include "Timer.h" +#ifndef AMDIS_LINEAR_SOLVER_BASE_H +#define AMDIS_LINEAR_SOLVER_BASE_H +#include "solver/LinearSolverInterface.h" #ifdef HAVE_PARALLEL_DOMAIN_AMDIS -#include "parallel/ParallelMapper.h" +#include "parallel/ParallelSolver.h" #endif +#include "solver/details/LinearSolver.h" + namespace AMDiS { - /// Base-Class for Preconditioner types - struct OEMPreconditioner - { - virtual void exit() {} - }; - - /// Base-Class for Runner / Worker types - struct OEMRunner + template< typename MatrixType, typename VectorType > + struct RunnerBase : public RunnerInterface { - virtual void exit() {} + virtual void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) = 0; - virtual OEMPreconditioner* getLeftPrecon() - { - return nullptr; - } + virtual int solve(const MatrixType& A, VectorType& x, const VectorType& b) = 0; - virtual OEMPreconditioner* getRightPrecon() + virtual int adjoint_solve(const MatrixType& A, VectorType& x, const VectorType& b) { - return nullptr; + FUNCNAME("RunnerBase::adjoint_solve()"); + ERROR_EXIT("Must be implemented in derived class!\n"); + return 0; } }; - /** - * \ingroup Solver - * - *\brief - * Solver for linear equation systems. - */ - class LinearSolver + + /// Wrapper for template-argument dependent constructors + template < typename MatrixType, typename Enable = void > + struct LinearSolverBase : public LinearSolverInterface { - public: - - typedef DOFMatrix::base_matrix_type matrix_type; - typedef DOFMatrix::value_type value_type; - - /// The constructor reads needed parameters and sets solvers \ref name. - LinearSolver(std::string str) - : name(str), - tolerance(DBL_TOL), - relative(0), - max_iter(1000), - info(0), - residual(-1.0), - rel_residual(-1.0), - print_cycle(100), - iterations(-1), - error(-1), - breakTolNotReached(true) - { - Parameters::get(name + "->tolerance", tolerance); - Parameters::get(name + "->relative tolerance", relative); - Parameters::get(name + "->max iteration", max_iter); - Parameters::get(name + "->print cycle", print_cycle); - Parameters::get(name + "->info", info); - Parameters::get(name + "->break if tolerance not reached", breakTolNotReached); - } - - /// destructor - virtual ~LinearSolver() - {} - - - int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, - SystemVector& x, - SystemVector& b, - bool createMatrixData, - bool storeMatrixData) - { FUNCNAME("LinearSolver::solveSystem()"); - MSG("LinearSolver::solveSystem()\n"); + typedef BlockMapper Mapper; + + LinearSolverBase(std::string name) + : LinearSolverInterface(name) {} - residual = -1.0; - rel_residual = -1.0; - int error_code = solveLinearSystem(A, x, b, createMatrixData, storeMatrixData); - - // calculate and print resiual - if (info > 0) { - if (residual >= 0.0 && rel_residual >= 0.0) { - MSG("Residual norm: ||b-Ax|| = %e, ||b-Ax||/||b|| = %e\n", residual, rel_residual); - } else if (residual >= 0.0) { - MSG("Residual norm: ||b-Ax|| = %e\n", residual); - } - - // test for absolute tolerance - TEST_EXIT((isNumber(residual) && (residual < 0.0 || tolerance < 1.e-30 || residual <= tolerance)) - || !breakTolNotReached) - ("Tolerance tol = %e could not be reached!\n Set tolerance by '->solver->tolerance:' \n", tolerance); - - // test for relative tolerance - TEST_EXIT((isNumber(rel_residual) && (rel_residual < 0.0 || relative < 1.e-30 || rel_residual <= relative)) - || (residual < 1.e-30) || !breakTolNotReached) - ("Relative tolerance rtol = %e could not be reached!\n Set tolerance by '->solver->relative tolerance:' \n", relative); - } - return error_code; - } - - /** \name getting methods - * \{ - */ - - /// Returns solvers \ref name. - inline std::string getName() const - { - return name; - } - - /// Returns \ref tolerance - inline double getTolerance() const + MatrixType& getMatrix() { - return tolerance; - } - - /// Returns \ref max_iter - inline int getMaxIterations() const - { - return max_iter; + return matrix; } - - /// Returns number of iterations in last run of an iterative solver - inline int getIterations() + + /// create a sequential BlockMapper + void initMapper(const SolverMatrix<Matrix<DOFMatrix*> >& A) { - return iterations; + mapper = new BlockMapper(A); } - - /// Returns error code in last run of an iterative solver - inline int getErrorCode() - { - return error; - } - - /// Returns info - inline int getInfo() + + void exitMapper() { - return info; + delete mapper; } - - /// Returns \ref print_cycle - inline int getPrint_cycle() const + + protected: + MatrixType matrix; + Mapper* mapper; + }; + +#ifdef HAVE_PARALLEL_MTL4 + template< typename MatrixType > + struct LinearSolverBase<MatrixType, typename boost::enable_if< mtl::traits::is_distributed<MatrixType> > > + : public ParallelSolver + { + typedef ParallelMapper Mapper; + + LinearSolverBase(std::string name) + : ParallelSolver(name, false) {} + + MatrixType& getMatrix() { - return print_cycle; + return matrix; } - - /// Returns \ref residual - inline double getResidual() const + + /// create a parallel mapper based on local-to-global mapping + void initMapper(const SolverMatrix<Matrix<DOFMatrix*> >& A) { - return residual; + mapper = new ParallelMapper(*ParallelSolver::getDofMapping()); } - - /// Returns \ref relative - inline double getRelative() const + + void exitMapper() { - return relative; + delete mapper; } + + protected: + MatrixType matrix; + Mapper* mapper; + }; +#endif + /** \ingroup Solver + * + * \brief + * Wrapper class for various MTL4 solvers. These solvers + * are parametrized by MatrixType and VectorType. The different + * algorithms, like krylov subspace methods or other external + * solvers where MTL4 provides an interface, can be assigned + * by different Runner objects. + **/ + template< typename MatrixType, typename VectorType, typename Runner > + class LinearSolver : public LinearSolverBase<MatrixType> + { + private: + typedef LinearSolverBase<MatrixType> super; + typedef LinearSolver<MatrixType, VectorType, Runner> self; + typedef typename super::Mapper Mapper; + + Runner runner; // redirect the implementation to a runner - virtual OEMPreconditioner* getLeftPrecon() + public: + /// Creator class used in the LinearSolverInterfaceMap. + class Creator : public LinearSolverCreator { - FUNCNAME("LinearSolver::getLeftPrecon()"); - ERROR("no left preconditioner provided!\n"); - return nullptr; - } + public: + virtual ~Creator() {} + + /// Returns a new LinearSolver object. + LinearSolverInterface* create() + { + return new self(this->name); + } + }; + + /// Constructor + LinearSolver(std::string name) + : super(name), + runner(this) + {} + - virtual OEMPreconditioner* getRightPrecon() + /// Implementation of \ref LinearSolverInterface::getRunner() + RunnerInterface* getRunner() { - FUNCNAME("LinearSolver::getRightPrecon()"); - ERROR("no right preconditioner provided!\n"); - return nullptr; + return &runner; } - virtual OEMRunner* getRunner() + + /// Implementation of \ref LinearSolverInterface::getLeftPrecon() + PreconditionerInterface* getLeftPrecon() { - FUNCNAME("LinearSolver::getRunner()"); - ERROR("no runner provided!\n"); - return nullptr; + return runner.getLeftPrecon(); } - - /** \} */ - - /** \name setting methods - * \{ - */ - - /// Sets \ref tolerance - inline void setTolerance(double tol) + + + /// Implementation of \ref LinearSolverInterface::getRightPrecon() + PreconditionerInterface* getRightPrecon() { - tolerance = tol; + return runner.getRightPrecon(); } + + protected: + /// Implementation of \ref LinearSolverInterface::solveLinearSystem() + int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, + SystemVector& x, + SystemVector& b, + bool createMatrixData, + bool storeMatrixData) override + { +#ifdef HAVE_PARALLEL_DOMAIN_AMDIS + MPI::COMM_WORLD.Barrier(); +#endif + super::initMapper(A); + + Timer t; + if (createMatrixData) { + initMatrix(super::matrix, A, *super::mapper); + runner.init(A, super::matrix); + } - inline void setResidual(double r) - { - residual = r; - } + VectorType mtl_x; + initVector(mtl_x, x, *super::mapper); - /// Sets \ref relative - inline void setRelative(double rel) - { - relative = rel; - } + VectorType mtl_b; + initVector(mtl_b, b, *super::mapper); + + INFO(self::getInfo(), 8)("fill MTL4 matrix needed %.5f seconds\n", t.elapsed()); - inline void setRelativeResidual(double r) - { - rel_residual = r; - } + int error = runner.solve(super::matrix ,mtl_x, mtl_b); + + VecMap<SystemVector, Mapper> xVecMap(x, *super::mapper); + mtl_x >> xVecMap; - /// Sets \ref max_iter - inline void setMaxIterations(int i) - { - max_iter = i; - } + if (!storeMatrixData) + runner.exit(); - inline void setIterations(int i) - { - iterations=i; + super::exitMapper(); + return error; } - - /// set the \ref error - inline void setErrorCode(int code) + + // functions to initialize mtl-matrix and mtl-vector + // from AMDiS matrix / vectors using mappers + + /// initialize a MTL matrix and assign values from an AMDiS matrix + template< typename Matrix1, typename Matrix2, typename M > + void initMatrix(Matrix1& target, const Matrix2& source, MapperBase<M>& mapper) { - error=code; + dispatch::initMatrix(target, mapper.self()); + dispatch::fillMatrix(target, source, mapper.self()); } - - /// Sets \ref info - inline void setInfo(int i) + + /// initialize a MTL vector and assign values from an AMDiS vector + template< typename Vector1, typename Vector2, typename M > + void initVector(Vector1& target, const Vector2& source, MapperBase<M>& mapper) { - info = i; + dispatch::initVector(target, super::matrix); + dispatch::fillVector(target, source, mapper.self()); } - - /** \} */ - - protected: - /// main methods that all solvers must implement - virtual int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, - SystemVector& x, - SystemVector& b, - bool createMatrixData, - bool storeMatrixData) = 0; - - protected: - /// solvers name. - std::string name; - - /// Solver tolerance |r|. Set in LinearSolver's constructor. - double tolerance; - - /// Relative solver tolerance |r|/|r0|. Set in LinearSolver's constructor. - double relative; - - /// maximal number of iterations. Set in LinearSolver's constructor. - int max_iter; - - /// info level during solving the system. Set in LinearSolver's constructor. - int info; - - /// current absolute residual norm. - double residual; - - /// current relative residual norm. - double rel_residual; - - /// Print cycle, after how many iterations the residuum norm is logged. - int print_cycle; - - /// How many iterations were performed in last solver (not set by UmfPack) - int iterations; - - /// Error code in last solver (not set by UmfPack) - int error; - - /// break if residual norm > prescribed tolerance - bool breakTolNotReached; }; - - - typedef CreatorInterfaceName<LinearSolver> LinearSolverCreator; } -#endif // AMDIS_OEM_SOLVER_H +#endif // AMDIS_LINEAR_SOLVER_BASE_H diff --git a/AMDiS/src/solver/LinearSolverInterface.h b/AMDiS/src/solver/LinearSolverInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..c7047583f8e8d27fcf31658bbb0f41d55b37c0c3 --- /dev/null +++ b/AMDiS/src/solver/LinearSolverInterface.h @@ -0,0 +1,323 @@ +/****************************************************************************** + * + * AMDiS - Adaptive multidimensional simulations + * + * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved. + * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis + * + * Authors: + * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * + * This file is part of AMDiS + * + * See also license.opensource.txt in the distribution. + * + ******************************************************************************/ + + +/** \file LinearSolverInterface.h */ + +/** + * \defgroup Solver Solver module + * @{ <img src="solver.png"> @} + * + * \brief + * Contains all classes needed for solving linear and non linear equation + * systems. + */ + +#ifndef AMDIS_LINEAR_SOLVER_H +#define AMDIS_LINEAR_SOLVER_H + +#include "Global.h" +#include "AMDiS_fwd.h" +#include "Initfile.h" +#include "solver/SolverMatrix.h" +#include "DOFVector.h" +#include "SystemVector.h" +#include "DOFMatrix.h" +#include "Mapper.h" +#include "Timer.h" + +#ifdef HAVE_PARALLEL_DOMAIN_AMDIS +#include "parallel/ParallelMapper.h" +#endif + +namespace AMDiS { + + /// Non-templated base-class for Preconditioner types + struct PreconditionerInterface + { + virtual void exit() {} + }; + + /// Non-templates base-class for Runner / Worker types + struct RunnerInterface + { + virtual void exit() {} + + virtual PreconditionerInterface* getLeftPrecon() + { + return NULL; + } + + virtual PreconditionerInterface* getRightPrecon() + { + return NULL; + } + }; + + /** + * \ingroup Solver + * + *\brief + * Solver for linear equation systems. + */ + class LinearSolverInterface + { + public: + /// The constructor reads needed parameters and sets solvers \ref name. + LinearSolverInterface(std::string name_) + : name(name_), + tolerance(DBL_TOL), + relative(0), + max_iter(1000), + info(0), + residual(-1.0), + rel_residual(-1.0), + print_cycle(100), + iterations(-1), + error(-1), + breakTolNotReached(true) + { + Parameters::get(name + "->tolerance", tolerance); + Parameters::get(name + "->relative tolerance", relative); + Parameters::get(name + "->max iteration", max_iter); + Parameters::get(name + "->print cycle", print_cycle); + Parameters::get(name + "->info", info); + Parameters::get(name + "->break if tolerance not reached", breakTolNotReached); + } + + /// destructor + virtual ~LinearSolverInterface() + {} + + + int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, + SystemVector& x, + SystemVector& b, + bool createMatrixData, + bool storeMatrixData) + { FUNCNAME("LinearSolverInterface::solveSystem()"); + MSG("LinearSolverInterface::solveSystem()\n"); + + residual = -1.0; + rel_residual = -1.0; + int error_code = solveLinearSystem(A, x, b, createMatrixData, storeMatrixData); + + // calculate and print resiual + if (info > 0) { + if (residual >= 0.0 && rel_residual >= 0.0) { + MSG("Residual norm: ||b-Ax|| = %e, ||b-Ax||/||b|| = %e\n", residual, rel_residual); + } else if (residual >= 0.0) { + MSG("Residual norm: ||b-Ax|| = %e\n", residual); + } + + // test for absolute tolerance + TEST_EXIT((isNumber(residual) && (residual < 0.0 || tolerance < 1.e-30 || residual <= tolerance)) + || !breakTolNotReached) + ("Tolerance tol = %e could not be reached!\n Set tolerance by '->solver->tolerance:' \n", tolerance); + + // test for relative tolerance + TEST_EXIT((isNumber(rel_residual) && (rel_residual < 0.0 || relative < 1.e-30 || rel_residual <= relative)) + || (residual < 1.e-30) || !breakTolNotReached) + ("Relative tolerance rtol = %e could not be reached!\n Set tolerance by '->solver->relative tolerance:' \n", relative); + } + return error_code; + } + + /** \name getting methods + * \{ + */ + + /// Returns solvers \ref name. + inline std::string getName() const + { + return name; + } + + /// Returns \ref tolerance + inline double getTolerance() const + { + return tolerance; + } + + /// Returns \ref max_iter + inline int getMaxIterations() const + { + return max_iter; + } + + /// Returns number of iterations in last run of an iterative solver + inline int getIterations() + { + return iterations; + } + + /// Returns error code in last run of an iterative solver + inline int getErrorCode() + { + return error; + } + + /// Returns info + inline int getInfo() + { + return info; + } + + /// Returns \ref print_cycle + inline int getPrint_cycle() const + { + return print_cycle; + } + + /// Returns \ref residual + inline double getResidual() const + { + return residual; + } + + /// Returns \ref relative + inline double getRelative() const + { + return relative; + } + + + virtual PreconditionerInterface* getLeftPrecon() + { + FUNCNAME("LinearSolverInterface::getLeftPrecon()"); + ERROR("no left preconditioner provided!\n"); + return NULL; + } + + virtual PreconditionerInterface* getRightPrecon() + { + FUNCNAME("LinearSolverInterface::getRightPrecon()"); + ERROR("no right preconditioner provided!\n"); + return NULL; + } + + virtual RunnerInterface* getRunner() + { + FUNCNAME("LinearSolverInterface::getRunner()"); + ERROR("no runner provided!\n"); + return NULL; + } + + /** \} */ + + /** \name setting methods + * \{ + */ + + /// Sets \ref tolerance + inline void setTolerance(double tol) + { + tolerance = tol; + } + + inline void setResidual(double r) + { + residual = r; + } + + /// Sets \ref relative + inline void setRelative(double rel) + { + relative = rel; + } + + inline void setRelativeResidual(double r) + { + rel_residual = r; + } + + /// Sets \ref max_iter + inline void setMaxIterations(int i) + { + max_iter = i; + } + + inline void setIterations(int i) + { + iterations=i; + } + + /// set the \ref error + inline void setErrorCode(int code) + { + error=code; + } + + /// Sets \ref info + inline void setInfo(int i) + { + info = i; + } + + /** \} */ + + protected: + /// main methods that all solvers must implement + virtual int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, + SystemVector& x, + SystemVector& b, + bool createMatrixData, + bool storeMatrixData) = 0; + + protected: + /// solvers name. + std::string name; + + /// Solver tolerance |r|. Set in LinearSolverInterface's constructor. + double tolerance; + + /// Relative solver tolerance |r|/|r0|. Set in LinearSolverInterface's constructor. + double relative; + + /// maximal number of iterations. Set in LinearSolverInterface's constructor. + int max_iter; + + /// info level during solving the system. Set in LinearSolverInterface's constructor. + int info; + + /// current absolute residual norm. + double residual; + + /// current relative residual norm. + double rel_residual; + + /// Print cycle, after how many iterations the residuum norm is logged. + int print_cycle; + + /// How many iterations were performed in last solver (not set by UmfPack) + int iterations; + + /// Error code in last solver (not set by UmfPack) + int error; + + /// break if residual norm > prescribed tolerance + bool breakTolNotReached; + }; + + + typedef CreatorInterfaceName<LinearSolverInterface> LinearSolverCreator; +} + +#endif // AMDIS_LINEAR_SOLVER_H diff --git a/AMDiS/src/solver/MTL4Solver.h b/AMDiS/src/solver/MTL4Solver.h deleted file mode 100644 index 518604b59a1cd02846f2b83888e55400e505d346..0000000000000000000000000000000000000000 --- a/AMDiS/src/solver/MTL4Solver.h +++ /dev/null @@ -1,237 +0,0 @@ -/****************************************************************************** - * - * AMDiS - Adaptive multidimensional simulations - * - * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved. - * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis - * - * Authors: - * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * - * This file is part of AMDiS - * - * See also license.opensource.txt in the distribution. - * - ******************************************************************************/ - - -/** \file MTL4Solver.h */ - -#ifndef AMDIS_MTL4SOLVER_H -#define AMDIS_MTL4SOLVER_H - -#include "solver/LinearSolver.h" -#ifdef HAVE_PARALLEL_DOMAIN_AMDIS -#include "parallel/ParallelSolver.h" -#endif -#include "solver/MTL4SolverBase.h" - -namespace AMDiS { - - template< typename MatrixType, typename VectorType > - struct MTL4Runner : public OEMRunner - { -// typedef SolverMatrix<Matrix<DOFMatrix*> > BlockMatrix; - - virtual void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) = 0; - - virtual int solve(const MatrixType& A, VectorType& x, const VectorType& b) = 0; - - virtual int adjoint_solve(const MatrixType& A, VectorType& x, const VectorType& b) - { - FUNCNAME("MTL4Runner::adjoint_solve()"); - ERROR_EXIT("Must be implemented in derived class!\n"); - return 0; - } - }; - - - /// Wrapper for template-argument dependent constructors - template < typename MatrixType, typename Enable = void> - struct MTL4SolverBase : public LinearSolver - { - typedef BlockMapper Mapper; - - MTL4SolverBase(std::string name) - : LinearSolver(name) {} - - MatrixType& getMatrix() - { - return matrix; - } - - /// create a sequential BlockMapper - void initMapper(const SolverMatrix<Matrix<DOFMatrix*> >& A) - { - mapper = new BlockMapper(A); - } - - void exitMapper() - { - delete mapper; - } - - protected: - MatrixType matrix; - Mapper* mapper; - }; - -#ifdef HAVE_PARALLEL_MTL4 - template < typename MatrixType > - struct MTL4SolverBase<MatrixType, typename boost::enable_if<mtl::traits::is_distributed<MatrixType> > > - : public ParallelSolver - { - typedef ParallelMapper Mapper; - - MTL4SolverBase(std::string name) - : ParallelSolver(name, false) {} - - MatrixType& getMatrix() - { - return matrix; - } - - /// create a parallel mapper based on local-to-global mapping - void initMapper(const SolverMatrix<Matrix<DOFMatrix*> >& A) - { - mapper = new ParallelMapper(*ParallelSolver::getDofMapping()); - } - - void exitMapper() - { - delete mapper; - } - - protected: - MatrixType matrix; - Mapper* mapper; - }; -#endif - - /** \ingroup Solver - * - * \brief - * Wrapper class for different MTL4 solvers. These solvers - * are parametrized by Matrix- and VectorType. The different - * algorithms, like krylov subspace methods or other external - * solvers where MTL4 provides an interface, can be assigned - * by different Runner objects. - **/ - template < typename MatrixType, typename VectorType, typename Runner > - class MTL4Solver : public MTL4SolverBase<MatrixType> - { - private: - typedef MTL4SolverBase<MatrixType> super; - typedef MTL4Solver<MatrixType, VectorType, Runner> self; - typedef typename super::Mapper Mapper; - - Runner runner; // redirect the implementation to a runner - - public: - /// Creator class used in the LinearSolverMap. - class Creator : public LinearSolverCreator - { - public: - virtual ~Creator() {} - - /// Returns a new MTL4Solver object. - LinearSolver* create() - { - return new self(this->name); - } - }; - - /// Constructor - MTL4Solver(std::string n) - : super(n), - runner(this) - {} - - - /// Implementation of \ref LinearSolver::getRunner() - OEMRunner* getRunner() - { - return &runner; - } - - - /// Implementation of \ref LinearSolver::getLeftPrecon() - OEMPreconditioner* getLeftPrecon() - { - return runner.getLeftPrecon(); - } - - - /// Implementation of \ref LinearSolver::getRightPrecon() - OEMPreconditioner* getRightPrecon() - { - return runner.getRightPrecon(); - } - - protected: - - - /// Implementation of \ref LinearSolver::solveLinearSystem() - int solveLinearSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A, - SystemVector& x, - SystemVector& b, - bool createMatrixData, - bool storeMatrixData) override - { -#ifdef HAVE_PARALLEL_DOMAIN_AMDIS - MPI::COMM_WORLD.Barrier(); -#endif - super::initMapper(A); - - Timer t; - if (createMatrixData) { - initMatrix(super::matrix, A, *super::mapper); - runner.init(A, super::matrix); - } - - VectorType mtl_x; - initVector(mtl_x, x, *super::mapper); - - VectorType mtl_b; - initVector(mtl_b, b, *super::mapper); - - INFO(self::getInfo(), 8)("fill MTL4 matrix needed %.5f seconds\n", t.elapsed()); - - int error = runner.solve(super::matrix ,mtl_x, mtl_b); - - VecMap<SystemVector, Mapper> xVecMap(x, *super::mapper); - mtl_x >> xVecMap; - - if (!storeMatrixData) - runner.exit(); - - super::exitMapper(); - return error; - } - - // functions to initialize mtl-matrix and mtl-vector - // from AMDiS matrix / vectors using mappers - - /// initialize a MTL matrix and assign values from an AMDiS matrix - template< typename Matrix1, typename Matrix2, typename M > - void initMatrix(Matrix1& target, const Matrix2& source, MapperBase<M>& mapper) - { - dispatch::initMatrix(target, mapper.self()); - dispatch::fillMatrix(target, source, mapper.self()); - } - - /// initialize a MTL vector and assign values from an AMDiS vector - template< typename Vector1, typename Vector2, typename M > - void initVector(Vector1& target, const Vector2& source, MapperBase<M>& mapper) - { - dispatch::initVector(target, super::matrix); - dispatch::fillVector(target, source, mapper.self()); - } - }; -} - -#endif // AMDIS_MTL4SOLVER_H diff --git a/AMDiS/src/solver/PetscSolver.h b/AMDiS/src/solver/PetscSolver.h index c750c484ef6ac3864d58d799abc6987e4886a6b6..1ab83db6c50531a553449f3f8bceafc438935f92 100644 --- a/AMDiS/src/solver/PetscSolver.h +++ b/AMDiS/src/solver/PetscSolver.h @@ -26,7 +26,7 @@ #ifdef HAVE_SEQ_PETSC -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" #include "solver/PetscTypes.h" #include "solver/MatrixStreams.h" #include "Timer.h" @@ -49,10 +49,12 @@ namespace AMDiS { * \brief Common base class for wrappers to use Petsc preconditioners in AMDiS. */ template< class MatrixType, class VectorType > - struct Petsc_BasePreconditioner : public OEMPreconditioner + struct PetscPreconditionerInterface : public PreconditionerInterface { - Petsc_BasePreconditioner(std::string prefix, std::string name) : prefix(prefix), name(name) {} - virtual ~Petsc_BasePreconditioner() {} + PetscPreconditionerInterface(std::string prefix, std::string name) + : prefix(prefix), name(name) {} + + virtual ~PetscPreconditionerInterface() {} virtual void init(PC pc, const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) { @@ -68,16 +70,20 @@ namespace AMDiS { }; - typedef Petsc_BasePreconditioner<PetscMatrix, PetscVector> PetscPreconditioner; - typedef Petsc_BasePreconditioner<PetscMatrixNested, PetscVectorNested> PetscPreconditionerNested; + /// PETSc preconditioners using MATSEQAIJ and VECSEQ data structures + typedef PetscPreconditionerInterface<PetscMatrix, PetscVector> PetscPreconditioner; + + /// PETSc preconditioner using MATNEST and VECNEST data structures + typedef PetscPreconditionerInterface<PetscMatrixNested, PetscVectorNested> PetscPreconditionerNested; + /// Runner that can be passed to LinearSolver to redirect the solution to PETSc template<typename MatrixType, typename VectorType> - class PetscRunner : public OEMRunner + class PetscRunner : public RunnerInterface { public: /// Constructor of standard PETSc runner. Reads ksp and pc parameters from initfile. - PetscRunner(LinearSolver* oem); + PetscRunner(LinearSolverInterface* oem); /// Destructor, deletes preconditioner object \ref preconditioner ~PetscRunner() @@ -114,13 +120,13 @@ namespace AMDiS { } /// Returns preconditioner object \ref preconditioner - OEMPreconditioner* getLeftPrecon() + PreconditionerInterface* getLeftPrecon() { return preconditioner; } /// Returns preconditioner object \ref preconditioner - OEMPreconditioner* getRightPrecon() + PreconditionerInterface* getRightPrecon() { return preconditioner; } @@ -140,7 +146,7 @@ namespace AMDiS { void setPrecon(); protected: - LinearSolver& oem; + LinearSolverInterface& oem; /// PETSc solver object KSP ksp; @@ -155,8 +161,8 @@ namespace AMDiS { bool initialized; ///< true when \ref init() was called bool matSolverPackage; ///< true when using a direct solver - /// Preconditioner object, that set parameters to \ref pc - Petsc_BasePreconditioner<MatrixType, VectorType>* preconditioner; + /// Preconditioner object, that sets parameters to \ref pc + PetscPreconditionerInterface<MatrixType, VectorType>* preconditioner; }; @@ -170,8 +176,8 @@ namespace AMDiS { * This is a suite of data structures and routines for the * scalable (parallel) solution of scientific applications. */ - typedef MTL4Solver< PetscMatrix, PetscVector, PetscRunner<PetscMatrix, PetscVector> > PetscSolver; - typedef MTL4Solver< PetscMatrixNested, PetscVectorNested, PetscRunner<PetscMatrixNested, PetscVectorNested> > PetscSolverNested; + typedef LinearSolver< PetscMatrix, PetscVector, PetscRunner<PetscMatrix, PetscVector> > PetscSolver; + typedef LinearSolver< PetscMatrixNested, PetscVectorNested, PetscRunner<PetscMatrixNested, PetscVectorNested> > PetscSolverNested; } // end namespace AMDiS diff --git a/AMDiS/src/solver/PetscSolver.hh b/AMDiS/src/solver/PetscSolver.hh index 096178c7f3b4fb3d3732b19b8936fab9d665095c..e8b6bf7c588ae3288244e23af928b1fae49a52de 100644 --- a/AMDiS/src/solver/PetscSolver.hh +++ b/AMDiS/src/solver/PetscSolver.hh @@ -24,7 +24,7 @@ namespace AMDiS { template<typename M, typename V> - PetscRunner<M,V>::PetscRunner(LinearSolver* oem_) + PetscRunner<M,V>::PetscRunner(LinearSolverInterface* oem_) : oem(*oem_), kspPrefix(""), zeroStartVector(false), @@ -82,7 +82,7 @@ namespace AMDiS { createSubSolver(ksp, fullMatrix.matrix, kspPrefix); - // set tolerance options from LinearSolver-parameters + // set tolerance options from LinearSolverInterface-parameters KSPSetTolerances(ksp, oem.getRelative(), oem.getTolerance(), PETSC_DEFAULT, oem.getMaxIterations()); // Do not delete the solution vector, use it for the initial guess. @@ -181,11 +181,11 @@ namespace AMDiS { } // Creator for the left preconditioner - CreatorInterfaceName< Petsc_BasePreconditioner<MatrixType, VectorType> >* creator(NULL); + CreatorInterfaceName< PetscPreconditionerInterface<MatrixType, VectorType> >* creator(NULL); try { - creator = dynamic_cast<CreatorInterfaceName< Petsc_BasePreconditioner<MatrixType, VectorType> >*>( - CreatorMap<Petsc_BasePreconditioner<MatrixType, VectorType> >::getCreator(precon, initFileStr) ); + creator = dynamic_cast<CreatorInterfaceName< PetscPreconditionerInterface<MatrixType, VectorType> >*>( + CreatorMap<PetscPreconditionerInterface<MatrixType, VectorType> >::getCreator(precon, initFileStr) ); } catch (...) { creator = NULL; } @@ -195,7 +195,7 @@ namespace AMDiS { preconditioner = creator->create(); } else if (!matSolverPackage && !params.emptyParam[precon]) { precon = (params.preconMap.find(precon) != params.preconMap.end() ? params.preconMap[precon] : precon); - preconditioner = new Petsc_BasePreconditioner<MatrixType, VectorType>(kspPrefix, precon); + preconditioner = new PetscPreconditionerInterface<MatrixType, VectorType>(kspPrefix, precon); } else { ERROR_EXIT((std::string("There is no creator for the given preconditioner '") + precon + "'").c_str()); } diff --git a/AMDiS/src/solver/SolverMatrix.h b/AMDiS/src/solver/SolverMatrix.h index 48599aefc44944efbb40b61d75f12705f5d7f5fd..f386aabc578c3d4048d9ab2b5ec71f7a45c4633c 100644 --- a/AMDiS/src/solver/SolverMatrix.h +++ b/AMDiS/src/solver/SolverMatrix.h @@ -41,24 +41,23 @@ namespace AMDiS { template <> class SolverMatrix<DOFMatrix> { - public : - - SolverMatrix() : - matrix(0) - {} + public: + SolverMatrix() + : matrix(0) + {} - void setMatrix(const DOFMatrix& A) - { - matrix= &A.getBaseMatrix(); - } + void setMatrix(const DOFMatrix& A) + { + matrix= &A.getBaseMatrix(); + } - const DOFMatrix::base_matrix_type& getMatrix() const - { - return *matrix; - } + const DOFMatrix::base_matrix_type& getMatrix() const + { + return *matrix; + } - private: - const DOFMatrix::base_matrix_type* matrix; + private: + const DOFMatrix::base_matrix_type* matrix; }; @@ -68,7 +67,7 @@ namespace AMDiS { { public : SolverMatrix<Matrix<DOFMatrix* > >() - : originalMat(nullptr) + : originalMat(NULL) {} void setMatrix(const Matrix<DOFMatrix*>& A) @@ -104,10 +103,8 @@ namespace AMDiS { mutable DOFMatrix::base_matrix_type matrix; const Matrix<DOFMatrix*>* originalMat; - }; - -} // namespace AMDiS +} // end namespace AMDiS #endif // AMDIS_SOLVERMATRIX_H diff --git a/AMDiS/src/solver/TriangularPreconditioner.h b/AMDiS/src/solver/TriangularPreconditioner.h index b79dae83413211bc96c39f4e9d23008045140e1d..150c134d751018f0ee6400d576ffd64f7efd1a39 100644 --- a/AMDiS/src/solver/TriangularPreconditioner.h +++ b/AMDiS/src/solver/TriangularPreconditioner.h @@ -33,7 +33,7 @@ namespace AMDiS { struct TriangularPreconditioner : CombinedPreconditioner<MatrixType> { typedef CombinedPreconditioner<MatrixType> super; - typedef ITL_BasePreconditioner<MatrixType, MTLTypes::MTLVector> precon_base; + typedef ITL_PreconditionerBase<MatrixType, MTLTypes::MTLVector> precon_base; typedef TriangularPreconditioner<MatrixType> self; class Creator : public CreatorInterfaceName<precon_base> diff --git a/AMDiS/src/solver/UmfPackSolver.h b/AMDiS/src/solver/UmfPackSolver.h index 81c8784d076ae5247c53d38ce384414764759daf..f24538f880da1dbd6a165a0d38c22677fd189c38 100644 --- a/AMDiS/src/solver/UmfPackSolver.h +++ b/AMDiS/src/solver/UmfPackSolver.h @@ -29,33 +29,34 @@ #include <iostream> #include <boost/numeric/mtl/operation/two_norm.hpp> #include <boost/numeric/mtl/interface/umfpack_solve.hpp> -#include "solver/MTL4Solver.h" +#include "solver/LinearSolver.h" namespace AMDiS { template< typename MatrixType, typename VectorType > - struct Umfpack_Runner : public MTL4Runner<MatrixType, VectorType> + struct Umfpack_Runner : public RunnerBase<MatrixType, VectorType> { - typedef MTL4Runner<MatrixType, VectorType> super; + typedef RunnerBase<MatrixType, VectorType> super; + typedef Umfpack_Runner<MatrixType, VectorType> self; - Umfpack_Runner(LinearSolver* oem_): - oem(*oem_), - solver(nullptr), - store_symbolic(0), - symmetric_strategy(0), - alloc_init(0.7) + Umfpack_Runner(LinearSolverInterface* oem_) + : oem(*oem_), + solver(NULL), + store_symbolic(0), + symmetric_strategy(0), + alloc_init(0.7) { Parameters::get(oem.getName() + "->store symbolic", store_symbolic); // ? Parameters::get(oem.getName() + "->symmetric strategy", symmetric_strategy); Parameters::get(oem.getName() + "->alloc init", alloc_init); } - /// Implementation of \ref MTL4Runner::init() + /// Implementation of \ref RunnerBase::init() void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const MatrixType& fullMatrix) override { - if (solver != nullptr) { + if (solver != NULL) { delete solver; - solver = nullptr; + solver = NULL; } try { @@ -65,12 +66,11 @@ namespace AMDiS { } } - /// Implementation of \ref MTL4Runner::solve() + /// Implementation of \ref RunnerBase::solve() int solve(const MatrixType& A, VectorType& x, const VectorType& b) override { FUNCNAME("Umfpack_Runner::solve()"); - TEST_EXIT(solver != nullptr)("The umfpack solver was not initialized\n"); - + TEST_EXIT(solver != NULL)("The umfpack solver was not initialized\n"); int code = 0; try { @@ -88,19 +88,19 @@ namespace AMDiS { return code; } - /// Implementation of \ref OEMRunner::adjoint_solve() + /// Implementation of \ref RunnerInterface::adjoint_solve() void exit() override {} ~Umfpack_Runner() { - if (solver != nullptr) { + if (solver != NULL) { delete solver; - solver = nullptr; + solver = NULL; } } public: - LinearSolver& oem; + LinearSolverInterface& oem; private: mtl::matrix::umfpack::solver<MatrixType> *solver; @@ -116,13 +116,13 @@ namespace AMDiS { /** * \ingroup Solver * \class AMDiS::UmfPackSolver - * \brief \implements MTL4Solver + * \brief \implements LinearSolver * Wrapper for the external UMFPACK solver: * http://www.cise.ufl.edu/research/sparse/umfpack/ * * This is a direct solver for large sparse matrices. */ - typedef MTL4Solver<MTLTypes::MTLMatrix, MTLTypes::MTLVector, Umfpack_Runner< MTLTypes::MTLMatrix, MTLTypes::MTLVector > > UmfPackSolver; + typedef LinearSolver<MTLTypes::MTLMatrix, MTLTypes::MTLVector, Umfpack_Runner< MTLTypes::MTLMatrix, MTLTypes::MTLVector > > UmfPackSolver; } diff --git a/AMDiS/src/solver/MTL4SolverBase.h b/AMDiS/src/solver/details/LinearSolver.h similarity index 95% rename from AMDiS/src/solver/MTL4SolverBase.h rename to AMDiS/src/solver/details/LinearSolver.h index 198534537a83e73d7ea07151f8680b7ef9900c9b..77f412f1450a1fbabf84d4fb40e3489fd81f73b1 100644 --- a/AMDiS/src/solver/MTL4SolverBase.h +++ b/AMDiS/src/solver/details/LinearSolver.h @@ -19,12 +19,12 @@ ******************************************************************************/ -/** \file MTL4SolverBase.h */ +/** \file LinearSolver.h */ -#ifndef AMDIS_MTL4SOLVER_BASE_H -#define AMDIS_MTL4SOLVER_BASE_H +#ifndef AMDIS_MTL4SOLVER_DETAILS_H +#define AMDIS_MTL4SOLVER_DETAILS_H -#include "MatrixStreams.h" +#include "solver/MatrixStreams.h" #include "Timer.h" #include <iostream> #include <boost/mpl/bool.hpp> @@ -122,4 +122,4 @@ namespace AMDiS { } // end namespace dispatch } // end namespace AMDiS -#endif // AMDIS_MTL4SOLVER_BASE_H +#endif // AMDIS_MTL4SOLVER_DETAILS_H diff --git a/AMDiS/src/solver/details/MTL4Solver.h b/AMDiS/src/solver/details/MTL4Solver.h deleted file mode 100644 index 1a9818a1dd487f01f1dce2f2d1c83adb99422c3a..0000000000000000000000000000000000000000 --- a/AMDiS/src/solver/details/MTL4Solver.h +++ /dev/null @@ -1,168 +0,0 @@ -/****************************************************************************** - * - * AMDiS - Adaptive multidimensional simulations - * - * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved. - * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis - * - * Authors: - * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * - * This file is part of AMDiS - * - * See also license.opensource.txt in the distribution. - * - ******************************************************************************/ -#ifndef MTL4SOLVER_BASE_H -#define MTL4SOLVER_BASE_H - -#include "MatrixStreams.h" -#include "Timer.h" -#include <iostream> -#include <boost/mpl/bool.hpp> -#include <boost/numeric/mtl/utility/is_distributed.hpp> - -#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) && defined(HAVE_PARALLEL_MTL4) -#include <boost/numeric/mtl/par/distribution.hpp> -#endif - -namespace AMDiS { - namespace details { - - template< typename MatrixType, typename VectorType, typename Runner > - class MTL4Solver - { - public: - /// Constructor - MTL4Solver(LinearSolver* oem) - : runner(oem), - matrix(0,0) - {} - - protected: - Runner runner; - - /// init systemmatrix depending on Mapper parameters. - template< typename Mapper, bool IsDist> - void init(MatrixType& m, Mapper& mapper, boost::mpl::bool_<IsDist>) - { - m.change_dim(mapper.getNumRows(), mapper.getNumCols()); - } - - -#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) && defined(HAVE_PARALLEL_MTL4) - /// init systemmatrix depending on Mapper parameters, - /// specialized for distributed matrices - void init(MatrixType& m, ParallelMapper& mapper, boost::mpl::true_) - { - mtl::par::block_distribution dist(mapper.getNumRows()); - dist.setup_from_local_size(mapper.getMap().getLocalDofs()); - m.change_dim(0, 0); - m.init_distribution(dist, dist, mapper.getNumRows(), mapper.getNumRows()); - } -#endif - - - /// init MTL-vector depending on Mapper parameters. - template< bool IsDist> - void init(VectorType& v, boost::mpl::bool_<IsDist>) - { - v.change_dim(num_rows(matrix)); - } - - - /// init MTL-vector depending on Mapper parameters, - /// specialized for distributed matrices - void init(VectorType& v, boost::mpl::true_) - { - v.init_distribution(row_distribution(matrix), num_rows(matrix)); - } - - - /// Realization of solve(A, x, b) to solve the linear system \f$ Ax=b \f$. - /// 1. transfer matrix and vectors to MTL datatypes - /// 2. call Runner::solve(A, x, b) - /// 3. transfer solution back to AMDiS \ref SystemVector - template< typename MatrixT, typename VectorT, typename Mapper > - int solve(const MatrixT& A, VectorT& x, VectorT& b, Mapper& mapper, - bool createMatrixData, - bool storeMatrixData) - { FUNCNAME("MTL4Solver::solve()"); - - #ifdef HAVE_PARALLEL_DOMAIN_AMDIS - MPI::COMM_WORLD.Barrier(); - #endif - Timer t; - if (createMatrixData) { - init(matrix, mapper, mtl::traits::is_distributed<MatrixType>()); - - set_to_zero(matrix); - MatMap< const MatrixT, Mapper > matMap(A, mapper); - matrix << matMap; - mtl::io::matrix_market_ostream out("matrix.mtx"); - out << matrix; - #ifdef HAVE_PARALLEL_DOMAIN_AMDIS - mtl::io::matrix_market_ostream out2("matrix-p"+boost::lexical_cast<std::string>(MPI::COMM_WORLD.Get_rank())+".mtx"); - #else - mtl::io::matrix_market_ostream out2("matrix-full.mtx"); - #endif - out2 << A.getSubMatrix(0,0); - MSG("matrix.nnz=%d\n", matrix.nnz()); - - runner.init(A, matrix); - } - - VectorType mtl_x; - init(mtl_x, mtl::traits::is_distributed<VectorType>()); - set_to_zero(mtl_x); - VecMap< VectorT, Mapper > xVecMap(x, mapper); - mtl_x << xVecMap; - - VectorType mtl_b; - init(mtl_b, mtl::traits::is_distributed<VectorType>()); - set_to_zero(mtl_b); - VecMap< VectorT, Mapper> bVecMap(b, mapper); - mtl_b << bVecMap; - - MSG("fill MTL4 matrix needed %.5f seconds\n", t.elapsed()); - - t.reset(); - int error = runner.solve(matrix ,mtl_x, mtl_b); - MSG("solve MTL4 matrix needed %.5f seconds\n", t.elapsed()); - - VectorType r(mtl_b); - r -= matrix * mtl_x; - double residual = two_norm(r); - MSG("MTL4Solver: ||b-Ax||= %e\n", residual); - - mtl_x >> xVecMap; - - runner.exit(); - - return error; - } - - OEMRunner* getRunner() - { - return &runner; - } - - OEMPreconditioner* getLeftPrecon() - { - return runner.getLeftPrecon(); - } - - OEMPreconditioner* getRightPrecon() - { - return runner.getRightPrecon(); - } - - private: - MatrixType matrix; - }; -} -#endif diff --git a/AMDiS/src/time/RosenbrockStationary.cc b/AMDiS/src/time/RosenbrockStationary.cc index f21d9c93e2c5b8df3e6c9cf629d07c8ef7bb7e36..4ffda79c90ebd7994f6ae8cda016eb80fb4c333c 100644 --- a/AMDiS/src/time/RosenbrockStationary.cc +++ b/AMDiS/src/time/RosenbrockStationary.cc @@ -182,7 +182,7 @@ namespace AMDiS { { FUNCNAME("RosenbrockStationary::addOperator()"); - TEST_EXIT(op.getUhOld() == nullptr)("UhOld is not allowed to be set!\n"); + TEST_EXIT(op.getUhOld() == NULL)("UhOld is not allowed to be set!\n"); op.setUhOld(stageSolution->getDOFVector(col)); ProblemStat::addVectorOperator(op, row, factor, estFactor); @@ -194,8 +194,8 @@ namespace AMDiS { { FUNCNAME("RosenbrockStationary::addJacobianOperator()"); - TEST_EXIT(factor == nullptr)("Not yet implemented!\n"); - TEST_EXIT(estFactor == nullptr)("Not yet implemented!\n"); + TEST_EXIT(factor == NULL)("Not yet implemented!\n"); + TEST_EXIT(estFactor == NULL)("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 2bf60aebc603218a950600fea52a4b1ad07f8b55..c71219715afe35fa0ee6f202229d9a1c65e9c1d1 100644 --- a/AMDiS/src/time/RosenbrockStationary.h +++ b/AMDiS/src/time/RosenbrockStationary.h @@ -75,11 +75,11 @@ namespace AMDiS { minusOne(-1.0), stageTime(0.0), oldTime(0.0), - tauPtr(nullptr), - tauGamma(nullptr), - minusTauGamma(nullptr), - invTauGamma(nullptr), - minusInvTauGamma(nullptr) + tauPtr(NULL), + tauGamma(NULL), + minusTauGamma(NULL), + invTauGamma(NULL), + minusInvTauGamma(NULL) {} @@ -95,11 +95,11 @@ namespace AMDiS { /// Add operators of function F virtual void addOperator(Operator &op, int row, int col, - double *factor = nullptr, double *estFactor = nullptr); + double *factor = NULL, double *estFactor = NULL); /// Add operators of jacobian J = d_X(F) virtual void addJacobianOperator(Operator &op, int row, int col, - double *factor = nullptr, double *estFactor = nullptr); + double *factor = NULL, double *estFactor = NULL); virtual void addTimeOperator(int i, int j); diff --git a/extensions/ProblemStatMassConserve.h b/extensions/ProblemStatMassConserve.h index 4daee757b14fcf970a0fe5841e2c33c16f337591..37a20de56ae12ee12388f6e77bca65a5c68a3569 100644 --- a/extensions/ProblemStatMassConserve.h +++ b/extensions/ProblemStatMassConserve.h @@ -39,7 +39,7 @@ struct ProblemStatMassConserve : public ExtendedProblemStat, public StandardRefi ProblemStatMassConserve(std::string name_) : ExtendedProblemStat(name_), initialMeshAdoption(false), - prob2(nullptr), + prob2(NULL), comp(0) { #ifdef HAVE_PARALLEL_DOMAIN_AMDIS @@ -85,9 +85,9 @@ struct ProblemStatMassConserve : public ExtendedProblemStat, public StandardRefi ~ProblemStatMassConserve() { - if (prob2 != nullptr) { + if (prob2 != NULL) { delete prob2; - prob2 = nullptr; + prob2 = NULL; } } @@ -119,7 +119,7 @@ struct ProblemStatMassConserve : public ExtendedProblemStat, public StandardRefi if (refSet < 0) refSet = 0; - if (meshForRefinementSet[refSet] == nullptr) { + if (meshForRefinementSet[refSet] == NULL) { Mesh *newMesh = new Mesh(getMesh(comp)->getName(), getMesh(comp)->getDim()); meshForRefinementSet[refSet] = newMesh; meshes2.push_back(newMesh); diff --git a/extensions/ProblemStatMassConserve2.h b/extensions/ProblemStatMassConserve2.h index 943d4742fbad77bc996d785af567a13e7853637c..42ef1404701178b368a0660c29b17698faf5b8eb 100644 --- a/extensions/ProblemStatMassConserve2.h +++ b/extensions/ProblemStatMassConserve2.h @@ -36,7 +36,7 @@ struct ProblemStatMassConserve2 : public ExtendedProblemStat, public StandardRef /// similar parameters as the regular one ProblemStatMassConserve2(std::string name_) : ExtendedProblemStat(name_), - prob2(nullptr), + prob2(NULL), comp(0) { Parameters::get(name_ + "->mass conservation component", comp); @@ -75,9 +75,9 @@ struct ProblemStatMassConserve2 : public ExtendedProblemStat, public StandardRef ~ProblemStatMassConserve2() { - if (prob2 != nullptr) { + if (prob2 != NULL) { delete prob2; - prob2 = nullptr; + prob2 = NULL; } } diff --git a/extensions/Refinement.h b/extensions/Refinement.h index 31494603bda6ab7da558255f28a7017bf3905cf0..9dadce2ca5553b863b334e86a2b32f33e030a1ca 100644 --- a/extensions/Refinement.h +++ b/extensions/Refinement.h @@ -369,8 +369,8 @@ public: RefinementLocal(Mesh *mesh_) : mesh(mesh_), - adaptInfo(nullptr), - refineOperation(nullptr), + adaptInfo(NULL), + refineOperation(NULL), numRefinements0(15), globalRefined(false) { diff --git a/extensions/preconditioner/PetscPreconCahnHilliard.cc b/extensions/preconditioner/PetscPreconCahnHilliard.cc index 082d20cab209a7ac66afae68365933dd18336aae..684cf2f31ad3f0df631e8c027d6b1b3605ca9100 100644 --- a/extensions/preconditioner/PetscPreconCahnHilliard.cc +++ b/extensions/preconditioner/PetscPreconCahnHilliard.cc @@ -57,20 +57,19 @@ namespace AMDiS { } - void PetscPreconCahnHilliard::init(const BlockMatrix& A, const Mat& matrix) + void PetscPreconCahnHilliard::init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const PetscMatrixNested& src) { - PetscRunner::init(A, matrix); - dynamic_cast<PetscSolver<self>*>(&oem)->setNestedVectors(true); + super::init(A, src); PCSetType(getPc(), PCSHELL); PCShellSetApply(getPc(), pcChShell); PCShellSetContext(getPc(), &data); - MatNestGetSubMat(matrix, 1, 0, &data.matM); + MatNestGetSubMat(src.matrix, 1, 0, &data.matM); MatDuplicate(data.matM, MAT_COPY_VALUES, &data.matMinusDeltaK); MatScale(data.matMinusDeltaK, -1.0); - MatNestGetSubMat(matrix, 0, 0, &data.matM); + MatNestGetSubMat(src.matrix, 0, 0, &data.matM); MatDuplicate(data.matM, MAT_COPY_VALUES, &MpK); MatAXPY(MpK, -(*eps)/sqrt(*delta), data.matMinusDeltaK, SAME_NONZERO_PATTERN); @@ -95,6 +94,6 @@ namespace AMDiS { KSPDestroy(&data.kspM); KSPDestroy(&data.kspMpK); - PetscRunner::exit(); + super::exit(); } } diff --git a/extensions/preconditioner/PetscPreconCahnHilliard.h b/extensions/preconditioner/PetscPreconCahnHilliard.h index 15dc87b2aa23260fa50d3b7ccde8737a220d361c..efb208b57e7cd508504ccf28fd295ee83e62d42b 100644 --- a/extensions/preconditioner/PetscPreconCahnHilliard.h +++ b/extensions/preconditioner/PetscPreconCahnHilliard.h @@ -31,16 +31,18 @@ namespace AMDiS { double delta, eps; }; - class PetscPreconCahnHilliard : public PetscRunner + class PetscPreconCahnHilliard : public PetscRunner<PetscMatrixNested, PetscVectorNested> { public: - typedef PetscPreconCahnHilliard self; + typedef PetscPreconCahnHilliard self; + typedef PetscRunner<PetscMatrixNested, PetscVectorNested> super; - PetscPreconCahnHilliard(LinearSolver* oem_) - : PetscRunner(oem_), - MpK(PETSC_NULL), - eps(NULL), - delta(NULL) { } + PetscPreconCahnHilliard(LinearSolverInterface* oem_) + : super(oem_), + MpK(PETSC_NULL), + eps(NULL), + delta(NULL) + { } void setData(double *epsPtr, double *deltaPtr) { @@ -48,7 +50,7 @@ namespace AMDiS { delta = deltaPtr; } - void init(const BlockMatrix& A, const Mat& fullMatrix); + void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const PetscMatrixNested& fullMatrix); void exit(); private: diff --git a/extensions/preconditioner/PetscPreconPfc.cc b/extensions/preconditioner/PetscPreconPfc.cc index fb64056de5c4f512c34ca39e645853587675827c..aa950490e8af64331a1a0111e3eabf249005236a 100644 --- a/extensions/preconditioner/PetscPreconPfc.cc +++ b/extensions/preconditioner/PetscPreconPfc.cc @@ -72,10 +72,10 @@ namespace AMDiS { } - void PetscPreconPfc::init(const BlockMatrix& A, const Mat& matrix) + void PetscPreconPfc::init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const PetscMatrixNested& src) { assert(tau != NULL); - PetscRunner::init(A, matrix); + super::init(A, src); // init shell preconditioner PCSetType(getPc(), PCSHELL); @@ -85,8 +85,8 @@ namespace AMDiS { double delta = sqrt(*tau); - MatNestGetSubMat(matrix, 2, 2, &data.matM); - MatNestGetSubMat(matrix, 2, 1, &data.matK); + MatNestGetSubMat(src.matrix, 2, 2, &data.matM); + MatNestGetSubMat(src.matrix, 2, 1, &data.matK); MatDuplicate(data.matM, MAT_COPY_VALUES, &MpK); MatAXPY(MpK, delta, data.matK, SAME_NONZERO_PATTERN); @@ -140,6 +140,6 @@ namespace AMDiS { KSPDestroy(&data.kspMpK); KSPDestroy(&data.kspMpK2); - PetscRunner::exit(); + super::exit(); } } diff --git a/extensions/preconditioner/PetscPreconPfc.h b/extensions/preconditioner/PetscPreconPfc.h index 322d1049ee6d171d5fc8e830067f502f30899f55..1a6a7c8978b018aa590210ea7b3065bb9aeeeadb 100644 --- a/extensions/preconditioner/PetscPreconPfc.h +++ b/extensions/preconditioner/PetscPreconPfc.h @@ -30,12 +30,16 @@ namespace AMDiS { double delta, tau; }; - class PetscPreconPfc : public PetscRunner + class PetscPreconPfc : public PetscRunner<PetscMatrixNested, PetscVectorNested> { public: - PetscPreconPfc(LinearSolver* oem_) - : PetscRunner(oem_), - tau(NULL) + typedef PetscPreconPfc self; + typedef PetscRunner<PetscMatrixNested, PetscVectorNested> super; + + + PetscPreconPfc(LinearSolverInterface* oem_) + : super(oem_), + tau(NULL) { } void setData(double *tauPtr) @@ -43,7 +47,7 @@ namespace AMDiS { tau = tauPtr; } - void init(const BlockMatrix& A, const Mat& fullMatrix); + void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const PetscMatrixNested& fullMatrix); void exit(); private: diff --git a/extensions/preconditioner/PetscPreconPfcDiag.cc b/extensions/preconditioner/PetscPreconPfcDiag.cc index b1f7d65555765cda97f71e026555b8429773abc9..a16167fb161e013147a2f9a31a2d5944bf79608e 100644 --- a/extensions/preconditioner/PetscPreconPfcDiag.cc +++ b/extensions/preconditioner/PetscPreconPfcDiag.cc @@ -70,10 +70,10 @@ namespace AMDiS { } - void PetscPreconPfcDiag::init(const BlockMatrix& A, const Mat& matrix) + void PetscPreconPfcDiag::init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const PetscMatrixNested& src) { assert(tau != NULL); - PetscRunner::init(A, matrix); + super::init(A, src); // init shell preconditioner PCSetType(getPc(), PCSHELL); @@ -83,8 +83,8 @@ namespace AMDiS { double delta = sqrt(*tau); - MatNestGetSubMat(matrix, 2, 2, &data.matM); - MatNestGetSubMat(matrix, 2, 1, &data.matK); + MatNestGetSubMat(src.matrix, 2, 2, &data.matM); + MatNestGetSubMat(src.matrix, 2, 1, &data.matK); MatDuplicate(data.matM, MAT_COPY_VALUES, &MpK); MatAXPY(MpK, delta, data.matK, SAME_NONZERO_PATTERN); @@ -153,6 +153,6 @@ namespace AMDiS { KSPDestroy(&data.kspMpK); KSPDestroy(&data.kspS); - PetscRunner::exit(); + super::exit(); } } diff --git a/extensions/preconditioner/PetscPreconPfcDiag.h b/extensions/preconditioner/PetscPreconPfcDiag.h index 1c626487402f0fb7249682b3ee29e59d1238f725..553548dab77ba45d06defa14147bd88806e81dd5 100644 --- a/extensions/preconditioner/PetscPreconPfcDiag.h +++ b/extensions/preconditioner/PetscPreconPfcDiag.h @@ -30,12 +30,15 @@ namespace AMDiS { double delta, tau; }; - class PetscPreconPfcDiag : public PetscRunner + class PetscPreconPfcDiag : public PetscRunner<PetscMatrixNested, PetscVectorNested> { public: - PetscPreconPfcDiag(LinearSolver* oem_) - : PetscRunner(oem_), - tau(NULL) + typedef PetscPreconPfcDiag self; + typedef PetscRunner<PetscMatrixNested, PetscVectorNested> super; + + PetscPreconPfcDiag(LinearSolverInterface* oem_) + : super(oem_), + tau(NULL) { } void setData(double *tauPtr) @@ -43,7 +46,7 @@ namespace AMDiS { tau = tauPtr; } - void init(const BlockMatrix& A, const Mat& fullMatrix); + void init(const SolverMatrix<Matrix<DOFMatrix*> >& A, const PetscMatrixNested& fullMatrix); void exit(); private: diff --git a/extensions/preconditioner/PetscSolverNavierStokes2.h b/extensions/preconditioner/PetscSolverNavierStokes2.h index 091ff96d0ebba01678942dfa7cccca797857d67a..9fa2d05cccc93bc9af504a92a512ccf47b676f23 100644 --- a/extensions/preconditioner/PetscSolverNavierStokes2.h +++ b/extensions/preconditioner/PetscSolverNavierStokes2.h @@ -105,7 +105,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverNavierStokes2(this->name); } diff --git a/extensions/preconditioner/PetscSolverPfc.h b/extensions/preconditioner/PetscSolverPfc.h index 99cce0f38061df920c39e6cb93f980330edcbcb1..0fb7674cbd08fb37e2626082cb51627d5bb265ca 100644 --- a/extensions/preconditioner/PetscSolverPfc.h +++ b/extensions/preconditioner/PetscSolverPfc.h @@ -38,7 +38,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverPfc(this->name); } diff --git a/extensions/preconditioner/PetscSolverPfc_diag.h b/extensions/preconditioner/PetscSolverPfc_diag.h index 0dd3a91b43266e79e6b013ec3e016cda919d75c4..5bba67897fe2c0e196efb852ff085ac5652ec7ea 100644 --- a/extensions/preconditioner/PetscSolverPfc_diag.h +++ b/extensions/preconditioner/PetscSolverPfc_diag.h @@ -38,7 +38,7 @@ namespace AMDiS { namespace Parallel { virtual ~Creator() {} /// Returns a new PetscSolver object. - LinearSolver* create() + LinearSolverInterface* create() { return new PetscSolverPfcDiag(this->name); }