LCOV - code coverage report
Current view: top level - include/base - SCM.h (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 8 10 80.0 %
Date: 2025-09-04 07:58:06 Functions: 8 8 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             : #pragma once
      11             : 
      12             : #include "MooseUtils.h"
      13             : 
      14             : class MooseMesh;
      15             : 
      16             : namespace SCM
      17             : {
      18             : /// function to cast const mesh
      19             : template <typename T>
      20             : const T &
      21        1696 : getConstMesh(const MooseMesh & mesh)
      22             : {
      23        1696 :   const auto T_mesh = dynamic_cast<const T *>(&mesh);
      24             :   // Check that the mesh of the right type
      25        1696 :   if (!T_mesh)
      26           0 :     mooseError("The mesh is not of type: ",
      27             :                MooseUtils::prettyCppType<T>(),
      28             :                ". You must use the relevant Subchannel mesh/mesh generator with this object.");
      29        1696 :   return *T_mesh;
      30             : }
      31             : 
      32             : /// function to cast mesh
      33             : template <typename T>
      34             : T &
      35         488 : getMesh(MooseMesh & mesh)
      36             : {
      37         488 :   auto T_mesh = dynamic_cast<T *>(&mesh);
      38             :   // Check that the mesh of the right type
      39         488 :   if (!T_mesh)
      40           0 :     mooseError("The mesh is not of type: ",
      41             :                MooseUtils::prettyCppType<T>(),
      42             :                ". You must use the relevant Subchannel mesh/mesh generator with this object.");
      43         488 :   return *T_mesh;
      44             : }
      45             : }

Generated by: LCOV version 1.14