17 #include "libmesh/libmesh.h" 18 #include "libmesh/int_range.h" 20 #include "metaphysicl/raw_type.h" 60 static constexpr
unsigned int N2 =
N *
N;
61 static constexpr
unsigned int N3 =
N *
N *
N;
91 template <
typename T2>
101 inline T &
operator()(
unsigned int i,
unsigned int j,
unsigned int k)
103 return _vals[((i *
N + j) *
N + k)];
107 inline T
operator()(
unsigned int i,
unsigned int j,
unsigned int k)
const 109 return _vals[((i *
N + j) *
N + k)];
119 void print(std::ostream & stm = Moose::out)
const;
121 friend std::ostream & operator<<(std::ostream & os, const RankThreeTensorTempl<T> & t)
130 template <
typename T2>
174 void rotate(
const T2 & R);
239 template <
typename T>
257 template <
typename T>
258 template <
typename T2>
262 _vals[i] = copy.
_vals[i];
265 template <
typename T>
270 unsigned int index = 0;
275 unsigned int index2 = 0;
284 sum += ab * R(k, o) * _vals[index2++];
287 _vals[index++] = sum;
291 template <
typename T>
299 template <
typename T>
304 "RankTwoTensor and RankThreeTensor have to have the same dimension N.");
310 result(i, j) += p(k) * b(k, i, j);
315 template <
typename T>
316 template <
typename T2>
323 (*this)(i, j, k) = a(i, j, k);
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
RankThreeTensorTempl< T > operator*(T a, const RankThreeTensorTempl< T > &b)
RankFourTensorTempl< T > mixedProductRankFour(const RankTwoTensorTempl< T > &a) const
Creates fourth order tensor D_{ijkl}=A_{mij}*b_{mn}*A_{nkl} where A is rank 3 and b is rank 2...
T operator()(unsigned int i, unsigned int j, unsigned int k) const
Gets the value for the index specified. Takes index = 0,1,2. Used for const.
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
static constexpr unsigned int N2
void fillFromPlaneNormal(const libMesh::VectorValue< T > &input)
Fills RankThreeTensor from plane normal vectors ref.
RankThreeTensorTempl< T > & operator/=(const T a)
r_ijk /= a for all i, j, k
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
libMesh::VectorValue< T > doubleContraction(const RankTwoTensorTempl< T > &b) const
Creates a vector from the double contraction of a rank three and rank two tensor. ...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
RankThreeTensorTempl< T > & operator-=(const RankThreeTensorTempl< T > &a)
r_ijk -= a_ijk
std::basic_ostream< charT, traits > * os
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method=automatic)
fillFromInputVector takes some number of inputs to fill the Rank-3 tensor.
RankThreeTensorTempl< T > operator/(const T a) const
r_ijk/a
RankThreeTensor is designed to handle any N-dimensional third order tensor, r.
RankThreeTensorTempl< T > operator-() const
-r_ijk
FillMethod
To fill up the 27 entries in the 3rd-order tensor, fillFromInputVector is called with one of the foll...
RankThreeTensorTempl< T > & operator+=(const RankThreeTensorTempl< T > &a)
r_ijk += a_ijk for all i, j, k
static MooseEnum fillMethodEnum()
Static method for use in validParams for getting the "fill_method".
RankThreeTensorTempl< T > & operator*=(const T a)
r_ijk *= a
void rotate(const T2 &R)
Rotate the tensor using r_ijk = R_im R_in R_ko r_mno.
libMesh::VectorValue< T > operator*(const RankTwoTensorTempl< T > &a) const
b_i = r_ijk * a_jk
RankThreeTensorTempl< T > & operator=(const T &value)
Assignment-from-scalar operator.
T & operator()(unsigned int i, unsigned int j, unsigned int k)
Gets the value for the index specified. Takes index = 0,1,2.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
T _vals[N3]
The values of the rank-three tensor stored by index=((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) ...
InitMethod
Initialization method.
static constexpr unsigned int N3
RankThreeTensorTempl()
Default constructor; fills to zero.
RankThreeTensorTempl< T > operator+(const RankThreeTensorTempl< T > &a) const
r_ijkl + a_ijk
T L2norm() const
(r_ijk*r_ijk)
friend void dataLoad(std::istream &, RankThreeTensorTempl< T2 > &, void *)
RankTwoTensorTempl is designed to handle the Stress or Strain Tensor for a fully anisotropic material...
friend void dataStore(std::ostream &, RankThreeTensorTempl< T2 > &, void *)
IntRange< T > make_range(T beg, T end)
void zero()
Zeros out the tensor.
void fillGeneralFromInputVector(const std::vector< T > &input)
void print(std::ostream &stm=Moose::out) const
Print the rank three tensor.
static constexpr unsigned int N
tensor dimension and powers of the dimension