https://mooseframework.inl.gov
Restartable.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 #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 
50 #ifdef MOOSE_KOKKOS_ENABLED
52  : _restartable_app(object._restartable_app),
53  _restartable_system_name(object._restartable_system_name),
54  _restartable_tid(object._restartable_tid),
55  _restartable_read_only(object._restartable_read_only),
56  _metaname(object._metaname),
57  _restartable_name(object._restartable_name)
58 {
59 }
60 #endif
61 
63 Restartable::registerRestartableDataOnApp(std::unique_ptr<RestartableDataValue> data,
64  THREAD_ID tid) const
65 {
67  std::move(data), tid, _restartable_read_only, _metaname);
68 }
69 
70 void
73 {
75 }
76 
77 std::string
78 Restartable::restartableName(const std::string & data_name) const
79 {
80  return _restartable_system_name + "/" + _restartable_name + "/" + data_name;
81 }
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:1133
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition: MooseApp.C:1873
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:78
Base class for MOOSE-based applications.
Definition: MooseApp.h:103
std::string _restartable_name
The name of the object.
Definition: Restartable.h:250
const std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:237
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data.
Definition: MooseTypes.h:792
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:27
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
Definition: MooseApp.C:2522
Restartable(const MooseObject *moose_object, const std::string &system_name)
Class constructor.
Definition: Restartable.C:18
std::string RestartableDataMapName
Definition: MooseTypes.h:214
void registerRestartableNameWithFilterOnApp(const std::string &name, Moose::RESTARTABLE_FILTER filter)
Helper function for actually registering the restartable data.
Definition: Restartable.C:71
const bool _restartable_read_only
Flag for toggling read only status (see ReporterData)
Definition: Restartable.h:243
const RestartableDataMapName _metaname
Restartable metadata name.
Definition: Restartable.h:247
MooseApp & _restartable_app
Reference to the application.
Definition: Restartable.h:234
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:63
unsigned int THREAD_ID
Definition: MooseTypes.h:209