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;
130 template <
typename T2>
174 void rotate(
const T2 & R);
258template <
typename T2>
262 _vals[i] = copy.
_vals[i];
270 unsigned int index = 0;
275 unsigned int index2 = 0;
284 sum += ab * R(k, o) * _vals[index2++];
287 _vals[index++] = sum;
304 "RankTwoTensor and RankThreeTensor have to have the same dimension N.");
310 result(i, j) += p(k) * b(k, i, j);
316template <
typename T2>
323 (*
this)(i, j, k) = a(i, j, k);
RankThreeTensorTempl< T > operator*(T a, const RankThreeTensorTempl< T > &b)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
RankThreeTensor is designed to handle any N-dimensional third order tensor, r.
FillMethod
To fill up the 27 entries in the 3rd-order tensor, fillFromInputVector is called with one of the foll...
void print(std::ostream &stm=Moose::out) const
Print the rank three tensor.
libMesh::VectorValue< T > operator*(const RankTwoTensorTempl< T > &a) const
b_i = r_ijk * a_jk
RankThreeTensorTempl< T > operator-() const
-r_ijk
T _vals[N3]
The values of the rank-three tensor stored by index=((i * LIBMESH_DIM + j) * LIBMESH_DIM + k)
static constexpr unsigned int N
tensor dimension and powers of the dimension
InitMethod
Initialization method.
RankThreeTensorTempl< T > & operator-=(const RankThreeTensorTempl< T > &a)
r_ijk -= a_ijk
RankThreeTensorTempl< T > & operator/=(const T a)
r_ijk /= a for all i, j, k
RankThreeTensorTempl< T > & operator*=(const T a)
r_ijk *= a
friend void dataStore(std::ostream &, RankThreeTensorTempl< T2 > &, void *)
RankThreeTensorTempl< T > & operator=(const T &value)
Assignment-from-scalar operator.
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method=automatic)
fillFromInputVector takes some number of inputs to fill the Rank-3 tensor.
friend std::ostream & operator<<(std::ostream &os, const RankThreeTensorTempl< T > &t)
static constexpr unsigned int N3
RankThreeTensorTempl< T > operator/(const T a) const
r_ijk/a
void zero()
Zeros out the tensor.
static constexpr unsigned int N2
libMesh::VectorValue< T > doubleContraction(const RankTwoTensorTempl< T > &b) const
Creates a vector from the double contraction of a rank three and rank two tensor.
friend void dataLoad(std::istream &, RankThreeTensorTempl< T2 > &, void *)
void rotate(const T2 &R)
Rotate the tensor using r_ijk = R_im R_in R_ko r_mno.
T & operator()(unsigned int i, unsigned int j, unsigned int k)
Gets the value for the index specified. Takes index = 0,1,2.
T L2norm() const
\sqrt(r_ijk*r_ijk)
RankThreeTensorTempl< T > & operator+=(const RankThreeTensorTempl< T > &a)
r_ijk += a_ijk for all i, j, k
void fillFromPlaneNormal(const libMesh::VectorValue< T > &input)
Fills RankThreeTensor from plane normal vectors ref.
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.
static MooseEnum fillMethodEnum()
Static method for use in validParams for getting the "fill_method".
RankThreeTensorTempl(const RankThreeTensorTempl< T > &a)=default
Copy assignment operator must be defined if used.
RankThreeTensorTempl< T > operator+(const RankThreeTensorTempl< T > &a) const
r_ijkl + a_ijk
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.
friend class RankThreeTensorTempl
void fillGeneralFromInputVector(const std::vector< T > &input)
RankTwoTensorTempl is designed to handle the Stress or Strain Tensor for a fully anisotropic material...
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
IntRange< T > make_range(T beg, T end)