From 3ae1479f9bf479c4c950ffa7d5a87af334fb39a3 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Mon, 25 May 2009 07:12:23 +0000 Subject: [PATCH] Neuman boundary bug fixed. --- AMDiS/src/ProblemVec.cc | 77 +++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 3d379374..1159d6cd 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -236,7 +236,7 @@ namespace AMDiS { refSet = 0; } if (meshForRefinementSet[refSet] == NULL) { - Mesh *newMesh = NEW Mesh(meshName, dim); + Mesh *newMesh = new Mesh(meshName, dim); meshForRefinementSet[refSet] = newMesh; meshes.push_back(newMesh); nMeshes++; @@ -245,16 +245,16 @@ namespace AMDiS { } switch(dim) { case 1: - coarseningManager = NEW CoarseningManager1d(); - refinementManager = NEW RefinementManager1d(); + coarseningManager = new CoarseningManager1d(); + refinementManager = new RefinementManager1d(); break; case 2: - coarseningManager = NEW CoarseningManager2d(); - refinementManager = NEW RefinementManager2d(); + coarseningManager = new CoarseningManager2d(); + refinementManager = new RefinementManager2d(); break; case 3: - coarseningManager = NEW CoarseningManager3d(); - refinementManager = NEW RefinementManager3d(); + coarseningManager = new CoarseningManager3d(); + refinementManager = new RefinementManager3d(); break; default: ERROR_EXIT("invalid dim!\n"); @@ -317,22 +317,22 @@ namespace AMDiS { // === create vectors and system matrix === - systemMatrix = NEW Matrix<DOFMatrix*>(nComponents, nComponents); + systemMatrix = new Matrix<DOFMatrix*>(nComponents, nComponents); systemMatrix->set(NULL); - rhs = NEW SystemVector("rhs", componentSpaces, nComponents); - solution = NEW SystemVector("solution", componentSpaces, nComponents); + rhs = new SystemVector("rhs", componentSpaces, nComponents); + solution = new SystemVector("solution", componentSpaces, nComponents); char number[10]; std::string numberedName; for (int i = 0; i < nComponents; i++) { - (*systemMatrix)[i][i] = NEW DOFMatrix(componentSpaces[i], + (*systemMatrix)[i][i] = new DOFMatrix(componentSpaces[i], componentSpaces[i], "A_ii"); (*systemMatrix)[i][i]->setCoupleMatrix(false); sprintf(number, "[%d]", i); numberedName = "rhs" + std::string(number); - rhs->setDOFVector(i, NEW DOFVector<double>(componentSpaces[i], numberedName)); + rhs->setDOFVector(i, new DOFVector<double>(componentSpaces[i], numberedName)); numberedName = name + std::string(number); - solution->setDOFVector(i, NEW DOFVector<double>(componentSpaces[i], + solution->setDOFVector(i, new DOFVector<double>(componentSpaces[i], numberedName)); solution->getDOFVector(i)->setCoarsenOperation(COARSE_INTERPOL); solution->getDOFVector(i)->set(0.0); @@ -361,7 +361,7 @@ namespace AMDiS { // create and set leaf data prototype for (int i = 0; i < static_cast<int>(meshes.size()); i++) { meshes[i]->setElementDataPrototype - (NEW LeafDataEstimatableVec(NEW LeafDataCoarsenableVec)); + (new LeafDataEstimatableVec(new LeafDataCoarsenableVec)); } char number[3]; @@ -442,7 +442,7 @@ namespace AMDiS { solutionList[i] = solution->getDOFVector(i); } - fileWriters.push_back(NEW FileWriter(numberedName, + fileWriters.push_back(new FileWriter(numberedName, componentMeshes[0], solutionList)); } @@ -457,7 +457,7 @@ namespace AMDiS { GET_PARAMETER(0, numberedName + "->filename", &filename); if (filename != "") { - fileWriters.push_back(NEW FileWriter(numberedName, + fileWriters.push_back(new FileWriter(numberedName, componentMeshes[i], solution->getDOFVector(i))); } @@ -475,7 +475,7 @@ namespace AMDiS { GET_PARAMETER(0, name + "->output->write serialization", "%d", &writeSerialization); if (writeSerialization) { - fileWriters.push_back(NEW Serializer<ProblemVec>(this)); + fileWriters.push_back(new Serializer<ProblemVec>(this)); } } @@ -873,7 +873,7 @@ namespace AMDiS { if (!(*systemMatrix)[i][j]) { TEST_EXIT(i != j)("should have been created already\n"); - (*systemMatrix)[i][j] = NEW DOFMatrix(componentSpaces[i], componentSpaces[j], ""); + (*systemMatrix)[i][j] = new DOFMatrix(componentSpaces[i], componentSpaces[j], ""); (*systemMatrix)[i][j]->setCoupleMatrix(true); (*systemMatrix)[i][j]->getBoundaryManager()-> setBoundaryConditionMap((*systemMatrix)[i][i]->getBoundaryManager()-> @@ -1007,7 +1007,7 @@ namespace AMDiS { DOFVector<double> *tmpVector = NULL; if (matrix) { - tmpMatrix = NEW DOFMatrix(matrix->getRowFESpace(), matrix->getColFESpace(), "tmp"); + tmpMatrix = new DOFMatrix(matrix->getRowFESpace(), matrix->getColFESpace(), "tmp"); // Copy the global matrix to the private matrix, because we need the // operators defined on the global matrix in the private one. Only the @@ -1021,7 +1021,7 @@ namespace AMDiS { } if (vector) { - tmpVector = NEW DOFVector<double>(vector->getFESpace(), "tmp"); + tmpVector = new DOFVector<double>(vector->getFESpace(), "tmp"); // Copy the global vector to the private vector, because we need the // operatirs defined on the global vector in the private one. But set @@ -1093,7 +1093,7 @@ namespace AMDiS { #endif matrix->removeRowsWithDBC(tmpMatrix->getApplyDBCs()); - DELETE tmpMatrix; + delete tmpMatrix; } if (vector) { @@ -1102,7 +1102,7 @@ namespace AMDiS { #endif *vector += *tmpVector; - DELETE tmpVector; + delete tmpVector; } if (useGetBound) @@ -1228,8 +1228,8 @@ namespace AMDiS { #endif { // Each thread assembles on its own dof-vectors. - DOFVector<double> *tmpRhsVec = NEW DOFVector<double>(rhs->getFESpace(), "tmpRhs"); - DOFVector<double> *tmpSolVec = NEW DOFVector<double>(solution->getFESpace(), "tmpSol"); + DOFVector<double> *tmpRhsVec = new DOFVector<double>(rhs->getFESpace(), "tmpRhs"); + DOFVector<double> *tmpSolVec = new DOFVector<double>(solution->getFESpace(), "tmpSol"); tmpRhsVec->set(0.0); tmpSolVec->set(0.0); @@ -1261,17 +1261,14 @@ namespace AMDiS { for (rhsIt.reset(), solIt.reset(), tmpRhsIt.reset(), tmpSolIt.reset(); !rhsIt.end(); ++rhsIt, ++solIt, ++tmpRhsIt, ++tmpSolIt) { - if (*tmpRhsIt != 0.0) - *rhsIt = *tmpRhsIt; - - if (*tmpSolIt != 0.0) - *solIt = *tmpSolIt; + *rhsIt += *tmpRhsIt; + *solIt += *tmpSolIt; } } // pragma omp critical - DELETE tmpRhsVec; - DELETE tmpSolVec; + delete tmpRhsVec; + delete tmpSolVec; } // pragma omp parallel @@ -1308,9 +1305,8 @@ namespace AMDiS { SerializerUtil::serializeBool(out, &allowFirstRef); - for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + for (int i = 0; i < static_cast<int>(meshes.size()); i++) meshes[i]->serialize(out); - } solution->serialize(out); } @@ -1321,9 +1317,8 @@ namespace AMDiS { SerializerUtil::deserializeBool(in, &allowFirstRef); - for (int i = 0; i < static_cast<int>(meshes.size()); i++) { + for (int i = 0; i < static_cast<int>(meshes.size()); i++) meshes[i]->deserialize(in); - } solution->deserialize(in); } @@ -1336,7 +1331,7 @@ namespace AMDiS { TEST_EXIT(exactSolutionFcts[i])("No solution function given!\n"); // Compute the difference between exact and computed solution - DOFVector<double> *tmp = NEW DOFVector<double>(componentSpaces[i], "tmp"); + DOFVector<double> *tmp = new DOFVector<double>(componentSpaces[i], "tmp"); tmp->interpol(exactSolutionFcts[i]); double solMax = tmp->absMax(); *tmp -= *(solution->getDOFVector(i)); @@ -1349,7 +1344,7 @@ namespace AMDiS { // To set element estimates, compute a vector with the difference // between exact and computed solution for each DOF. - DOFVector<double> *sol = NEW DOFVector<double>(componentSpaces[i], "tmp"); + DOFVector<double> *sol = new DOFVector<double>(componentSpaces[i], "tmp"); sol->interpol(exactSolutionFcts[i]); DOFVector<double>::Iterator it1(sol, USED_DOFS); DOFVector<double>::Iterator it2(tmp, USED_DOFS); @@ -1370,17 +1365,17 @@ namespace AMDiS { componentSpaces[i]->getAdmin(), &locInd); double estimate = 0.0; - for (int j = 0; j < componentSpaces[i]->getBasisFcts()->getNumber(); j++) { + for (int j = 0; j < componentSpaces[i]->getBasisFcts()->getNumber(); j++) estimate += (*tmp)[locInd[j]]; - } + elInfo->getElement()->setEstimation(estimate, i); elInfo->getElement()->setMark(0); elInfo = stack.traverseNext(elInfo); } - DELETE tmp; - DELETE sol; + delete tmp; + delete sol; } } } -- GitLab