Commit ee371742 authored by Praetorius, Simon's avatar Praetorius, Simon

transformDOF corrected

parent 6fdea22a
...@@ -74,10 +74,10 @@ struct Mult2 : public BinaryAbstractFunction<T1,T2,T3> ...@@ -74,10 +74,10 @@ struct Mult2 : public BinaryAbstractFunction<T1,T2,T3>
}; };
template<typename T> template<typename T>
struct MultScal : public AbstractFunction<T,T> struct MultScal : public BinaryAbstractFunction<T,T,T>
{ {
MultScal(T scal_) : scal(scal_) {} MultScal(T scal_) : scal(scal_) {}
T operator()(const T &v) const { return v*scal; } T operator()(const T &v1, const T &v2) const { return v1*v2*scal; }
private: private:
T scal; T scal;
}; };
......
...@@ -79,7 +79,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec, DOFVector<T2> *result, Abs ...@@ -79,7 +79,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec, DOFVector<T2> *result, Abs
vec->getLocalVector(el, vecLocalCoeffs); vec->getLocalVector(el, vecLocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords = vecBasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*op)(vecBasisFcts->evalUh(*coords, vecLocalCoeffs)); (*res)[resLocalIndices[i]] = (*op)(vecBasisFcts->evalUh(*coords, vecLocalCoeffs));
} }
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
...@@ -167,7 +167,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV ...@@ -167,7 +167,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV
mtl::dense_vector<T1> vec1LocalCoeffs(nVec1BasisFcts); mtl::dense_vector<T1> vec1LocalCoeffs(nVec1BasisFcts);
mtl::dense_vector<T2> vec2LocalCoeffs(nVec2BasisFcts); mtl::dense_vector<T2> vec2LocalCoeffs(nVec2BasisFcts);
DimVec<double> *coords1 = NULL, *coords2 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -181,11 +181,10 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV ...@@ -181,11 +181,10 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV
vec2->getLocalVector(el, vec2LocalCoeffs); vec2->getLocalVector(el, vec2LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec1BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
coords2 = vec2BasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*binary_op)( (*res)[resLocalIndices[i]] = (*binary_op)(
vec1BasisFcts->evalUh(*coords1, vec1LocalCoeffs), vec1BasisFcts->evalUh(*coords, vec1LocalCoeffs),
vec2BasisFcts->evalUh(*coords2, vec2LocalCoeffs) vec2BasisFcts->evalUh(*coords, vec2LocalCoeffs)
); );
} }
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
...@@ -254,7 +253,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T ...@@ -254,7 +253,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T
std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts); std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts);
ElementVector vec1LocalCoeffs(nVec1BasisFcts); ElementVector vec1LocalCoeffs(nVec1BasisFcts);
DimVec<double> *coords1 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -267,9 +266,9 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T ...@@ -267,9 +266,9 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T
vec1->getLocalVector(el, vec1LocalCoeffs); vec1->getLocalVector(el, vec1LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec1BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*binary_op)( (*res)[resLocalIndices[i]] = (*binary_op)(
vec1BasisFcts->evalUh(*coords1, vec1LocalCoeffs), vec1BasisFcts->evalUh(*coords, vec1LocalCoeffs),
val val
); );
} }
...@@ -338,7 +337,7 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T ...@@ -338,7 +337,7 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T
std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts); std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts);
ElementVector vec1LocalCoeffs(nVec1BasisFcts); ElementVector vec1LocalCoeffs(nVec1BasisFcts);
DimVec<double> *coords1 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -351,10 +350,10 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T ...@@ -351,10 +350,10 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T
vec1->getLocalVector(el, vec1LocalCoeffs); vec1->getLocalVector(el, vec1LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec1BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*binary_op)( (*res)[resLocalIndices[i]] = (*binary_op)(
val, val,
vec1BasisFcts->evalUh(*coords1, vec1LocalCoeffs) vec1BasisFcts->evalUh(*coords, vec1LocalCoeffs)
); );
} }
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
...@@ -433,11 +432,11 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV ...@@ -433,11 +432,11 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV
int nResBasisFcts = resBasisFcts->getNumber(); int nResBasisFcts = resBasisFcts->getNumber();
std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts); std::vector<DegreeOfFreedom> resLocalIndices(nResBasisFcts);
ElementVector vec1LocalCoeffs(nVec1BasisFcts); mtl::dense_vector<T1> vec1LocalCoeffs(nVec1BasisFcts);
ElementVector vec2LocalCoeffs(nVec2BasisFcts); mtl::dense_vector<T2> vec2LocalCoeffs(nVec2BasisFcts);
ElementVector vec3LocalCoeffs(nVec3BasisFcts); mtl::dense_vector<T3> vec3LocalCoeffs(nVec3BasisFcts);
DimVec<double> *coords1 = NULL, *coords2 = NULL, *coords3 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -452,13 +451,11 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV ...@@ -452,13 +451,11 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV
vec3->getLocalVector(el, vec3LocalCoeffs); vec3->getLocalVector(el, vec3LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec1BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
coords2 = vec2BasisFcts->getCoords(i);
coords3 = vec3BasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*tertiary_op)( (*res)[resLocalIndices[i]] = (*tertiary_op)(
vec1BasisFcts->evalUh(*coords1, vec1LocalCoeffs), vec1BasisFcts->evalUh(*coords, vec1LocalCoeffs),
vec2BasisFcts->evalUh(*coords2, vec2LocalCoeffs), vec2BasisFcts->evalUh(*coords, vec2LocalCoeffs),
vec3BasisFcts->evalUh(*coords3, vec3LocalCoeffs) vec3BasisFcts->evalUh(*coords, vec3LocalCoeffs)
); );
} }
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
...@@ -520,7 +517,7 @@ inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVe ...@@ -520,7 +517,7 @@ inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVe
ElementVector vec1LocalCoeffs(nVec1BasisFcts); ElementVector vec1LocalCoeffs(nVec1BasisFcts);
ElementVector vec2LocalCoeffs(nVec2BasisFcts); ElementVector vec2LocalCoeffs(nVec2BasisFcts);
DimVec<double> *coords1 = NULL, *coords2 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -534,11 +531,10 @@ inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVe ...@@ -534,11 +531,10 @@ inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVe
vec2->getLocalVector(el, vec2LocalCoeffs); vec2->getLocalVector(el, vec2LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec1BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
coords2 = vec2BasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*tertiary_op)( (*res)[resLocalIndices[i]] = (*tertiary_op)(
vec1BasisFcts->evalUh(*coords1, vec1LocalCoeffs), vec1BasisFcts->evalUh(*coords, vec1LocalCoeffs),
vec2BasisFcts->evalUh(*coords2, vec2LocalCoeffs), vec2BasisFcts->evalUh(*coords, vec2LocalCoeffs),
val val
); );
} }
...@@ -585,7 +581,7 @@ inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVe ...@@ -585,7 +581,7 @@ inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVe
ElementVector vec1LocalCoeffs(nVec1BasisFcts); ElementVector vec1LocalCoeffs(nVec1BasisFcts);
ElementVector vec3LocalCoeffs(nVec3BasisFcts); ElementVector vec3LocalCoeffs(nVec3BasisFcts);
DimVec<double> *coords1 = NULL, *coords2 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -599,12 +595,11 @@ inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVe ...@@ -599,12 +595,11 @@ inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVe
vec3->getLocalVector(el, vec3LocalCoeffs); vec3->getLocalVector(el, vec3LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec1BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
coords2 = vec3BasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*tertiary_op)( (*res)[resLocalIndices[i]] = (*tertiary_op)(
vec1BasisFcts->evalUh(*coords1, vec1LocalCoeffs), vec1BasisFcts->evalUh(*coords, vec1LocalCoeffs),
val, val,
vec3BasisFcts->evalUh(*coords2, vec3LocalCoeffs) vec3BasisFcts->evalUh(*coords, vec3LocalCoeffs)
); );
} }
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
...@@ -650,7 +645,7 @@ inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVe ...@@ -650,7 +645,7 @@ inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVe
ElementVector vec2LocalCoeffs(nVec2BasisFcts); ElementVector vec2LocalCoeffs(nVec2BasisFcts);
ElementVector vec3LocalCoeffs(nVec3BasisFcts); ElementVector vec3LocalCoeffs(nVec3BasisFcts);
DimVec<double> *coords1 = NULL, *coords2 = NULL; DimVec<double> *coords = NULL;
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1, ElInfo *elInfo = stack.traverseFirst(resFeSpace->getMesh(), -1,
Mesh::CALL_LEAF_EL | Mesh::CALL_LEAF_EL |
...@@ -664,12 +659,11 @@ inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVe ...@@ -664,12 +659,11 @@ inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVe
vec3->getLocalVector(el, vec3LocalCoeffs); vec3->getLocalVector(el, vec3LocalCoeffs);
for (int i = 0; i < nResBasisFcts; i++) { for (int i = 0; i < nResBasisFcts; i++) {
coords1 = vec2BasisFcts->getCoords(i); coords = resBasisFcts->getCoords(i);
coords2 = vec3BasisFcts->getCoords(i);
(*res)[resLocalIndices[i]] = (*tertiary_op)( (*res)[resLocalIndices[i]] = (*tertiary_op)(
val, val,
vec2BasisFcts->evalUh(*coords1, vec2LocalCoeffs), vec2BasisFcts->evalUh(*coords, vec2LocalCoeffs),
vec3BasisFcts->evalUh(*coords2, vec3LocalCoeffs) vec3BasisFcts->evalUh(*coords, vec3LocalCoeffs)
); );
} }
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
......
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