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 
136  bool operator==(const StateArg & other) const
137  {
138  return state == other.state && iteration_type == other.iteration_type;
139  }
140 
144  unsigned int state;
145 
148 
149 private:
151 
152  friend StateArg currentState();
153 };
154 
155 inline StateArg
157 {
158  return {};
159 }
160 
161 inline StateArg
163 {
164  return {(unsigned int)1};
165 }
166 
167 inline StateArg
169 {
170  return {(unsigned int)1, SolutionIterationType::Nonlinear};
171 }
172 
173 inline StateArg
175 {
176  return {(unsigned int)1, SolutionIterationType::FixedPoint};
177 }
178 
182 struct FaceArg
183 {
185  const FaceInfo * fi;
186 
190 
193 
196 
207 
210 
214  libMesh::Point getPoint() const { return fi->faceCentroid(); }
215 
219  ElemArg makeElem() const { return {&fi->elem(), correct_skewness}; }
220 
225 
230  friend bool operator<(const FaceArg & l, const FaceArg & r)
231  {
232  return std::make_tuple(
234  std::make_tuple(r.fi, r.limiter_type, r.elem_is_upwind, r.correct_skewness, r.face_side);
235  }
236 };
237 
238 struct NodeArg
239 {
242 
250  const std::set<SubdomainID> * subdomain_ids;
251 
252  libMesh::Point getPoint() const { return *node; }
253 
257  static const std::set<SubdomainID> undefined_subdomain_connection;
258 };
259 
268 struct ElemQpArg
269 {
272 
274  unsigned int qp;
275 
278 
281 
285  libMesh::Point getPoint() const { return point; }
286 };
287 }
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()
StateArg previousFixedPointState()
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.
bool operator==(const StateArg &other) const
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...