https://mooseframework.inl.gov
MooseObject.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 // MOOSE includes
13 #include "MooseUtils.h"
14 #include "ParallelParamObject.h"
15 #include "InputParameters.h"
16 #include "ConsoleStreamInterface.h"
17 #include "Registry.h"
19 
20 #define usingMooseObjectMembers \
21  usingMooseBaseMembers; \
22  using MooseObject::enabled
23 
27 class MooseObject : public ParallelParamObject, public std::enable_shared_from_this<MooseObject>
28 {
29 public:
31 
33 
34 #ifdef MOOSE_KOKKOS_ENABLED
35 
38  MooseObject(const MooseObject & object, const Moose::Kokkos::FunctorCopy & key);
39 #endif
40 
41  virtual ~MooseObject() = default;
42 
46  virtual bool enabled() const { return _enabled; }
47 
52  std::shared_ptr<MooseObject> getSharedPtr();
53  std::shared_ptr<const MooseObject> getSharedPtr() const;
54 
55 #ifdef MOOSE_KOKKOS_ENABLED
57  {
58  friend class BlockRestrictable;
59  friend class BoundaryRestrictable;
61  IsKokkosObjectKey() = default;
62  IsKokkosObjectKey(const IsKokkosObjectKey &) = delete;
64  };
65 
73  {
75  }
76 #endif
77 
78 protected:
80  const bool & _enabled;
81 
82  // Base classes have the same name for that attribute, pick one
83  using MooseBase::_app;
84 };
virtual ~MooseObject()=default
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
MooseObject(const InputParameters &parameters)
Definition: MooseObject.C:45
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
std::shared_ptr< MooseObject > getSharedPtr()
Get another shared pointer to this object that has the same ownership group.
Definition: MooseObject.C:68
static const std::string kokkos_object_param
The name of the parameter that indicates an object is a Kokkos functor.
Definition: MooseBase.h:64
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:27
const bool & _enabled
Reference to the "enable" InputParameters, used by Controls for toggling on/off MooseObjects.
Definition: MooseObject.h:80
bool isKokkosObject(IsKokkosObjectKey &&) const
Get whether this object is a Kokkos functor The parameter is set by the Kokkos base classes: ...
Definition: MooseObject.h:72
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:357
An interface for accessing Materials.
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
static InputParameters validParams()
Definition: MooseObject.C:25
Base class shared by both Action and MooseObject.
virtual bool enabled() const
Return the enabled status of the object.
Definition: MooseObject.h:46
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.