https://mooseframework.inl.gov
MooseFunctorArguments.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 <tuple>
13 
14 #include "Limiter.h"
15 #include "FaceInfo.h"
16 #include "MooseTypes.h"
17 #include "libmesh/elem.h"
18 #include "libmesh/point.h"
19 #include "libmesh/quadrature.h"
20 
21 #include <set>
22 
23 namespace Moose
24 {
28 struct ElemArg
29 {
32 
36  Point getPoint() const { return elem->vertex_average(); }
37 
42  friend bool operator<(const ElemArg & l, const ElemArg & r)
43  {
44  return std::make_tuple(l.elem, l.correct_skewness) <
45  std::make_tuple(r.elem, r.correct_skewness);
46  }
47 };
48 
54 {
58 
62  Point getPoint() const { return point; }
63 
68  friend bool operator<(const ElemPointArg & l, const ElemPointArg & r)
69  {
70  return std::make_tuple(l.elem, l.point, l.correct_skewness) <
71  std::make_tuple(r.elem, r.point, r.correct_skewness);
72  }
73 
77  ElemArg makeElem() const { return {elem, correct_skewness}; }
78 };
79 
90 {
93 
95  unsigned int side;
96 
98  unsigned int qp;
99 
102 
104  Point point;
105 
109  Point getPoint() const { return point; }
110 };
111 
121 struct StateArg
122 {
127  StateArg(bool) = delete;
128 
129  StateArg(unsigned int state_in) : state(state_in), iteration_type(SolutionIterationType::Time) {}
130 
131  StateArg(unsigned int state_in, SolutionIterationType iteration_type_in)
132  : state(state_in), iteration_type(iteration_type_in)
133  {
134  }
135 
139  unsigned int state;
140 
143 
144 private:
146 
147  friend StateArg currentState();
148 };
149 
150 inline StateArg
152 {
153  return {};
154 }
155 
156 inline StateArg
158 {
159  return {(unsigned int)1};
160 }
161 
162 inline StateArg
164 {
165  return {(unsigned int)1, SolutionIterationType::Nonlinear};
166 }
167 
171 struct FaceArg
172 {
174  const FaceInfo * fi;
175 
179 
182 
185 
196 
199 
203  libMesh::Point getPoint() const { return fi->faceCentroid(); }
204 
208  ElemArg makeElem() const { return {&fi->elem(), correct_skewness}; }
209 
214 
219  friend bool operator<(const FaceArg & l, const FaceArg & r)
220  {
221  return std::make_tuple(
223  std::make_tuple(r.fi, r.limiter_type, r.elem_is_upwind, r.correct_skewness, r.face_side);
224  }
225 };
226 
227 struct NodeArg
228 {
231 
239  const std::set<SubdomainID> * subdomain_ids;
240 
241  libMesh::Point getPoint() const { return *node; }
242 
246  static const std::set<SubdomainID> undefined_subdomain_connection;
247 };
248 
257 struct ElemQpArg
258 {
261 
263  unsigned int qp;
264 
267 
270 
274  libMesh::Point getPoint() const { return point; }
275 };
276 }
unsigned int side
The local side index.
StateArg(unsigned int state_in)
Point getPoint() const
const libMesh::QBase * qrule
The quadrature rule.
static const std::set< SubdomainID > undefined_subdomain_connection
A static member that can be used when the connection of a node to subdomains is unknown.
StateArg oldState()
const libMesh::Elem * face_side
A member that can be used to indicate whether there is a sidedness to this face.
friend StateArg currentState()
const Elem & elem() const
Definition: FaceInfo.h:81
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition: FaceInfo.h:71
bool correct_skewness
Whether to perform skew correction.
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
const libMesh::Node * node
The node which defines our location in space.
const Moose::StateArg * state_limiter
A member that can be used to define the instance in which the limiters are executed.
friend bool operator<(const ElemPointArg &l, const ElemPointArg &r)
friend function that allows this structure to be used as keys in ordered containers like sets and map...
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
const std::set< SubdomainID > * subdomain_ids
Indicates what subdomains this argument should be associated with.
const Elem * neighborPtr() const
Definition: FaceInfo.h:84
A structure defining a "face" evaluation calling argument for Moose functors.
unsigned int qp
The quadrature point index.
const FaceInfo * fi
a face information object which defines our location in space
SolutionIterationType iteration_type
The solution iteration type, e.g. time or nonlinear.
Point point
The physical location of the quadrature point.
libMesh::Point getPoint() const
const libMesh::QBase * qrule
The quadrature rule.
const libMesh::Elem * elem
LimiterType
Definition: Limiter.h:26
libMesh::Point getPoint() const
const libMesh::Elem * elem
Moose::FV::LimiterType limiter_type
a limiter which defines how the functor evaluated on either side of the face should be interpolated t...
A structure that is used to evaluate Moose functors logically at an element/cell center.
ElemArg makeNeighbor() const
Make a ElemArg from our data using the face information neighbor.
Argument for requesting functor evaluation at a quadrature point location in an element.
const libMesh::Elem * elem
The element.
libMesh::Point getPoint() const
State argument for evaluating functors.
StateArg(unsigned int state_in, SolutionIterationType iteration_type_in)
ElemArg makeElem() const
Make a ElemArg from our data.
unsigned int qp
The quadrature point index.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
libMesh::Point point
The physical location of the quadrature point.
bool elem_is_upwind
a boolean which states whether the face information element is upwind of the face ...
const libMesh::Elem * elem
The element.
StateArg previousNonlinearState()
StateArg currentState()
ElemArg makeElem() const
Make a ElemArg from our data using the face information element.
void ErrorVector unsigned int
Argument for requesting functor evaluation at quadrature point locations on an element side...
Point vertex_average() const
unsigned int state
The state.
SolutionIterationType
Definition: MooseTypes.h:241
friend bool operator<(const FaceArg &l, const FaceArg &r)
friend function that allows this structure to be used as keys in ordered containers like sets and map...
friend bool operator<(const ElemArg &l, const ElemArg &r)
friend function that allows this structure to be used as keys in ordered containers like sets and map...