A Rank 4 Tensor class. More...
#include <matrices.h>
Public Member Functions | |
| RankFourTensor () | |
| Empty constructor. | |
| RankFourTensor (const RankFourTensor &source_tensor) | |
| Copy constructor: Deep copy. | |
| RankFourTensor & | operator= (const RankFourTensor &source_tensor) |
| Copy assignement. | |
| void | shallow_copy_from (const RankFourTensor &source_tensor) |
| Shallow copy of data from source_tensor. | |
| RankFourTensor (const unsigned long &n) | |
| One parameter constructor produces a nxnxnxn tensor. | |
| RankFourTensor (const unsigned long &n_index1, const unsigned long &n_index2, const unsigned long &n_index3, const unsigned long &n_index4) | |
| Four parameter constructor, general non-square tensor. | |
| RankFourTensor (const unsigned long &n_index1, const unsigned long &n_index2, const unsigned long &n_index3, const unsigned long &n_index4, const T &initial_val) | |
| Four parameter constructor, general non-square tensor. | |
| virtual | ~RankFourTensor () |
| Destructor: delete the pointers. | |
| void | resize (const unsigned long &n) |
| Resize to a square nxnxnxn tensor. | |
| void | resize (const unsigned long &n_index1, const unsigned long &n_index2, const unsigned long &n_index3, const unsigned long &n_index4) |
| Resize to a general tensor. | |
| void | resize (const unsigned long &n_index1, const unsigned long &n_index2, const unsigned long &n_index3, const unsigned long &n_index4, const T &initial_value) |
| Resize to a general tensor. | |
| void | initialise (const T &val) |
| Initialise all values in the tensor to val. | |
| unsigned long | nindex1 () const |
| Return the range of index 1 of the tensor. | |
| unsigned long | nindex2 () const |
| Return the range of index 2 of the tensor. | |
| unsigned long | nindex3 () const |
| Return the range of index 3 of the tensor. | |
| unsigned long | nindex4 () const |
| Return the range of index 4 of the tensor. | |
| T & | operator() (const unsigned long &i, const unsigned long &j, const unsigned long &k, const unsigned long &l) |
| Overload the round brackets to give access as a(i,j,k,l) | |
| T | operator() (const unsigned long &i, const unsigned long &j, const unsigned long &k, const unsigned long &l) const |
| Overload a const version for read-only access as a(i,j,k,l) | |
| T & | raw_direct_access (const unsigned long &i) |
| Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems. | |
| const T & | raw_direct_access (const unsigned long &i) const |
| Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems. | |
| unsigned | offset (const unsigned long &i, const unsigned long &j) const |
| Caculate the offset in flat-packed C-style, column-major format, required for a given i,j. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems. | |
Private Member Functions | |
| void | range_check (const unsigned long &i, const unsigned long &j, const unsigned long &k, const unsigned long &l) const |
Range check to catch when an index is out of bounds, if so, it issues a warning message and dies by throwing an OomphLibError. | |
Private Attributes | |
| T * | Tensordata |
| Private internal representation as pointer to data. | |
| unsigned | N |
| 1st Tensor dimension | |
| unsigned | M |
| 2nd Tensor dimension | |
| unsigned | P |
| 3rd Tensor dimension | |
| unsigned | Q |
| 4th Tensor dimension | |
| bool | Is_tensordata_a_copy |
| Boolean to indicate whether data is a copy. | |
A Rank 4 Tensor class.
Definition at line 1700 of file matrices.h.
|
inline |
Empty constructor.
Definition at line 1772 of file matrices.h.
|
inline |
Copy constructor: Deep copy.
Definition at line 1778 of file matrices.h.
References i, oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
One parameter constructor produces a nxnxnxn tensor.
Definition at line 1863 of file matrices.h.
References oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Four parameter constructor, general non-square tensor.
Definition at line 1880 of file matrices.h.
References oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Four parameter constructor, general non-square tensor.
Definition at line 1901 of file matrices.h.
References oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
inlinevirtual |
Destructor: delete the pointers.
Definition at line 1920 of file matrices.h.
References oomph::RankFourTensor< T >::Is_tensordata_a_copy, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Initialise all values in the tensor to val.
Definition at line 2063 of file matrices.h.
References i, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
Referenced by oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::resize(), and oomph::RankFourTensor< T >::resize().
|
inline |
Return the range of index 1 of the tensor.
Definition at line 2072 of file matrices.h.
References oomph::RankFourTensor< T >::N.
|
inline |
Return the range of index 2 of the tensor.
Definition at line 2078 of file matrices.h.
References oomph::RankFourTensor< T >::M.
|
inline |
Return the range of index 3 of the tensor.
Definition at line 2084 of file matrices.h.
References oomph::RankFourTensor< T >::P.
|
inline |
Return the range of index 4 of the tensor.
Definition at line 2090 of file matrices.h.
References oomph::RankFourTensor< T >::Q.
|
inline |
Caculate the offset in flat-packed C-style, column-major format, required for a given i,j. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems.
Definition at line 2142 of file matrices.h.
References i, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::P, and oomph::RankFourTensor< T >::Q.
|
inline |
Overload the round brackets to give access as a(i,j,k,l)
Definition at line 2096 of file matrices.h.
References i, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, oomph::RankFourTensor< T >::range_check(), and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Overload a const version for read-only access as a(i,j,k,l)
Definition at line 2109 of file matrices.h.
References i, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, oomph::RankFourTensor< T >::range_check(), and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Copy assignement.
Definition at line 1808 of file matrices.h.
References i, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::resize().
|
inlineprivate |
Range check to catch when an index is out of bounds, if so, it issues a warning message and dies by throwing an OomphLibError.
Definition at line 1723 of file matrices.h.
References i, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, and oomph::RankFourTensor< T >::Q.
Referenced by oomph::RankFourTensor< T >::operator()(), and oomph::RankFourTensor< T >::operator()().
|
inline |
Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems.
Definition at line 2124 of file matrices.h.
References i, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Direct access to internal storage of data in flat-packed C-style column-major format. WARNING: Only for experienced users. Only use this if raw speed is of the essence, as in the solid mechanics problems.
Definition at line 2133 of file matrices.h.
References i, and oomph::RankFourTensor< T >::Tensordata.
Resize to a square nxnxnxn tensor.
Definition at line 1930 of file matrices.h.
References oomph::RankFourTensor< T >::resize().
Referenced by oomph::RankFourTensor< T >::operator=(), and oomph::RankFourTensor< T >::resize().
|
inline |
Resize to a general tensor.
Definition at line 1936 of file matrices.h.
References i, oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Resize to a general tensor.
Definition at line 1999 of file matrices.h.
References i, oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
inline |
Shallow copy of data from source_tensor.
Definition at line 1845 of file matrices.h.
References oomph::RankFourTensor< T >::Is_tensordata_a_copy, oomph::RankFourTensor< T >::M, oomph::RankFourTensor< T >::N, oomph::RankFourTensor< T >::P, oomph::RankFourTensor< T >::Q, and oomph::RankFourTensor< T >::Tensordata.
|
private |
Boolean to indicate whether data is a copy.
Definition at line 1719 of file matrices.h.
Referenced by oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::shallow_copy_from(), and oomph::RankFourTensor< T >::~RankFourTensor().
|
private |
2nd Tensor dimension
Definition at line 1710 of file matrices.h.
Referenced by oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::nindex2(), oomph::RankFourTensor< T >::offset(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator=(), oomph::RankFourTensor< T >::range_check(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::resize(), and oomph::RankFourTensor< T >::shallow_copy_from().
|
private |
1st Tensor dimension
Definition at line 1707 of file matrices.h.
Referenced by oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::nindex1(), oomph::RankFourTensor< T >::operator=(), oomph::RankFourTensor< T >::range_check(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::resize(), and oomph::RankFourTensor< T >::shallow_copy_from().
|
private |
3rd Tensor dimension
Definition at line 1713 of file matrices.h.
Referenced by oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::nindex3(), oomph::RankFourTensor< T >::offset(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator=(), oomph::RankFourTensor< T >::range_check(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::resize(), and oomph::RankFourTensor< T >::shallow_copy_from().
|
private |
4th Tensor dimension
Definition at line 1716 of file matrices.h.
Referenced by oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::nindex4(), oomph::RankFourTensor< T >::offset(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator=(), oomph::RankFourTensor< T >::range_check(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::resize(), and oomph::RankFourTensor< T >::shallow_copy_from().
|
private |
Private internal representation as pointer to data.
Definition at line 1704 of file matrices.h.
Referenced by oomph::RankFourTensor< T >::initialise(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::operator()(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::RankFourTensor(), oomph::RankFourTensor< T >::raw_direct_access(), oomph::RankFourTensor< T >::raw_direct_access(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::resize(), oomph::RankFourTensor< T >::shallow_copy_from(), and oomph::RankFourTensor< T >::~RankFourTensor().