DUNE-FEM (unstable)

rowreferencevector.hh
1#ifndef DUNE_FEM_STORAGE_ROWREFERENCEVECTOR_HH
2#define DUNE_FEM_STORAGE_ROWREFERENCEVECTOR_HH
3
5
6namespace Dune
7{
8
9 namespace Fem
10 {
11
12 // Internal Forward Declarations
13 // -----------------------------
14
15 template< class K >
16 class RowReferenceVector;
17
18 } // namespace Fem
19
20
21
22 // DenseMatVecTraits for RowReferenceVector
23 // ----------------------------------------
24
25 template< class K >
26 struct DenseMatVecTraits< Fem::RowReferenceVector< K > >
27 {
28 typedef Fem::RowReferenceVector< K > derived_type;
29 typedef K value_type;
30 typedef std::size_t size_type;
31 };
32
33
34
35 // FieldTraits for RowReferenceVector
36 // ----------------------------------
37
38 template< class K >
39 struct FieldTraits< Fem::RowReferenceVector< K > >
40 {
41 typedef typename FieldTraits< K >::field_type field_type;
42 typedef typename FieldTraits< K >::real_type real_type;
43 };
44
45
46
47 namespace Fem
48 {
49
50 // RowReferenceVector
51 // ------------------
52
53 template< class K >
54 class RowReferenceVector
55 : public Dune::DenseVector< RowReferenceVector< K > >
56 {
58
59 public:
60 typedef typename Base::size_type size_type;
61 typedef typename Base::value_type value_type;
62
63 RowReferenceVector ( K *data, size_type size )
64 : data_( data ), size_( size )
65 {}
66
67 RowReferenceVector ( const RowReferenceVector &other )
68 : data_( other.data_ ), size_( other.size_ )
69 {}
70
71 using Base::operator=;
72
73 const K &operator[] ( size_type i ) const { return data_[ i ]; }
74 K &operator[] ( size_type i ) { return data_[ i ]; }
75
76 size_type size () const { return size_; }
77
78 const K *data () const { return data_; }
79 K *data () { return data_; }
80
81 private:
82 K *data_;
83 size_type size_;
84 };
85
86 } // namespace Fem
87
88} // namespace Dune
89
90#endif // #ifndef DUNE_FEM_STORAGE_ROWREFERENCEVECTOR_HH
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:229
Traits::value_type value_type
export the type representing the field
Definition: densevector.hh:250
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:259
Implements the dense vector interface, with an exchangeable storage class.
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)