AGX Dynamics  2.35.0.1
FlowBlockConstraint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXHYDRAULICS_FLOW_BLOCK_CONSTRAINT_H
18 #define AGXHYDRAULICS_FLOW_BLOCK_CONSTRAINT_H
19 
20 #include <agx/Constraint.h>
23 
24 #include <agxHydraulics/FlowUnit.h>
26 
27 namespace agxHydraulics
28 {
29 
31 
35  class AGXHYDRAULICS_EXPORT ElementaryFlowBlockConstraint : public agx::ElementaryConstraintN<1>
36  {
37  public:
44  ElementaryFlowBlockConstraint(
45  agxHydraulics::FlowDirection::Literal allowedFlowDirection,
46  agx::UInt8 elementIndex);
47 
51  agxHydraulics::FlowDirection::Literal getAllowedFlowDirection() const;
52 
56  void setAllowedFlowDirection(agxHydraulics::FlowDirection::Literal allowedFlowDirection);
57 
58  void setElementIndex(agx::UInt8 elementIndex);
59 
60  virtual agx::UInt getJacobian(
61  agx::Jacobian6DOFElement* G, agx::UInt numBlocks,
62  agx::UInt row, agx::GWriteState::Enum writeState) override;
63 
67  virtual agx::UInt getViolation(agx::Real* g, agx::UInt row) override;
68 
72  virtual agx::UInt getVelocity(agx::Real* v, agx::UInt row) const override;
73 
74  AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::ElementaryFlowBlockConstraint);
75 
76  protected:
77  ElementaryFlowBlockConstraint();
78  virtual ~ElementaryFlowBlockConstraint() {}
79 
80  private:
81  agx::UInt8 m_elementIndex;
82  agxHydraulics::FlowDirection::Literal m_allowedFlowDirection;
83  };
84 
85 
89  class AGXHYDRAULICS_EXPORT FlowBlockConstraintImplementation : public agx::ConstraintImplementation, public agxStream::Serializable
90  {
91  public:
96  FlowBlockConstraintImplementation(
97  agxHydraulics::FlowDirection::Literal allowedFlowDirection,
98  agxHydraulics::FlowUnit* flowUnit);
99 
103  agxHydraulics::FlowDirection::Literal getAllowedFlowDirection() const;
104 
108  void setAllowedFlowDirection(agxHydraulics::FlowDirection::Literal allowedFlowDirection);
109 
110  // Methods called by the rest of the PowerLine/Hydraulics framework.
111  public:
112  ElementaryFlowBlockConstraint* getElementaryFlowBlockConstraint();
113 
114  virtual void prepare() override;
115 
116  virtual void storeLightData(agxStream::StorageStream& str) const override;
117  virtual void restoreLightData(agxStream::StorageStream& str) override;
118 
119  AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::FlowBlockConstraintImplementation);
120 
121  protected:
122  FlowBlockConstraintImplementation();
123 
124  private:
125  ~FlowBlockConstraintImplementation();
126  ElementaryFlowBlockConstraint* m_flowBlockConstraint;
127  agxHydraulics::FlowDimension* m_flowDimension;
128  };
129 
130 
131  AGX_DECLARE_POINTER_TYPES(FlowBlockConstraint);
132 
136  class AGXHYDRAULICS_EXPORT FlowBlockConstraint : public agx::Constraint
137  {
138  public:
143  FlowBlockConstraint(agxHydraulics::FlowDirection::Literal allowedFlowDirection, agxHydraulics::FlowUnit* flowUnit);
144 
148  agxHydraulics::FlowDirection::Literal getAllowedFlowDirection() const;
149 
153  void setAllowedFlowDirection(agxHydraulics::FlowDirection::Literal allowedFlowDirection);
154 
155  virtual void render(agxRender::RenderManager* /*canvas*/, float /*scale*/) const override {}
156 
157  AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::FlowBlockConstraint);
158 
159  protected:
160  FlowBlockConstraint();
161  virtual ~FlowBlockConstraint();
162  virtual int getNumDOF() const override;
163 
164  private:
165  FlowBlockConstraintImplementation* m_flowBlockConstraint;
166  };
168 
169 }
170 
171 
172 #endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXHYDRAULICS_EXPORT
A FlowDimension represents the flow of fluid through a FlowUnit.
Definition: FlowDimension.h:54
FlowUnit is the base class for Units that contains a FlowDimension.
Definition: FlowUnit.h:67
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
The base class for a constraint.
Definition: Constraint.h:89
Helper class to hold data that is general for elementary constraints.
The agxHydraulics namespace contains classes for modeling hydraulic circuits within the power line fr...
Definition: Accumulator.h:28
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:38