SESubstanceTransport.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5#ifdef MSVC
6 #pragma warning(disable : 4503)
7#endif
8
9#define SUBSTANCE_TRANSPORTER_TEMPLATE typename GraphType, typename FluxUnit, typename QuantityUnit, typename ExtensiveUnit, typename IntensiveUnit
10
11#define TRANSPORT_AMOUNT_TYPES ExtensiveScalar, IntensiveScalar
12template<typename ExtensiveScalar, typename IntensiveScalar>
14{
15 template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
16public:
18
19 virtual void Clear() = 0;
20
21 virtual bool HasExtensive() const = 0;
22 virtual ExtensiveScalar& GetExtensive() = 0;
23
24 virtual bool HasIntensive() const = 0;
25 virtual IntensiveScalar& GetIntensive() = 0;
26};
29
30#define TRANSPORT_VERTEX_TYPES QuantityScalar, ExtensiveScalar, IntensiveScalar
31template <typename QuantityScalar, typename ExtensiveScalar, typename IntensiveScalar>
33{
34 template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
35public:
37
38 virtual std::string GetName() const = 0;
39
40protected:
41 virtual bool HasQuantity() const = 0;
42 virtual QuantityScalar& GetQuantity() = 0;
43
44 virtual std::vector<SESubstanceTransportAmount<TRANSPORT_AMOUNT_TYPES>*>& GetTransportSubstances() = 0;
45};
48
49#define TRANSPORT_EDGE_TYPES FluxScalar, QuantityScalar, ExtensiveScalar, IntensiveScalar
50template <typename FluxScalar, typename QuantityScalar, typename ExtensiveScalar, typename IntensiveScalar>
52{
53 template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
54public:
56
57 virtual std::string GetName() const = 0;
58
59protected:
60 virtual bool HasFlux() const = 0;
61 virtual FluxScalar& GetFlux() = 0;
62
65};
68
69template <typename FluxScalar, typename QuantityScalar, typename ExtensiveScalar, typename IntensiveScalar>
71{
72 template<SUBSTANCE_TRANSPORTER_TEMPLATE> friend class SESubstanceTransporter;
73public:
75
76protected:
77 virtual void BalanceByIntensive() = 0;// Transporter calculates the new concentration
79 virtual const std::vector<SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>*>& GetVerticies() const = 0;
80 virtual const std::vector<SESubstanceTransportEdge<TRANSPORT_EDGE_TYPES>*>* GetSourceEdges(const SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& v) const = 0;
81 virtual const std::vector<SESubstanceTransportEdge<TRANSPORT_EDGE_TYPES>*>* GetTargetEdges(const SESubstanceTransportVertex<TRANSPORT_VERTEX_TYPES>& v) const = 0;
82};
83
84template <SUBSTANCE_TRANSPORTER_TEMPLATE>
85class CDM_DECL SESubstanceTransporter : public Loggable
86{
87public:
88 SESubstanceTransporter(const FluxUnit& fUnit, const QuantityUnit& qUnit, const ExtensiveUnit& eUnit, const IntensiveUnit& iUnit, Logger* logger);
90
91 void Transport(GraphType& graph, double timeStep_s);
92
93protected:
94 const FluxUnit &m_FluxUnit;
95 const QuantityUnit &m_QuantityUnit;
96 const ExtensiveUnit &m_ExtensiveUnit;
97 const IntensiveUnit &m_IntensiveUnit;
98};
Definition: Logger.h:23
Definition: Logger.h:71
Definition: SESubstanceTransport.h:14
virtual bool HasIntensive() const =0
virtual bool HasExtensive() const =0
virtual IntensiveScalar & GetIntensive()=0
virtual ~SESubstanceTransportAmount()
Definition: SESubstanceTransport.h:17
virtual ExtensiveScalar & GetExtensive()=0
virtual void Clear()=0
Definition: SESubstanceTransport.h:52
virtual ~SESubstanceTransportEdge()
Definition: SESubstanceTransport.h:55
virtual SESubstanceTransportVertex< TRANSPORT_VERTEX_TYPES > & GetTargetVertex()=0
virtual std::string GetName() const =0
virtual bool HasFlux() const =0
virtual SESubstanceTransportVertex< TRANSPORT_VERTEX_TYPES > & GetSourceVertex()=0
virtual FluxScalar & GetFlux()=0
Definition: SESubstanceTransport.h:71
virtual ~SESubstanceTransportGraph()
Definition: SESubstanceTransport.h:74
virtual void BalanceByIntensive()=0
virtual int GetVertexIndex(const SESubstanceTransportVertex< TRANSPORT_VERTEX_TYPES > &v) const =0
virtual const std::vector< SESubstanceTransportEdge< TRANSPORT_EDGE_TYPES > * > * GetTargetEdges(const SESubstanceTransportVertex< TRANSPORT_VERTEX_TYPES > &v) const =0
virtual const std::vector< SESubstanceTransportEdge< TRANSPORT_EDGE_TYPES > * > * GetSourceEdges(const SESubstanceTransportVertex< TRANSPORT_VERTEX_TYPES > &v) const =0
virtual const std::vector< SESubstanceTransportVertex< TRANSPORT_VERTEX_TYPES > * > & GetVerticies() const =0
Definition: SESubstanceTransport.h:33
virtual std::vector< SESubstanceTransportAmount< TRANSPORT_AMOUNT_TYPES > * > & GetTransportSubstances()=0
virtual QuantityScalar & GetQuantity()=0
virtual bool HasQuantity() const =0
virtual std::string GetName() const =0
virtual ~SESubstanceTransportVertex()
Definition: SESubstanceTransport.h:36
Definition: SESubstanceTransport.h:86
virtual ~SESubstanceTransporter()
Definition: SESubstanceTransport.h:89
const FluxUnit & m_FluxUnit
Definition: SESubstanceTransport.h:94
const ExtensiveUnit & m_ExtensiveUnit
Definition: SESubstanceTransport.h:96
const IntensiveUnit & m_IntensiveUnit
Definition: SESubstanceTransport.h:97
const QuantityUnit & m_QuantityUnit
Definition: SESubstanceTransport.h:95

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.