Skip to content
Snippets Groups Projects
Commit 06274677 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Rename HybridAlgorithm:: to Hybrid:: and if_() to ifElse()

I like these names proposed by Oliver
parent efd3d83b
Branches
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@
namespace Dune {
namespace Solvers {
namespace HybridAlgorithm {
namespace Hybrid {
namespace Imp {
......@@ -82,7 +82,7 @@ namespace Imp {
template<class T>
constexpr auto size(const T& t)
{
return HybridAlgorithm::Imp::size(&t, PriorityTag<42>());
return Hybrid::Imp::size(&t, PriorityTag<42>());
}
......@@ -133,7 +133,7 @@ namespace Imp {
template<class Container, class Index>
constexpr decltype(auto) elementAt(Container&& c, Index&& i)
{
return HybridAlgorithm::Imp::elementAt(std::forward<Container>(c), std::forward<Index>(i), PriorityTag<42>());
return Hybrid::Imp::elementAt(std::forward<Container>(c), std::forward<Index>(i), PriorityTag<42>());
}
......@@ -222,7 +222,7 @@ namespace Imp {
template<class Begin, class End>
constexpr auto integralRange(const Begin& begin, const End& end)
{
return HybridAlgorithm::Imp::integralRange(begin, end, PriorityTag<42>());
return Hybrid::Imp::integralRange(begin, end, PriorityTag<42>());
}
/**
......@@ -239,7 +239,7 @@ constexpr auto integralRange(const Begin& begin, const End& end)
template<class End>
constexpr auto integralRange(const End& end)
{
return HybridAlgorithm::Imp::integralRange(Dune::Indices::_0, end, PriorityTag<42>());
return Hybrid::Imp::integralRange(Dune::Indices::_0, end, PriorityTag<42>());
}
......@@ -249,14 +249,14 @@ namespace Imp {
template<class Range, class F, class Index, Index... i>
constexpr void forEachIndex(Range&& range, F&& f, std::integer_sequence<Index, i...>)
{
std::initializer_list<int>{(f(HybridAlgorithm::elementAt(range, std::integral_constant<Index,i>())), 0)...};
std::initializer_list<int>{(f(Hybrid::elementAt(range, std::integral_constant<Index,i>())), 0)...};
}
template<class Range, class F,
std::enable_if_t<IsIntegralConstant<decltype(HybridAlgorithm::size(std::declval<Range>()))>::value, int> = 0>
std::enable_if_t<IsIntegralConstant<decltype(Hybrid::size(std::declval<Range>()))>::value, int> = 0>
constexpr void forEach(Range&& range, F&& f, PriorityTag<1>)
{
auto size = HybridAlgorithm::size(range);
auto size = Hybrid::size(range);
auto indices = std::make_index_sequence<size>();
forEachIndex(std::forward<Range>(range), std::forward<F>(f), indices);
}
......@@ -286,7 +286,7 @@ namespace Imp {
*
* This supports looping over the following ranges
* * ranges obtained from integralRange()
* * all ranges that provide HybridAlgorithm::size() and HybridAlgorithm::elementAt()
* * all ranges that provide Hybrid::size() and Hybrid::elementAt()
*
* This especially included instances of std::integer_sequence,
* std::tuple, Dune::TupleVector, and Dune::MultiTypeBlockVector.
......@@ -294,7 +294,7 @@ namespace Imp {
template<class Range, class F>
constexpr void forEach(Range&& range, F&& f)
{
HybridAlgorithm::Imp::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
Hybrid::Imp::forEach(std::forward<Range>(range), std::forward<F>(f), PriorityTag<42>());
}
......@@ -302,19 +302,19 @@ constexpr void forEach(Range&& range, F&& f)
namespace Imp {
template<class IfFunc, class ElseFunc>
constexpr void if_(std::true_type, IfFunc&& ifFunc, ElseFunc&& elseFunc)
constexpr void ifElse(std::true_type, IfFunc&& ifFunc, ElseFunc&& elseFunc)
{
ifFunc([](auto&& x) { return std::forward<decltype(x)>(x);});
}
template<class IfFunc, class ElseFunc>
constexpr void if_(std::false_type, IfFunc&& ifFunc, ElseFunc&& elseFunc)
constexpr void ifElse(std::false_type, IfFunc&& ifFunc, ElseFunc&& elseFunc)
{
elseFunc([](auto&& x) { return std::forward<decltype(x)>(x);});
}
template<class IfFunc, class ElseFunc>
constexpr void if_(const bool& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
constexpr void ifElse(const bool& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
{
if (condition)
ifFunc([](auto&& x) { return std::forward<decltype(x)>(x);});
......@@ -345,20 +345,20 @@ namespace Imp {
* a static if statement.
*/
template<class Condition, class IfFunc, class ElseFunc>
constexpr void if_(const Condition& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
constexpr void ifElse(const Condition& condition, IfFunc&& ifFunc, ElseFunc&& elseFunc)
{
Imp::if_(condition, std::forward<IfFunc>(ifFunc), std::forward<ElseFunc>(elseFunc));
Imp::ifElse(condition, std::forward<IfFunc>(ifFunc), std::forward<ElseFunc>(elseFunc));
}
/**
* \brief A conditional expression
*
* This provides an if_ conditional with empty else clause.
* This provides an ifElse conditional with empty else clause.
*/
template<class Condition, class IfFunc>
constexpr void if_(const Condition& condition, IfFunc&& ifFunc)
constexpr void ifElse(const Condition& condition, IfFunc&& ifFunc)
{
if_(condition, std::forward<IfFunc>(ifFunc), [](auto&& i) {});
ifElse(condition, std::forward<IfFunc>(ifFunc), [](auto&& i) {});
}
......@@ -367,7 +367,7 @@ constexpr void if_(const Condition& condition, IfFunc&& ifFunc)
} // namespace HybridAlgorithm
} // namespace Hybrid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment