https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14class MooseMesh;
15
16namespace SCM
17{
19template <typename T>
20const T &
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
33template <typename T>
34T &
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}
const double T
void mooseError(Args &&... args)
MeshBase & mesh
Definition SCM.h:17
const T & getConstMesh(const MooseMesh &mesh)
function to cast const mesh
Definition SCM.h:21
T & getMesh(MooseMesh &mesh)
function to cast mesh
Definition SCM.h:35