AGX Dynamics  2.37.3.2
Deformable1DRoute.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 AGXMODEL_DEFORMABLE1DROUTE_H
18 #define AGXMODEL_DEFORMABLE1DROUTE_H
19 
21 
22 namespace agxModel
23 {
26  AGX_DECLARE_POINTER_TYPES(Deformable1DMinErrorPointRoute);
27 
33  {
34  public:
43 
47  Deformable1DInitializationReport(agx::Real targetError, agx::Real maxError, agx::Real resolution, size_t numNodes);
48 
52  agx::Bool successful() const;
53 
57  agx::Real getTargetError() const;
58 
62  agx::Real getMaximumError() const;
63 
67  size_t getNumNodes() const;
68 
72  agx::Real getResolution() const;
73 
79  agx::Real getLength() const;
80 
84  void store(agxStream::OutputArchive& out) const;
85 
89  void restore(agxStream::InputArchive& in);
90 
91  private:
92  agx::Real m_targetError;
93  agx::Real m_maxError;
94  agx::Real m_resolution;
95  size_t m_numNodes;
96  };
97 
102  {
103  public:
110 
112 
116  virtual void postInitialize();
117 
122  const agxModel::Deformable1DNodeRefContainer& getNodes() const;
123 
127  agx::Real getResolutionPerUnitLength() const;
128 
130 
131  protected:
136  Deformable1DRoute( agx::Real resolutionPerUnitLength );
137 
141  virtual ~Deformable1DRoute();
142 
143 
144  virtual agxModel::Deformable1DInitializationReport tryInitializeAllNodes() = 0;
145 
150  virtual agxModel::Deformable1DInitializationReport initializeAndAddAllNodes() = 0;
151 
160 
165  void setResolutionPerUnitLength( agx::Real resolutionPerUnitLength );
166 
170  void store( agxStream::OutputArchive& out ) const override;
171 
175  void restore( agxStream::InputArchive& in ) override;
176 
177  private:
178  Deformable1DNodeRefContainer m_allNodes;
179  agx::Real m_resolutionPerUnitLength;
180  };
181 
186  {
187  public:
198  Deformable1DPointRoute( agx::Real resolutionPerUnitLength, agx::Real minError = agx::Real(-1) );
199 
200  void setMinError(agx::Real minError);
201  agx::Real getMinError() const;
202 
209 
215  agxModel::Deformable1DNodeRef add( const agx::Vec3& point );
216 
223 
227  const agxModel::Deformable1DNodeRefContainer& getRouteNodes() const;
228 
229 
233  agx::Real getOriginalResolutionPerUnitLength() const;
234 
235 
237 
238  protected:
243 
247  virtual ~Deformable1DPointRoute();
248 
249 
250  virtual agxModel::Deformable1DInitializationReport tryInitializeAllNodes() override;
251 
255  virtual agxModel::Deformable1DInitializationReport initializeAndAddAllNodes() override;
256 
257  protected:
261  };
262 
270  {
271  public:
273  {
275 
276  RouteData( agxModel::Deformable1DNodeRef node, agx::Real length ) : node( node ), length( length ) {}
279  };
280 
281  public:
286 
294 
298  const RouteData::Container& getRouteDataContainer() const;
299 
301 
302  protected:
306  virtual ~Deformable1DNodeRoute();
307 
311  virtual agxModel::Deformable1DInitializationReport initializeAndAddAllNodes() override;
312 
313  virtual agxModel::Deformable1DInitializationReport tryInitializeAllNodes() override;
314 
315  protected:
317  };
318 }
319 
320 #endif // AGXMODEL_DEFORMABLE1DROUTE_H
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
Initialization report kept in Deformable1D object for the user to check validity of the initial state...
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
bool Bool
Definition: Integer.h:48
Deformable1DNodeRefContainer m_routeNodes
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Base class for routing algorithms holding all nodes and resolution.
Base class providing referencing counted objects.
Definition: Referenced.h:119
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
Route the initial setup given nodes.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
#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
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
Routing implementation where the user add &#39;points&#39;, i.e., orientation is neglected.
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:221
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
RouteData(agxModel::Deformable1DNodeRef node, agx::Real length)