Pulse adds COVID-19 Simulation Support
×
SESubstanceTransport.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 
6 #define SUBSTANCE_TRANSPORTER_TEMPLATE typename GraphType, typename FluxUnit, typename QuantityUnit, typename ExtensiveUnit, typename IntensiveUnit
7 
8 #define TRANSPORT_AMOUNT_TYPES ExtensiveScalar, IntensiveScalar
9 template<typename ExtensiveScalar, typename IntensiveScalar>
11 {
12  template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
13 public:
15 
16  virtual void Invalidate() = 0;
17 
18  virtual bool HasExtensive() const = 0;
19  virtual ExtensiveScalar& GetExtensive() = 0;
20 
21  virtual bool HasIntensive() const = 0;
22  virtual IntensiveScalar& GetIntensive() = 0;
23 };
26 
27 #define TRANSPORT_VERTEX_TYPES QuantityScalar, ExtensiveScalar, IntensiveScalar
28 template <typename QuantityScalar, typename ExtensiveScalar, typename IntensiveScalar>
30 {
31  template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
32 public:
34 
35  virtual std::string GetName() const = 0;
36 
37 protected:
38  virtual bool HasQuantity() const = 0;
39  virtual QuantityScalar& GetQuantity() = 0;
40 
41  virtual std::vector<SESubstanceTransportAmount<TRANSPORT_AMOUNT_TYPES>*>& GetTransportSubstances() = 0;
42 };
45 
46 #define TRANSPORT_EDGE_TYPES FluxScalar, QuantityScalar, ExtensiveScalar, IntensiveScalar
47 template <typename FluxScalar, typename QuantityScalar, typename ExtensiveScalar, typename IntensiveScalar>
49 {
50  template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
51 public:
53 
54  virtual std::string GetName() const = 0;
55 
56 protected:
57  virtual bool HasFlux() const = 0;
58  virtual FluxScalar& GetFlux() = 0;
59 
60  virtual SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& GetSourceVertex() = 0;
61  virtual SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& GetTargetVertex() = 0;
62 };
65 
66 template <typename FluxScalar, typename QuantityScalar, typename ExtensiveScalar, typename IntensiveScalar>
68 {
69  template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
70 public:
72 
73 protected:
74  virtual void BalanceByIntensive() = 0;// Transporter calculates the new concentration
75  virtual int GetVertexIndex(const SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& v) const = 0;
76  virtual const std::vector<SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>*>& GetVerticies() const = 0;
77  virtual const std::vector<SESubstanceTransportEdge<TRANSPORT_EDGE_TYPES>*>* GetSourceEdges(const SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& v) const = 0;
78  virtual const std::vector<SESubstanceTransportEdge<TRANSPORT_EDGE_TYPES>*>* GetTargetEdges(const SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& v) const = 0;
79 };
82 
83 template <SUBSTANCE_TRANSPORTER_TEMPLATE>
85 {
86 public:
87  SESubstanceTransporter(const FluxUnit& fUnit, const QuantityUnit& qUnit, const ExtensiveUnit& eUnit, const IntensiveUnit& iUnit, Logger* logger);
89 
90  void Transport(GraphType& graph, double timeStep_s);
91 
92 protected:
93  const FluxUnit &m_FluxUnit;
94  const QuantityUnit &m_QuantityUnit;
95  const ExtensiveUnit &m_ExtensiveUnit;
96  const IntensiveUnit &m_IntensiveUnit;
97 };
98 
99 class SEGasTransporter : public SESubstanceTransporter<SEGasTransportGraph, VolumePerTimeUnit, VolumeUnit, VolumeUnit, NoUnit>
100 {
101 public:
102  SEGasTransporter(Logger* logger);
103  SEGasTransporter(const VolumePerTimeUnit& fUnit, const VolumeUnit& qUnit, const VolumeUnit& eUnit, Logger* logger);
104  ~SEGasTransporter();
105 };
106 
107 class SELiquidTransporter : public SESubstanceTransporter<SELiquidTransportGraph, VolumePerTimeUnit, VolumeUnit, MassUnit, MassPerVolumeUnit>
108 {
109 public:
110  SELiquidTransporter(Logger* logger);
111  SELiquidTransporter(const VolumePerTimeUnit& fUnit, const VolumeUnit& qUnit, const MassUnit& eUnit, const MassPerVolumeUnit& iUnit, Logger* logger);
113 };
114 
115 
Definition: SESubstanceTransport.h:10
Definition: SEScalarVolume.h:7
virtual ~SESubstanceTransportVertex()
Definition: SESubstanceTransport.h:33
virtual IntensiveScalar & GetIntensive()=0
Definition: Logger.h:75
Definition: SEScalarMassPerVolume.h:7
Definition: SESubstanceTransport.h:67
virtual ExtensiveScalar & GetExtensive()=0
const FluxUnit & m_FluxUnit
Definition: SESubstanceTransport.h:93
Definition: SEScalarVolumePerTime.h:7
Definition: SESubstanceTransport.h:48
Definition: Logger.h:21
virtual ~SESubstanceTransporter()
Definition: SESubstanceTransport.h:88
friend class SESubstanceTransporter
Definition: SESubstanceTransport.h:12
virtual bool HasExtensive() const =0
virtual bool HasIntensive() const =0
Definition: SESubstanceTransport.h:29
Definition: SESubstanceTransport.h:107
virtual ~SESubstanceTransportEdge()
Definition: SESubstanceTransport.h:52
const ExtensiveUnit & m_ExtensiveUnit
Definition: SESubstanceTransport.h:95
Definition: SESubstanceTransport.h:99
const IntensiveUnit & m_IntensiveUnit
Definition: SESubstanceTransport.h:96
virtual ~SESubstanceTransportAmount()
Definition: SESubstanceTransport.h:14
virtual ~SESubstanceTransportGraph()
Definition: SESubstanceTransport.h:71
virtual void Invalidate()=0
Definition: SEScalarMass.h:7
const QuantityUnit & m_QuantityUnit
Definition: SESubstanceTransport.h:94
Definition: SESubstanceTransport.h:84

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.