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;
15class FEProblemBase;
16
17namespace SCM
18{
20template <typename T>
21const T &
23{
24 const auto T_mesh = dynamic_cast<const T *>(&mesh);
25 // Check that the mesh of the right type
26 if (!T_mesh)
27 mooseError("The mesh is not of type: ",
28 MooseUtils::prettyCppType<T>(),
29 ". You must use the relevant Subchannel mesh/mesh generator with this object.");
30 return *T_mesh;
31}
32
34template <typename T>
35T &
37{
38 auto T_mesh = dynamic_cast<T *>(&mesh);
39 // Check that the mesh of the right type
40 if (!T_mesh)
41 mooseError("The mesh is not of type: ",
42 MooseUtils::prettyCppType<T>(),
43 ". You must use the relevant Subchannel mesh/mesh generator with this object.");
44 return *T_mesh;
45}
46
48template <typename T>
49const T &
51{
52 const auto T_problem = dynamic_cast<const T *>(&problem);
53 if (!T_problem)
54 mooseError("The problem is not of type: ",
55 MooseUtils::prettyCppType<T>(),
56 ". You must use the relevant Subchannel problem with this object.");
57 return *T_problem;
58}
59}
const double T
void mooseError(Args &&... args)
MeshBase & mesh
Definition SCM.h:18
const T & getConstProblem(const FEProblemBase &problem)
function to cast const problem
Definition SCM.h:50
const T & getConstMesh(const MooseMesh &mesh)
function to cast const mesh
Definition SCM.h:22
T & getMesh(MooseMesh &mesh)
function to cast mesh
Definition SCM.h:36