Commit 04e259ab authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'issue/grid_functions_order' into 'develop'

determine order of divides grid-function of second argument is constant

See merge request !69
parents 8d9e4082 dcbeb47a
Pipeline #1628 failed with stage
in 29 minutes and 52 seconds
...@@ -82,7 +82,7 @@ namespace AMDiS ...@@ -82,7 +82,7 @@ namespace AMDiS
template <class R, class D, class LocalContext, class T> template <class R, class D, class LocalContext, class T>
int order(ConstantLocalFunction<R(D), LocalContext, T> const& lf) int order(ConstantLocalFunction<R(D), LocalContext, T> const& lf)
{ {
return lf.order(); return 0;
} }
......
...@@ -35,7 +35,7 @@ namespace AMDiS ...@@ -35,7 +35,7 @@ namespace AMDiS
return x; return x;
} }
friend int order(Self const& /*f*/, int /*d*/) friend int order(CoordsFunction /*f*/, int /*d*/)
{ {
return 1; return 1;
} }
...@@ -81,7 +81,7 @@ namespace AMDiS ...@@ -81,7 +81,7 @@ namespace AMDiS
return x[comp_]; return x[comp_];
} }
friend int order(Self const& /*f*/, int /*d*/) friend int order(CoordsCompFunction /*f*/, int /*d*/)
{ {
return 1; return 1;
} }
......
...@@ -16,7 +16,7 @@ namespace AMDiS ...@@ -16,7 +16,7 @@ namespace AMDiS
// @{ // @{
/// \brief Applies \ref Operation::Negate to GridFunctions. \relates FunctorGridFunction /// \brief Applies \ref Operation::Negate to GridFunctions. \relates FunctorGridFunction
template <class Lhs, class Rhs, template <class Lhs,
REQUIRES(Concepts::AnyGridFunction<Lhs>)> REQUIRES(Concepts::AnyGridFunction<Lhs>)>
auto operator-(Lhs&& lhs) auto operator-(Lhs&& lhs)
{ {
...@@ -47,12 +47,29 @@ namespace AMDiS ...@@ -47,12 +47,29 @@ namespace AMDiS
return invokeAtQP(Operation::Multiplies{}, std::forward<Lhs>(lhs), std::forward<Rhs>(rhs)); return invokeAtQP(Operation::Multiplies{}, std::forward<Lhs>(lhs), std::forward<Rhs>(rhs));
} }
namespace Impl
{
template <class Lhs, class Value,
REQUIRES(Concepts::ConstantToGridFunction<Value>)>
auto divideAtQP(Lhs&& lhs, Value value)
{
return invokeAtQP(Operation::Multiplies{}, std::forward<Lhs>(lhs), 1.0/value);
}
template <class Lhs, class Rhs,
REQUIRES(not Concepts::ConstantToGridFunction<std::decay_t<Rhs>>)>
auto divideAtQP(Lhs&& lhs, Rhs&& rhs)
{
return invokeAtQP(Operation::Divides{}, std::forward<Lhs>(lhs), std::forward<Rhs>(rhs));
}
}
/// \brief Applies \ref Operation::Divides to GridFunctions. \relates FunctorGridFunction /// \brief Applies \ref Operation::Divides to GridFunctions. \relates FunctorGridFunction
template <class Lhs, class Rhs, template <class Lhs, class Rhs,
REQUIRES(Concepts::AnyGridFunction<Lhs,Rhs>)> REQUIRES(Concepts::AnyGridFunction<Lhs,Rhs>)>
auto operator/(Lhs&& lhs, Rhs&& rhs) auto operator/(Lhs&& lhs, Rhs&& rhs)
{ {
return invokeAtQP(Operation::Divides{}, std::forward<Lhs>(lhs), std::forward<Rhs>(rhs)); return Impl::divideAtQP(std::forward<Lhs>(lhs), std::forward<Rhs>(rhs));
} }
......
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