https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMExecutedObject.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#ifdef MOOSE_MFEM_ENABLED
11
12#include "MFEMExecutedObject.h"
13
16{
19 params.registerSystemAttributeName("MFEMExecutedObject");
20 params.addPrivateParam<std::vector<std::string>>("_mfem_dependency_param_names", {});
21 params.set<ExecFlagEnum>("execute_on", true) = EXEC_TIMESTEP_END;
22 params.addClassDescription("Base class for executed MFEM objects.");
23 return params;
24}
25
30
31std::optional<std::string>
33{
34 return std::nullopt;
35}
36
37std::optional<std::string>
39{
40 return std::nullopt;
41}
42
43std::optional<std::string>
45{
46 return std::nullopt;
47}
48
49const std::set<std::string> &
51{
53 return *_requested_items;
54
55 _requested_items.emplace();
56
57 for (const auto & param : getParam<std::vector<std::string>>("_mfem_dependency_param_names"))
58 {
59 if (const auto * name = queryParam<VariableName>(param))
61 if (const auto * names = queryParam<std::vector<VariableName>>(param))
62 for (const auto & name : *names)
64 if (const auto * name = queryParam<PostprocessorName>(param))
66 if (const auto * names = queryParam<std::vector<PostprocessorName>>(param))
67 for (const auto & name : *names)
69 if (const auto * name = queryParam<VectorPostprocessorName>(param))
71 if (const auto * names = queryParam<std::vector<VectorPostprocessorName>>(param))
72 for (const auto & name : *names)
74 }
75
76 return *_requested_items;
77}
78
79const std::set<std::string> &
96
97std::string
99{
100 return "variable:" + name;
101}
102
103std::string
105{
106 return "postprocessor:" + name;
107}
108
109std::string
111{
112 return "vector_postprocessor:" + name;
113}
114
115void
116MFEMExecutedObject::appendDependencyParam(InputParameters & params, const std::string & param_name)
117{
118 auto & param_names = params.set<std::vector<std::string>>("_mfem_dependency_param_names");
119 param_names.push_back(param_name);
120}
121
122#endif
const ExecFlagType EXEC_TIMESTEP_END
Definition Moose.C:36
Interface for sorting dependent vectors of objects.
A MultiMooseEnum object to hold "execute_on" flags.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
virtual std::optional< std::string > suppliedVectorPostprocessorName() const
Return the vector postprocessor name supplied by this object, or std::nullopt if none.
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
static std::string variableDependencyKey(const std::string &name)
Build the dependency key used for a supplied/requested variable.
virtual std::optional< std::string > suppliedPostprocessorName() const
Return the postprocessor name supplied by this object, or std::nullopt if none.
static void appendDependencyParam(InputParameters &params, const std::string &param_name)
Record one dependency-bearing parameter in the private parameter metadata.
virtual std::optional< std::string > suppliedVariableName() const
Return the variable name supplied by this object, or std::nullopt if none.
MFEMExecutedObject(const InputParameters &parameters)
Construct an executed MFEM object and materialize its dependency metadata.
std::optional< std::set< std::string > > _requested_items
Lazily constructed requested dependency keys for this object's registered dependencies.
static std::string postprocessorDependencyKey(const std::string &name)
Build the dependency key used for a supplied/requested postprocessor.
static InputParameters validParams()
Declare the common parameters used by MFEM executed objects.
std::optional< std::set< std::string > > _supplied_items
Lazily constructed supplied dependency keys for this object's supplied resources.
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
static std::string vectorPostprocessorDependencyKey(const std::string &name)
Build the dependency key used for a supplied/requested vector postprocessor.
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
Definition MFEMObject.h:30
static InputParameters validParams()
Declare the common parameters required by MFEM MooseObject-backed classes.
Definition MFEMObject.C:17
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
const T * queryParam(const std::string &name) const
Query a parameter for the object.
Definition MooseBase.h:413
static InputParameters validParams()