libMesh::RawAccessor< FieldType > Class Template Reference

#include <raw_accessor.h>

Public Member Functions

 RawAccessor (FieldType &data, const unsigned int dim)
 
 ~RawAccessor ()
 
RawFieldType< FieldType >::type & operator() (unsigned int i)
 
const RawFieldType< FieldType >
::type & 
operator() (unsigned int i) const
 
template<>
Numberoperator() (unsigned int i)
 
template<>
Numberoperator() (unsigned int i)
 
template<>
Numberoperator() (unsigned int k)
 
template<>
Realoperator() (unsigned int 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

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  {}
template<typename FieldType>
libMesh::RawAccessor< FieldType >::~RawAccessor ( )
inline

Definition at line 102 of file raw_accessor.h.

102 {}
template<typename FieldType>
libMesh::RawAccessor< FieldType >::RawAccessor ( )
private

Member Function Documentation

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

Definition at line 117 of file raw_accessor.h.

118 {
119  libmesh_assert_equal_to (i, 0);
120  return this->_data;
121 }
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 }
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 }
template<>
Real & libMesh::RawAccessor< Real >::operator() ( unsigned int  i)
inline

Definition at line 181 of file raw_accessor.h.

182 {
183  libmesh_assert_equal_to (i, 0);
184  return this->_data;
185 }
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 }
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 }

Member Data Documentation

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

Definition at line 110 of file raw_accessor.h.

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:

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:30 UTC

Hosted By:
SourceForge.net Logo