LCOV - code coverage report
Current view: top level - src/meshgenerators - StitchBoundaryMeshGenerator.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 27 27 100.0 %
Date: 2025-07-17 01:28:37 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 "StitchBoundaryMeshGenerator.h"
      11             : #include "CastUniquePointer.h"
      12             : #include "MooseUtils.h"
      13             : #include "libmesh/unstructured_mesh.h"
      14             : 
      15             : registerMooseObject("MooseApp", StitchBoundaryMeshGenerator);
      16             : 
      17             : InputParameters
      18       14297 : StitchBoundaryMeshGenerator::validParams()
      19             : {
      20       14297 :   InputParameters params = MeshGenerator::validParams();
      21             : 
      22       14297 :   MooseEnum algorithm("BINARY EXHAUSTIVE", "BINARY");
      23             : 
      24       14297 :   params.addRequiredParam<MeshGeneratorName>("input", "The mesh we want to modify");
      25       42891 :   params.addParam<bool>(
      26       28594 :       "clear_stitched_boundary_ids", true, "Whether or not to clear the stitched boundary IDs");
      27       14297 :   params.addParam<MooseEnum>(
      28             :       "algorithm",
      29             :       algorithm,
      30             :       "Control the use of binary search for the nodes of the stitched surfaces.");
      31       14297 :   params.addRequiredParam<std::vector<boundary_id_type>>(
      32             :       "stitch_boundaries_pair", "Pair of boundaries to be stitched together.");
      33       14297 :   params.addClassDescription("Allows a pair of boundaries to be stitched together.");
      34             : 
      35       28594 :   return params;
      36       14297 : }
      37             : 
      38          16 : StitchBoundaryMeshGenerator::StitchBoundaryMeshGenerator(const InputParameters & parameters)
      39             :   : MeshGenerator(parameters),
      40          16 :     _input(getMesh("input")),
      41          16 :     _clear_stitched_boundary_ids(getParam<bool>("clear_stitched_boundary_ids")),
      42          16 :     _stitch_boundaries_pair(getParam<std::vector<boundary_id_type>>("stitch_boundaries_pair")),
      43          32 :     _algorithm(parameters.get<MooseEnum>("algorithm"))
      44             : {
      45          16 : }
      46             : 
      47             : std::unique_ptr<MeshBase>
      48          16 : StitchBoundaryMeshGenerator::generate()
      49             : {
      50             :   std::unique_ptr<UnstructuredMesh> mesh =
      51          16 :       dynamic_pointer_cast<UnstructuredMesh>(std::move(_input));
      52             : 
      53          16 :   const bool use_binary_search = (_algorithm == "BINARY");
      54             : 
      55             :   // stitch_surfaces only recognizes node_set boundaries
      56          16 :   mesh->get_boundary_info().build_node_list_from_side_list();
      57             : 
      58          32 :   mesh->stitch_surfaces(_stitch_boundaries_pair[0],
      59          16 :                         _stitch_boundaries_pair[1],
      60             :                         TOLERANCE,
      61          16 :                         _clear_stitched_boundary_ids,
      62             :                         /*verbose = */ true,
      63             :                         use_binary_search);
      64             : 
      65          16 :   mesh->set_isnt_prepared();
      66          32 :   return dynamic_pointer_cast<MeshBase>(mesh);
      67          16 : }

Generated by: LCOV version 1.14