https://mooseframework.inl.gov
RBBMappingConverter.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 
10 #include "RBBMappingConverter.h"
11 
12 #include "CastUniquePointer.h"
13 
14 #include "libmesh/mesh_modification.h"
15 #include "libmesh/unstructured_mesh.h"
16 
18 
21 {
23 
24  params.addRequiredParam<MeshGeneratorName>(
25  "input", "Input mesh to convert to use Rational Bernstein-Bezier mappings");
26 
27  params.addClassDescription(
28  "Reinterpolates all elements in a mesh to use Rational Bernstein-Bezier mappings");
29 
30  return params;
31 }
32 
34  : MeshGenerator(parameters), _input_ptr(getMesh("input"))
35 {
36 }
37 
38 std::unique_ptr<MeshBase>
40 {
41  // Put the input mesh in a local pointer
42  std::unique_ptr<UnstructuredMesh> mesh =
43  dynamic_pointer_cast<UnstructuredMesh>(std::move(_input_ptr));
44 
45  MeshTools::Modification::all_rbb(*mesh);
46 
47  // The remapping here subtly changes element geometry. libMesh
48  // should be properly clearing any point locator accordingly, but
49  // until that's fixed we should clear it ourselves, and even
50  // afterward this is a cheap redundancy.
51  mesh->clear_point_locator();
52 
53  return mesh;
54 }
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.
std::unique_ptr< MeshBase > & _input_ptr
Input mesh defining the original mixed mesh.
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...
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
static InputParameters validParams()
Definition: MeshGenerator.C:23
RBBMappingConverter(const InputParameters &parameters)
registerMooseObject("MooseApp", RBBMappingConverter)
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...
Takes a mesh with a Lagrange mapping, and reinterpolate its nodes using a Rational Bezier-Bernstein m...
static InputParameters validParams()
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:33