libMesh
Public Member Functions | Private Member Functions | Private Attributes | List of all members
libMesh::RawAccessor< FieldType > Class Template Reference

This class provides single index access to FieldType (i.e. More...

#include <raw_accessor.h>

Public Member Functions

 RawAccessor (FieldType &data, const unsigned int dim)
 
 ~RawAccessor ()=default
 
RawFieldType< FieldType >::type & operator() (unsigned int i)
 
const RawFieldType< FieldType >::type & operator() (unsigned int i) const
 
template<>
Numberoperator() (unsigned int libmesh_dbg_var(i))
 
template<>
Numberoperator() (unsigned int i)
 
template<>
Numberoperator() (unsigned int k)
 
template<>
Realoperator() (unsigned int libmesh_dbg_var(i))
 
template<>
Realoperator() (unsigned int i)
 
template<>
Realoperator() (unsigned int k)
 

Private Member Functions

 RawAccessor ()
 

Private Attributes

FieldType & _data
 
const unsigned int _dim
 

Detailed Description

template<typename FieldType>
class libMesh::RawAccessor< FieldType >

This class provides single index access to FieldType (i.e.

Number, Gradient, Tensor, etc.).

Definition at line 93 of file raw_accessor.h.

Constructor & Destructor Documentation

◆ RawAccessor() [1/2]

template<typename FieldType>
libMesh::RawAccessor< FieldType >::RawAccessor ( FieldType &  data,
const unsigned int  dim 
)
inline

Definition at line 97 of file raw_accessor.h.

98  : _data(data),
99  _dim(dim)
100  {}
unsigned int dim
const unsigned int _dim
Definition: raw_accessor.h:111

◆ ~RawAccessor()

template<typename FieldType>
libMesh::RawAccessor< FieldType >::~RawAccessor ( )
default

◆ RawAccessor() [2/2]

template<typename FieldType>
libMesh::RawAccessor< FieldType >::RawAccessor ( )
private

Member Function Documentation

◆ operator()() [1/8]

template<typename FieldType>
RawFieldType<FieldType>::type& libMesh::RawAccessor< FieldType >::operator() ( unsigned int  i)

◆ operator()() [2/8]

template<typename FieldType>
const RawFieldType<FieldType>::type& libMesh::RawAccessor< FieldType >::operator() ( unsigned int  i) const

◆ operator()() [3/8]

template<>
Number & libMesh::RawAccessor< Number >::operator() ( unsigned int   libmesh_dbg_vari)
inline

Definition at line 117 of file raw_accessor.h.

118 {
119  libmesh_assert_equal_to (i, 0);
120  return this->_data;
121 }

◆ operator()() [4/8]

template<>
Number & libMesh::RawAccessor< Gradient >::operator() ( unsigned int  i)
inline

Definition at line 125 of file raw_accessor.h.

126 {
127  libmesh_assert_less (i, this->_dim);
128  return this->_data(i);
129 }
const unsigned int _dim
Definition: raw_accessor.h:111

◆ operator()() [5/8]

template<>
Number & libMesh::RawAccessor< Tensor >::operator() ( unsigned int  k)
inline

Definition at line 133 of file raw_accessor.h.

134 {
135  libmesh_assert_less (k, this->_dim*this->_dim);
136 
137  // For tensors, each row is filled first, i.e. for 2-D
138  // [ 0 1; 2 3]
139  // Thus, k(i,j) = j + i*dim
140  unsigned int ii = k/_dim;
141  unsigned int jj = k - ii*_dim;
142 
143  return this->_data(ii,jj);
144 }
const unsigned int _dim
Definition: raw_accessor.h:111

◆ operator()() [6/8]

template<>
Real & libMesh::RawAccessor< Real >::operator() ( unsigned int   libmesh_dbg_vari)
inline

Definition at line 181 of file raw_accessor.h.

182 {
183  libmesh_assert_equal_to (i, 0);
184  return this->_data;
185 }

◆ operator()() [7/8]

template<>
Real & libMesh::RawAccessor< RealGradient >::operator() ( unsigned int  i)
inline

Definition at line 189 of file raw_accessor.h.

190 {
191  libmesh_assert_less (i, this->_dim);
192  return this->_data(i);
193 }
const unsigned int _dim
Definition: raw_accessor.h:111

◆ operator()() [8/8]

template<>
Real & libMesh::RawAccessor< RealTensor >::operator() ( unsigned int  k)
inline

Definition at line 197 of file raw_accessor.h.

198 {
199  libmesh_assert_less (k, this->_dim*this->_dim);
200 
201  // For tensors, each row is filled first, i.e. for 2-D
202  // [ 0 1; 2 3]
203  // Thus, k(i,j) = i + j*dim
204  unsigned int jj = k/_dim;
205  unsigned int ii = k - jj*_dim;
206 
207  return this->_data(ii,jj);
208 }
const unsigned int _dim
Definition: raw_accessor.h:111

Member Data Documentation

◆ _data

template<typename FieldType>
FieldType& libMesh::RawAccessor< FieldType >::_data
private

Definition at line 110 of file raw_accessor.h.

◆ _dim

template<typename FieldType>
const unsigned int libMesh::RawAccessor< FieldType >::_dim
private

Definition at line 111 of file raw_accessor.h.


The documentation for this class was generated from the following file: