AGXDynamics  2.35.0.3
Deformable1DRoute.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 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
agx::Real
double Real
Definition: Real.h:42
agxModel
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
agx::Vector< Deformable1DNodeRef >
agxStream::out
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.
Definition: OutputArchive.h:412
agxStream::Serializable
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
agxModel::Deformable1DNodeRoute::RouteData::node
agxModel::Deformable1DNodeRef node
Definition: Deformable1DRoute.h:277
agxModel::Deformable1DNodeRoute::RouteData
Definition: Deformable1DRoute.h:272
agxModel::Deformable1DPointRoute::m_routeNodes
Deformable1DNodeRefContainer m_routeNodes
Definition: Deformable1DRoute.h:260
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE
#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
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agxStream::in
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
agxModel::Deformable1DPointRoute
Routing implementation where the user add 'points', i.e., orientation is neglected.
Definition: Deformable1DRoute.h:185
agx::ref_ptr< Deformable1DNode >
agxModel::Deformable1DNodeRoute
Route the initial setup given nodes.
Definition: Deformable1DRoute.h:269
agxModel::Deformable1DPointRoute::m_minError
agx::Real m_minError
Definition: Deformable1DRoute.h:258
agxModel::Deformable1DNodeRoute::RouteData::length
agx::Real length
Definition: Deformable1DRoute.h:278
Deformable1DNode.h
agxModel::Deformable1DInitializationReport
Initialization report kept in Deformable1D object for the user to check validity of the initial state...
Definition: Deformable1DRoute.h:32
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agxModel::Deformable1DRoute
Base class for routing algorithms holding all nodes and resolution.
Definition: Deformable1DRoute.h:101
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
agxModel::Deformable1DNodeRoute::m_routeNodes
RouteData::Container m_routeNodes
Definition: Deformable1DRoute.h:316
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agx::Bool
bool Bool
Definition: Integer.h:48
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agx::Vec3T< Real >
agxModel::Deformable1DPointRoute::m_originalResolutionPerUnitLength
agx::Real m_originalResolutionPerUnitLength
Definition: Deformable1DRoute.h:259
agxModel::Deformable1DNodeRoute::RouteData::Container
agx::Vector< RouteData > Container
Definition: Deformable1DRoute.h:274
agxModel::Deformable1DNodeRoute::RouteData::RouteData
RouteData(agxModel::Deformable1DNodeRef node, agx::Real length)
Definition: Deformable1DRoute.h:276