www.mooseframework.org
InitialConditionBase.h
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "Coupleable.h"
14 #include "FunctionInterface.h"
15 #include "UserObjectInterface.h"
16 #include "Restartable.h"
17 #include "BlockRestrictable.h"
19 #include "BoundaryRestrictable.h"
20 #include "MooseTypes.h"
21 
22 // forward declarations
24 class SystemBase;
26 namespace libMesh
27 {
28 class Point;
29 }
30 
31 template <>
33 
41  public BlockRestrictable,
42  public Coupleable,
43  public FunctionInterface,
44  public UserObjectInterface,
45  public BoundaryRestrictable,
47  public Restartable
48 {
49 public:
56 
57  virtual ~InitialConditionBase();
58 
62  virtual MooseVariableFEBase & variable() = 0;
63 
67  const std::set<std::string> & getDependObjects() const { return _depend_uo; }
68 
72  virtual void compute() = 0;
77  virtual void computeNodal(const Point & p) = 0;
78 
85  virtual void initialSetup() {}
86 
87  virtual const std::set<std::string> & getRequestedItems() override;
88 
89  virtual const std::set<std::string> & getSuppliedItems() override;
90 
94  template <typename T2>
95  const T2 & getUserObject(const std::string & name);
99  template <typename T2>
100  const T2 & getUserObjectByName(const UserObjectName & name);
101 
105  const UserObject & getUserObjectBase(const std::string & name);
106 
107 protected:
110 
112  std::set<std::string> _depend_vars;
114  std::set<std::string> _supplied_vars;
115 
117  std::set<std::string> _depend_uo;
118 
121 };
122 
123 template <typename T>
124 const T &
125 InitialConditionBase::getUserObject(const std::string & name)
126 {
128  _depend_uo.insert(_pars.get<UserObjectName>(name));
129  return UserObjectInterface::getUserObject<T>(name);
130 }
131 
132 template <typename T>
133 const T &
134 InitialConditionBase::getUserObjectByName(const UserObjectName & name)
135 {
137  _depend_uo.insert(name);
138  return UserObjectInterface::getUserObjectByName<T>(name);
139 }
140 
A class for creating restricted objects.
Definition: Restartable.h:29
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
virtual void computeNodal(const Point &p)=0
Workhorse method for projecting the initial conditions for boundary restricted initial conditions...
const T2 & getUserObject(const std::string &name)
reimplements the getUserObject method from UserObjectInterface
const T2 & getUserObjectByName(const UserObjectName &name)
reimplements the getUserObjectByName method from UserObjectInterface
const std::set< std::string > & getDependObjects() const
getter method for dependent user objects
std::set< std::string > _depend_uo
Depend UserObjects.
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...
InitialConditionBase serves as the abstract base class for InitialConditions and VectorInitialConditi...
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
Definition: SystemBase.h:92
virtual MooseVariableFEBase & variable()=0
retrieves the MOOSE variable that this initial condition acts upon
SystemBase & _sys
The system object.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
const UserObject & getUserObjectBase(const std::string &name)
reimplements the getUserObjectBase method from UserObjectInterface
const bool _ignore_uo_dependency
If set, UOs retrieved by this IC will not be executed before this IC.
Interface for objects that need to use UserObjects.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:174
InitialConditionBase(const InputParameters &parameters)
Constructor.
std::set< std::string > _depend_vars
Dependent variables.
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:62
std::set< std::string > _supplied_vars
Supplied variables.
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
Interface for sorting dependent vectors of objects.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
virtual void compute()=0
Workhorse method for projecting the initial conditions for block initial conditions.
InputParameters validParams< InitialConditionBase >()
virtual void initialSetup()
Gets called at the beginning of the simulation before this object is asked to do its job...
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
Interface for objects that need to use functions.
Base class for user-specific data.
Definition: UserObject.h:37