dune-functions 2.10
Loading...
Searching...
No Matches
backends/concepts.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUNCTIONS_BACKEND_CONCEPTS_HH
8#define DUNE_FUNCTIONS_BACKEND_CONCEPTS_HH
9
10
11#include <utility>
12
13#include <dune/common/concept.hh>
14
15namespace Dune {
16namespace Functions {
17namespace Concept {
18
19using namespace Dune::Concept;
20
21
22// Concept for a ConstVectorBackend
23template<class GlobalBasis>
25{
26 template<class V>
27 auto require(const V& v) -> decltype(
28 v[std::declval<typename GlobalBasis::MultiIndex>()]
29 );
30};
31
32// Concept for a VectorBackend
33template<class GlobalBasis>
34struct VectorBackend : Refines<ConstVectorBackend<GlobalBasis>>
35{
36 template<class V>
37 auto require(const V& v) -> decltype(
38 const_cast<V&>(v).resize(std::declval<const GlobalBasis&>()),
39 const_cast<V&>(v)[std::declval<typename GlobalBasis::MultiIndex>()] = v[std::declval<typename GlobalBasis::MultiIndex>()]
40 );
41};
42
43} // namespace Dune::Functions::Concept
44} // namespace Dune::Functions
45} // namespace Dune
46
47
48#endif // DUNE_FUNCTIONS_BACKEND_CONCEPTS_HH
Definition polynomial.hh:17
Definition backends/concepts.hh:25
auto require(const V &v) -> decltype(v[std::declval< typename GlobalBasis::MultiIndex >()])
Definition backends/concepts.hh:35
auto require(const V &v) -> decltype(const_cast< V & >(v).resize(std::declval< const GlobalBasis & >()), const_cast< V & >(v)[std::declval< typename GlobalBasis::MultiIndex >()]=v[std::declval< typename GlobalBasis::MultiIndex >()])