https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
17
18Restartable::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
63Restartable::registerRestartableDataOnApp(std::unique_ptr<RestartableDataValue> data,
64 THREAD_ID tid) const
65{
67 std::move(data), tid, _restartable_read_only, _metaname);
68}
69
70void
76
77std::string
78Restartable::restartableName(const std::string & data_name) const
79{
80 return _restartable_system_name + "/" + _restartable_name + "/" + data_name;
81}
std::string RestartableDataMapName
Definition MooseTypes.h:242
unsigned int THREAD_ID
Definition MooseTypes.h:237
Base class for MOOSE-based applications.
Definition MooseApp.h:110
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition MooseApp.C:1701
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
Definition MooseApp.C:2449
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
Abstract definition of a RestartableData value.
A class for creating restricted objects.
Definition Restartable.h:29
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
const RestartableDataMapName _metaname
Restartable metadata name.
const bool _restartable_read_only
Flag for toggling read only status (see ReporterData)
const std::string _restartable_system_name
The system name this object is in.
std::string _restartable_name
The name of the object.
void registerRestartableNameWithFilterOnApp(const std::string &name, Moose::RESTARTABLE_FILTER filter)
Helper function for actually registering the restartable data.
Definition Restartable.C:71
Restartable(const MooseObject *moose_object, const std::string &system_name)
Class constructor.
Definition Restartable.C:18
MooseApp & _restartable_app
Reference to the application.
RestartableDataValue & registerRestartableDataOnApp(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const
Helper function for actually registering the restartable data.
Definition Restartable.C:63
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data.
Definition MooseTypes.h:846