https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16using namespace Moose;
17
18template <typename OutputType>
24
25template <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
34template <typename OutputType>
35void
41
42template <typename OutputType>
43void
49
50template <typename OutputType>
51void
57
58template <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
72template <typename OutputType>
73bool
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
83template <typename OutputType>
84bool
87 return std::is_same<OutputType, RealVectorValue>::value;
90template <>
91template <>
94{
95 return dofValues();
96}
97
98template <>
99template <>
100const MooseArray<Real> &
102{
103 return dofValues();
104}
105
106template <>
107template <>
108const MooseArray<Real> &
110{
111 mooseError("genericDofValues not implemented for array variables");
112}
113
114template class MooseVariableField<Real>;
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Interface for notifications that the mesh has changed.
forward declarations
Definition MooseArray.h:18
virtual bool isArray() const
This class provides an interface for common operations on field variables of both FE and FV types wit...
static InputParameters validParams()
Class for stuff related to variables.
virtual bool isVector() const override
MooseVariableField(const InputParameters &parameters)
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job.
virtual void jacobianSetup() override
Gets called just before the Jacobian is computed and before this object is asked to do its job.
virtual Moose::VarFieldType fieldType() const override
Field type of this variable.
static InputParameters validParams()
virtual bool isArray() const override
virtual void residualSetup() override
Gets called just before the residual is computed and before this object is asked to do its job.
Base class template for functor objects.
virtual void residualSetup()
Gets called just before the residual is computed and before this object is asked to do its job.
virtual void jacobianSetup()
Gets called just before the Jacobian is computed and before this object is asked to do its job.
virtual void timestepSetup()
Gets called at the beginning of the timestep before this object is asked to do its job.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
@ VAR_FIELD_STANDARD
Definition MooseTypes.h:777
@ VAR_FIELD_ARRAY
Definition MooseTypes.h:780
@ VAR_FIELD_VECTOR
Definition MooseTypes.h:779