LCOV - code coverage report
Current view: top level - src/userobjects - MeshCutUserObjectBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose xfem: #31730 (e8b711) with base e0c998 Lines: 20 23 87.0 %
Date: 2025-10-29 16:56:32 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 "MeshCutUserObjectBase.h"
      11             : 
      12             : #include "MooseError.h"
      13             : #include "MooseUtils.h"
      14             : #include "MooseMesh.h"
      15             : #include "libmesh/serial_mesh.h"
      16             : #include "libmesh/mesh_tools.h"
      17             : 
      18             : InputParameters
      19         139 : MeshCutUserObjectBase::validParams()
      20             : {
      21         139 :   InputParameters params = GeometricCutUserObject::validParams();
      22         278 :   params.addDeprecatedParam<MeshFileName>(
      23             :       "mesh_file",
      24             :       "Mesh file for the XFEM geometric cut.",
      25             :       "This parameter is deprecated in favor of reading in the cuttermesh from the mesh system "
      26             :       "using 'mesh_generator_name'.");
      27         278 :   params.addParam<std::string>("mesh_generator_name",
      28             :                                "Mesh generator for the XFEM geometric cutter.");
      29         139 :   params.addClassDescription("Base class for mesh-based cutters used with XFEM.");
      30         139 :   return params;
      31           0 : }
      32             : 
      33          70 : MeshCutUserObjectBase::MeshCutUserObjectBase(const InputParameters & parameters)
      34          70 :   : GeometricCutUserObject(parameters, true)
      35             : {
      36         140 :   if (isParamValid("mesh_generator_name"))
      37             :   {
      38          82 :     std::string cutterMeshName = getParam<std::string>("mesh_generator_name");
      39          41 :     auto & mesh_generator_system = _app.getMeshGeneratorSystem();
      40          82 :     _cutter_mesh = mesh_generator_system.getSavedMesh(cutterMeshName);
      41             :   }
      42          58 :   else if (isParamValid("mesh_file"))
      43             :   {
      44          29 :     MeshFileName cutterMeshName = getParam<MeshFileName>("mesh_file");
      45          29 :     _cutter_mesh = std::make_unique<ReplicatedMesh>(_communicator);
      46          29 :     _cutter_mesh->read(cutterMeshName);
      47             :   }
      48             :   else
      49             :   {
      50           0 :     mooseError("Must specify 'mesh_generator_name' or 'mesh_file'. ");
      51             :   }
      52             : 
      53          70 :   if (!_cutter_mesh)
      54           0 :     mooseError("Not able to read in a cutter mesh.");
      55          70 : }
      56             : 
      57             : MeshBase &
      58          92 : MeshCutUserObjectBase::getCutterMesh() const
      59             : {
      60             :   mooseAssert(_cutter_mesh, "MeshCutUserObjectBase::getCutterMesh _cutter_mesh is nullptr");
      61          92 :   return *_cutter_mesh;
      62             : }

Generated by: LCOV version 1.14