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

Bugfix for DOFVector::getGradient()

parent 0776d6f4
...@@ -81,26 +81,26 @@ namespace AMDiS { ...@@ -81,26 +81,26 @@ namespace AMDiS {
std::vector<int> numNodePreDOFs; std::vector<int> numNodePreDOFs;
std::vector<DimVec<double>*> bary; std::vector<DimVec<double>*> bary;
int numNodes = 0; int nNodes = 0;
int numDOFs = 0; int nDofs = 0;
for (int i = 0; i < dim + 1; i++) { for (int i = 0; i < dim + 1; i++) {
GeoIndex geoIndex = INDEX_OF_DIM(i, dim); GeoIndex geoIndex = INDEX_OF_DIM(i, dim);
int numPositionNodes = mesh->getGeo(geoIndex); int nPositions = mesh->getGeo(geoIndex);
int numPreDOFs = admin->getNumberOfPreDOFs(i); int numPreDOFs = admin->getNumberOfPreDOFs(i);
for (int j = 0; j < numPositionNodes; j++) { for (int j = 0; j < nPositions; j++) {
int dofs = basFcts->getNumberOfDOFs(geoIndex); int dofs = basFcts->getNumberOfDOFs(geoIndex);
numNodeDOFs.push_back(dofs); numNodeDOFs.push_back(dofs);
numDOFs += dofs; nDofs += dofs;
numNodePreDOFs.push_back(numPreDOFs); numNodePreDOFs.push_back(numPreDOFs);
} }
numNodes += numPositionNodes; nNodes += nPositions;
} }
TEST_EXIT_DBG(numDOFs == basFcts->getNumber()) TEST_EXIT_DBG(nDofs == basFcts->getNumber())
("number of dofs != number of basis functions\n"); ("number of dofs != number of basis functions\n");
for (int i = 0; i < numDOFs; i++) for (int i = 0; i < nDofs; i++)
bary.push_back(basFcts->getCoords(i)); bary.push_back(basFcts->getCoords(i));
double *localUh = new double[basFcts->getNumber()]; double *localUh = new double[basFcts->getNumber()];
...@@ -117,9 +117,9 @@ namespace AMDiS { ...@@ -117,9 +117,9 @@ namespace AMDiS {
getLocalVector(elInfo->getElement(), localUh); getLocalVector(elInfo->getElement(), localUh);
int localDOFNr = 0; int localDOFNr = 0;
for (int i = 0; i < numNodes; i++) { // for all nodes for (int i = 0; i < nNodes; i++) { // for all nodes
for (int j = 0; j < numNodeDOFs[i]; j++) { // for all dofs at this node for (int j = 0; j < numNodeDOFs[i]; j++) { // for all dofs at this node
DegreeOfFreedom dofIndex = dof[i][numNodePreDOFs[localDOFNr] + j]; DegreeOfFreedom dofIndex = dof[i][numNodePreDOFs[i] + j];
if (!visited[dofIndex]) { if (!visited[dofIndex]) {
basFcts->evalGrdUh(*(bary[localDOFNr]), grdLambda, basFcts->evalGrdUh(*(bary[localDOFNr]), grdLambda,
localUh, &((*result)[dofIndex])); localUh, &((*result)[dofIndex]));
...@@ -646,8 +646,8 @@ namespace AMDiS { ...@@ -646,8 +646,8 @@ namespace AMDiS {
std::vector<int> numNodePreDOFs; std::vector<int> numNodePreDOFs;
std::vector<DimVec<double>*> bary; std::vector<DimVec<double>*> bary;
int numNodes = 0; int nNodes = 0;
int numDOFs = 0; int nDofs = 0;
for (int i = 0; i < dim + 1; i++) { for (int i = 0; i < dim + 1; i++) {
GeoIndex geoIndex = INDEX_OF_DIM(i, dim); GeoIndex geoIndex = INDEX_OF_DIM(i, dim);
...@@ -656,16 +656,16 @@ namespace AMDiS { ...@@ -656,16 +656,16 @@ namespace AMDiS {
for (int j = 0; j < numPositionNodes; j++) { for (int j = 0; j < numPositionNodes; j++) {
int dofs = basFcts->getNumberOfDOFs(geoIndex); int dofs = basFcts->getNumberOfDOFs(geoIndex);
numNodeDOFs.push_back(dofs); numNodeDOFs.push_back(dofs);
numDOFs += dofs; nDofs += dofs;
numNodePreDOFs.push_back(numPreDOFs); numNodePreDOFs.push_back(numPreDOFs);
} }
numNodes += numPositionNodes; nNodes += numPositionNodes;
} }
TEST_EXIT_DBG(numDOFs == basFcts->getNumber()) TEST_EXIT_DBG(nDofs == basFcts->getNumber())
("number of dofs != number of basis functions\n"); ("number of dofs != number of basis functions\n");
for (int i = 0; i < numDOFs; i++) for (int i = 0; i < nDofs; i++)
bary.push_back(basFcts->getCoords(i)); bary.push_back(basFcts->getCoords(i));
// traverse mesh // traverse mesh
...@@ -681,9 +681,9 @@ namespace AMDiS { ...@@ -681,9 +681,9 @@ namespace AMDiS {
const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda(); const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda();
int localDOFNr = 0; int localDOFNr = 0;
for (int i = 0; i < numNodes; i++) { // for all nodes for (int i = 0; i < nNodes; i++) { // for all nodes
for (int j = 0; j < numNodeDOFs[i]; j++) { // for all dofs at this node for (int j = 0; j < numNodeDOFs[i]; j++) { // for all dofs at this node
DegreeOfFreedom dofIndex = dof[i][numNodePreDOFs[localDOFNr] + j]; DegreeOfFreedom dofIndex = dof[i][numNodePreDOFs[i] + j];
if (!visited[dofIndex]) { if (!visited[dofIndex]) {
basFcts->evalGrdUh(*(bary[localDOFNr]), grdLambda, localUh, &grd); basFcts->evalGrdUh(*(bary[localDOFNr]), grdLambda, localUh, &grd);
......
Supports Markdown
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