Commit 61feafb2 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Some corrections to the last commit

parent 62841d3c
...@@ -324,9 +324,7 @@ namespace AMDiS { ...@@ -324,9 +324,7 @@ namespace AMDiS {
calculateElementMatrix(elInfo, elementMatrix); calculateElementMatrix(elInfo, elementMatrix);
} }
// eventuell einfach
// vec = elementMatrix*uhOldLoc; // vec = elementMatrix*uhOldLoc;
// schreiben
for (int i = 0; i < nRow; i++) { for (int i = 0; i < nRow; i++) {
double val = 0.0; double val = 0.0;
for (int j = 0; j < nCol; j++) for (int j = 0; j < nCol; j++)
......
...@@ -1015,7 +1015,7 @@ namespace AMDiS { ...@@ -1015,7 +1015,7 @@ namespace AMDiS {
out << name << "\n"; out << name << "\n";
// SerUtil::serialize(out, dim); SerUtil::serialize(out, dim);
SerUtil::serialize(out, nVertices); SerUtil::serialize(out, nVertices);
SerUtil::serialize(out, nEdges); SerUtil::serialize(out, nEdges);
SerUtil::serialize(out, nLeaves); SerUtil::serialize(out, nLeaves);
...@@ -1095,8 +1095,8 @@ namespace AMDiS { ...@@ -1095,8 +1095,8 @@ namespace AMDiS {
in.get(); in.get();
int oldVal = dim; int oldVal = dim;
// SerUtil::deserialize(in, dim); SerUtil::deserialize(in, dim);
// TEST_EXIT_DBG(oldVal == 0 || dim == oldVal)("Invalid dimension!\n"); TEST_EXIT_DBG(oldVal == 0 || dim == oldVal)("Invalid dimension!\n");
SerUtil::deserialize(in, nVertices); SerUtil::deserialize(in, nVertices);
SerUtil::deserialize(in, nEdges); SerUtil::deserialize(in, nEdges);
......
...@@ -7,18 +7,25 @@ namespace AMDiS { ...@@ -7,18 +7,25 @@ namespace AMDiS {
/** /**
* analogon to std::for_each/std::transform for DOFVectors. * analogon to std::for_each/std::transform for DOFVectors.
* The operators are applied to each degree of freedom. * The operators are applied to each degree of freedom:
* *
* forEachDOF(vec, op) * forEachDOF(vec, op)
* transformDOF(vec1, result, op) * transformDOF(vec1, result, op)
* transformDOF(vec1, vec2, result, binary_op) * transformDOF(vec1, vec2, result, binary_op)
* transformDOF(vec1, vec2, vec3, result, tertiary_op) * transformDOF(vec1, vec2, vec3, result, tertiary_op)
* *
* transformDOFInterpolation(vec, f(x), result, binary_op)
*
* vec1,vec2,vec3 .. {DOFVector<Ti>*, DOFVector<Ti>&, Ti} * vec1,vec2,vec3 .. {DOFVector<Ti>*, DOFVector<Ti>&, Ti}
* vec, result .. {DOFVector<TOut>*, DOFVector<TOut>&} * vec, result .. {DOFVector<TOut>*, DOFVector<TOut>&}
* op .. AbstractFunction<TOut, T1>* * op .. AbstractFunction<TOut, T1>*
* binary_op ..BinaryAbstractFunction<TOut, T1, T2>* * binary_op ..BinaryAbstractFunction<TOut, T1, T2>*
* tertiary_op .. TertiaryAbstractFunction<TOut, T1, T2, T3>* * tertiary_op .. TertiaryAbstractFunction<TOut, T1, T2, T3>*
*
* analogon to std::accumulate for DOFVectors:
*
* result = accumulateDOF_simple(vec, value0, binary_op)
* result = accumulateDOF_simple(vec1, vec2, value0, tertiary_op)
**/ **/
// result = op(vec) // result = op(vec)
...@@ -83,7 +90,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec, DOFVector<T2> *result, Abs ...@@ -83,7 +90,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec, DOFVector<T2> *result, Abs
} }
} }
// result = op(vec) /// result = op(vec)
template<typename T1, typename T2> template<typename T1, typename T2>
inline void transformDOF(DOFVector<T1> *vec, inline void transformDOF(DOFVector<T1> *vec,
DOFVector<T2> *result, DOFVector<T2> *result,
...@@ -112,7 +119,6 @@ inline void forEachDOF(DOFVector<T1> *vec, AbstractFunction<T1, T1> *op) ...@@ -112,7 +119,6 @@ inline void forEachDOF(DOFVector<T1> *vec, AbstractFunction<T1, T1> *op)
template<typename T1> inline void forEachDOF(DOFVector<T1> &vec, AbstractFunction<T1, T1> &op) template<typename T1> inline void forEachDOF(DOFVector<T1> &vec, AbstractFunction<T1, T1> &op)
{ transformDOF(&vec, &op); } { transformDOF(&vec, &op); }
// =======================================================================================================
// result = binary_op(vec1, vec2) // result = binary_op(vec1, vec2)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
...@@ -190,7 +196,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV ...@@ -190,7 +196,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV
} }
} }
// result = binary_op(vec1, vec2) /// result = binary_op(vec1, vec2)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF(DOFVector<T1> *vec1, inline void transformDOF(DOFVector<T1> *vec1,
DOFVector<T2> *vec2, DOFVector<T2> *vec2,
...@@ -208,7 +214,7 @@ template<typename T1, typename T2, typename T3> inline void transformDOF(DOFVect ...@@ -208,7 +214,7 @@ template<typename T1, typename T2, typename T3> inline void transformDOF(DOFVect
{ transformDOF(&vec1, &vec2, &result, &binary_op); } { transformDOF(&vec1, &vec2, &result, &binary_op); }
// result = binary_op(vec1, vec2) // result = binary_op(vec1, value)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF_simple(DOFVector<T1> *vec1, inline void transformDOF_simple(DOFVector<T1> *vec1,
const T2 val, const T2 val,
...@@ -224,7 +230,7 @@ inline void transformDOF_simple(DOFVector<T1> *vec1, ...@@ -224,7 +230,7 @@ inline void transformDOF_simple(DOFVector<T1> *vec1,
} }
} }
// result = binary_op(vec1, vec2) // result = binary_op(vec1, value)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T3> *result, BinaryAbstractFunction<T3, T1, T2> *binary_op) inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T3> *result, BinaryAbstractFunction<T3, T1, T2> *binary_op)
{ {
...@@ -275,7 +281,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T ...@@ -275,7 +281,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, const T2 val, DOFVector<T
} }
} }
// result = binary_op(vec1, vec2) /// result = binary_op(vec1, value)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF(DOFVector<T1> *vec1, inline void transformDOF(DOFVector<T1> *vec1,
const T2 val, const T2 val,
...@@ -292,7 +298,7 @@ template<typename T1, typename T2, typename T3> inline void transformDOF(DOFVect ...@@ -292,7 +298,7 @@ template<typename T1, typename T2, typename T3> inline void transformDOF(DOFVect
{ transformDOF(&vec1, val, &result, &binary_op); } { transformDOF(&vec1, val, &result, &binary_op); }
// result = binary_op(vec1, vec2) // result = binary_op(value, vec2)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF_simple(const T1 val, inline void transformDOF_simple(const T1 val,
DOFVector<T2> *vec1, DOFVector<T2> *vec1,
...@@ -308,7 +314,7 @@ inline void transformDOF_simple(const T1 val, ...@@ -308,7 +314,7 @@ inline void transformDOF_simple(const T1 val,
} }
} }
// result = binary_op(vec1, vec2) // result = binary_op(value, vec2)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T3> *result, BinaryAbstractFunction<T3, T1, T2> *binary_op) inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T3> *result, BinaryAbstractFunction<T3, T1, T2> *binary_op)
{ {
...@@ -359,7 +365,7 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T ...@@ -359,7 +365,7 @@ inline void transformDOF_extended(const T1 val, DOFVector<T2> *vec1, DOFVector<T
} }
} }
// result = binary_op(vec1, vec2) /// result = binary_op(value, vec2)
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
inline void transformDOF(const T1 val, inline void transformDOF(const T1 val,
DOFVector<T2> *vec1, DOFVector<T2> *vec1,
...@@ -376,9 +382,7 @@ template<typename T1, typename T2, typename T3> inline void transformDOF(const T ...@@ -376,9 +382,7 @@ template<typename T1, typename T2, typename T3> inline void transformDOF(const T
{ transformDOF(val, &vec1, &result, &binary_op); } { transformDOF(val, &vec1, &result, &binary_op); }
// ======================================================================================== // result = tertiary_op(vec1, vec2, vec3)
// result = binary_op(vec1, vec2)
template<typename T1, typename T2, typename T3, typename T4> template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF_simple(DOFVector<T1> *vec1, inline void transformDOF_simple(DOFVector<T1> *vec1,
DOFVector<T2> *vec2, DOFVector<T2> *vec2,
...@@ -466,7 +470,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV ...@@ -466,7 +470,7 @@ inline void transformDOF_extended(DOFVector<T1> *vec1, DOFVector<T2> *vec2, DOFV
} }
} }
// result = binary_op(vec1, vec2) /// result = tertiary_op(vec1, vec2, vec3)
template<typename T1, typename T2, typename T3, typename T4> template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(DOFVector<T1> *vec1, inline void transformDOF(DOFVector<T1> *vec1,
DOFVector<T2> *vec2, DOFVector<T2> *vec2,
...@@ -486,7 +490,7 @@ template<typename T1, typename T2, typename T3, typename T4> ...@@ -486,7 +490,7 @@ template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(DOFVector<T1> &vec1, DOFVector<T2> &vec2, DOFVector<T3> &vec3, DOFVector<T4> &result, TertiaryAbstractFunction<T4, T1, T2, T3> &tertiary_op) inline void transformDOF(DOFVector<T1> &vec1, DOFVector<T2> &vec2, DOFVector<T3> &vec3, DOFVector<T4> &result, TertiaryAbstractFunction<T4, T1, T2, T3> &tertiary_op)
{ transformDOF(&vec1, &vec2, &vec3, &result, &tertiary_op); } { transformDOF(&vec1, &vec2, &vec3, &result, &tertiary_op); }
// result = tertiary_op(vec1, vec2, vec3) /// result = tertiary_op(vec1, vec2, value)
template<typename T1, typename T2, typename T3, typename T4> template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVector<T4> *result, TertiaryAbstractFunction<T4, T1, T2, T3> *tertiary_op) inline void transformDOF(DOFVector<T1> *vec1, DOFVector<T2> *vec2, T3 val, DOFVector<T4> *result, TertiaryAbstractFunction<T4, T1, T2, T3> *tertiary_op)
{ {
...@@ -551,7 +555,7 @@ template<typename T1, typename T2, typename T3, typename T4> ...@@ -551,7 +555,7 @@ template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(DOFVector<T1> &vec1, DOFVector<T2> &vec2, T3 val, DOFVector<T4> &result, TertiaryAbstractFunction<T4, T1, T2, T3> &tertiary_op) inline void transformDOF(DOFVector<T1> &vec1, DOFVector<T2> &vec2, T3 val, DOFVector<T4> &result, TertiaryAbstractFunction<T4, T1, T2, T3> &tertiary_op)
{ transformDOF(&vec1, &vec2, val, &result, &tertiary_op); } { transformDOF(&vec1, &vec2, val, &result, &tertiary_op); }
// result = tertiary_op(vec1, vec2, vec3) /// result = tertiary_op(vec1, value, vec3)
template<typename T1, typename T2, typename T3, typename T4> template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVector<T4> *result, TertiaryAbstractFunction<T4, T1, T2, T3> *tertiary_op) inline void transformDOF(DOFVector<T1> *vec1, T2 val, DOFVector<T2> *vec3, DOFVector<T4> *result, TertiaryAbstractFunction<T4, T1, T2, T3> *tertiary_op)
{ {
...@@ -616,7 +620,7 @@ template<typename T1, typename T2, typename T3, typename T4> ...@@ -616,7 +620,7 @@ template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(DOFVector<T1> &vec1, T2 val, DOFVector<T3> &vec3, DOFVector<T4> &result, TertiaryAbstractFunction<T4, T1, T2, T3> &tertiary_op) inline void transformDOF(DOFVector<T1> &vec1, T2 val, DOFVector<T3> &vec3, DOFVector<T4> &result, TertiaryAbstractFunction<T4, T1, T2, T3> &tertiary_op)
{ transformDOF(&vec1, val, &vec3, &result, &tertiary_op); } { transformDOF(&vec1, val, &vec3, &result, &tertiary_op); }
// result = tertiary_op(vec1, vec2, vec3) /// result = tertiary_op(value, vec2, vec3)
template<typename T1, typename T2, typename T3, typename T4> template<typename T1, typename T2, typename T3, typename T4>
inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVector<T4> *result, TertiaryAbstractFunction<T4, T1, T2, T3> *tertiary_op) inline void transformDOF(T1 val, DOFVector<T2> *vec2, DOFVector<T2> *vec3, DOFVector<T4> *result, TertiaryAbstractFunction<T4, T1, T2, T3> *tertiary_op)
{ {
...@@ -684,7 +688,7 @@ inline void transformDOF(T1 val, DOFVector<T2> &vec2, DOFVector<T3> &vec3, DOFVe ...@@ -684,7 +688,7 @@ inline void transformDOF(T1 val, DOFVector<T2> &vec2, DOFVector<T3> &vec3, DOFVe
// =========================================================================================== // ===========================================================================================
// return binary_op(vec, interpol(fct)) /// return binary_op(vec, interpol(fct))
template<typename T> template<typename T>
inline void transformDOFInterpolation( inline void transformDOFInterpolation(
DOFVector<T> *vec, DOFVector<T> *vec,
...@@ -700,7 +704,7 @@ template<typename T> inline void transformDOFInterpolation( ...@@ -700,7 +704,7 @@ template<typename T> inline void transformDOFInterpolation(
DOFVector<T> &vec, AbstractFunction<T, WorldVector<double> > &fct, BinaryAbstractFunction<T, T, T> &binary_op) DOFVector<T> &vec, AbstractFunction<T, WorldVector<double> > &fct, BinaryAbstractFunction<T, T, T> &binary_op)
{ transformDOFInterpolation(&vec, &fct, &binary_op); } { transformDOFInterpolation(&vec, &fct, &binary_op); }
// return binary_op(vec, interpol(fct)) /// return binary_op(vec, interpol(fct))
template<typename T> template<typename T>
inline void transformDOFInterpolation( inline void transformDOFInterpolation(
DOFVector<T> *vec, DOFVector<T> *vec,
...@@ -717,11 +721,12 @@ template<typename T> inline void transformDOFInterpolation( ...@@ -717,11 +721,12 @@ template<typename T> inline void transformDOFInterpolation(
DOFVector<T> &vec, AbstractFunction<T, WorldVector<double> > &fct, DOFVector<T> &result, BinaryAbstractFunction<T, T, T> &binary_op) DOFVector<T> &vec, AbstractFunction<T, WorldVector<double> > &fct, DOFVector<T> &result, BinaryAbstractFunction<T, T, T> &binary_op)
{ transformDOFInterpolation(&vec, &fct, &result, &binary_op); } { transformDOFInterpolation(&vec, &fct, &result, &binary_op); }
}
// ==================================================================================== // ====================================================================================
template<typename T> template<typename T>
T accumulateDOF_simple(DOFVector<T> *vec, inline T accumulateDOF_simple(DOFVector<T> *vec,
T value0, T value0,
BinaryAbstractFunction<T, T, T> *binary_op) BinaryAbstractFunction<T, T, T> *binary_op)
{ {
...@@ -735,10 +740,10 @@ T accumulateDOF_simple(DOFVector<T> *vec, ...@@ -735,10 +740,10 @@ T accumulateDOF_simple(DOFVector<T> *vec,
} }
template<typename TOut, typename T1, typename T2> template<typename TOut, typename T1, typename T2>
TOut accumulateDOF_simple(DOFVector<T1> *vec1, inline TOut accumulateDOF_simple(DOFVector<T1> *vec1,
DOFVector<T2> *vec2, DOFVector<T2> *vec2,
TOut value0, TOut value0,
TertiaryAbstractFunction<TOut, TOut, T1, T2> *tertiary_op) TertiaryAbstractFunction<TOut, T1, T2> *tertiary_op)
{ {
TEST_EXIT(vec1->getFeSpace() == vec2->getFeSpace())("FeSpaces must be equal!\n"); TEST_EXIT(vec1->getFeSpace() == vec2->getFeSpace())("FeSpaces must be equal!\n");
DOFIterator<T1> vec1Iter(vec1, USED_DOFS); DOFIterator<T1> vec1Iter(vec1, USED_DOFS);
...@@ -751,6 +756,4 @@ TOut accumulateDOF_simple(DOFVector<T1> *vec1, ...@@ -751,6 +756,4 @@ TOut accumulateDOF_simple(DOFVector<T1> *vec1,
return value; return value;
} }
}
#endif // AMDIS_TRANSFORM_DOF_H #endif // AMDIS_TRANSFORM_DOF_H
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