Loading...
Searching...
No Matches
combinedfunctor.hh
Go to the documentation of this file.
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_AMG_COMBINEDFUNCTOR_HH
#define DUNE_AMG_COMBINEDFUNCTOR_HH
#include <tuple>
namespace Dune
{
namespace Amg
{
template<std::size_t i>
struct ApplyHelper
{
template<class TT, class T>
static void apply(TT tuple, const T& t)
{
std::get<i-1>(tuple) (t);
ApplyHelper<i-1>::apply(tuple, t);
}
};
template<>
struct ApplyHelper<0>
{
template<class TT, class T>
static void apply([[maybe_unused]] TT tuple, [[maybe_unused]] const T& t)
{}
};
template<typename T>
class CombinedFunctor :
public T
{
public:
CombinedFunctor(const T& tuple_)
: T(tuple_)
{}
template<class T1>
void operator()(const T1& t)
{
ApplyHelper<std::tuple_size<T>::value>::apply(*this, t);
}
};
} //namespace Amg
} // namespace Dune
#endif
Dune
Definition allocator.hh:11
Dune::Amg
Definition novlpschwarz.hh:256
Dune::Amg::ApplyHelper
Definition combinedfunctor.hh:17
Dune::Amg::ApplyHelper::apply
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:19
Dune::Amg::ApplyHelper< 0 >::apply
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:29
Dune::Amg::CombinedFunctor::CombinedFunctor
CombinedFunctor(const T &tuple_)
Definition combinedfunctor.hh:38
Dune::Amg::CombinedFunctor::operator()
void operator()(const T1 &t)
Definition combinedfunctor.hh:43