https://mooseframework.inl.gov
ComponentPhysicsInterface.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 #include "ActionComponent.h"
13 #include "InputParameters.h"
14 #include "MooseTypes.h"
15 #include "PhysicsBase.h"
16 
24 {
25 public:
27 
29 
31  std::vector<PhysicsBase *> getPhysics() const { return _physics; }
32 
33 protected:
35  template <typename T>
36  bool physicsExists(const PhysicsName & name) const;
37 
38  virtual void addPhysics() override;
39 
41  std::vector<PhysicsName> _physics_names;
43  std::vector<PhysicsBase *> _physics;
44 };
45 
46 template <typename T>
47 bool
48 ComponentPhysicsInterface::physicsExists(const PhysicsName & name) const
49 {
50  const auto physics = _awh.getPhysics<const T>();
51  for (const auto phys : physics)
52  if (phys->name() == name)
53  return true;
54  return false;
55 }
std::vector< PhysicsName > _physics_names
Names of the Physics defined on the component.
std::vector< PhysicsBase * > _physics
Pointers to the Physics defined on the component.
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition: Action.h:159
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Base class for components that are defined using an action.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
static InputParameters validParams()
Helper class to help creating an entire physics Note: Trying out virtual inheritance.
virtual void addPhysics() override
Used to add one or more Physics to be active on the component.
ComponentPhysicsInterface(const InputParameters &params)
std::vector< PhysicsBase * > getPhysics() const
Get the Physics from the Component.
T * getPhysics(const std::string &name) const
bool physicsExists(const PhysicsName &name) const
Whether the physics exists with the requested type and name.