NEML2 2.0.0
Loading...
Searching...
No Matches
R2.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 Vec;
33class SR2;
34class R2;
35class R3;
36class R4;
37class Rot;
38class WR2;
39
40template <class>
41class VecBase;
42
48class R2 : public PrimitiveTensor<R2, 3, 3>
49{
50public:
52
53 using PrimitiveTensor<R2, 3, 3>::fill;
54
57 R2(const SR2 & S);
58
61 R2(const WR2 & W);
62
64 [[nodiscard]] static R2 fill(const CScalar & a,
65 const TensorOptions & options = default_tensor_options());
66 [[nodiscard]] static R2 fill(const Scalar & a);
68 [[nodiscard]] static R2 fill(const CScalar & a11,
69 const CScalar & a22,
70 const CScalar & a33,
71 const TensorOptions & options = default_tensor_options());
72 [[nodiscard]] static R2 fill(const Scalar & a11, const Scalar & a22, const Scalar & a33);
74 [[nodiscard]] static R2 fill(const CScalar & a11,
75 const CScalar & a22,
76 const CScalar & a33,
77 const CScalar & a23,
78 const CScalar & a13,
79 const CScalar & a12,
80 const TensorOptions & options = default_tensor_options());
81 [[nodiscard]] static R2 fill(const Scalar & a11,
82 const Scalar & a22,
83 const Scalar & a33,
84 const Scalar & a23,
85 const Scalar & a13,
86 const Scalar & a12);
87
89 [[nodiscard]] static R2 skew(const Vec & v);
91 [[nodiscard]] static R2 identity(const TensorOptions & options = default_tensor_options());
92
94 R2 rotate(const Rot & r) const;
95
97 R2 rotate(const R2 & R) const;
98
100 R3 drotate(const Rot & r) const;
101
103 R4 drotate(const R2 & R) const;
104
106 Vec row(Size i) const;
107
109 Vec col(Size i) const;
110
112 R2 transpose() const;
113};
114
116R2 operator*(const R2 &, const R2 &);
118Vec operator*(const R2 &, const Vec &);
119
120} // namespace neml2
PrimitiveTensor inherits from TensorBase and additionally templates on the base shape.
Definition PrimitiveTensor.h:51
Base class for second order tensor.
Definition R2.h:49
R3 drotate(const Rot &r) const
Derivative of the rotated tensor w.r.t. the Rodrigues vector.
Definition R2.cxx:139
Vec row(Size i) const
Row.
Definition R2.cxx:156
static R2 skew(const Vec &v)
Skew matrix from Vec.
Definition R2.cxx:111
static R2 fill(const CScalar &a, const TensorOptions &options=default_tensor_options())
Fill the diagonals with a11 = a22 = a33 = a.
Definition R2.cxx:52
Vec col(Size i) const
Coluomn.
Definition R2.cxx:162
R2(const SR2 &S)
Form a full R2 from a symmetric tensor.
Definition R2.cxx:41
R2 transpose() const
transpose
Definition R2.cxx:168
R2 rotate(const Rot &r) const
Rotate using a Rodrigues vector.
Definition R2.cxx:127
static R2 identity(const TensorOptions &options=default_tensor_options())
Identity.
Definition R2.cxx:121
Third order tensor without symmetry.
Definition R3.h:41
Fourth order tensor without symmetry.
Definition R4.h:43
Rotation stored as modified Rodrigues parameters.
Definition Rot.h:49
The symmetric second order tensor.
Definition SR2.h:46
Scalar.
Definition Scalar.h:38
3-vector.
Definition Vec.h:43
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:42
Tensor operator*(const Tensor &a, const Tensor &b)
Definition operators.cxx:171
int64_t Size
Definition types.h:65
c10::Scalar CScalar
Definition types.h:39
c10::TensorOptions TensorOptions
Definition types.h:60