https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
25public:
27
29
31 std::vector<PhysicsBase *> getPhysics() const { return _physics; }
32
33protected:
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
46template <typename T>
47bool
48ComponentPhysicsInterface::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}
Base class for components that are defined using an action.
T * getPhysics(const std::string &name) const
Retrieve a Physics with its name and the desired type.
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Definition Action.h:169
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.
std::vector< PhysicsBase * > _physics
Pointers to the Physics defined on the component.
static InputParameters validParams()
bool physicsExists(const PhysicsName &name) const
Whether the physics exists with the requested type and name.
std::vector< PhysicsBase * > getPhysics() const
Get the Physics from the Component.
std::vector< PhysicsName > _physics_names
Names of the Physics defined on the component.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103