Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
MooseAppCoordTransform.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MooseTypes.h"
13 #include "Units.h"
14 #include "libmesh/point.h"
15 #include "libmesh/tensor_value.h"
16 #include <memory>
17 #include <string>
18 #include <array>
19 #include <tuple>
20 
21 class InputParameters;
22 class MooseMesh;
23 
25 {
26 public:
30  enum Direction : unsigned int
31  {
32  X = 0,
33  Y,
34  Z,
36  };
37 
52  typedef std::tuple<short int,
53  Real,
54  short int,
55  std::array<Real, 3>,
56  int,
57  unsigned int,
58  unsigned int,
59  short int,
60  short int,
61  short int>
63 
70 
71  MooseAppCoordTransform(const MooseAppCoordTransform & other); // we have unique pointers
73 
77  MooseAppCoordTransform(const MinimalData & minimal_data);
78 
83  MooseAppCoordTransform(const MooseMesh & mesh);
84 
85  ~MooseAppCoordTransform() = default;
86 
88  operator=(const MooseAppCoordTransform & other); // we have unique pointers
90 
96 
103 
108 
116  void setTranslationVector(const libMesh::Point & translation);
117 
125  void setUpDirection(Direction up_direction);
126 
144  void setRotation(Real alpha, Real beta, Real gamma);
145 
152  void setLengthUnit(const MooseUnits & length_unit);
153 
158  const MooseUnits & lengthUnit() const { return _length_unit; }
159 
166  Direction rz_symmetry_axis = INVALID);
167 
171  void setCoordinateSystem(const MooseMesh & mesh);
172 
176  void computeRS();
177 
184  void transformMesh(MooseMesh & mesh, const libMesh::Point & translation);
185 
190 
191 private:
197 
200  std::unique_ptr<libMesh::RealTensorValue> _scale;
201 
203  std::unique_ptr<libMesh::RealTensorValue> _rotate;
204 
206  std::unique_ptr<libMesh::RealTensorValue> _rs;
207 
209  std::unique_ptr<libMesh::RealTensorValue> _rs_inverse;
210 
217 
224 
227 
230 
232  std::array<Real, 3> _euler_angles;
233 
237 
239 };
240 
246 {
247 public:
248  explicit MultiAppCoordTransform(const MooseAppCoordTransform & our_app_transform);
249 
262  libMesh::Point operator()(const libMesh::Point & point) const;
263 
272  libMesh::Point mapBack(const libMesh::Point & point) const;
273 
281  void setTranslationVector(const libMesh::Point & translation);
282 
292  void setDestinationCoordTransform(const MooseAppCoordTransform & destination_coord_transform);
293 
298  bool isIdentity() const;
299 
305  bool hasNonTranslationTransformation() const;
306 
311  bool hasCoordinateSystemTypeChange() const;
312 
317 
321  void skipCoordinateCollapsing(bool skip_coordinate_collapsing);
322 
327 
332 
333 private:
338 
346 
349 
352 };
libMesh::Point _translation
Describes a forward translation transformation from our domain to the reference frame domain...
std::tuple< short int, Real, short int, std::array< Real, 3 >, int, unsigned int, unsigned int, short int, short int, short int > MinimalData
A typedef for conveniency that describes the minimal data necessary to broadcast and build a MooseApp...
std::unique_ptr< libMesh::RealTensorValue > _scale
Represents a forward scaling transformation from our units to reference frame units of meters...
void setTranslationVector(const libMesh::Point &translation)
Set how much our domain should be translated in order to match a reference frame. ...
static InputParameters validParams()
Describes the parameters this object can take to setup transformations.
bool _mesh_transformed
Whether the mesh has been translated and rotated.
Direction _z_axis
If we are RZ, the Cartesian axis corresponding to the axial/axis-of-symmetry coordinate.
MooseAppCoordTransform()
Default constructor.
const MooseAppCoordTransform & ourAppTransform() const
std::unique_ptr< libMesh::RealTensorValue > _rs_inverse
Represents the inverse of the product of rotation and scaling transformations.
Moose::CoordinateSystemType coordinateSystem() const
Moose::CoordinateSystemType _coord_type
Our coordinate system.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const MooseAppCoordTransform * _destination_app_transform
A pointer to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate syste...
Direction
A class scope enumeration for conveniently denoting X, Y, and Z axis directions.
libMesh::Point mapBack(const libMesh::Point &point) const
Inverse transform from the reference space to our space.
bool _has_different_coord_sys
Whether we have different coordinate systems within our single domain.
const MooseAppCoordTransform & _our_app_transform
A reference to the MooseAppCoordTransform object that describes scaling, rotation, and coordinate system transformations from our domain to the reference domain, e.g.
void setTranslationVector(const libMesh::Point &translation)
Set how much our domain should be translated in order to match a reference frame. ...
Direction _r_axis
If we are RZ or RSPHERICAL, the Cartesian axis corresponding to the radial coordinate.
bool hasCoordinateSystemTypeChange() const
Moose::CoordinateSystemType coordinateSystem() const
MinimalData minimalDataDescription() const
bool hasScalingOrRotationTransformation() const
Returns true if the app has scaling and/or rotation transformation.
const MooseUnits & lengthUnit() const
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
std::unique_ptr< libMesh::RealTensorValue > _rs
Represents the product of rotation and scaling transformations.
Direction processZAxis(Direction z_axis)
If the coordinate system type is RZ, then we return the provided argument.
bool skipCoordinateCollapsing() const
whether coordinate collapsing operations should be skipped
std::unique_ptr< libMesh::RealTensorValue > _rotate
Represents a forward rotation transformation from our domain to the reference frame domain...
void setLengthUnit(const MooseUnits &length_unit)
Set the scaling transformation.
void setCoordinateSystem(Moose::CoordinateSystemType system_type, Direction rz_symmetry_axis=INVALID)
Set our coordinate system.
MooseUnits _length_unit
How much distance one mesh length unit represents, e.g. 1 cm, 1 nm, 1 ft, 5 inches.
Physical unit management class with runtime unit string parsing, unit checking, unit conversion...
Definition: Units.h:32
void transformMesh(MooseMesh &mesh, const libMesh::Point &translation)
Transforms the entire mesh with the coordinate transform This can be done to output in position...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CoordinateSystemType
Definition: MooseTypes.h:803
void computeRS()
Compute the RS and (RS)^{-1} matrices.
libMesh::Point operator()(const libMesh::Point &point) const
Transforms a point from our domain into the reference domain.
bool _skip_coordinate_collapsing
whether coordinate collapsing operations should be skipped
void setDestinationCoordTransform(const MooseAppCoordTransform &destination_coord_transform)
Set the destination coordinate system and destination radial and symmetry axes as appropriate for RZ ...
bool hasNonTranslationTransformation() const
MooseAppCoordTransform & operator=(const MooseAppCoordTransform &other)
MultiAppCoordTransform(const MooseAppCoordTransform &our_app_transform)
~MooseAppCoordTransform()=default
void setRotation(Real alpha, Real beta, Real gamma)
Setup an extrinsic rotation defined in the following way:
void ErrorVector unsigned int
bool _using_general_rz_coord_axes
Whether general axisymmetric coordinate axes are being used.
This class contains transformation information that only exists in a context in which there are multi...
std::array< Real, 3 > _euler_angles
The Euler angles describing rotation.
void setUpDirection(Direction up_direction)
Will setup a rotation transformation.