NEML2 2.0.0
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Rot.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/VecBase.h"
28
29namespace neml2
30{
31// Forward declarations
32class Scalar;
33class Vec;
34class R2;
35class R3;
36
48class Rot : public VecBase<Rot>
49{
50public:
51 using VecBase<Rot>::VecBase;
52
53 Rot(const Vec & v);
54
56 [[nodiscard]] static Rot identity(const TensorOptions & options = default_tensor_options());
57
59 static Rot fill_euler_angles(const Vec & v,
60 const std::string & angle_convention,
61 const std::string & angle_type);
62
64 static Rot fill_matrix(const R2 & M);
65
67 static Rot fill_random(unsigned int n);
68
70 static Rot fill_rodrigues(const Scalar & rx, const Scalar & ry, const Scalar & rz);
71
73 Rot inverse() const;
74
76 R2 euler_rodrigues() const;
77
79 R3 deuler_rodrigues() const;
80
82 Rot rotate(const Rot & r) const;
83
85 R2 drotate(const Rot & r) const;
86
88 R2 drotate_self(const Rot & r) const;
89
91 Rot shadow() const;
92
94 R2 dshadow() const;
95
97 Scalar dist(const Rot & r) const;
98
100 Scalar gdist(const Rot & r) const;
101
103 Scalar dV() const;
104};
105
107// So this follows the "matrix" convention where it's exactly the same
108// as the standard matrix product R1 * R2 where R1 and R2 are the
109// matrix representations of r1 and r2
110Rot operator*(const Rot & r1, const Rot & r2);
111
112} // namespace neml2
Second order tensor without symmetry.
Definition R2.h:42
Third order tensor without symmetry.
Definition R3.h:41
Rotation stored as modified Rodrigues parameters.
Definition Rot.h:49
Rot rotate(const Rot &r) const
Rotate.
Definition Rot.cxx:188
static Rot fill_rodrigues(const Scalar &rx, const Scalar &ry, const Scalar &rz)
Fill from standard Rodrigues parameters.
Definition Rot.cxx:128
Scalar dist(const Rot &r) const
Distance measure between two rotations, accounting for shadow mapping.
Definition Rot.cxx:239
R3 deuler_rodrigues() const
d(R2)/d(r) – useful in constructing other derivatives
Definition Rot.cxx:173
Rot shadow() const
Return the shadow parameter set (a set of MRPs that define the same orientation)
Definition Rot.cxx:226
static Rot fill_random(unsigned int n)
Fill some number of random orientations.
Definition Rot.cxx:139
R2 dshadow() const
Return the derivative of the shadow map.
Definition Rot.cxx:232
static Rot fill_matrix(const R2 &M)
Fill from rotation matrices.
Definition Rot.cxx:111
static Rot identity(const TensorOptions &options=default_tensor_options())
The identity rotation, helpfully the zero vector.
Definition Rot.cxx:57
static Rot fill_euler_angles(const Vec &v, const std::string &angle_convention, const std::string &angle_type)
Fill from an array of Euler angles.
Definition Rot.cxx:63
R2 euler_rodrigues() const
Generate a rotation matrix using the Euler-Rodrigues formula.
Definition Rot.cxx:162
R2 drotate_self(const Rot &r) const
Derivative of the rotated Rodrigues vector w.r.t. this vector.
Definition Rot.cxx:210
Scalar gdist(const Rot &r) const
Raw distance formula, not accounting for shadown mapping.
Definition Rot.cxx:252
Rot inverse() const
Inversion.
Definition Rot.cxx:156
Rot(const Vec &v)
Definition Rot.cxx:51
Scalar dV() const
Volume element at locations.
Definition Rot.cxx:259
R2 drotate(const Rot &r) const
Derivative of the rotated Rodrigues vector w.r.t. the other Rodrigues vector.
Definition Rot.cxx:194
Scalar.
Definition Scalar.h:38
Base class 3-vector.
Definition VecBase.h:44
3-vector.
Definition Vec.h:42
Definition DiagnosticsInterface.cxx:30
TensorOptions default_tensor_options()
Default floating point tensor options.
Definition defaults.cxx:44
Tensor operator*(const Tensor &a, const Tensor &b)
Definition operators.cxx:134
c10::TensorOptions TensorOptions
Definition types.h:63