Skip to content
Snippets Groups Projects
Commit dcbeb47a authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

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

parent e034a097
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment