SEFluidCompartmentLink.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "cdm/compartment/SECompartmentLink.h"
6 #include "cdm/substance/SESubstanceTransport.h"
7 #include "cdm/compartment/fluid/SEFluidCompartment.h"
8 #include "cdm/circuit/fluid/SEFluidCircuitPath.h"
9 
10 #define FLUID_COMPARTMENT_LINK_TEMPLATE typename EdgeType, typename VertexType, typename CompartmentType
11 #define FLUID_COMPARTMENT_LINK_TYPES EdgeType, VertexType, CompartmentType
12 
13 template<FLUID_COMPARTMENT_LINK_TEMPLATE>
14 class SEFluidCompartmentLink : public SECompartmentLink, public EdgeType
15 {
16  friend class PBCompartment;//friend the serialization class
17 protected:
18  SEFluidCompartmentLink(CompartmentType& src, CompartmentType & tgt, const std::string& name);
19 public:
20  virtual ~SEFluidCompartmentLink();
21 
22  void Clear() override;
23 
24  const SEScalar* GetScalar(const std::string& name) override;
25 
26  std::string GetName() const override { return m_Name; }
27 
28  virtual bool HasCompliance() const;
29  virtual double GetCompliance(const VolumePerPressureUnit& unit) const;
30 
31  virtual bool HasFlow() const;
32  virtual SEScalarVolumePerTime& GetFlow();
33  virtual double GetFlow(const VolumePerTimeUnit& unit) const;
34 
35  virtual bool HasResistance() const;
36  virtual double GetResistance(const PressureTimePerVolumeUnit& unit) const;
37 
38  virtual CompartmentType& GetSourceCompartment() { return m_SourceCmpt; }
39  virtual CompartmentType& GetTargetCompartment() { return m_TargetCmpt; }
40 
41  virtual bool HasPath() { return m_Path != nullptr; }
42  virtual SEFluidCircuitPath* GetPath() { return m_Path; }
43  virtual void RemovePath() { m_Path = nullptr; }
44  virtual void MapPath(SEFluidCircuitPath& path) { Clear(); m_Path = &path; }
45 
46 protected:
47  // For Transport
48  bool HasFlux() const override { return HasFlow(); }
49  SEScalarVolumePerTime& GetFlux() override { return GetFlow(); }
50  virtual double GetFlux(const VolumePerTimeUnit& unit) const { return GetFlow(unit); }
51 
52  VertexType& GetSourceVertex() override { return m_SourceVertex; }
53  VertexType& GetTargetVertex() override { return m_TargetVertex; }
54 
56  CompartmentType& m_SourceCmpt;
57  CompartmentType& m_TargetCmpt;
58  VertexType& m_SourceVertex;
59  VertexType& m_TargetVertex;
61 };
62 
63 #include "cdm/compartment/fluid/SEFluidCompartmentLink.hxx"
Definition: PBCompartment.h:28
Definition: SEScalarPressureTimePerVolume.h:8
Definition: SEFluidCircuitPath.h:9
Definition: SEScalar.h:19
Definition: SEScalarVolumePerTime.h:32
Definition: SEScalarVolumePerPressure.h:8
Definition: SEScalarVolumePerTime.h:8

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.