https://mooseframework.inl.gov
RestartableModelInterface.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 #pragma once
11 
12 #include "PublicRestartable.h"
13 #include "StochasticToolsApp.h"
14 
20 {
21 public:
23 
25  const bool read_only,
26  const std::string & meta_data_name);
27 
29 
32  // MOOSEDOCS_BEGIN
33  template <typename T, typename... Args>
34  T & declareModelData(const std::string & data_name, Args &&... args);
35  // MOOSEDOCS_END
37 
39 
42  template <typename T, typename... Args>
43  const T & getModelData(const std::string & data_name, Args &&... args) const;
45 
47  const std::string & modelMetaDataName() const { return _model_meta_data_name; }
48 
50  const FileName & getModelDataFileName() const;
51 
53  bool hasModelData() const;
54 
55 private:
58 
61  const std::string _model_meta_data_name;
62 
69 };
70 
71 template <>
72 void dataStore(std::ostream & stream, Eigen::LLT<RealEigenMatrix> & decomp, void * context);
73 template <>
74 void dataLoad(std::istream & stream, Eigen::LLT<RealEigenMatrix> & decomp, void * context);
75 
76 template <typename T, typename... Args>
77 T &
78 RestartableModelInterface::declareModelData(const std::string & data_name, Args &&... args)
79 {
80  return _model_restartable.declareRestartableData<T>(data_name, std::forward<Args>(args)...);
81 }
82 
83 template <typename T, typename... Args>
84 const T &
85 RestartableModelInterface::getModelData(const std::string & data_name, Args &&... args) const
86 {
87  return _model_restartable.getRestartableData<T>(data_name, std::forward<Args>(args)...);
88 }
void dataLoad(std::istream &stream, Eigen::LLT< RealEigenMatrix > &decomp, void *context)
const FileName & getModelDataFileName() const
Get the associated filename.
T & declareRestartableData(const std::string &data_name, Args &&... args)
Declare a piece of data as "restartable" and initialize it.
const T & getRestartableData(const std::string &data_name) const
Declare a piece of data as "restartable" and initialize it Similar to declareRestartableData but retu...
const std::string _model_meta_data_name
The model meta data name.
const T & getModelData(const std::string &data_name, Args &&... args) const
Retrieve model data from the interface.
bool hasModelData() const
Check if we need to load model data (if the filename parameter is used)
static InputParameters validParams()
const MooseObject & _model_object
Reference to the MooseObject that uses this interface.
T & declareModelData(const std::string &data_name, Args &&... args)
Declare model data for loading from file as well as restart.
const std::string & modelMetaDataName() const
Accessor for the name of the model meta data.
RestartableModelInterface(const MooseObject &object, const bool read_only, const std::string &meta_data_name)
void dataStore(std::ostream &stream, Eigen::LLT< RealEigenMatrix > &decomp, void *context)
A class which creates public interface functions for declaring and getting restartable data...
PublicRestartable _model_restartable
Member for interfacing with the framework&#39;s restartable system.
An interface class which manages the model data save and load functionalities from moose objects (suc...