Commit ac1878f9 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

problems with swap() solved

parent a84300ab
......@@ -70,6 +70,46 @@ namespace AMDiS
private:
T val;
};
template<typename T, typename S>
struct add_constant : FunctorBase
{
typedef T result_type;
S value;
add_constant(S value) : value(value) {}
result_type& operator()(T& v) { return (v += value); }
};
template<typename T, typename S>
struct minus_constant : FunctorBase
{
typedef T result_type;
S value;
minus_constant(S value) : value(value) {}
result_type& operator()(T& v) { return (v -= value); }
};
template<typename T, typename S>
struct mult_constant : FunctorBase
{
typedef T result_type;
S value;
mult_constant(S value) : value(value) {}
result_type& operator()(T& v) { return (v *= value); }
};
template<typename T, typename S>
struct div_constant : FunctorBase
{
typedef T result_type;
S value;
div_constant(S value) : value(value) {}
result_type& operator()(T& v) { return (v /= value); }
};
/// functor for operator+=
template<typename T>
......@@ -100,6 +140,7 @@ namespace AMDiS
static result_type& apply(T& v, T const& v0) { return (v *= v0); }
result_type& operator()(T& v, T const& v0) { return apply(v,v0); }
};
/// abs(v) == |v|
template<typename T>
......
......@@ -366,6 +366,7 @@ namespace AMDiS { namespace Parallel {
Element *child0 = boundEl.el->getFirstChild();
Element *child1 = boundEl.el->getSecondChild();
if (boundEl.reverseMode) {
using std::swap;
swap(s0, s1);
swap(child0, child1);
}
......@@ -478,6 +479,7 @@ namespace AMDiS { namespace Parallel {
Element *child0 = el->getFirstChild();
Element *child1 = el->getSecondChild();
if (rMode) {
using std::swap;
swap(s0, s1);
swap(child0, child1);
}
......
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