AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
FlowBlockConstraint.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
26
27namespace 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(
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
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXHYDRAULICS_EXPORT
A FlowDimension represents the flow of fluid through a FlowUnit.
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...
Abstract base class for storing/restoring a line/drums with version control.
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
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
uint8_t UInt8
Definition Integer.h:30