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

Bugfix for DOFVector::getGradient()

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