SECircuitNode.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "properties/SEScalarElectricCharge.h"
6 #include "properties/SEScalarElectricPotential.h"
7 #include "properties/SEScalarPressure.h"
8 #include "properties/SEScalarVolume.h"
9 #include "properties/SEScalarTemperature.h"
10 #include "properties/SEScalarEnergy.h"
11 
12 #define CIRCUIT_NODE_TEMPLATE typename PotentialScalar, typename QuantityScalar
13 #define CIRCUIT_NODE_TYPES PotentialScalar,QuantityScalar
14 #define ELECTRICAL_CIRCUIT_NODE SEScalarElectricPotential, SEScalarElectricCharge
15 #define FLUID_CIRCUIT_NODE SEScalarPressure, SEScalarVolume
16 #define THERMAL_CIRCUIT_NODE SEScalarTemperature, SEScalarEnergy
17 
18 template<CIRCUIT_NODE_TEMPLATE>
19 class SECircuitNode : public Loggable
20 {
21  friend class PBCircuit;//friend the serialization class
22  template< typename NodeType, typename PathType> friend class SECircuit;
23 protected:
24  SECircuitNode(const std::string& name, Logger* logger);
25 public:
26  virtual ~SECircuitNode();
27 
28  virtual void Clear(); //clear memory
29 
30  virtual std::string GetName() const;
31 
32  virtual bool HasPotential() const;
33  virtual PotentialScalar& GetPotential();
34  virtual bool HasNextPotential() const;
35  virtual PotentialScalar& GetNextPotential();
36 
37  virtual bool HasQuantity() const;
38  virtual QuantityScalar& GetQuantity();
39  virtual bool HasNextQuantity() const;
40  virtual QuantityScalar& GetNextQuantity();
41  virtual bool HasQuantityBaseline() const;
42  virtual QuantityScalar& GetQuantityBaseline();
43 
44  void SetCalculatorIndex(const size_t index);
45  size_t GetCalculatorIndex() const;
46 
47  bool IsReferenceNode() const;
48  void SetAsReferenceNode();
49  void RemoveAsReferenceNode();
50 
51 protected:
52  std::string m_Name;
53 
54  PotentialScalar* m_Potential;
55  PotentialScalar* m_NextPotential;
56 
58  // Quantity Types //
60  QuantityScalar* m_Quantity;
61  QuantityScalar* m_NextQuantity;
62  QuantityScalar* m_QuantityBaseline;
63 
64 private:
66  bool m_IsReferenceNode = false;
67 };
68 
69 #include "circuit/SECircuitNode.inl"
virtual bool HasPotential() const
void SetCalculatorIndex(const size_t index)
Definition: Logger.h:61
virtual bool HasNextPotential() const
QuantityScalar * m_Quantity
Definition: SECircuitNode.h:60
virtual PotentialScalar & GetNextPotential()
size_t m_CalculatorIndex
Definition: SECircuitNode.h:65
QuantityScalar * m_NextQuantity
Definition: SECircuitNode.h:61
virtual ~SECircuitNode()
virtual QuantityScalar & GetQuantityBaseline()
QuantityScalar * m_QuantityBaseline
Definition: SECircuitNode.h:62
std::string m_Name
Definition: SECircuitNode.h:52
virtual QuantityScalar & GetQuantity()
Definition: Logger.h:11
bool IsReferenceNode() const
void RemoveAsReferenceNode()
SECircuitNode(const std::string &name, Logger *logger)
Definition: SECircuitNode.h:19
PotentialScalar * m_NextPotential
Definition: SECircuitNode.h:55
Definition: PBCircuit.h:25
virtual bool HasNextQuantity() const
void SetAsReferenceNode()
virtual std::string GetName() const
virtual QuantityScalar & GetNextQuantity()
size_t GetCalculatorIndex() const
virtual void Clear()
bool m_IsReferenceNode
Definition: SECircuitNode.h:66
Definition: SECircuit.h:12
virtual bool HasQuantity() const
virtual PotentialScalar & GetPotential()
virtual bool HasQuantityBaseline() const
PotentialScalar * m_Potential
Definition: SECircuitNode.h:54