DUNE PDELab (git)

concepts.hh
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
14
15namespace Dune {
16namespace Functions {
17namespace Concept {
18
19using namespace Dune::Concept;
20
21
22// Concept for a ConstVectorBackend
23template<class GlobalBasis>
24struct ConstVectorBackend
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
Infrastructure for concepts.
Namespace for concepts.
Definition: concept.hh:34
Dune namespace.
Definition: alignedallocator.hh:13
Base class for refined concepts.
Definition: concept.hh:54
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)