Debian Codegraph @

dune/localfunctions/rannacherturek/rannachertureklocalcoefficients.hh

raw symbols SCIP
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_RANNACHER_TUREK_LOCALCOEFFICIENTS_HH
6 #define DUNE_RANNACHER_TUREK_LOCALCOEFFICIENTS_HH
7
8 #include <algorithm>
9 #include <array>
10 #include <cassert>
11 #include <cstddef>
12
13 #include <dune/localfunctions/common/localkey.hh>
14
15 namespace Dune
16 {
17 /**
18 * \ingroup RannacherTurekImpl
19 \brief layout for Rannacher-Turek elements
20
21 \tparam d Domain dimension
22
23 \nosubgrouping
24 */
25 template< unsigned int d >
26 struct RannacherTurekLocalCoefficients
27 {
28 RannacherTurekLocalCoefficients ()
29 {
30 for( std::size_t i = 0; i < 2*d; ++i )
31 localKeys_[ i ] = LocalKey( i, 1, 0 );
32 }
33
34 RannacherTurekLocalCoefficients ( const RannacherTurekLocalCoefficients &other )
35 {
36 (*this) = other;
37 }
38
39 RannacherTurekLocalCoefficients &operator= ( const RannacherTurekLocalCoefficients &other )
40 {
41 std::copy( other.localKeys_.begin(), other.localKeys_.end(), localKeys_.begin() );
42 return *this;
43 }
44
45 //! number of coefficients
46 std::size_t size () const
47 {
48 return 2*d;
49 }
50
51 //! map index i to local key
52 const LocalKey &localKey ( std::size_t i ) const
53 {
54 assert( i < 2*d );
55 return localKeys_[ i ];
56 }
57
58 private:
59 std::array< LocalKey, 2*d > localKeys_;
60 };
61
62 } // namespace Dune
63
64 #endif // #ifndef DUNE_RANNACHER_TUREK_LOCALCOEFFICIENTS_HH