Commit 99303ce3 authored by Praetorius, Simon's avatar Praetorius, Simon

A lot of changes in the solver interface

parent fc619e37
......@@ -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)
......
......@@ -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"
......
......@@ -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;
......
......@@ -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),
......
......@@ -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;
}
......
......@@ -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);
};
}
......
......@@ -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_)
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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))
{
......
......@@ -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);
};
}
......
......@@ -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)
{}
......
......@@ -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]);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
}
}
......@@ -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
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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() {}
......
......@@ -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();