www.mooseframework.org
Transform.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "Transform.h"
11 #include "MooseMesh.h"
12 
13 #include "libmesh/mesh_modification.h"
14 
15 registerMooseObject("MooseApp", Transform);
16 
17 template <>
20 {
21  MooseEnum transforms("TRANSLATE=1 ROTATE=2 SCALE=3");
22 
24  params.addClassDescription("Applies a linear transform to the entire mesh.");
26  "transform", transforms, "The type of transformation to perform (TRANSLATE, ROTATE, SCALE)");
28  "vector_value",
29  "The value to use for the transformation. When using TRANSLATE or SCALE, the "
30  "xyz coordinates are applied in each direction respectively. When using "
31  "ROTATE, the values are interpreted as the Euler angles phi, theta and psi "
32  "given in degrees.");
33 
34  return params;
35 }
36 
38  : MeshModifier(parameters),
39  _transform(getParam<MooseEnum>("transform")),
40  _vector_value(getParam<RealVectorValue>("vector_value"))
41 {
42 }
43 
44 void
46 {
47  switch (_transform)
48  {
49  case 1:
50  MeshTools::Modification::translate(
52  break;
53  case 2:
54  MeshTools::Modification::rotate(
56  break;
57  case 3:
58  MeshTools::Modification::scale(
60  break;
61  }
62 }
VectorValue< Real > RealVectorValue
Definition: Assembly.h:31
MeshModifiers are objects that can modify or add to an existing mesh.
Definition: MeshModifier.h:25
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
MooseMesh * _mesh_ptr
Pointer to the mesh.
Definition: MeshModifier.h:68
MooseEnum _transform
Definition: Transform.h:30
void modify() override
Pure virtual modify function MUST be overridden by children classes.
Definition: Transform.C:45
RealVectorValue _vector_value
Definition: Transform.h:31
Transform(const InputParameters &parameters)
Definition: Transform.C:37
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
InputParameters validParams< Transform >()
Definition: Transform.C:19
registerMooseObject("MooseApp", Transform)
InputParameters validParams< MeshModifier >()
Definition: MeshModifier.C:15