Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
ElementsToTetrahedronsConverter.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 
12 
13 #include "libmesh/elem.h"
14 #include "libmesh/boundary_info.h"
15 #include "libmesh/mesh_base.h"
16 #include "libmesh/parallel.h"
17 #include "libmesh/parallel_algebra.h"
18 #include "libmesh/cell_tet4.h"
19 #include "libmesh/face_tri3.h"
20 
21 // C++ includes
22 #include <cmath>
23 
25 
28 {
30 
31  params.addRequiredParam<MeshGeneratorName>(
32  "input", "The input mesh that needs to be converted to tetrahedral elements.");
33 
34  params.addClassDescription(
35  "This ElementsToTetrahedronsConverter object is designed to convert all the elements in a 3D "
36  "mesh consisting only linear elements into TET4 elements.");
37 
38  return params;
39 }
40 
42  : MeshGenerator(parameters),
43  _input_name(getParam<MeshGeneratorName>("input")),
44  _input(getMeshByName(_input_name))
45 {
46 }
47 
48 std::unique_ptr<MeshBase>
50 {
51  auto replicated_mesh_ptr = dynamic_cast<ReplicatedMesh *>(_input.get());
52  if (!replicated_mesh_ptr)
53  paramError("input", "Input is not a replicated mesh, which is required");
54  if (*(replicated_mesh_ptr->elem_dimensions().begin()) != 3 ||
55  *(replicated_mesh_ptr->elem_dimensions().rbegin()) != 3)
56  paramError("input", "Only 3D meshes are supported.");
57 
58  ReplicatedMesh & mesh = *replicated_mesh_ptr;
59 
61 
62  return std::move(_input);
63 }
MeshBase & mesh
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...
std::unique_ptr< MeshBase > & _input
Reference to input mesh pointer.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
static InputParameters validParams()
Definition: MeshGenerator.C:23
void convert3DMeshToAllTet4(ReplicatedMesh &mesh, const std::vector< std::pair< dof_id_type, bool >> &elems_to_process, std::vector< dof_id_type > &converted_elems_ids_to_track, const subdomain_id_type block_id_to_remove, const bool delete_block_to_remove)
Convert all the elements in a 3D mesh, consisting of only linear elements, into TET4 elements...
registerMooseObject("MooseApp", ElementsToTetrahedronsConverter)
ElementsToTetrahedronsConverter(const InputParameters &parameters)
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...
This ElementsToTetrahedronsConverter object is designed to convert all the elements in a 3D mesh cons...
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32