SELiquidSubstanceQuantity.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "compartment/substances/SESubstanceQuantity.h"
6 #include "substance/SESubstanceTransport.h"
8 
9 enum class BalanceLiquidBy { Mass, Concentration, Molarity, PartialPressure };
10 
12 {
13  friend class PBSubstanceQuantity;//friend the serialization class
14  friend class SELiquidCompartment;
15 protected:
17 public:
18  virtual ~SELiquidSubstanceQuantity();
19 
20  virtual void Clear();
21  virtual void Invalidate();
22 
23  virtual void SetToZero();
24  virtual const SEScalar* GetScalar(const std::string& name);
25 
26  virtual void Balance(BalanceLiquidBy e);// Balance Substance based on a specific property
27 
28  virtual bool HasConcentration() const;
29  virtual SEScalarMassPerVolume& GetConcentration();
30  virtual double GetConcentration(const MassPerVolumeUnit& unit) const;
31 
32  virtual bool HasMass() const;
33  virtual SEScalarMass& GetMass();
34  virtual double GetMass(const MassUnit& unit) const;
35 
36  virtual bool HasMassCleared() const;
37  virtual SEScalarMass& GetMassCleared();
38  virtual double GetMassCleared(const MassUnit& unit) const;
39 
40  virtual bool HasMassDeposited() const;
41  virtual SEScalarMass& GetMassDeposited();
42  virtual double GetMassDeposited(const MassUnit& unit) const;
43 
44  virtual bool HasMassExcreted() const;
45  virtual SEScalarMass& GetMassExcreted();
46  virtual double GetMassExcreted(const MassUnit& unit) const;
47 
48  virtual bool HasMolarity() const;
49  virtual SEScalarAmountPerVolume& GetMolarity();
50  virtual double GetMolarity(const AmountPerVolumeUnit& unit) const;
51 
52  virtual bool HasPartialPressure() const;
53  virtual SEScalarPressure& GetPartialPressure();
54  virtual double GetPartialPressure(const PressureUnit& unit) const;
55 
56  virtual bool HasSaturation() const;
57  virtual SEScalar0To1& GetSaturation();
58  virtual double GetSaturation() const;
59  virtual void SetHemoglobins(SESubstance& Hb, SESubstance& HbO2, SESubstance& HbCO2, SESubstance& HbO2CO2, SESubstance& HbCO);
60 
61 protected:
62  virtual void AddChild(SELiquidSubstanceQuantity& subQ);
63 
64  virtual bool HasExtensive() const { return HasMass(); }
65  virtual SEScalarMass& GetExtensive() { return GetMass(); }
66 
67  virtual bool HasIntensive() const { return HasConcentration(); }
68  virtual SEScalarMassPerVolume& GetIntensive() { return GetConcentration(); }
69 
78 
80  std::vector<SELiquidSubstanceQuantity*> m_Children;
81 
82  bool m_isO2;
83  bool m_isCO;
84  bool m_isCO2;
85  // Inorder to caluclate a hierarchical saturation, we need these substances
91 };
virtual const SEScalar * GetScalar(const std::string &name)
Definition: SELiquidCompartment.cpp:33
bool m_isO2
Definition: SELiquidSubstanceQuantity.h:82
Definition: SESubstanceTransport.h:13
Definition: SEScalarMass.h:23
Definition: SEScalar.h:19
virtual void AddChild(SELiquidCompartment &child)
Definition: SELiquidCompartment.cpp:126
virtual SEScalarMassPerVolume & GetIntensive()
Definition: SELiquidSubstanceQuantity.h:68
SESubstance * m_HbCO
Definition: SELiquidSubstanceQuantity.h:90
bool m_isCO
Definition: SELiquidSubstanceQuantity.h:83
Definition: SEScalarMassPerVolume.h:32
SESubstance * m_HbCO2
Definition: SELiquidSubstanceQuantity.h:88
bool m_isCO2
Definition: SELiquidSubstanceQuantity.h:84
SEScalar0To1 * m_Saturation
Definition: SELiquidSubstanceQuantity.h:77
Definition: SEScalarPressure.h:23
Definition: SEScalarMassPerVolume.h:7
virtual SEScalarMass & GetExtensive()
Definition: SELiquidSubstanceQuantity.h:65
virtual bool HasIntensive() const
Definition: SELiquidSubstanceQuantity.h:67
virtual bool HasExtensive() const
Definition: SELiquidSubstanceQuantity.h:64
SEScalarMass * m_MassCleared
Definition: SELiquidSubstanceQuantity.h:72
Definition: SELiquidSubstanceQuantity.h:11
std::vector< SELiquidSubstanceQuantity * > m_Children
Definition: SELiquidSubstanceQuantity.h:80
SEScalarAmountPerVolume * m_Molarity
Definition: SELiquidSubstanceQuantity.h:75
SEScalarMassPerVolume * m_Concentration
Definition: SELiquidSubstanceQuantity.h:70
Definition: SELiquidCompartment.h:10
virtual void Clear()
Definition: SELiquidCompartment.cpp:24
Definition: SEScalarPressure.h:7
SESubstance * m_HbO2CO2
Definition: SELiquidSubstanceQuantity.h:89
SEScalarMass * m_MassExcreted
Definition: SELiquidSubstanceQuantity.h:74
SEScalarPressure * m_PartialPressure
Definition: SELiquidSubstanceQuantity.h:76
Definition: SEScalarAmountPerVolume.h:7
SESubstance * m_Hb
Definition: SELiquidSubstanceQuantity.h:86
Definition: SEScalarAmountPerVolume.h:24
Definition: PBSubstanceQuantity.h:10
friend class SELiquidSubstanceQuantity
Definition: SELiquidCompartment.h:15
Definition: SEScalarMass.h:7
Definition: SESubstance.h:14
virtual void Balance(BalanceLiquidBy e)
Definition: SELiquidCompartment.cpp:52
SEScalarMass * m_MassDeposited
Definition: SELiquidSubstanceQuantity.h:73
SESubstance * m_HbO2
Definition: SELiquidSubstanceQuantity.h:87
Definition: SEScalar0To1.h:7
SEScalarMass * m_Mass
Definition: SELiquidSubstanceQuantity.h:71
SELiquidCompartment & m_Compartment
Definition: SELiquidSubstanceQuantity.h:79
Definition: SESubstanceQuantity.h:7