https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMExecutedObject.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#ifdef MOOSE_MFEM_ENABLED
11
12#pragma once
13
14#include "MFEMObject.h"
15#include "SetupInterface.h"
17
18#include <optional>
19#include <set>
20
25 public SetupInterface,
27{
28public:
33
38
42 virtual void initialize() {}
46 virtual void execute() {}
50 virtual void finalize() {}
51
55 virtual std::optional<std::string> suppliedVariableName() const;
59 virtual std::optional<std::string> suppliedPostprocessorName() const;
63 virtual std::optional<std::string> suppliedVectorPostprocessorName() const;
64
65 virtual const std::set<std::string> & getRequestedItems() override;
66 virtual const std::set<std::string> & getSuppliedItems() override;
67
71 template <typename T>
72 static void addDependencyParam(InputParameters & params,
73 const std::string & param_name,
74 const std::string & doc_string);
75
79 template <typename T>
81 const std::string & param_name,
82 const std::string & doc_string);
83
84protected:
88 static std::string variableDependencyKey(const std::string & name);
92 static std::string postprocessorDependencyKey(const std::string & name);
96 static std::string vectorPostprocessorDependencyKey(const std::string & name);
97
101 static void appendDependencyParam(InputParameters & params, const std::string & param_name);
102
103private:
105 std::optional<std::set<std::string>> _requested_items;
107 std::optional<std::set<std::string>> _supplied_items;
108};
109
110template <typename T>
111void
113 const std::string & param_name,
114 const std::string & doc_string)
115{
116 params.addParam<T>(param_name, doc_string);
117 appendDependencyParam(params, param_name);
118}
119
120template <typename T>
121void
123 const std::string & param_name,
124 const std::string & doc_string)
125{
126 params.addRequiredParam<T>(param_name, doc_string);
127 appendDependencyParam(params, param_name);
128}
129
130#endif
Interface for sorting dependent vectors of objects.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Base class for MFEM objects that participate in execution ordering but are not UserObjects.
static void addDependencyParam(InputParameters &params, const std::string &param_name, const std::string &doc_string)
Add an optional dependency-bearing parameter and register it with the MFEM scheduler.
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.
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.
static void addRequiredDependencyParam(InputParameters &params, const std::string &param_name, const std::string &doc_string)
Add a required dependency-bearing parameter and register it with the MFEM scheduler.
std::optional< std::set< std::string > > _supplied_items
Lazily constructed supplied dependency keys for this object's supplied resources.
virtual void execute()
Perform the main work for this object.
virtual void initialize()
Perform any pre-execution setup for this object.
virtual void finalize()
Perform any post-execution finalization for this object.
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
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103