SEFluidCompartmentLink.hxx
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#include "cdm/compartment/fluid/SELiquidCompartment.h"
5#include "cdm/properties/SEScalarVolumePerTime.h"
6
7template<FLUID_COMPARTMENT_LINK_TEMPLATE>
8SEFluidCompartmentLink<FLUID_COMPARTMENT_LINK_TYPES>::SEFluidCompartmentLink(CompartmentType& src, CompartmentType & tgt, const std::string& name) : SECompartmentLink(name, src.GetLogger()), m_SourceCmpt(src), m_TargetCmpt(tgt), m_SourceVertex(src), m_TargetVertex(tgt)
9{
10 m_Flow = nullptr;
11 m_Path = nullptr;
12
13}
14template<FLUID_COMPARTMENT_LINK_TEMPLATE>
16{
17
18}
19
20template<FLUID_COMPARTMENT_LINK_TEMPLATE>
22{
23 m_Path = nullptr;
24 SAFE_DELETE(m_Flow);
25}
26
27template<FLUID_COMPARTMENT_LINK_TEMPLATE>
29{
30 if (name.compare("Flow") == 0)
31 return &GetFlow();
32 return nullptr;
33}
34
35template<FLUID_COMPARTMENT_LINK_TEMPLATE>
37{
38 if (m_Path != nullptr)
39 return m_Path->HasNextCompliance();
40 return false;
41}
42template<FLUID_COMPARTMENT_LINK_TEMPLATE>
44{
45 if (m_Path != nullptr)
46 return m_Path->GetNextCompliance(unit);
47 return SEScalar::dNaN();
48}
49
50template<FLUID_COMPARTMENT_LINK_TEMPLATE>
52{
53 if (m_Path != nullptr)
54 return m_Path->HasNextFlow();
55 return m_Flow == nullptr ? false : m_Flow->IsValid();
56}
57template<FLUID_COMPARTMENT_LINK_TEMPLATE>
59{
60 if (m_Path != nullptr)
61 return m_Path->GetNextFlow();
62 if (m_Flow == nullptr)
63 m_Flow = new SEScalarVolumePerTime();
64 return *m_Flow;
65}
66template<FLUID_COMPARTMENT_LINK_TEMPLATE>
68{
69 if (m_Path != nullptr)
70 return m_Path->GetNextFlow(unit);
71 if (m_Flow == nullptr)
72 return SEScalar::dNaN();
73 return m_Flow->GetValue(unit);
74}
75
76
77template<FLUID_COMPARTMENT_LINK_TEMPLATE>
79{
80 if (m_Path != nullptr)
81 return m_Path->HasNextResistance();
82 return false;
83}
84template<FLUID_COMPARTMENT_LINK_TEMPLATE>
86{
87 if (m_Path != nullptr)
88 return m_Path->GetNextResistance(unit);
89 return SEScalar::dNaN();
90}
Definition: SEScalarPressureTimePerVolume.h:8
Definition: SEScalar.h:19
static double dNaN()
Definition: SEScalar.cpp:10
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.