AGX Dynamics  2.37.3.2
FlowBlockConstraint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 #ifndef SWIG
117  virtual void storeLightData(agxStream::StorageStream& str) const override;
118  virtual void restoreLightData(agxStream::StorageStream& str) override;
119 #endif
120 
121  AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::FlowBlockConstraintImplementation);
122 
123  protected:
124  FlowBlockConstraintImplementation();
125 
126  private:
127  ~FlowBlockConstraintImplementation();
128  ElementaryFlowBlockConstraint* m_flowBlockConstraint;
129  agxHydraulics::FlowDimension* m_flowDimension;
130  };
131 
132 
133  AGX_DECLARE_POINTER_TYPES(FlowBlockConstraint);
134 
138  class AGXHYDRAULICS_EXPORT FlowBlockConstraint : public agx::Constraint
139  {
140  public:
145  FlowBlockConstraint(agxHydraulics::FlowDirection::Literal allowedFlowDirection, agxHydraulics::FlowUnit* flowUnit);
146 
150  agxHydraulics::FlowDirection::Literal getAllowedFlowDirection() const;
151 
155  void setAllowedFlowDirection(agxHydraulics::FlowDirection::Literal allowedFlowDirection);
156 
157  virtual void render(agxRender::RenderManager* /*canvas*/, float /*scale*/) const override {}
158 
159  AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::FlowBlockConstraint);
160 
161  protected:
162  FlowBlockConstraint();
163  virtual ~FlowBlockConstraint();
164  virtual int getNumDOF() const override;
165 
166  private:
167  FlowBlockConstraintImplementation* m_flowBlockConstraint;
168  };
170 
171 }
172 
173 
174 #endif
A FlowDimension represents the flow of fluid through a FlowUnit.
Definition: FlowDimension.h:53
uint8_t UInt8
Definition: Integer.h:38
Helper class to hold data that is general for elementary constraints.
The base class for a constraint.
Definition: Constraint.h:88
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
uint32_t UInt
Definition: Integer.h:34
#define AGXHYDRAULICS_EXPORT
The agxHydraulics namespace contains classes for modeling hydraulic circuits within the power line fr...
Definition: Accumulator.h:27
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
#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
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
double Real
Definition: Real.h:42
FlowUnit is the base class for Units that contains a FlowDimension.
Definition: FlowUnit.h:66