NEML2 2.0.0
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
SR2.h
1// Copyright 2024, UChicago Argonne, LLC
2// All Rights Reserved
3// Software Name: NEML2 -- the New Engineering material Model Library, version 2
4// By: Argonne National Laboratory
5// OPEN SOURCE LICENSE (MIT)
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23// THE SOFTWARE.
24
25#pragma once
26
27#include "neml2/tensors/PrimitiveTensor.h"
28
29namespace neml2
30{
31class Scalar;
32class R2;
33class SFR3;
34class SSR4;
35class SFFR4;
36class Rot;
37class SWR4;
38class WR2;
39
45class SR2 : public PrimitiveTensor<SR2, 6>
46{
47public:
49
51 SR2(const R2 & T);
52
54 [[nodiscard]] static SR2 fill(const Real & a,
55 const TensorOptions & options = default_tensor_options());
56 [[nodiscard]] static SR2 fill(const Scalar & a);
58 [[nodiscard]] static SR2 fill(const Real & a11,
59 const Real & a22,
60 const Real & a33,
61 const TensorOptions & options = default_tensor_options());
62 [[nodiscard]] static SR2 fill(const Scalar & a11, const Scalar & a22, const Scalar & a33);
64 [[nodiscard]] static SR2 fill(const Real & a11,
65 const Real & a22,
66 const Real & a33,
67 const Real & a23,
68 const Real & a13,
69 const Real & a12,
70 const TensorOptions & options = default_tensor_options());
71 [[nodiscard]] static SR2 fill(const Scalar & a11,
72 const Scalar & a22,
73 const Scalar & a33,
74 const Scalar & a23,
75 const Scalar & a13,
76 const Scalar & a12);
78 [[nodiscard]] static SR2 identity(const TensorOptions & options = default_tensor_options());
80 [[nodiscard]] static SSR4 identity_map(const TensorOptions & options = default_tensor_options());
81
83 SR2 rotate(const Rot & r) const;
84 SR2 rotate(const R2 & R) const;
85
87 SFR3 drotate(const Rot & r) const;
88 SFFR4 drotate(const R2 & R) const;
89
91 Scalar operator()(Size i, Size j) const;
92
94 Scalar tr() const;
95
97 SR2 vol() const;
98
100 SR2 dev() const;
101
103 Scalar det() const;
104
106 Scalar inner(const SR2 & other) const;
107
109 Scalar norm_sq() const;
110
112 Scalar norm(Real eps = 0) const;
113
115 SSR4 outer(const SR2 & other) const;
116
118 SR2 inverse() const;
119
121 SR2 transpose() const;
122};
123
124} // namespace neml2
Second order tensor without symmetry.
Definition R2.h:42
Rotation stored as modified Rodrigues parameters.
Definition Rot.h:49
The fourth order tensor with minor symmetry in the 1st and 2nd dimensions.
Definition SFFR4.h:37
The third order tensor with symmetry in the first two dimensions.
Definition SFR3.h:38
SR2 transpose() const
Transpose, no-op.
Definition SR2.cxx:215
SFR3 drotate(const Rot &r) const
Derivative of the rotated tensor w.r.t. the Rodrigues vector.
Definition SR2.cxx:132
Scalar tr() const
Trace.
Definition SR2.cxx:153
SR2 inverse() const
Inversion.
Definition SR2.cxx:209
SR2(const R2 &T)
Symmetrize an R2 then fill.
Definition SR2.cxx:47
Scalar operator()(Size i, Size j) const
Accessor.
Definition SR2.cxx:146
Scalar inner(const SR2 &other) const
Double contraction ij,ij.
Definition SR2.cxx:184
SSR4 outer(const SR2 &other) const
Outer product ij,kl -> ijkl.
Definition SR2.cxx:202
Scalar det() const
Determinant.
Definition SR2.cxx:171
SR2 rotate(const Rot &r) const
Rotate.
Definition SR2.cxx:120
SR2 dev() const
Deviatoric part of the tensor.
Definition SR2.cxx:165
Scalar norm_sq() const
Norm squared.
Definition SR2.cxx:190
Scalar norm(Real eps=0) const
Norm.
Definition SR2.cxx:196
SR2 vol() const
Volumetric part of the tensor.
Definition SR2.cxx:159
static SSR4 identity_map(const TensorOptions &options=default_tensor_options())
The derivative of a SR2 with respect to itself.
Definition SR2.cxx:114
static SR2 identity(const TensorOptions &options=default_tensor_options())
Identity.
Definition SR2.cxx:108
static SR2 fill(const Real &a, const TensorOptions &options=default_tensor_options())
Fill the diagonals with a11 = a22 = a33 = a.
Definition SR2.cxx:53
The symmetric fourth order tensor, with symmetry in the first two dimensionss as well as in the last ...
Definition SSR4.h:45
The symmetric fourth order tensor, with symmetry in the first two dimensionss and skew-symmetry in th...
Definition SWR4.h:40
Scalar.
Definition Scalar.h:38
A skew-symmetric second order tensor, represented as an axial vector.
Definition WR2.h:43
Definition DiagnosticsInterface.cxx:30
TensorOptions default_tensor_options()
Default floating point tensor options.
Definition defaults.cxx:44
constexpr auto eps
Constants.
Definition types.h:101
double Real
Definition types.h:68
int64_t Size
Definition types.h:69
c10::TensorOptions TensorOptions
Definition types.h:63