AGX Dynamics  2.35.0.1
WireMaterialController.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 #pragma once
18 
19 #include <agx/agxPhysics_export.h>
20 #include <agx/Material.h>
23 
25 
26 
27 namespace agxWire
28 {
29  class AGXPHYSICS_EXPORT WireMaterialController : public agx::Referenced
30  {
31  public:
32  WireMaterialController( agx::Real resolutionPerUnitLength );
33 
38  void setWire( WireDistanceCompositeConstraint* wire );
39 
43  const agxWire::WireDistanceCompositeConstraint* getWire() const;
44 
48  void updateMaterial();
49 
53  void updateNodeMaterial();
54 
59  void setRadius( agx::Real radius);
60 
64  agx::Real getRadius() const;
65 
69  agx::Real getCrossSectionArea() const;
70 
78  void setVolumeRatio( agx::Real volumeRatio );
79 
83  agx::Real getVolumeRatio() const;
84 
89  void setGlobalLumpDistance( agx::Real lumpDistance );
90 
94  agx::Real getGlobalLumpDistance() const;
95 
99  bool resolutionHighEnoughForPosition(const agx::Real restlengthToBfn,const agx::Real minDistanceToLump, const agx::Real eps = agx::Real(1E-6) ) const;
100 
106  void findLocalHighResolutionRanges( const agx::Real distanceOnWireToStart,const agx::Real localLength, agx::Vector< WireNodeRange >& foundRanges );
107 
112  agx::Real getMassPerUnitLength() const;
113 
119  agx::Real getMass( agx::Real segmentLength ) const;
120 
124  void updateWireNodeDensity();
125 
129  void clearWireNodeDensity();
130 
134  agxWire::WireNodeDensityController* getNodeDensityController() const;
135 
139  agx::Material* getMaterial() const;
140 
145  void setMaterial( agx::Material* material );
146 
150  bool getIsBendResistant() const;
151 
157  void setIsBendResistant( bool isBendResistant );
158 
167  void changeMassAndVelocityByAddition( const NodeConstIterator bfnAIt,
168  const NodeConstIterator bfnCIt,
169  const NodeConstIterator bfnNewIt,
170  agx::Real halfMassFromA,
171  agx::Real halfMassFromC ) const;
172  void changeMassAndVelocityByRemoval( const NodeConstIterator bfnAIt,
173  const NodeConstIterator bfnCIt,
174  const NodeConstIterator bfnRemoveIt,
175  agx::Real halfMassToA,
176  agx::Real halfMassToC ) const;
177 
178  private:
179  NodeIterator updateNodeMaterial( NodeIterator it, const NodeConstIterator end ) const;
180 
181  private:
183  agx::Real m_lumpNodeDistance;
184  bool m_isBendResistant;
185  agx::Real m_radius;
186  agx::Real m_volumeRatio;
187  agx::ref_ptr< WireNodeDensityController > m_wireNodeDensityController;
188  agx::MaterialRef m_material;
189  };
190 
191  AGX_FORCE_INLINE agx::Real WireMaterialController::getRadius() const
192  {
193  return m_radius;
194  }
195 
196  AGX_FORCE_INLINE agx::Real WireMaterialController::getCrossSectionArea() const
197  {
198  return getRadius() * getRadius() * agx::PI;
199  }
200 
201  AGX_FORCE_INLINE agx::Real WireMaterialController::getGlobalLumpDistance() const
202  {
203  return m_lumpNodeDistance;
204  }
205 
206  AGX_FORCE_INLINE agx::Material* WireMaterialController::getMaterial() const
207  {
208  return m_material;
209  }
210 
211  typedef agx::ref_ptr< WireMaterialController > WireMaterialControllerRef;
212 }
213 
#define AGXPHYSICS_EXPORT
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition: Material.h:388
Base class providing referencing counted objects.
Definition: Referenced.h:114
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:61
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:40
NodeContainer::const_iterator NodeConstIterator
Definition: agxWire/Node.h:57
NodeContainer::iterator NodeIterator
Definition: agxWire/Node.h:54
const Real PI
Definition: Math.h:63
double Real
Definition: Real.h:42
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)