diff --git a/AMDiS/src/BoundaryManager.cc b/AMDiS/src/BoundaryManager.cc index e80457340fc9d876611bbfe745af9ef36d3464c2..77b806926efa3db5f6992a493b735f1d33621ed0 100644 --- a/AMDiS/src/BoundaryManager.cc +++ b/AMDiS/src/BoundaryManager.cc @@ -15,7 +15,7 @@ namespace AMDiS { dofIndices.resize(omp_get_overall_max_threads()); allocatedMemoryLocalBounds = feSpace->getBasisFcts()->getNumber(); for (int i = 0; i < static_cast<int>(localBounds.size()); i++) - localBounds[i] = GET_MEMORY(BoundaryType, allocatedMemoryLocalBounds); + localBounds[i] = new BoundaryType[allocatedMemoryLocalBounds]; } BoundaryManager::BoundaryManager(BoundaryManager &bm) @@ -25,13 +25,13 @@ namespace AMDiS { localBounds.resize(bm.localBounds.size()); dofIndices.resize(bm.localBounds.size()); for (int i = 0; i < static_cast<int>(localBounds.size()); i++) - localBounds[i] = GET_MEMORY(BoundaryType, allocatedMemoryLocalBounds); + localBounds[i] = new BoundaryType[allocatedMemoryLocalBounds]; } BoundaryManager::~BoundaryManager() { for (int i = 0; i < static_cast<int>(localBounds.size()); i++) - FREE_MEMORY(localBounds[i], BoundaryType, allocatedMemoryLocalBounds); + delete [] localBounds[i]; } double BoundaryManager::boundResidual(ElInfo *elInfo, @@ -40,10 +40,10 @@ namespace AMDiS { { double result = 0.0; std::map<BoundaryType, BoundaryCondition*>::iterator it; - for (it = localBCs.begin(); it != localBCs.end(); ++it) { + for (it = localBCs.begin(); it != localBCs.end(); ++it) if ((*it).second) result += (*it).second->boundResidual(elInfo, matrix, dv); - } + return result; } diff --git a/AMDiS/src/DOFVector.cc b/AMDiS/src/DOFVector.cc index 718a3bd4cdddc61f4e597ecbd41452d6a2c9ad11..c2eb996cb48bd6d6420c3c05c37ae2986a80a274 100644 --- a/AMDiS/src/DOFVector.cc +++ b/AMDiS/src/DOFVector.cc @@ -484,7 +484,7 @@ namespace AMDiS { this->set(0.0); DegreeOfFreedom *myLocalIndices = localIndices[omp_get_thread_num()]; - double *sourceLocalCoeffs = GET_MEMORY(double, nSourceBasisFcts); + double *sourceLocalCoeffs = new double[nSourceBasisFcts]; if (feSpace->getMesh() == sourceFeSpace->getMesh()) { DimVec<double> *coords = NULL; @@ -552,7 +552,7 @@ namespace AMDiS { } } - FREE_MEMORY(sourceLocalCoeffs, double, nSourceBasisFcts); + delete [] sourceLocalCoeffs; } @@ -564,12 +564,10 @@ namespace AMDiS { this->set(nul); DimVec<double> *coords = NULL; - const FiniteElemSpace *vFESpace = v->getFESpace(); - if (feSpace == vFESpace) { + if (feSpace == vFESpace) WARNING("same FE-spaces\n"); - } const BasisFunction *basFcts = feSpace->getBasisFcts(); const BasisFunction *vBasFcts = vFESpace->getBasisFcts(); diff --git a/AMDiS/src/DataCollector.cc b/AMDiS/src/DataCollector.cc index 4370b3b47a84f0fd894ec9997bc1740fbfc9e6ce..b533bc574182d57c8c50410cbfba0fa7680e40a5 100644 --- a/AMDiS/src/DataCollector.cc +++ b/AMDiS/src/DataCollector.cc @@ -124,7 +124,7 @@ namespace AMDiS { basisFcts_ = const_cast<BasisFunction*>(feSpace_->getBasisFcts()); nBasisFcts_ = basisFcts_->getNumber(); - localDOFs_ = GET_MEMORY(DegreeOfFreedom, nBasisFcts_); + localDOFs_ = new DegreeOfFreedom[nBasisFcts_]; TraverseStack stack; @@ -161,10 +161,10 @@ namespace AMDiS { } } - FREE_MEMORY(localDOFs_, DegreeOfFreedom, nBasisFcts_); + delete [] localDOFs_; valueDataCollected_ = true; - return(0); + return 0; } int DataCollector::startCollectingPeriodicData() diff --git a/AMDiS/src/Element.cc b/AMDiS/src/Element.cc index 6bc7b18050f01a27c9dc7823e925a2164face179..8dfd646b8921eea80a142da24adb225f1ad1a4db 100644 --- a/AMDiS/src/Element.cc +++ b/AMDiS/src/Element.cc @@ -103,7 +103,7 @@ namespace AMDiS { if (dof[j]) { if (deletedDOFs.count(dof[j]) == 0) { deletedDOFs[dof[j]] = true; - FREE_MEMORY(dof[j], DegreeOfFreedom, ndof); + delete [] dof[j]; } } j++; @@ -113,12 +113,10 @@ namespace AMDiS { FREE_MEMORY(dof, DegreeOfFreedom*, mesh->getNumberOfNodes()); - if (child[0]) { + if (child[0]) child[0]->deleteElementDOFs(); - } - if (child[1]) { + if (child[1]) child[1]->deleteElementDOFs(); - } } Element* Element::cloneWithDOFs() @@ -144,7 +142,7 @@ namespace AMDiS { /* =========== And here we clone the DOFs =========== */ - el->dof = GET_MEMORY(DegreeOfFreedom*, mesh->getNumberOfNodes()); + el->dof = new DegreeOfFreedom*[mesh->getNumberOfNodes()]; int dim = mesh->getDim(); int j = 0; @@ -153,18 +151,17 @@ namespace AMDiS { GeoIndex position = INDEX_OF_DIM(pos, dim); int ndof = 0; - for (int i = 0; i < mesh->getNumberOfDOFAdmin(); i++) { + for (int i = 0; i < mesh->getNumberOfDOFAdmin(); i++) ndof += mesh->getDOFAdmin(i).getNumberOfDOFs(position); - } if (ndof > 0) { for (int i = 0; i < mesh->getGeo(position); i++) { if (dof[j] != NULL) { if (Mesh::serializedDOFs[dof[j][0]] == NULL) { - el->dof[j] = GET_MEMORY(DegreeOfFreedom, ndof); - for (int k = 0; k < ndof; k++) { + el->dof[j] = new DegreeOfFreedom[ndof]; + for (int k = 0; k < ndof; k++) el->dof[j][k] = dof[j][k]; - } + Mesh::serializedDOFs[dof[j][0]] = el->dof[j]; } else { el->dof[j] = Mesh::serializedDOFs[dof[j][0]]; @@ -466,7 +463,7 @@ namespace AMDiS { int nodes; in.read(reinterpret_cast<char*>(&nodes), sizeof(int)); - dof = GET_MEMORY(DegreeOfFreedom*, nodes); + dof = new DegreeOfFreedom*[nodes]; for (int i = 0; i < nodes; i++) { int dofs; @@ -474,11 +471,11 @@ namespace AMDiS { if (dofs) { if (dofs != -1) { - dof[i] = GET_MEMORY(DegreeOfFreedom, dofs); + dof[i] = new DegreeOfFreedom[dofs]; in.read(reinterpret_cast<char*>(dof[i]), dofs * sizeof(DegreeOfFreedom)); if (Mesh::serializedDOFs[dof[i][0]] != NULL) { DegreeOfFreedom *dofPtr = Mesh::serializedDOFs[dof[i][0]]; - FREE_MEMORY(dof[i], DegreeOfFreedom, dofs); + delete [] dof[i]; dof[i] = dofPtr; } else { Mesh::serializedDOFs[dof[i][0]] = dof[i]; diff --git a/AMDiS/src/FixVec.cc b/AMDiS/src/FixVec.cc index e087e080e40b0f59ac50a6c034f9b4bacb8bd4ce..6073c5524fd08423051f84aa5b6d104e3841010f 100644 --- a/AMDiS/src/FixVec.cc +++ b/AMDiS/src/FixVec.cc @@ -9,24 +9,21 @@ namespace AMDiS { va_start(arg, size); VectorOfFixVecs<DimVec<double> > *result = new VectorOfFixVecs<DimVec<double> >(dim, size, NO_INIT); - for (int i = 0; i < size; i++) { - for (int j = 0; j < dim + 1; j++) { + for (int i = 0; i < size; i++) + for (int j = 0; j < dim + 1; j++) (*result)[i][j] = va_arg(arg, double); - } - } va_end(arg); return result; - }; + } double* createAndInitArray(int size, ...) { va_list arg; va_start(arg, size); - double *result = GET_MEMORY(double, size); + double *result = new double[size]; - for (int i = 0; i < size; i++) { + for (int i = 0; i < size; i++) result[i] = va_arg(arg, double); - } va_end(arg); return result; diff --git a/AMDiS/src/GNUPlotWriter.cc b/AMDiS/src/GNUPlotWriter.cc index 90d7b54463e8b8acf77cdcb41b6f7bf6ae57904c..488654b237de209f0cfa5555e3526a17754bcd15 100644 --- a/AMDiS/src/GNUPlotWriter.cc +++ b/AMDiS/src/GNUPlotWriter.cc @@ -22,51 +22,44 @@ namespace AMDiS { void GNUPlotWriter::writeFiles(AdaptInfo *adaptInfo, bool force) { DOFVector<WorldVector<double> > coords(feSpace_, "coords"); - Mesh *mesh = feSpace_->getMesh(); - int dow = Global::getGeo(WORLD); - const BasisFunction *basFcts = feSpace_->getBasisFcts(); - int i, numFcts = basFcts->getNumber(); - DegreeOfFreedom *localDOFs = GET_MEMORY(DegreeOfFreedom, numFcts); + int numFcts = basFcts->getNumber(); + DegreeOfFreedom *localDOFs = new DegreeOfFreedom[numFcts]; TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS); - while(elInfo) { + while (elInfo) { basFcts->getLocalIndices(elInfo->getElement(), feSpace_->getAdmin(), localDOFs); - for(i = 0; i < numFcts; i++) { + for (int i = 0; i < numFcts; i++) coords[localDOFs[i]] = elInfo->getCoord(i); - } + elInfo = stack.traverseNext(elInfo); } - FREE_MEMORY(localDOFs, DegreeOfFreedom, numFcts); + delete [] localDOFs; FILE *file = NULL; if (!(file = fopen(filename_.c_str(), "w"))) - { - ERROR("could not open file %s for writing\n", filename_.c_str()); - } + ERROR("could not open file %s for writing\n", filename_.c_str()); fprintf(file, "# line format: time x y z val1[x,y,z] val2[x,y,z] ...\n"); DOFVector<WorldVector<double> >::Iterator coordsIt(&coords, USED_DOFS); int index, numVecs = static_cast<int>(dofVectors_.size()); - for(coordsIt.reset(); !coordsIt.end(); ++coordsIt) { + for (coordsIt.reset(); !coordsIt.end(); ++coordsIt) { index = coordsIt.getDOFIndex(); fprintf(file, "%e ", adaptInfo->getTime()); - for(i = 0; i < dow; i++) { + for (int i = 0; i < dow; i++) fprintf(file, "%e ", (*coordsIt)[i]); - } - for(i = 0; i < numVecs; i++) { + for (int i = 0; i < numVecs; i++) fprintf(file, "%e ", (*(dofVectors_[i]))[index]); - } fprintf(file, "\n"); } } diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 27ee75376d7a69abfaf7bb30129dba8df95d26ee..41894b57e117fb6bb6cd5beb87e5bb81ea6ecca8 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -494,7 +494,7 @@ namespace AMDiS { if (ndof <= 0) return NULL; - DegreeOfFreedom *dof = GET_MEMORY(DegreeOfFreedom, ndof); + DegreeOfFreedom *dof = new DegreeOfFreedom[ndof]; for (int i = 0; i < getNumberOfDOFAdmin(); i++) { const DOFAdmin *localAdmin = &getDOFAdmin(i); @@ -505,9 +505,8 @@ namespace AMDiS { TEST_EXIT_DBG(n + n0 <= ndof)("n=%d, n0=%d too large: ndof=%d\n", n, n0, ndof); - for (int j = 0; j < n; j++) { + for (int j = 0; j < n; j++) dof[n0 + j] = const_cast<DOFAdmin*>(localAdmin)->getDOFIndex(); - } } return dof; @@ -521,7 +520,7 @@ namespace AMDiS { if (nNodeEl <= 0) return NULL; - DegreeOfFreedom **ptrs = GET_MEMORY(DegreeOfFreedom*, nNodeEl); + DegreeOfFreedom **ptrs = new DegreeOfFreedom*[nNodeEl]; for (int i = 0; i < nNodeEl; i++) ptrs[i] = NULL; @@ -537,7 +536,7 @@ namespace AMDiS { if (nNodeEl <= 0) return; - FREE_MEMORY(ptrs, DegreeOfFreedom*, nNodeEl); + delete [] ptrs; } @@ -606,7 +605,7 @@ namespace AMDiS { localAdmin->freeDOFIndex(dof[n0 + j]); } - FREE_MEMORY(dof, DegreeOfFreedom, ndof); + delete [] dof; } void Mesh::freeElement(Element* el) diff --git a/AMDiS/src/NonLinUpdater.cc b/AMDiS/src/NonLinUpdater.cc index 9f866f11bed991310786138a6cf2345604177c97..42af007ccd73ff7466d843d5a44d0631b47957b6 100644 --- a/AMDiS/src/NonLinUpdater.cc +++ b/AMDiS/src/NonLinUpdater.cc @@ -26,9 +26,8 @@ namespace AMDiS { const FiniteElemSpace *feSpace = F ? F->getFESpace() : df->getFESpace(); - if (updateDF) { + if (updateDF) df->clear(); - } BasisFunction *basFcts = const_cast<BasisFunction*>(feSpace->getBasisFcts()); @@ -43,24 +42,21 @@ namespace AMDiS { Mesh::FILL_DET| Mesh::FILL_GRD_LAMBDA; - BoundaryType *bound = GET_MEMORY(BoundaryType, feSpace->getBasisFcts()->getNumber()); + BoundaryType *bound = new BoundaryType[feSpace->getBasisFcts()->getNumber()]; el_info = stack.traverseFirst(feSpace->getMesh(), -1, fill_flag); while (el_info) { basFcts->getBound(el_info, bound); - if (updateDF) { + if (updateDF) df->assemble(1.0, el_info, bound); - } - - if (F) { + if (F) F->assemble(1.0, el_info, bound); - } el_info = stack.traverseNext(el_info); } - FREE_MEMORY(bound, BoundaryType, feSpace->getBasisFcts()->getNumber()); + delete [] bound; } void NonLinUpdaterVec::update(bool updateDF, @@ -89,13 +85,10 @@ namespace AMDiS { if (updateDF) { TEST_EXIT(df)("df not set but update tried!\n"); - for (int i = 0; i < size; i++) { - for (int j = 0; j < size; j++) { - if ((*df)[i][j]) { + for (int i = 0; i < size; i++) + for (int j = 0; j < size; j++) + if ((*df)[i][j]) (*df)[i][j]->clear(); - } - } - } } BasisFunction *basFcts = const_cast<BasisFunction*>(feSpace->getBasisFcts()); @@ -113,32 +106,26 @@ namespace AMDiS { Mesh::FILL_DET| Mesh::FILL_GRD_LAMBDA; - BoundaryType *bound = GET_MEMORY(BoundaryType, basFcts->getNumber()); + BoundaryType *bound = new BoundaryType[basFcts->getNumber()]; el_info = stack.traverseFirst(feSpace->getMesh(), -1, fill_flag); while (el_info) { basFcts->getBound(el_info, bound); - if (updateDF) { - for (int i = 0; i < size; i++) { - for (int j = 0; j < size; j++) { - if ((*df)[i][j]) { + if (updateDF) + for (int i = 0; i < size; i++) + for (int j = 0; j < size; j++) + if ((*df)[i][j]) (*df)[i][j]->assemble(1.0, el_info, bound); - } - } - } - } - if (F) { - for(int i = 0; i < size; i++) { + if (F) + for(int i = 0; i < size; i++) F->getDOFVector(i)->assemble(1.0, el_info, bound); - } - } el_info = stack.traverseNext(el_info); } - FREE_MEMORY(bound, BoundaryType, basFcts->getNumber()); - }; + delete [] bound; + } } diff --git a/AMDiS/src/PeriodicBC.cc b/AMDiS/src/PeriodicBC.cc index b6c6e400156b3cea1eee1b7a4ad3962884ec868e..108183ba8bbef6bd34f12e8b50ff4404314ec8b6 100644 --- a/AMDiS/src/PeriodicBC.cc +++ b/AMDiS/src/PeriodicBC.cc @@ -9,18 +9,17 @@ namespace AMDiS { - ::std::vector<PeriodicDOFMapping*> PeriodicDOFMapping::mappings_; + std::vector<PeriodicDOFMapping*> PeriodicDOFMapping::mappings_; PeriodicDOFMapping* PeriodicDOFMapping::providePeriodicDOFMapping(const BasisFunction *basFcts) { - ::std::vector<PeriodicDOFMapping*>::iterator it; - ::std::vector<PeriodicDOFMapping*>::iterator end = mappings_.end(); - for(it = mappings_.begin(); it != end; ++it) { - if((*it)->basFcts_ == basFcts) { + std::vector<PeriodicDOFMapping*>::iterator it; + std::vector<PeriodicDOFMapping*>::iterator end = mappings_.end(); + for (it = mappings_.begin(); it != end; ++it) + if ((*it)->basFcts_ == basFcts) return *it; - } - } + PeriodicDOFMapping *newMapping = new PeriodicDOFMapping(basFcts); mappings_.push_back(newMapping); return newMapping; @@ -32,9 +31,9 @@ namespace AMDiS { { FUNCNAME("PeriodicDOFMapping::PeriodicDOFMapping()"); TEST_EXIT(basFcts_->getDim() > 1)("dim == 1\n"); - int i, num = basFcts_->getNumber(); + int num = basFcts_->getNumber(); DimVec<double> *lambda; - for(i = 0; i < num; i++) { + for (int i = 0; i < num; i++) { lambda = basFcts_->getCoords(i); indexOfCoords_[*lambda] = i; } @@ -42,16 +41,13 @@ namespace AMDiS { PeriodicDOFMapping::~PeriodicDOFMapping() { - ::std::map<DimVec<int>, DegreeOfFreedom*, DimVecLess<int> >::iterator it; - for(it = dofPermutation_.begin(); it != dofPermutation_.end(); ++it) { - if(it->second) { - FREE_MEMORY(it->second, DegreeOfFreedom, basFcts_->getNumber()); - } - } + std::map<DimVec<int>, DegreeOfFreedom*, DimVecLess<int> >::iterator it; + for (it = dofPermutation_.begin(); it != dofPermutation_.end(); ++it) + if (it->second) + delete [] it->second; } - const DegreeOfFreedom - *PeriodicDOFMapping::getDOFPermutation(const DimVec<int> &vertexPermutation) + const DegreeOfFreedom *PeriodicDOFMapping::getDOFPermutation(const DimVec<int> &vertexPermutation) { FUNCNAME("PeriodicDOFMapping::getDOFPermutation()"); @@ -74,7 +70,7 @@ namespace AMDiS { DimVec<double> *lambda; DimVec<double> newLambda(dim, NO_INIT); - DegreeOfFreedom *mapping = GET_MEMORY(DegreeOfFreedom, num); + DegreeOfFreedom *mapping = new DegreeOfFreedom[num]; for(i = 0; i < num; i++) { lambda = basFcts_->getCoords(i); @@ -121,7 +117,7 @@ namespace AMDiS { boundaryType); const BasisFunction *basFcts = rowFESpace->getBasisFcts(); - neighIndices_ = GET_MEMORY(DegreeOfFreedom, basFcts->getNumber()); + neighIndices_ = new DegreeOfFreedom[basFcts->getNumber()]; } } @@ -210,8 +206,7 @@ namespace AMDiS { TEST_EXIT(matrix)("no matrix\n"); if (matrix == masterMatrix_) { - FREE_MEMORY(neighIndices_, DegreeOfFreedom, - rowFESpace()->getBasisFcts()->getNumber()); + delete [] neighIndices_; masterMatrix_ = NULL; } diff --git a/AMDiS/src/Quadrature.cc b/AMDiS/src/Quadrature.cc index 31a25526bb3cd61401b359bed5507467b544b9fd..f9645b1132ed646672077d4169abb06eb61a5670 100644 --- a/AMDiS/src/Quadrature.cc +++ b/AMDiS/src/Quadrature.cc @@ -21,11 +21,10 @@ namespace AMDiS { lambda = new VectorOfFixVecs<DimVec<double> >(*(q.lambda)); // copy weights - w = GET_MEMORY(double, n_points); + w = new double[n_points]; - for (int i = 0; i < n_points; i++) { + for (int i = 0; i < n_points; i++) w[i] = q.w[i]; - } } /****************************************************************************/ @@ -83,16 +82,15 @@ namespace AMDiS { } else { if (static_cast<int>( size) < n_points) { size_t new_size = std::max(maxNQuadPoints[dim], n_points); - FREE_MEMORY(quad_vec, double, size); - quad_vec = GET_MEMORY(double, new_size); + delete [] quad_vec; + quad_vec = new double[new_size]; size = new_size; } val = quad_vec; } - for (int i = 0; i < n_points; i++) { + for (int i = 0; i < n_points; i++) val[i] = f((*lambda)[i]); - } return(const_cast<const double *>(val)); } @@ -1509,17 +1507,15 @@ namespace AMDiS { if (!phi && init_flag.isSet(INIT_PHI)) { // check flag // allocate memory - phi = GET_MEMORY(double*, nPoints); - for (int i = 0; i < nPoints; i++) { - phi[i] = GET_MEMORY(double, nBasFcts); - } + phi = new double*[nPoints]; + for (int i = 0; i < nPoints; i++) + phi[i] = new double[nBasFcts]; // fill memory for (int i = 0; i< nPoints; i++) { lambda = quadrature->getLambda(i); - for (int j = 0; j < nBasFcts; j++) { + for (int j = 0; j < nBasFcts; j++) phi[i][j] = (*(basisFunctions->getPhi(j)))(lambda); - } } // update flag @@ -1584,31 +1580,26 @@ namespace AMDiS { int nBasFcts = basisFunctions->getNumber(); if (fastQuad.phi) { - phi = GET_MEMORY(double*, nPoints); + phi = new double*[nPoints]; for (int i = 0; i < nPoints; i++) { - phi[i] = GET_MEMORY(double, nBasFcts); - for (int j = 0; j < nBasFcts; j++) { + phi[i] = new double[nBasFcts]; + for (int j = 0; j < nBasFcts; j++) phi[i][j] = fastQuad.phi[i][j]; - } } } if (fastQuad.grdPhi) { grdPhi = new MatrixOfFixVecs<DimVec<double> >(dim, nPoints, nBasFcts, NO_INIT); - for (int i = 0; i < nPoints; i++) { - for (int j = 0; j < nBasFcts; j++) { + for (int i = 0; i < nPoints; i++) + for (int j = 0; j < nBasFcts; j++) (*grdPhi)[i][j] = (*(fastQuad.grdPhi))[i][j]; - } - } } if (fastQuad.D2Phi) { D2Phi = new MatrixOfFixVecs<DimMat<double> >(dim, nPoints, nBasFcts, NO_INIT); - for (int i = 0; i < nPoints; i++) { - for (int j = 0; j < nBasFcts; j++) { + for (int i = 0; i < nPoints; i++) + for (int j = 0; j < nBasFcts; j++) (*D2Phi)[i][j] = (*(fastQuad.D2Phi))[i][j]; - } - } } } @@ -1616,20 +1607,21 @@ namespace AMDiS { { int nPoints = quadrature->getNumPoints(); - for (int i = 0; i < nPoints; i++) { - FREE_MEMORY(phi[i], double, basisFunctions->getNumber()); - } + for (int i = 0; i < nPoints; i++) + delete [] phi[i]; - FREE_MEMORY(phi, double*, nPoints); + delete [] phi; delete grdPhi; delete D2Phi; } - const double FastQuadrature::getSecDer(int q,int i ,int j, int m) const { + const double FastQuadrature::getSecDer(int q,int i ,int j, int m) const + { return (D2Phi) ? (*D2Phi)[q][i][j][m] : 0.0; } - const VectorOfFixVecs<DimMat<double> > *FastQuadrature::getSecDer(int q) const { + const VectorOfFixVecs<DimMat<double> > *FastQuadrature::getSecDer(int q) const + { return D2Phi ? (&((*D2Phi)[q])) : NULL; } } diff --git a/AMDiS/src/Recovery.cc b/AMDiS/src/Recovery.cc index 65dbababcf80a5241782c1133e3b5ffd49e57585..ccff6ec1268333c391e36db37e219bee67e65762 100644 --- a/AMDiS/src/Recovery.cc +++ b/AMDiS/src/Recovery.cc @@ -302,7 +302,7 @@ void Recovery::compute_integrals(DOFVector<double> *uh, ElInfo *elInfo, (*matrix_fcts)[0][i]->getDegree() + deg_f); n_points = quad->getNumPoints(); - double *uhAtQP = GET_MEMORY(double, n_points); + double *uhAtQP = new double[n_points]; // Computing contributions to right hand side. if (gradient) // For gradient recovery. @@ -349,10 +349,8 @@ void Recovery::compute_integrals(DOFVector<double> *uh, ElInfo *elInfo, } (*rec_struct->rec_uh)[i] += sum * elInfo->getDet(); } - FREE_MEMORY(uhAtQP, double, n_points); + delete [] uhAtQP; } - - return; } void Recovery::compute_interior_sums(DOFVector<double> *uh, ElInfo *elInfo, @@ -367,14 +365,14 @@ void Recovery::compute_interior_sums(DOFVector<double> *uh, ElInfo *elInfo, TEST_EXIT_DBG(!(f_vec && f_scal))("Only one diffusion function, please!\n"); - int i, j, k; + int i, j, k; double sum; WorldVector<double> vec_sum; int n_points = quad->getNumPoints(); WorldVector<double> quad_pts; // For world coordinates of quadrature points. - double *uhAtQP = GET_MEMORY(double, n_points); + double *uhAtQP = new double[n_points]; WorldVector<double> *grdAtQP = new WorldVector<double>[n_points]; for (i=0; i<n_monomials; i++) @@ -418,10 +416,8 @@ void Recovery::compute_interior_sums(DOFVector<double> *uh, ElInfo *elInfo, (*rec_struct->rec_grdUh)[i] = (*rec_struct->rec_grdUh)[i] + vec_sum; } - FREE_MEMORY(uhAtQP, double, n_points); + delete [] uhAtQP; delete [] grdAtQP; - - return; } void Recovery::compute_node_sums(DOFVector<double> *uh, ElInfo *elInfo, diff --git a/AMDiS/src/RecoveryEstimator.cc b/AMDiS/src/RecoveryEstimator.cc index 479977f3eb24add2224d6d42e0f9f852cb7f8fac..df129567d575e6b090b9303feefa845cc17574f3 100644 --- a/AMDiS/src/RecoveryEstimator.cc +++ b/AMDiS/src/RecoveryEstimator.cc @@ -96,10 +96,10 @@ double RecoveryEstimator::estimate(double timestep) WorldVector<double> *grdAtQP = new WorldVector<double>[numPoints]; WorldVector<double> *recoveryGrdAtQP = new WorldVector<double>[numPoints]; - double *uhAtQP = GET_MEMORY(double, numPoints); - double *recoveryUhAtQP = GET_MEMORY(double, numPoints); + double *uhAtQP = new double[numPoints]; + double *recoveryUhAtQP = new double[numPoints]; - FastQuadrature *quadFast = + FastQuadrature *quadFast = FastQuadrature::provideFastQuadrature(basFcts, *quad, INIT_PHI | INIT_GRD_PHI); FastQuadrature *rec_quadFast = @@ -215,8 +215,8 @@ double RecoveryEstimator::estimate(double timestep) delete [] grdAtQP; delete [] recoveryGrdAtQP; - FREE_MEMORY(uhAtQP, double, numPoints); - FREE_MEMORY(recoveryUhAtQP, double, numPoints); + delete [] uhAtQP; + delete [] recoveryUhAtQP; return(est_sum); }