https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
RestartableModelInterface Class Reference

An interface class which manages the model data save and load functionalities from moose objects (such as surrogates, mappings, etc.) in the stochastic tools module. More...

#include <RestartableModelInterface.h>

Inheritance diagram for RestartableModelInterface:
[legend]

Public Member Functions

 RestartableModelInterface (const MooseObject &object, const bool read_only, const std::string &meta_data_name)
 
const std::string & modelMetaDataName () const
 Accessor for the name of the model meta data. More...
 
const FileName & getModelDataFileName () const
 Get the associated filename. More...
 
bool hasModelData () const
 Check if we need to load model data (if the filename parameter is used) More...
 
template<typename T , typename... Args>
T & declareModelData (const std::string &data_name, Args &&... args)
 Declare model data for loading from file as well as restart. More...
 
template<typename T , typename... Args>
const T & getModelData (const std::string &data_name, Args &&... args) const
 Retrieve model data from the interface. More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Private Attributes

const MooseObject_model_object
 Reference to the MooseObject that uses this interface. More...
 
const std::string _model_meta_data_name
 The model meta data name. More...
 
PublicRestartable _model_restartable
 Member for interfacing with the framework's restartable system. More...
 

Detailed Description

An interface class which manages the model data save and load functionalities from moose objects (such as surrogates, mappings, etc.) in the stochastic tools module.

Definition at line 19 of file RestartableModelInterface.h.

Constructor & Destructor Documentation

◆ RestartableModelInterface()

RestartableModelInterface::RestartableModelInterface ( const MooseObject object,
const bool  read_only,
const std::string &  meta_data_name 
)

Definition at line 21 of file RestartableModelInterface.C.

24  : _model_object(object),
25  _model_meta_data_name(meta_data_name),
26  _model_restartable(_model_object.getMooseApp(), "", "", 0, read_only, meta_data_name)
27 {
30 }
virtual const std::string & name() const
MooseApp & getMooseApp() const
const std::string _model_meta_data_name
The model meta data name.
const MooseObject & _model_object
Reference to the MooseObject that uses this interface.
void registerRestartableDataMapName(const RestartableDataMapName &name, std::string suffix="")
PublicRestartable _model_restartable
Member for interfacing with the framework&#39;s restartable system.

Member Function Documentation

◆ declareModelData()

template<typename T , typename... Args>
T & RestartableModelInterface::declareModelData ( const std::string &  data_name,
Args &&...  args 
)

Declare model data for loading from file as well as restart.

Definition at line 78 of file RestartableModelInterface.h.

79 {
80  return _model_restartable.declareRestartableData<T>(data_name, std::forward<Args>(args)...);
81 }
T & declareRestartableData(const std::string &data_name, Args &&... args)
Declare a piece of data as "restartable" and initialize it.
PublicRestartable _model_restartable
Member for interfacing with the framework&#39;s restartable system.

◆ getModelData()

template<typename T , typename... Args>
const T & RestartableModelInterface::getModelData ( const std::string &  data_name,
Args &&...  args 
) const

Retrieve model data from the interface.

Definition at line 85 of file RestartableModelInterface.h.

86 {
87  return _model_restartable.getRestartableData<T>(data_name, std::forward<Args>(args)...);
88 }
const T & getRestartableData(const std::string &data_name) const
Declare a piece of data as "restartable" and initialize it Similar to declareRestartableData but retu...
PublicRestartable _model_restartable
Member for interfacing with the framework&#39;s restartable system.

◆ getModelDataFileName()

const FileName & RestartableModelInterface::getModelDataFileName ( ) const

Get the associated filename.

Definition at line 33 of file RestartableModelInterface.C.

34 {
35  return _model_object.getParam<FileName>("filename");
36 }
const T & getParam(const std::string &name) const
const MooseObject & _model_object
Reference to the MooseObject that uses this interface.

◆ hasModelData()

bool RestartableModelInterface::hasModelData ( ) const

Check if we need to load model data (if the filename parameter is used)

Definition at line 39 of file RestartableModelInterface.C.

40 {
41  return _model_object.isParamValid("filename");
42 }
bool isParamValid(const std::string &name) const
const MooseObject & _model_object
Reference to the MooseObject that uses this interface.

◆ modelMetaDataName()

const std::string& RestartableModelInterface::modelMetaDataName ( ) const
inline

Accessor for the name of the model meta data.

Definition at line 47 of file RestartableModelInterface.h.

Referenced by SurrogateTrainerOutput::output(), and MappingOutput::output().

47 { return _model_meta_data_name; }
const std::string _model_meta_data_name
The model meta data name.

◆ validParams()

InputParameters RestartableModelInterface::validParams ( )
static

Definition at line 13 of file RestartableModelInterface.C.

Referenced by SurrogateModel::validParams(), VariableMappingBase::validParams(), and SurrogateTrainerBase::validParams().

14 {
16  params.addParam<FileName>(
17  "filename", "The name of the file which will be associated with the saved/loaded data.");
18  return params;
19 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
InputParameters emptyInputParameters()

Member Data Documentation

◆ _model_meta_data_name

const std::string RestartableModelInterface::_model_meta_data_name
private

The model meta data name.

This is used to store the restartable data within the RestartableDataMap.

Definition at line 61 of file RestartableModelInterface.h.

Referenced by modelMetaDataName(), and RestartableModelInterface().

◆ _model_object

const MooseObject& RestartableModelInterface::_model_object
private

Reference to the MooseObject that uses this interface.

Definition at line 57 of file RestartableModelInterface.h.

Referenced by getModelDataFileName(), hasModelData(), and RestartableModelInterface().

◆ _model_restartable

PublicRestartable RestartableModelInterface::_model_restartable
private

Member for interfacing with the framework's restartable system.

We need this because we would like to have the capability to handle the model data separately from the other data members used for checkpointing.

Definition at line 68 of file RestartableModelInterface.h.

Referenced by declareModelData(), and getModelData().


The documentation for this class was generated from the following files: