https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
48std::unique_ptr<MeshBase>
50{
51 // We're querying elem dim caches from our input mesh
52 if (!_input->preparation().has_cached_elem_data)
53 _input->cache_elem_data();
54
55 if (!_input->is_serial())
56 paramError("input", "Input is mesh not serialized, which is required");
57 if (*(_input->elem_dimensions().begin()) != 3 || *(_input->elem_dimensions().rbegin()) != 3)
58 paramError("input", "Only 3D meshes are supported.");
59
61
62 return std::move(_input);
63}
registerMooseObject("MooseApp", ElementsToTetrahedronsConverter)
This ElementsToTetrahedronsConverter object is designed to convert all the elements in a 3D mesh cons...
std::unique_ptr< MeshBase > & _input
Reference to input mesh pointer.
ElementsToTetrahedronsConverter(const InputParameters &parameters)
std::unique_ptr< MeshBase > generate() override
Generate / modify the 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...
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()
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 ...
Definition MooseBase.h:457
void convert3DMeshToAllTet4(MeshBase &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.