https://mooseframework.inl.gov
MooseVariableField.C
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 #include "MooseVariableField.h"
11 #include "SystemBase.h"
12 #include "TimeIntegrator.h"
13 
14 #include "libmesh/fe_base.h"
15 
16 using namespace Moose;
17 
18 template <typename OutputType>
21 {
23 }
24 
25 template <typename OutputType>
27  : MooseVariableFieldBase(parameters),
28  Moose::FunctorBase<typename Moose::ADType<OutputType>::type>(name()),
29  MeshChangedInterface(parameters),
30  _time_integrator(_sys.queryTimeIntegrator(_var_num))
31 {
32 }
33 
34 template <typename OutputType>
35 void
37 {
40 }
41 
42 template <typename OutputType>
43 void
45 {
48 }
49 
50 template <typename OutputType>
51 void
53 {
56 }
57 
58 template <typename OutputType>
61 {
62  if (std::is_same<OutputType, Real>::value)
64  else if (std::is_same<OutputType, RealVectorValue>::value)
66  else if (std::is_same<OutputType, RealEigenVector>::value)
68  else
69  mooseError("Unknown variable field type");
70 }
71 
72 template <typename OutputType>
73 bool
75 {
76  const auto is_array = MooseVariableBase::isArray();
77  if (std::is_same<OutputType, RealEigenVector>::value != is_array)
78  mooseError("A variable is marked as an array variable in a base class, but in a derived class "
79  "the output type is not consistent.");
80  return is_array;
81 }
82 
83 template <typename OutputType>
84 bool
86 {
87  return std::is_same<OutputType, RealVectorValue>::value;
88 }
89 
90 template <>
91 template <>
92 const MooseArray<Real> &
94 {
95  return dofValues();
96 }
97 
98 template <>
99 template <>
100 const MooseArray<Real> &
102 {
103  return dofValues();
104 }
105 
106 template <>
107 template <>
108 const MooseArray<Real> &
110 {
111  mooseError("genericDofValues not implemented for array variables");
112 }
113 
114 template class MooseVariableField<Real>;
std::string name(const ElemQuality q)
MooseVariableField(const InputParameters &parameters)
VarFieldType
Definition: MooseTypes.h:722
static InputParameters validParams()
Base class template for functor objects.
Definition: MooseFunctor.h:137
Class for stuff related to variables.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual void jacobianSetup() override
static InputParameters validParams()
virtual Moose::VarFieldType fieldType() const override
Field type of this variable.
Interface for notifications that the mesh has changed.
virtual void timestepSetup()
Gets called at the beginning of the timestep before this object is asked to do its job...
virtual bool isArray() const
virtual bool isVector() const override
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
virtual void timestepSetup() override
virtual void jacobianSetup()
Gets called just before the Jacobian is computed and before this object is asked to do its job...
virtual void residualSetup()
Gets called just before the residual is computed and before this object is asked to do its job...
virtual void residualSetup() override
virtual bool isArray() const override