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  params.addClassDescription("Mesh generator which converts orders of elements");
24  params.addRequiredParam<MeshGeneratorName>("input", "The mesh we want to modify");
25  params.addParam<MooseEnum>("conversion_type",
26  MooseEnum(getOrderConversionTypeOptions(), "FIRST_ORDER"),
27  "The type of element order conversion to perform");
28  return params;
29 }
30 
32  : MeshGenerator(parameters),
33  _input(getMesh("input")),
34  _conversion_type(getParam<MooseEnum>("conversion_type").template getEnum<OrderConversionType>())
35 {
36 }
37 
38 std::unique_ptr<MeshBase>
40 {
41  std::unique_ptr<MeshBase> mesh = std::move(_input);
42 
43  switch (_conversion_type)
44  {
45  case OrderConversionType::FIRST_ORDER:
46  mesh->all_first_order();
47  break;
48  case OrderConversionType::SECOND_ORDER_NONFULL:
49  mesh->all_second_order(false);
50  break;
51  case OrderConversionType::SECOND_ORDER:
52  mesh->all_second_order();
53  break;
54  case OrderConversionType::COMPLETE_ORDER:
55  mesh->all_complete_order();
56  break;
57  default:
58  mooseError("Invalid conversion type");
59  }
60 
61  mesh->unset_is_prepared();
62  return dynamic_pointer_cast<MeshBase>(mesh);
63 }
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:54
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 and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
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:33