Port FluidSim core and scenarios to C++20
This commit is contained in:
27
include/FluidSim/Component.hpp
Normal file
27
include/FluidSim/Component.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace fluidsim::port {
|
||||
|
||||
struct Port {
|
||||
float mass_flow{}; // kg/s, positive into the owning component
|
||||
float enthalpy{}; // J/kg
|
||||
float pressure{101325.0f};
|
||||
float density{1.1768f};
|
||||
float temperature{300.0f};
|
||||
float air_fraction{1.0f};
|
||||
float* owner_air_mass{};
|
||||
float* owner_exhaust_mass{};
|
||||
};
|
||||
|
||||
// Small equivalent of the C# IComponent lifecycle. Components update their
|
||||
// conserved state after the coupled 1-D pipe solve has accumulated port flow.
|
||||
class Component {
|
||||
public:
|
||||
virtual ~Component() = default;
|
||||
virtual std::vector<Port*> ports() = 0;
|
||||
virtual void update_state(float dt) = 0;
|
||||
};
|
||||
|
||||
} // namespace fluidsim::port
|
||||
Reference in New Issue
Block a user