Commit 3ae1479f authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Neuman boundary bug fixed.

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