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

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

parent e034a097
Pipeline #1424 passed with stage
in 19 minutes and 39 seconds
......@@ -82,7 +82,7 @@ namespace AMDiS
template <class R, class D, class LocalContext, class T>
int order(ConstantLocalFunction<R(D), LocalContext, T> const& lf)
{
return lf.order();
return 0;
}
......
......@@ -35,7 +35,7 @@ namespace AMDiS
return x;
}
friend int order(Self const& /*f*/, int /*d*/)
friend int order(CoordsFunction /*f*/, int /*d*/)
{
return 1;
}
......@@ -81,7 +81,7 @@ namespace AMDiS
return x[comp_];
}
friend int order(Self const& /*f*/, int /*d*/)
friend int order(CoordsCompFunction /*f*/, int /*d*/)
{
return 1;
}
......
......@@ -16,7 +16,7 @@ namespace AMDiS
// @{
/// \brief Applies \ref Operation::Negate to GridFunctions. \relates FunctorGridFunction
template <class Lhs, class Rhs,
template <class Lhs,
REQUIRES(Concepts::AnyGridFunction<Lhs>)>
auto operator-(Lhs&& lhs)
{
......@@ -47,12 +47,29 @@ namespace AMDiS
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
template <class Lhs, class Rhs,
REQUIRES(Concepts::AnyGridFunction<Lhs,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