www.mooseframework.org
Restartable.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "InputParameters.h"
11 #include "Restartable.h"
12 #include "SubProblem.h"
13 #include "FEProblem.h"
14 #include "MooseObject.h"
15 #include "MooseMesh.h"
16 #include "MeshMetaDataInterface.h"
17 
18 Restartable::Restartable(const MooseObject * moose_object, const std::string & system_name)
19  : Restartable(moose_object->getMooseApp(),
20  moose_object->name(),
21  system_name,
22  moose_object->parameters().isParamValid("_tid")
23  ? moose_object->parameters().get<THREAD_ID>("_tid")
24  : 0)
25 {
26 }
27 
29  const std::string & system_name,
30  THREAD_ID tid)
31  : Restartable(moose_object->getMooseApp(), moose_object->name(), system_name, tid)
32 {
33 }
34 
36  const std::string & name,
37  const std::string & system_name,
38  THREAD_ID tid,
39  const bool read_only,
40  const RestartableDataMapName & metaname)
41  : _restartable_app(moose_app),
42  _restartable_system_name(system_name),
43  _restartable_tid(tid),
44  _restartable_read_only(read_only),
45  _metaname(metaname),
46  _restartable_name(name)
47 {
48 }
49 
51 Restartable::registerRestartableDataOnApp(std::unique_ptr<RestartableDataValue> data,
52  THREAD_ID tid) const
53 {
55  std::move(data), tid, _restartable_read_only, _metaname);
56 }
57 
58 void
61 {
63 }
64 
65 std::string
66 Restartable::restartableName(const std::string & data_name) const
67 {
68  return _restartable_system_name + "/" + _restartable_name + "/" + data_name;
69 }
std::string name(const ElemQuality q)
A class for creating restricted objects.
Definition: Restartable.h:28
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1147
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition: MooseApp.C:1199
std::string restartableName(const std::string &data_name) const
Gets the name of a piece of restartable data given a data name, adding the system name and object nam...
Definition: Restartable.C:66
Base class for MOOSE-based applications.
Definition: MooseApp.h:69
std::string _restartable_name
The name of the object.
Definition: Restartable.h:243
const std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:230
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data.
Definition: MooseTypes.h:704
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:33
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
Definition: MooseApp.C:1806
Restartable(const MooseObject *moose_object, const std::string &system_name)
Class constructor.
Definition: Restartable.C:18
std::string RestartableDataMapName
Definition: MooseTypes.h:203
void registerRestartableNameWithFilterOnApp(const std::string &name, Moose::RESTARTABLE_FILTER filter)
Helper function for actually registering the restartable data.
Definition: Restartable.C:59
const bool _restartable_read_only
Flag for toggling read only status (see ReporterData)
Definition: Restartable.h:236
const RestartableDataMapName _metaname
Restartable metadata name.
Definition: Restartable.h:240
MooseApp & _restartable_app
Reference to the application.
Definition: Restartable.h:227
Abstract definition of a RestartableData value.
RestartableDataValue & registerRestartableDataOnApp(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const
Helper function for actually registering the restartable data.
Definition: Restartable.C:51
unsigned int THREAD_ID
Definition: MooseTypes.h:198