Commit 93e7dbf0 authored by Thomas Witkowski's avatar Thomas Witkowski

removed DELETE and NEW

parent 4652297c
......@@ -22,25 +22,25 @@ namespace AMDiS {
{
FUNCNAME("BasisFunction::BasisFunction()");
nDOF = NEW DimVec<int>(dim, DEFAULT_VALUE, -1);
nDOF = new DimVec<int>(dim, DEFAULT_VALUE, -1);
dow = Global::getGeo(WORLD);
grdTmpVec1.resize(omp_get_overall_max_threads());
grdTmpVec2.resize(omp_get_overall_max_threads());
for (int i = 0; i < omp_get_overall_max_threads(); i++) {
grdTmpVec1[i] = NEW DimVec<double>(dim, DEFAULT_VALUE, 0.0);
grdTmpVec2[i] = NEW DimVec<double>(dim, DEFAULT_VALUE, 0.0);
grdTmpVec1[i] = new DimVec<double>(dim, DEFAULT_VALUE, 0.0);
grdTmpVec2[i] = new DimVec<double>(dim, DEFAULT_VALUE, 0.0);
}
}
BasisFunction::~BasisFunction()
{
DELETE nDOF;
delete nDOF;
for (int i = 0; i < static_cast<int>(grdTmpVec1.size()); i++) {
DELETE grdTmpVec1[i];
DELETE grdTmpVec2[i];
delete grdTmpVec1[i];
delete grdTmpVec2[i];
}
}
......
......@@ -22,7 +22,7 @@ bool Cholesky::factorization(Matrix<double> *A, Vector<double> *p)
pT->resize(n);
}
else
pT = NEW Vector<double>(n);
pT = new Vector<double>(n);
p = pT;
}
......@@ -75,7 +75,7 @@ bool Cholesky::solve(Matrix<double> *A, Vector<double> *b, Vector<double> *x,
x->resize(n);
if (!x)
x = NEW Vector<double>(n);
x = new Vector<double>(n);
// Checking vector P.
static Vector<double> *pT = NULL;
......@@ -83,10 +83,10 @@ bool Cholesky::solve(Matrix<double> *A, Vector<double> *b, Vector<double> *x,
if (!p || (p->getSize() != n))
{
if (pT && pT->getSize() != n)
DELETE pT;
delete pT;
if (!pT)
pT = NEW Vector<double>(n);
pT = new Vector<double>(n);
p = pT;
......@@ -129,14 +129,14 @@ bool Cholesky::solve(Matrix<double> *A, Vector<WorldVector<double> > *b,
x->resize(n);
if (!x)
x = NEW Vector<WorldVector<double> >(n);
x = new Vector<WorldVector<double> >(n);
// Checking vector P.
static Vector<double> *pT = NULL;
if (!p || (p->getSize() != n))
{
pT = NEW Vector<double>(n);
pT = new Vector<double>(n);
p = pT;
success = factorization(A, p);
......
......@@ -41,7 +41,7 @@ namespace AMDiS {
/****************************************************************************/
/* get a list for storing all elements at the coarsening edge and fill it */
/****************************************************************************/
coarsenList = NEW RCNeighbourList(mesh->getMaxEdgeNeigh());
coarsenList = new RCNeighbourList(mesh->getMaxEdgeNeigh());
coarsenList->setCoarseningManager(this);
/****************************************************************************/
......@@ -98,7 +98,7 @@ namespace AMDiS {
}
}
DELETE coarsenList;
delete coarsenList;
return 0;
}
......
......@@ -21,23 +21,23 @@ namespace AMDiS {
{
OEMSolverCreator *creator;
creator = NEW CGSolver::Creator;
creator = new CGSolver::Creator;
addCreator("cg", creator);
creator = NEW BiCGSolver::Creator;
creator = new BiCGSolver::Creator;
addCreator("bicg", creator);
creator = NEW BiCGStab::Creator;
creator = new BiCGStab::Creator;
addCreator("bicgstab", creator);
creator = NEW BiCGStab2::Creator;
creator = new BiCGStab2::Creator;
addCreator("bicgstab2", creator);
creator = NEW BiCGStabEll::Creator;
creator = new BiCGStabEll::Creator;
addCreator("bicgstab_ell", creator);
#ifdef HAVE_UMFPACK
creator = NEW UmfPackSolver::Creator;
creator = new UmfPackSolver::Creator;
addCreator("umfpack", creator);
#endif
}
......@@ -47,16 +47,16 @@ namespace AMDiS {
{
CreatorInterface<ITL_BasePreconditioner> *creator;
creator = NEW DiagonalPreconditioner::Creator;
creator = new DiagonalPreconditioner::Creator;
addCreator("diag", creator);
creator = NEW ILUPreconditioner::Creator;
creator = new ILUPreconditioner::Creator;
addCreator("ilu", creator);
creator = NEW ICPreconditioner::Creator;
creator = new ICPreconditioner::Creator;
addCreator("ic", creator);
creator = NEW IdentityPreconditioner::Creator;
creator = new IdentityPreconditioner::Creator;
addCreator("no", creator);
}
......@@ -66,10 +66,10 @@ namespace AMDiS {
{
NonLinSolverCreator<DOFVector<double> > *creator;
creator = NEW Newton<DOFVector<double> >::Creator;
creator = new Newton<DOFVector<double> >::Creator;
addCreator("newton", creator);
creator = NEW NewtonS<DOFVector<double> >::Creator;
creator = new NewtonS<DOFVector<double> >::Creator;
addCreator("newton_fs", creator);
}
#endif
......@@ -81,10 +81,10 @@ namespace AMDiS {
{
NonLinSolverCreator<SystemVector> *creator;
creator = NEW Newton<SystemVector>::Creator;
creator = new Newton<SystemVector>::Creator;
addCreator("newton", creator);
creator = NEW NewtonS<SystemVector>::Creator;
creator = new NewtonS<SystemVector>::Creator;
addCreator("newton_fs", creator);
}
#endif
......@@ -94,10 +94,10 @@ namespace AMDiS {
{
EstimatorCreator *creator;
creator = NEW ResidualEstimator::Creator;
creator = new ResidualEstimator::Creator;
addCreator("residual", creator);
creator = NEW RecoveryEstimator::Creator;
creator = new RecoveryEstimator::Creator;
addCreator("recovery", creator);
}
......@@ -106,25 +106,25 @@ namespace AMDiS {
{
CreatorInterface<ElementData> *creator;
creator = NEW LeafDataEstimatable::Creator;
creator = new LeafDataEstimatable::Creator;
addCreator("LeafDataEstimatable", creator);
creator = NEW LeafDataEstimatableVec::Creator;
creator = new LeafDataEstimatableVec::Creator;
addCreator("LeafDataEstimatableVec", creator);
creator = NEW LeafDataCoarsenable::Creator;
creator = new LeafDataCoarsenable::Creator;
addCreator("LeafDataCoarsenable", creator);
creator = NEW LeafDataCoarsenableVec::Creator;
creator = new LeafDataCoarsenableVec::Creator;
addCreator("LeafDataCoarsenableVec", creator);
creator = NEW LeafDataPeriodic::Creator;
creator = new LeafDataPeriodic::Creator;
addCreator("LeafDataPeriodic", creator);
creator = NEW SurfaceRegion_ED::Creator;
creator = new SurfaceRegion_ED::Creator;
addCreator("SurfaceRegion_ED", creator);
creator = NEW ElementRegion_ED::Creator;
creator = new ElementRegion_ED::Creator;
addCreator("ElementRegion_ED", creator);
}
......
......@@ -8,6 +8,6 @@ namespace AMDiS {
typename std::map< std::string, CreatorInterface<BaseClass>* >::iterator it;
for (it = creatorMap.begin(); it != creatorMap.end(); ++it)
DELETE it->second;
delete it->second;
}
}
......@@ -48,7 +48,7 @@ namespace AMDiS {
if (rowFESpace && rowFESpace->getAdmin())
(const_cast<DOFAdmin*>(rowFESpace->getAdmin()))->addDOFIndexed(this);
boundaryManager = NEW BoundaryManager(rowFESpace_);
boundaryManager = new BoundaryManager(rowFESpace_);
nRow = rowFESpace->getBasisFcts()->getNumber();
nCol = colFESpace->getBasisFcts()->getNumber();
......@@ -158,7 +158,7 @@ namespace AMDiS {
matrix = rhs.matrix;
if (rhs.boundaryManager) {
boundaryManager = NEW BoundaryManager(*rhs.boundaryManager);
boundaryManager = new BoundaryManager(*rhs.boundaryManager);
} else {
boundaryManager = NULL;
}
......
......@@ -24,11 +24,11 @@ namespace AMDiS {
// === get admin ===
localAdmin_ = const_cast<DOFAdmin*>(feSpace->getAdmin());
// === create vertex info vector ===
vertexInfos_ = NEW DOFVector< std::list<VertexInfo> >(feSpace, "vertex infos");
vertexInfos_ = new DOFVector< std::list<VertexInfo> >(feSpace, "vertex infos");
interpPointInd_ = NEW DOFVector<int>(feSpace, "interpolation point indices");
interpPointCoords_ = NEW DOFVector< std::list<WorldVector<double> > >(feSpace, "interpolation point coordinates");
dofCoords_ = NEW DOFVector< std::list<WorldVector<double> > >(feSpace, "dof coords");
interpPointInd_ = new DOFVector<int>(feSpace, "interpolation point indices");
interpPointCoords_ = new DOFVector< std::list<WorldVector<double> > >(feSpace, "interpolation point coordinates");
dofCoords_ = new DOFVector< std::list<WorldVector<double> > >(feSpace, "dof coords");
dim_ = mesh_->getDim();
......@@ -47,16 +47,16 @@ namespace AMDiS {
valueDataCollected_ = false;
periodicDataCollected_ = false;
vertexCoords = NEW WorldVector<double>;
vertexCoords = new WorldVector<double>;
}
DataCollector::~DataCollector()
{
DELETE vertexInfos_;
DELETE interpPointInd_;
DELETE interpPointCoords_;
DELETE dofCoords_;
DELETE vertexCoords;
delete vertexInfos_;
delete interpPointInd_;
delete interpPointCoords_;
delete dofCoords_;
delete vertexCoords;
}
void DataCollector::fillAllData()
......
......@@ -32,16 +32,16 @@ namespace AMDiS {
ElInfo2d::ElInfo2d(Mesh *aMesh)
: ElInfo(aMesh)
{
e1 = NEW WorldVector<double>;
e2 = NEW WorldVector<double>;
normal = NEW WorldVector<double>;
e1 = new WorldVector<double>;
e2 = new WorldVector<double>;
normal = new WorldVector<double>;
}
ElInfo2d::~ElInfo2d()
{
DELETE e1;
DELETE e2;
DELETE normal;
delete e1;
delete e2;
delete normal;
}
void ElInfo2d::fillMacroInfo(const MacroElement * mel)
......
......@@ -16,7 +16,7 @@ namespace AMDiS {
ElInfoStack::~ElInfoStack()
{
for (int i = 0; i < static_cast<int>(elInfoStack_.size()); i++) {
DELETE elInfoStack_[i];
delete elInfoStack_[i];
}
}
......
......@@ -53,17 +53,17 @@ namespace AMDiS {
Element::~Element()
{
if (child[0])
DELETE child[0];
delete child[0];
if (child[1])
DELETE child[1];
delete child[1];
if (newCoord)
DELETE newCoord;
delete newCoord;
if (elementData) {
elementData->deleteDecorated();
DELETE elementData;
delete elementData;
}
}
......@@ -75,7 +75,7 @@ namespace AMDiS {
if (elementData->isOfType(typeID)) {
ElementData *tmp = elementData;
elementData = elementData->getDecorated();
DELETE tmp;
delete tmp;
tmp = NULL;
return true;
} else {
......@@ -126,18 +126,18 @@ namespace AMDiS {
Element *el;
if (isLine()) {
el = NEW Line(NULL);
el = new Line(NULL);
} else if (isTriangle()) {
el = NEW Triangle(NULL);
el = new Triangle(NULL);
} else {
el = NEW Tetrahedron(NULL);
el = new Tetrahedron(NULL);
}
el->mesh = mesh;
el->index = index;
el->mark = mark;
if (newCoord) {
WorldVector<double> *nc = NEW WorldVector<double>();
WorldVector<double> *nc = new WorldVector<double>();
*nc = *newCoord;
el->newCoord = nc;
}
......@@ -361,7 +361,7 @@ namespace AMDiS {
void Element::eraseNewCoord() {
if (newCoord != NULL) {
DELETE newCoord;
delete newCoord;
newCoord = NULL;
}
}
......@@ -445,16 +445,16 @@ namespace AMDiS {
if (typeName != "NULL") {
if (typeName == "Line") {
child[0] = NEW Line(NULL);
child[1] = NEW Line(NULL);
child[0] = new Line(NULL);
child[1] = new Line(NULL);
}
if (typeName == "Triangle") {
child[0] = NEW Triangle(NULL);
child[1] = NEW Triangle(NULL);
child[0] = new Triangle(NULL);
child[1] = new Triangle(NULL);
}
if (typeName == "Tetrahedron") {
child[0] = NEW Tetrahedron(NULL);
child[1] = NEW Tetrahedron(NULL);
child[0] = new Tetrahedron(NULL);
child[1] = new Tetrahedron(NULL);
}
child[0]->deserialize(in);
child[1]->deserialize(in);
......@@ -505,7 +505,7 @@ namespace AMDiS {
if (typeName != "NULL") {
if (typeName == "WorldVector") {
newCoord = NEW WorldVector<double>;
newCoord = new WorldVector<double>;
newCoord->deserialize(in);
} else {
ERROR_EXIT("unexpected type name\n");
......
......@@ -372,7 +372,7 @@ namespace AMDiS {
bool remove = elementData->refineElementData(this, child1, child2, elType);
if (remove) {
ElementData *tmp = elementData->getDecorated();
DELETE elementData;
delete elementData;
elementData = tmp;
}
}
......@@ -384,13 +384,13 @@ namespace AMDiS {
childData = child1->getElementData();
if (childData) {
childData->coarsenElementData(this, child1, child2, elType);
DELETE childData;
delete childData;
child1->setElementData(NULL);
}
childData = child2->getElementData();
if (childData) {
childData->coarsenElementData(this, child2, child1, elType);
DELETE childData;
delete childData;
child2->setElementData(NULL);
}
}
......
......@@ -42,7 +42,7 @@ namespace AMDiS {
{
if (decorated_) {
decorated_->deleteDecorated();
DELETE decorated_;
delete decorated_;
}
}
......
......@@ -41,7 +41,7 @@ namespace AMDiS {
{
public:
ElementData* create() {
return NEW ElementRegion_ED;
return new ElementRegion_ED;
}
};
......@@ -59,11 +59,11 @@ namespace AMDiS {
ElementRegion_ED *ep;
ep = NEW ElementRegion_ED(child1->getElementData());
ep = new ElementRegion_ED(child1->getElementData());
ep->region_ = region_;
child1->setElementData(ep);
ep = NEW ElementRegion_ED(child2->getElementData());
ep = new ElementRegion_ED(child2->getElementData());
ep->region_ = region_;
child2->setElementData(ep);
......@@ -71,7 +71,7 @@ namespace AMDiS {
}
ElementData *clone() const {
ElementRegion_ED *newObj = NEW ElementRegion_ED;
ElementRegion_ED *newObj = new ElementRegion_ED;
newObj->region_ = region_;
newObj->decorated_ = ElementData::clone();
return newObj;
......
......@@ -44,7 +44,7 @@ namespace AMDiS {
{
public:
ElementData* create() {
return NEW EmptyElementData;
return new EmptyElementData;
}
};
......@@ -58,13 +58,13 @@ namespace AMDiS {
int elType)
{
ElementData::refineElementData(parent, child1, child2, elType);
child1->setElementData(NEW EmptyElementData(child1->getElementData()));
child2->setElementData(NEW EmptyElementData(child2->getElementData()));
child1->setElementData(new EmptyElementData(child1->getElementData()));
child2->setElementData(new EmptyElementData(child2->getElementData()));
return false;
}
ElementData *clone() const {
EmptyElementData *newObj = NEW EmptyElementData;
EmptyElementData *newObj = new EmptyElementData;
newObj->decorated_ = ElementData::clone();
return newObj;
}
......
......@@ -66,7 +66,7 @@ namespace AMDiS {
nTmpSolutions_ = (*vec)[0].getSize();
solutionVecs_.resize(nTmpSolutions_);
for (int i = 0; i < nTmpSolutions_; i++) {
solutionVecs_[i] = NEW DOFVector<double>(vec->getFESpace(), "");
solutionVecs_[i] = new DOFVector<double>(vec->getFESpace(), "");
}
// Copy the components of the WorldVectors to different DOFVectors
......@@ -89,7 +89,7 @@ namespace AMDiS {
// some created in the constructor.
if (nTmpSolutions_ > 0) {
for (int i = 0; i < nTmpSolutions_; i++) {
DELETE solutionVecs_[i];
delete solutionVecs_[i];
}
}
}
......@@ -167,12 +167,12 @@ namespace AMDiS {
if (writeElem) {
for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++) {
dataCollectors[i] = NEW DataCollector(feSpace, solutionVecs_[i],
dataCollectors[i] = new DataCollector(feSpace, solutionVecs_[i],
level, flag, writeElem);
}
} else {
for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++) {
dataCollectors[i] = NEW DataCollector(feSpace, solutionVecs_[i],
dataCollectors[i] = new DataCollector(feSpace, solutionVecs_[i],
traverseLevel,
flag | traverseFlag,
writeElement);
......@@ -247,7 +247,7 @@ namespace AMDiS {
for (int i = 0; i < static_cast<int>(dataCollectors.size()); i++) {
DELETE dataCollectors[i];
delete dataCollectors[i];
}
}
......
......@@ -58,7 +58,7 @@ namespace AMDiS {
if (&feSpace == this)
return *this;
mesh = NEW Mesh(feSpace.mesh->getName(), feSpace.mesh->getDim());
mesh = new Mesh(feSpace.mesh->getName(), feSpace.mesh->getDim());
*mesh = *(feSpace.mesh);
admin = &(const_cast<DOFAdmin&>(mesh->getDOFAdmin(0)));
basFcts = feSpace.basFcts;
......@@ -92,7 +92,7 @@ namespace AMDiS {
ERROR_EXIT("no fespace found for this admin\n");
return NULL;
} else {
return NEW FiniteElemSpace(NULL, basFcts, mesh, name_);
return new FiniteElemSpace(NULL, basFcts, mesh, name_);
}
}
......@@ -107,7 +107,7 @@ namespace AMDiS {
{
for (int i = 0; i < static_cast<int>(feSpaces.size()); i++) {
if (feSpaces[i]) {
DELETE feSpaces[i];
delete feSpaces[i];
feSpaces[i] = NULL;
}
}
......
......@@ -81,19 +81,19 @@ namespace AMDiS {
if (!optimized) {
newAssembler =
(type == GRD_PSI) ?
dynamic_cast<FirstOrderAssembler*>(NEW Stand10(op, assembler, quad)) :
dynamic_cast<FirstOrderAssembler*>(NEW Stand01(op, assembler, quad));
dynamic_cast<FirstOrderAssembler*>(new Stand10(op, assembler, quad)) :
dynamic_cast<FirstOrderAssembler*>(new Stand01(op, assembler, quad));
} else {
if (pwConst) {
newAssembler =
(type == GRD_PSI) ?
dynamic_cast<FirstOrderAssembler*>(NEW Pre10(op, assembler, quad)) :
dynamic_cast<FirstOrderAssembler*>(NEW Pre01(op, assembler, quad));
dynamic_cast<FirstOrderAssembler*>(new Pre10(op, assembler, quad)) :
dynamic_cast<FirstOrderAssembler*>(new Pre01(op, assembler, quad));
} else {
newAssembler =
(type == GRD_PSI) ?
dynamic_cast<FirstOrderAssembler*>(NEW Quad10(op, assembler, quad)) :
dynamic_cast<FirstOrderAssembler*>(NEW Quad01(op, assembler, quad));
dynamic_cast<FirstOrderAssembler*>(new Quad10(op, assembler, quad)) :
dynamic_cast<FirstOrderAssembler*>(new Quad01(op, assembler, quad));
}
}
......
......@@ -8,7 +8,7 @@ namespace AMDiS {
va_list arg;
va_start(arg, size);
VectorOfFixVecs<DimVec<double> > *result =
NEW VectorOfFixVecs<DimVec<double> >(dim, size, NO_INIT);
new VectorOfFixVecs<DimVec<double> >(dim, size, NO_INIT);
for (int i = 0; i < size; i++) {
for (int j = 0; j < dim + 1; j++) {
(*result)[i][j] = va_arg(arg, double);
......
......@@ -148,7 +148,7 @@ namespace AMDiS {
vec.resize(size);