https://mooseframework.inl.gov
MeshMetaDataInterface.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 // MOOSE includes
11 #include "MeshMetaDataInterface.h"
12 #include "MooseApp.h"
13 
15  : _meta_data_app(moose_object->getMooseApp()), _meta_data_object(moose_object)
16 {
17 }
18 
20  : _meta_data_app(moose_app), _meta_data_object(nullptr)
21 {
22 }
23 
24 bool
25 MeshMetaDataInterface::hasMeshProperty(const std::string & data_name,
26  const std::string & prefix) const
27 {
28  return _meta_data_app.hasRestartableMetaData(meshPropertyName(data_name, prefix),
30 }
31 
32 std::string
33 MeshMetaDataInterface::meshPropertyName(const std::string & data_name, const std::string & prefix)
34 {
35  return std::string(SYSTEM) + "/" + prefix + "/" + data_name;
36 }
37 
38 std::string
40 {
41  mooseError("This object does not support obtaining a mesh property without a prefix.\n\nThis "
42  "capability is upcoming.");
43 }
44 
46 MeshMetaDataInterface::getMeshPropertyInternal(const std::string & data_name,
47  const std::string & prefix) const
48 {
50  meshPropertyName(data_name, prefix), MooseApp::MESH_META_DATA, 0);
51 }
bool hasRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname) const
Definition: MooseApp.C:2506
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
static const RestartableDataMapName MESH_META_DATA
Definition: MooseApp.h:123
Base class for MOOSE-based applications.
Definition: MooseApp.h:96
static std::string meshPropertyName(const std::string &data_name, const std::string &prefix)
MeshMetaDataInterface(const MooseObject *moose_object)
Interface for all objects reading MeshMetaData.
MooseApp & _meta_data_app
Reference to the application.
RestartableDataValue & getRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname, THREAD_ID tid)
Definition: MooseApp.C:2516
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
static constexpr auto SYSTEM
The system name used when initializing the Restartable interface.
virtual std::string meshPropertyPrefix(const std::string &data_name) const
The default prefix to use for getting/seeing if mesh properties exist.
bool hasMeshProperty(const std::string &data_name, const std::string &prefix) const
const RestartableDataValue & getMeshPropertyInternal(const std::string &data_name, const std::string &prefix) const
Helper for getting a mesh property.
Abstract definition of a RestartableData value.