Commit f696ed01 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Removed some *_MEMORY macros

parent cdf68971
...@@ -102,7 +102,9 @@ namespace AMDiS { ...@@ -102,7 +102,9 @@ namespace AMDiS {
std::cout.precision(10); std::cout.precision(10);
for (cursor_type cursor = begin<major>(matrix), cend = end<major>(matrix); cursor != cend; ++cursor) { for (cursor_type cursor = begin<major>(matrix), cend = end<major>(matrix); cursor != cend; ++cursor) {
for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); icursor != icend; ++icursor) for (icursor_type icursor = begin<nz>(cursor), icend = end<nz>(cursor); icursor != icend; ++icursor)
std::cout << "(" << row(*icursor) << "," << col(*icursor) << "," << value(*icursor) << ") "; if (value(*icursor) != 0.0)
std::cout << "(" << row(*icursor) << "," << col(*icursor) << "," << value(*icursor) << ") ";
std::cout << "\n"; std::cout << "\n";
} }
} }
......
...@@ -781,7 +781,7 @@ namespace AMDiS { ...@@ -781,7 +781,7 @@ namespace AMDiS {
assembleBoundaryConditions(rhs->getDOFVector(i), assembleBoundaryConditions(rhs->getDOFVector(i),
solution->getDOFVector(i), solution->getDOFVector(i),
componentMeshes[i], componentMeshes[i],
assembleFlag); assembleFlag);
} }
int nnz = 0; int nnz = 0;
...@@ -792,7 +792,7 @@ namespace AMDiS { ...@@ -792,7 +792,7 @@ namespace AMDiS {
if ((*systemMatrix)[i][j]) { if ((*systemMatrix)[i][j]) {
(*systemMatrix)[i][j]->finishInsertion(); (*systemMatrix)[i][j]->finishInsertion();
nnz += (*systemMatrix)[i][j]->getBaseMatrix().nnz(); nnz += (*systemMatrix)[i][j]->getBaseMatrix().nnz();
} }
solverMatrix.setMatrix(*systemMatrix); solverMatrix.setMatrix(*systemMatrix);
......
...@@ -38,8 +38,8 @@ namespace AMDiS { ...@@ -38,8 +38,8 @@ namespace AMDiS {
TEST_EXIT_DBG(nSystems > 0)("no system set\n"); TEST_EXIT_DBG(nSystems > 0)("no system set\n");
dim = mesh->getDim(); dim = mesh->getDim();
basFcts = GET_MEMORY(const BasisFunction*, nSystems); basFcts = new const BasisFunction*[nSystems];
quadFast = GET_MEMORY(FastQuadrature*, nSystems); quadFast = new FastQuadrature*[nSystems];
degree = 0; degree = 0;
for (int system = 0; system < nSystems; system++) { for (int system = 0; system < nSystems; system++) {
...@@ -63,21 +63,21 @@ namespace AMDiS { ...@@ -63,21 +63,21 @@ namespace AMDiS {
flag); flag);
} }
uhEl = GET_MEMORY(double*, nSystems); uhEl = new double*[nSystems];
uhNeigh = GET_MEMORY(double*, nSystems); uhNeigh = new double*[nSystems];
uhOldEl = timestep ? GET_MEMORY(double*, nSystems) : NULL; uhOldEl = timestep ? new double*[nSystems] : NULL;
for (int system = 0; system < nSystems; system++) { for (int system = 0; system < nSystems; system++) {
uhEl[system] = GET_MEMORY(double, basFcts[system]->getNumber()); uhEl[system] = new double[basFcts[system]->getNumber()];
uhNeigh[system] = GET_MEMORY(double, basFcts[system]->getNumber()); uhNeigh[system] = new double[basFcts[system]->getNumber()];
if (timestep) if (timestep)
uhOldEl[system] = GET_MEMORY(double, basFcts[system]->getNumber()); uhOldEl[system] = new double[basFcts[system]->getNumber()];
} }
uhQP = timestep ? GET_MEMORY(double, nPoints) : NULL; uhQP = timestep ? new double[nPoints] : NULL;
uhOldQP = timestep ? GET_MEMORY(double, nPoints) : NULL; uhOldQP = timestep ? new double[nPoints] : NULL;
riq = GET_MEMORY(double, nPoints); riq = new double[nPoints];
grdUh_qp = NULL; grdUh_qp = NULL;
D2uhqp = NULL; D2uhqp = NULL;
...@@ -131,42 +131,38 @@ namespace AMDiS { ...@@ -131,42 +131,38 @@ namespace AMDiS {
est_t_sum = sqrt(est_t_sum); est_t_sum = sqrt(est_t_sum);
for (int system = 0; system < nSystems; system++) { for (int system = 0; system < nSystems; system++) {
FREE_MEMORY(uhEl[system], double, basFcts[system]->getNumber()); delete [] uhEl[system];
FREE_MEMORY(uhNeigh[system], double, basFcts[system]->getNumber()); delete [] uhNeigh[system];
if (timestep) if (timestep)
FREE_MEMORY(uhOldEl[system], double, basFcts[system]->getNumber()); delete [] uhOldEl[system];
} }
FREE_MEMORY(uhEl, double*, nSystems); delete [] uhEl;
FREE_MEMORY(uhNeigh, double*, nSystems); delete [] uhNeigh;
if (timestep) { if (timestep) {
FREE_MEMORY(uhOldEl, double*, nSystems); delete [] uhOldEl;
FREE_MEMORY(uhQP, double, nPoints); delete [] uhQP;
FREE_MEMORY(uhOldQP, double, nPoints); delete [] uhOldQP;
} else { } else {
if (uhQP != NULL) { if (uhQP != NULL)
FREE_MEMORY(uhQP, double, nPoints); delete [] uhQP;
}
} }
if (output) { if (output) {
MSG("estimate = %.8e\n", est_sum); MSG("estimate = %.8e\n", est_sum);
if (C3) { if (C3)
MSG("time estimate = %.8e\n", est_t_sum); MSG("time estimate = %.8e\n", est_t_sum);
}
} }
FREE_MEMORY(riq, double, nPoints); delete [] riq;
FREE_MEMORY(basFcts, const BasisFunction*, nSystems); delete [] basFcts;
FREE_MEMORY(quadFast, FastQuadrature*, nSystems); delete [] quadFast;
if (grdUh_qp != NULL) { if (grdUh_qp != NULL)
FREE_MEMORY(grdUh_qp, WorldVector<double>, nPoints); delete [] grdUh_qp;
} if (D2uhqp != NULL)
if (D2uhqp != NULL) { delete [] D2uhqp;
FREE_MEMORY(D2uhqp, WorldMatrix<double>, nPoints);
}
if (C1 && (dim > 1)) { if (C1 && (dim > 1)) {
delete lambdaNeigh_; delete lambdaNeigh_;
...@@ -247,7 +243,7 @@ namespace AMDiS { ...@@ -247,7 +243,7 @@ namespace AMDiS {
++it, ++itfac) { ++it, ++itfac) {
if (*itfac == NULL || **itfac != 0.0) { if (*itfac == NULL || **itfac != 0.0) {
if ((uhQP == NULL) && (*it)->zeroOrderTerms()) { if ((uhQP == NULL) && (*it)->zeroOrderTerms()) {
uhQP = GET_MEMORY(double, nPoints); uhQP = new double[nPoints];
uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP); uh[system]->getVecAtQPs(elInfo, NULL, quadFast[system], uhQP);
} }
if ((grdUh_qp == NULL) && ((*it)->firstOrderTermsGrdPsi() || (*it)->firstOrderTermsGrdPhi())) { if ((grdUh_qp == NULL) && ((*it)->firstOrderTermsGrdPsi() || (*it)->firstOrderTermsGrdPhi())) {
......
...@@ -238,7 +238,7 @@ namespace AMDiS { ...@@ -238,7 +238,7 @@ namespace AMDiS {
TEST_EXIT(basFcts == rowFESpace->getBasisFcts())("invalid basFcts\n"); TEST_EXIT(basFcts == rowFESpace->getBasisFcts())("invalid basFcts\n");
double *uhEl = GET_MEMORY(double, basFcts->getNumber()); double *uhEl = new double[basFcts->getNumber()];
dv->getLocalVector(elInfo->getElement(), uhEl); dv->getLocalVector(elInfo->getElement(), uhEl);
...@@ -332,7 +332,7 @@ namespace AMDiS { ...@@ -332,7 +332,7 @@ namespace AMDiS {
} }
} }
FREE_MEMORY(uhEl, double, basFcts->getNumber()); delete [] uhEl;
return det * val; return det * val;
} }
......
...@@ -185,7 +185,7 @@ namespace AMDiS { ...@@ -185,7 +185,7 @@ namespace AMDiS {
int numNewNodes; int numNewNodes;
int numNodes; int numNodes;
bool validElement; bool validElement;
double *nodeCoords = GET_MEMORY(double, numBasFcts * dim); double *nodeCoords = new double[numBasFcts * dim];
DOFVector<char> alreadyAdded(feSpace_, "already added nodes"); DOFVector<char> alreadyAdded(feSpace_, "already added nodes");
alreadyAdded.set(0); alreadyAdded.set(0);
...@@ -198,8 +198,8 @@ namespace AMDiS { ...@@ -198,8 +198,8 @@ namespace AMDiS {
const DegreeOfFreedom *elementDofs = NULL; const DegreeOfFreedom *elementDofs = NULL;
DegreeOfFreedom dof; DegreeOfFreedom dof;
DegreeOfFreedom *nodeIndices = GET_MEMORY(int, numBasFcts); DegreeOfFreedom *nodeIndices = new int[numBasFcts];
DegreeOfFreedom *newNodeIndices = GET_MEMORY(int, numBasFcts); DegreeOfFreedom *newNodeIndices = new int[numBasFcts];
Flag fillFlag = Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS; Flag fillFlag = Mesh::CALL_LEAF_EL | Mesh::FILL_COORDS;
...@@ -391,12 +391,11 @@ namespace AMDiS { ...@@ -391,12 +391,11 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
FREE_MEMORY(nodeCoords, double, numBasFcts * dim); delete [] nodeCoords;
FREE_MEMORY(nodeIndices, int, numBasFcts); delete [] nodeIndices;
FREE_MEMORY(newNodeIndices, int, numBasFcts); delete [] newNodeIndices;
smiError = SMI_End_write_transaction(smiApplicationId_, smiError = SMI_End_write_transaction(smiApplicationId_, smiMeshId_);
smiMeshId_);
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_End_modification() failed with error %d\n", smiError); ("SMI_End_modification() failed with error %d\n", smiError);
...@@ -423,9 +422,7 @@ namespace AMDiS { ...@@ -423,9 +422,7 @@ namespace AMDiS {
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_Get_all_nodes() failed with error %d\n", smiError); ("SMI_Get_all_nodes() failed with error %d\n", smiError);
//double *values = GET_MEMORY(double, numNodes); if (quantityID == -1) {
if(quantityID == -1) {
std::map<int, std::vector<DOFVector<double>*> >::iterator quantityIt; std::map<int, std::vector<DOFVector<double>*> >::iterator quantityIt;
std::map<int, std::vector<DOFVector<double>*> >::iterator quantityEnd = std::map<int, std::vector<DOFVector<double>*> >::iterator quantityEnd =
dofVectors_.end(); dofVectors_.end();
...@@ -433,7 +430,7 @@ namespace AMDiS { ...@@ -433,7 +430,7 @@ namespace AMDiS {
for(quantityIt = dofVectors_.begin(); quantityIt != quantityEnd; ++quantityIt) { for(quantityIt = dofVectors_.begin(); quantityIt != quantityEnd; ++quantityIt) {
int quantityDim = static_cast<int>(quantityIt->second.size()); int quantityDim = static_cast<int>(quantityIt->second.size());
double *values = GET_MEMORY(double, numNodes * quantityDim); double *values = new double[numNodes * quantityDim];
int i, comp; int i, comp;
for(i = 0; i < numNodes; i++) { for(i = 0; i < numNodes; i++) {
...@@ -459,12 +456,12 @@ namespace AMDiS { ...@@ -459,12 +456,12 @@ namespace AMDiS {
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_Set_quantity_values() failed with error %d\n", smiError); ("SMI_Set_quantity_values() failed with error %d\n", smiError);
FREE_MEMORY(values, double, numNodes * quantityDim); delete [] values;
} }
} else { } else {
int quantityDim = static_cast<int>(dofVectors_[quantityID].size()); int quantityDim = static_cast<int>(dofVectors_[quantityID].size());
double *values = GET_MEMORY(double, numNodes * quantityDim); double *values = new double[numNodes * quantityDim];
int i, comp; int i, comp;
for(i = 0; i < numNodes; i++) { for(i = 0; i < numNodes; i++) {
...@@ -490,13 +487,10 @@ namespace AMDiS { ...@@ -490,13 +487,10 @@ namespace AMDiS {
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_Set_quantity_values() failed with error %d\n", smiError); ("SMI_Set_quantity_values() failed with error %d\n", smiError);
FREE_MEMORY(values, double, numNodes * quantityDim); delete [] values;
} }
//FREE_MEMORY(values, double, numNodes); smiError = SMI_End_write_transaction(smiApplicationId_, smiMeshId_);
smiError = SMI_End_write_transaction(smiApplicationId_,
smiMeshId_);
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_End_modification() failed with error %d\n", smiError); ("SMI_End_modification() failed with error %d\n", smiError);
...@@ -523,16 +517,14 @@ namespace AMDiS { ...@@ -523,16 +517,14 @@ namespace AMDiS {
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_Get_all_nodes() failed with error %d\n", smiError); ("SMI_Get_all_nodes() failed with error %d\n", smiError);
//double *values = GET_MEMORY(double, numNodes); if (quantityID == -1) {
if(quantityID == -1) {
std::map<int, std::vector<DOFVector<double>*> >::iterator quantityIt; std::map<int, std::vector<DOFVector<double>*> >::iterator quantityIt;
std::map<int, std::vector<DOFVector<double>*> >::iterator quantityEnd = std::map<int, std::vector<DOFVector<double>*> >::iterator quantityEnd =
dofVectors_.end(); dofVectors_.end();
for(quantityIt = dofVectors_.begin(); quantityIt != quantityEnd; ++quantityIt) { for(quantityIt = dofVectors_.begin(); quantityIt != quantityEnd; ++quantityIt) {
int quantityDim = static_cast<int>(quantityIt->second.size()); int quantityDim = static_cast<int>(quantityIt->second.size());
double *values = GET_MEMORY(double, numNodes * quantityDim); double *values = new double[numNodes * quantityDim];
smiError = SMI_Get_quantity_values(smiApplicationId_, smiError = SMI_Get_quantity_values(smiApplicationId_,
smiMeshId_, smiMeshId_,
...@@ -558,12 +550,12 @@ namespace AMDiS { ...@@ -558,12 +550,12 @@ namespace AMDiS {
} }
} }
FREE_MEMORY(values, double, numNodes * quantityDim); delete [] values;
} }
} else { } else {
int quantityDim = static_cast<int>(dofVectors_[quantityID].size()); int quantityDim = static_cast<int>(dofVectors_[quantityID].size());
double *values = GET_MEMORY(double, numNodes * quantityDim); double *values = new double[numNodes * quantityDim];
smiError = SMI_Get_quantity_values(smiApplicationId_, smiError = SMI_Get_quantity_values(smiApplicationId_,
smiMeshId_, smiMeshId_,
...@@ -589,13 +581,10 @@ namespace AMDiS { ...@@ -589,13 +581,10 @@ namespace AMDiS {
} }
} }
FREE_MEMORY(values, double, numNodes * quantityDim); delete [] values;
} }
//FREE_MEMORY(values, double, numNodes); smiError = SMI_End_read_transaction(smiApplicationId_, smiMeshId_);
smiError = SMI_End_read_transaction(smiApplicationId_,
smiMeshId_);
TEST_EXIT(smiError == SMI_OK) TEST_EXIT(smiError == SMI_OK)
("SMI_End_modification() failed with error %d\n", smiError); ("SMI_End_modification() failed with error %d\n", smiError);
......
...@@ -30,8 +30,6 @@ namespace AMDiS { ...@@ -30,8 +30,6 @@ namespace AMDiS {
class AdaptParaReal : public AdaptInstationary class AdaptParaReal : public AdaptInstationary
{ {
public: public:
MEMORY_MANAGED(AdaptParaReal);
AdaptParaReal(const char *name, AdaptParaReal(const char *name,
ProblemIterationInterface *problemStat, ProblemIterationInterface *problemStat,
AdaptInfo *info, AdaptInfo *info,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment