https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElementsToSimplicesConverter.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 "CastUniquePointer.h"
13
14#include "libmesh/mesh_modification.h"
15#include "libmesh/unstructured_mesh.h"
16
18
21{
23
24 params.addRequiredParam<MeshGeneratorName>("input", "Input mesh to convert to all-simplex mesh");
25
26 params.addClassDescription("Splits all non-simplex elements in a mesh into simplices.");
27
28 return params;
29}
30
32 : MeshGenerator(parameters), _input_ptr(getMesh("input"))
33{
34}
35
36std::unique_ptr<MeshBase>
38{
39 // Put the input mesh in a local pointer
40 std::unique_ptr<UnstructuredMesh> mesh =
41 dynamic_pointer_cast<UnstructuredMesh>(std::move(_input_ptr));
42
43 // all_tri() on a ReplicatedMesh skips its internal prepare_for_use() call (it only prepares
44 // for non-replicated meshes). Without preparation, element_ptr_range() may not iterate over
45 // all elements correctly, producing incomplete results. Prepare here to ensure correctness.
46 if (!mesh->is_prepared())
47 mesh->prepare_for_use();
48
49 MeshTools::Modification::all_tri(*mesh);
50
51 return mesh;
52}
registerMooseObject("MooseApp", ElementsToSimplicesConverter)
Takes a mesh with a mix of element types, and subdivides elements as needed to produce a mesh of the ...
std::unique_ptr< MeshBase > & _input_ptr
Input mesh defining the original mixed mesh.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
ElementsToSimplicesConverter(const InputParameters &parameters)
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...
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.
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()
MeshBase & mesh