LCOV - code coverage report
Current view: top level - src/meshgenerators - ElementsToTetrahedronsConverter.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 18 19 94.7 %
Date: 2026-05-29 20:35:17 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "ElementsToTetrahedronsConverter.h"
      11             : #include "MooseMeshElementConversionUtils.h"
      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             : 
      24             : registerMooseObject("MooseApp", ElementsToTetrahedronsConverter);
      25             : 
      26             : InputParameters
      27        3295 : ElementsToTetrahedronsConverter::validParams()
      28             : {
      29        3295 :   InputParameters params = MeshGenerator::validParams();
      30             : 
      31       13180 :   params.addRequiredParam<MeshGeneratorName>(
      32             :       "input", "The input mesh that needs to be converted to tetrahedral elements.");
      33             : 
      34        3295 :   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        3295 :   return params;
      39           0 : }
      40             : 
      41         117 : ElementsToTetrahedronsConverter::ElementsToTetrahedronsConverter(const InputParameters & parameters)
      42             :   : MeshGenerator(parameters),
      43         117 :     _input_name(getParam<MeshGeneratorName>("input")),
      44         234 :     _input(getMeshByName(_input_name))
      45             : {
      46         117 : }
      47             : 
      48             : std::unique_ptr<MeshBase>
      49         117 : ElementsToTetrahedronsConverter::generate()
      50             : {
      51             :   // We're querying elem dim caches from our input mesh
      52         117 :   if (!_input->preparation().has_cached_elem_data)
      53         114 :     _input->cache_elem_data();
      54             : 
      55         117 :   if (!_input->is_serial())
      56           6 :     paramError("input", "Input is mesh not serialized, which is required");
      57         114 :   if (*(_input->elem_dimensions().begin()) != 3 || *(_input->elem_dimensions().rbegin()) != 3)
      58           6 :     paramError("input", "Only 3D meshes are supported.");
      59             : 
      60         111 :   MooseMeshElementConversionUtils::convert3DMeshToAllTet4(*_input);
      61             : 
      62         108 :   return std::move(_input);
      63             : }

Generated by: LCOV version 1.14