https://mooseframework.inl.gov
SCM.h
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 
10 #pragma once
11 
12 #include "MooseUtils.h"
13 
14 class MooseMesh;
15 
16 namespace SCM
17 {
19 template <typename T>
20 const T &
21 getConstMesh(const MooseMesh & mesh)
22 {
23  const auto T_mesh = dynamic_cast<const T *>(&mesh);
24  // Check that the mesh of the right type
25  if (!T_mesh)
26  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  return *T_mesh;
30 }
31 
33 template <typename T>
34 T &
36 {
37  auto T_mesh = dynamic_cast<T *>(&mesh);
38  // Check that the mesh of the right type
39  if (!T_mesh)
40  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  return *T_mesh;
44 }
45 }
T & getMesh(MooseMesh &mesh)
function to cast mesh
Definition: SCM.h:35
void mooseError(Args &&... args)
MeshBase & mesh
const T & getConstMesh(const MooseMesh &mesh)
function to cast const mesh
Definition: SCM.h:21
Definition: SCM.h:16