SEGasCompartment.h
1 /**************************************************************************************
2 Copyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 
13 #pragma once
14 #include <biogears/cdm/compartment/fluid/SEFluidCompartment.h>
15 #include <biogears/cdm/compartment/fluid/SEGasCompartmentLink.h>
16 #include <biogears/cdm/compartment/substances/SEGasSubstanceQuantity.h>
17 #include <biogears/cdm/substance/SESubstanceTransport.h>
18 
19 namespace biogears {
20 enum class BalanceGasBy { Volume,
22 
23 class SECompartmentManager;
24 class BIOGEARS_API SEGasCompartment : public SEFluidCompartment<SEGasCompartmentLink, SEGasTransportVertex, SEGasTransportSubstance, SEGasSubstanceQuantity> {
25  friend class SECompartmentManager;
26 
27 protected:
28  SEGasCompartment(const char* name, Logger* logger);
29  SEGasCompartment(const std::string& name, Logger* logger);
30 
31 public:
32  virtual ~SEGasCompartment();
33 
34  virtual bool Load(const CDM::GasCompartmentData& in, SESubstanceManager& subMgr, SECircuitManager* circuits = nullptr);
35  virtual CDM::GasCompartmentData* Unload() override;
36 
37 protected:
38  virtual void Unload(CDM::GasCompartmentData& data);
39 
40 public:
41  virtual void StateChange() override;
42 
43  virtual void Balance(BalanceGasBy by);
44 
45  virtual void AddChild(SEGasCompartment& child);
46  virtual const std::vector<SEGasCompartment*>& GetChildren() { return m_Children; }
47  virtual const std::vector<SEGasCompartment*>& GetLeaves() { return m_Leaves; }
48 
49 protected:
50  virtual SEGasSubstanceQuantity& CreateSubstanceQuantity(SESubstance& substance);
51 
52  std::vector<SEGasCompartment*> m_Children;
53  std::vector<SEGasCompartment*> m_Leaves;
54 };
55 }
virtual const std::vector< SEGasCompartment * > & GetChildren()
Definition: SEGasCompartment.h:46
Class corresponding to the GasCompartmentData schema type.
Definition: Compartment.hxx:2524
Definition: SEFluidCompartment.h:39
Definition: SECompartmentManager.h:32
Definition: Logger.h:75
BalanceGasBy
Definition: SEGasCompartment.h:20
Definition: SEGasSubstanceQuantity.h:20
Definition: SESubstance.h:49
std::vector< SEGasCompartment * > m_Children
Definition: SEGasCompartment.h:52
virtual const std::vector< SEGasCompartment * > & GetLeaves()
Definition: SEGasCompartment.h:47
std::vector< SEGasCompartment * > m_Leaves
Definition: SEGasCompartment.h:53
Definition: SESubstanceManager.h:23
Definition: SEElectricalCircuit.h:18
Definition: SECircuitManager.h:53
Definition: SEGasCompartment.h:24