https://mooseframework.inl.gov
ElementOrderConversionGenerator.C
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 
11 
12 #include "MooseMeshUtils.h"
13 #include "CastUniquePointer.h"
14 
15 #include "libmesh/boundary_info.h"
16 
18 
21 {
23 
24  MooseEnum conversion_type("FIRST_ORDER SECOND_ORDER_NONFULL SECOND_ORDER COMPLETE_ORDER",
25  "FIRST_ORDER");
26 
27  params.addClassDescription("Mesh generator which converts orders of elements");
28  params.addRequiredParam<MeshGeneratorName>("input", "The mesh we want to modify");
29  params.addParam<MooseEnum>(
30  "conversion_type", conversion_type, "The type of element order conversion to perform");
31 
32  return params;
33 }
34 
36  : MeshGenerator(parameters),
37  _input(getMesh("input")),
38  _conversion_type(getParam<MooseEnum>("conversion_type").template getEnum<OrderConversionType>())
39 {
40 }
41 
42 std::unique_ptr<MeshBase>
44 {
45  std::unique_ptr<MeshBase> mesh = std::move(_input);
46 
47  switch (_conversion_type)
48  {
50  mesh->all_first_order();
51  break;
53  mesh->all_second_order(false);
54  break;
56  mesh->all_second_order();
57  break;
59  mesh->all_complete_order();
60  break;
61  default:
62  mooseError("Invalid conversion type");
63  }
64 
65  mesh->set_isnt_prepared();
66  return dynamic_pointer_cast<MeshBase>(mesh);
67 }
const OrderConversionType _conversion_type
Type of Element Order Conversion.
registerMooseObject("MooseApp", ElementOrderConversionGenerator)
MeshBase & mesh
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
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...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
static InputParameters validParams()
Definition: MeshGenerator.C:23
ElementOrderConversionGenerator(const InputParameters &parameters)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...
virtual std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
std::unique_ptr< MeshBase > & _input
The input mesh.
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32