AGX Dynamics  2.35.0.1
WireMaterialEntity.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
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a 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 
18 // AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20 
21 #ifndef GENERATED_AGX_PHYSICS_WIREMATERIAL_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_WIREMATERIAL_H_PLUGIN
23 
24 #define AGX_ENTITY_WRAPPER 1
25 
26 
27 #ifdef _MSC_VER
28 # pragma warning(push)
29 // warning C4505: 'agxData::VectorAttributeT<T>::print' : unreferenced local function has been removed
30 # pragma warning( disable : 4505 )
31 // warning C4251: 'X' : class 'Y' needs to have dll-interface to be used by clients of class 'Z'
32 # pragma warning( disable : 4251 )
33 // warning C4355: 'this' : used in base member initializer list
34 # pragma warning( disable : 4355 )
35 // marked as __forceinline not inlined
36 # pragma warning( disable: 4714 )
37 #endif
38 
39 #include <agxData/EntityModel.h>
40 #include <agxData/EntityStorage.h>
41 #include <agxData/EntityRef.h>
42 #include <agxData/EntityPtr.h>
43 #include <agxData/EntityInstance.h>
44 #include <agx/Integer.h>
45 #include <agx/Real.h>
46 #include <agx/macros.h>
47 #include <agx/ReferencedEntity.h>
48 #include <agx/Real.h>
49 #include <agx/Integer.h>
50 
51 
52 namespace agx
53 {
54  namespace Physics
55  {
56 
57  class WireMaterialModel;
58  class WireMaterialData;
59  class WireMaterialPtr;
60  class WireMaterialInstance;
61  class WireMaterialSemantics;
62 
63 
65 
70  {
71  public:
73 
74  WireMaterialModel(const agx::String& name = "WireMaterial");
75 
78 
81 
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
96 
97  protected:
98  virtual ~WireMaterialModel();
99  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
100  virtual void configure(agx::TiXmlElement* eEntity) override;
101  virtual void initAttributeAccessors() override;
102  virtual void construct(agxData::EntityPtr instance) override;
104  };
105 
106 
108  #ifndef AGX_PHYSICS_WIREMATERIAL_DATA_SET_OVERRIDE
109  #define AGX_PHYSICS_WIREMATERIAL_DATA_SET
110  class AGXPHYSICS_EXPORT WireMaterialData : public agx::ReferencedData
111  {
112  public:
113  WireMaterialInstance operator[] (size_t index);
114 
115  public:
117  agxData::Array< agx::Real > youngsModulusStretch;
118  agxData::Array< agx::Real > youngsModulusBend;
119  agxData::Array< agx::Real > dampingStretch;
120  agxData::Array< agx::Real > dampingBend;
122 
123  public:
124  typedef agx::Real youngsModulusStretchType;
125  typedef agx::Real youngsModulusBendType;
126  typedef agx::Real dampingStretchType;
127  typedef agx::Real dampingBendType;
128  typedef agx::Bool dirtyType;
129 
130  public:
131  WireMaterialData(agxData::EntityStorage* storage);
132  WireMaterialData();
133 
134  protected:
135  virtual ~WireMaterialData() {}
136  virtual void setNumElements(agx::Index numElements) override;
137 
138  private:
139  WireMaterialData& operator= (const WireMaterialData&) { return *this; }
140 
141  };
142  #endif
144 
145 
147  class AGXPHYSICS_EXPORT WireMaterialSemantics : public agx::ReferencedSemantics
148  {
149  public:
150 
151  // Automatic getters
152  agx::Real const& getYoungsModulusStretch() const;
153  agx::Real const& getYoungsModulusBend() const;
154  agx::Real const& getDampingStretch() const;
155  agx::Real const& getDampingBend() const;
156  agx::Bool const& getDirty() const;
157 
158  // Semantics defined by explicit kernels
159 
160  // Automatic setters
161  void setYoungsModulusStretch(agx::Real const& value);
162  void setYoungsModulusBend(agx::Real const& value);
163  void setDampingStretch(agx::Real const& value);
164  void setDampingBend(agx::Real const& value);
165  void setDirty(agx::Bool const& value);
166 
167 
168  protected:
169  friend class WireMaterialPtr;
170  friend class WireMaterialInstance;
171  WireMaterialSemantics();
172  };
174 
175 
176 
180  {
181  public:
183  typedef WireMaterialData DataType;
184  typedef WireMaterialInstance InstanceType;
185 
186  public:
193  AGXPHYSICS_EXPORT WireMaterialInstance instance();
194  AGXPHYSICS_EXPORT const WireMaterialInstance instance() const;
195 
196  AGXPHYSICS_EXPORT WireMaterialSemantics* operator->();
197  AGXPHYSICS_EXPORT const WireMaterialSemantics* operator->() const;
198 
199  WireMaterialData* getData();
200  const WireMaterialData* getData() const;
201 
202 
207 
212 
217 
222 
227 
229  // Only used by tolua!
230  #ifdef AGX_GENERATED_TOLUA_WRAPPER
231  inline agx::Real const& getYoungsModulusStretch() const { return (*this)->getYoungsModulusStretch(); }
232  inline agx::Real const& getYoungsModulusBend() const { return (*this)->getYoungsModulusBend(); }
233  inline agx::Real const& getDampingStretch() const { return (*this)->getDampingStretch(); }
234  inline agx::Real const& getDampingBend() const { return (*this)->getDampingBend(); }
235  inline agx::Bool const& getDirty() const { return (*this)->getDirty(); }
236 
237 
238  inline void setYoungsModulusStretch(agx::Real const& value) { (*this)->setYoungsModulusStretch(value); }
239  inline void setYoungsModulusBend(agx::Real const& value) { (*this)->setYoungsModulusBend(value); }
240  inline void setDampingStretch(agx::Real const& value) { (*this)->setDampingStretch(value); }
241  inline void setDampingBend(agx::Real const& value) { (*this)->setDampingBend(value); }
242  inline void setDirty(agx::Bool const& value) { (*this)->setDirty(value); }
243  #endif
245 
246  };
247 
248  // Entity is Referenced
250 
251 
253  class AGXPHYSICS_EXPORT WireMaterialInstance : public agx::ReferencedInstance
254  {
255  public:
256  WireMaterialInstance();
257  WireMaterialInstance(WireMaterialData* data, agx::Index index);
258  WireMaterialInstance(agxData::EntityStorage *storage, agx::Index index);
259  WireMaterialInstance(const agxData::EntityInstance& other);
260  WireMaterialInstance(const agxData::EntityPtr& ptr);
261 
262  WireMaterialData* getData();
263  const WireMaterialData* getData() const;
264 
265  public:
267  agx::Real& youngsModulusStretch();
269  agx::Real const& youngsModulusStretch() const;
270 
272  agx::Real& youngsModulusBend();
274  agx::Real const& youngsModulusBend() const;
275 
277  agx::Real& dampingStretch();
279  agx::Real const& dampingStretch() const;
280 
282  agx::Real& dampingBend();
284  agx::Real const& dampingBend() const;
285 
287  agx::Bool& dirty();
289  agx::Bool const& dirty() const;
290 
291  };
293 
294 
295 
298 
299 
300 
302  /* Implementation */
303  //-----------------------------------------------------------------------------------------------------
304  //-----------------------------------------------------------------------------------------------------
305  inline WireMaterialInstance agx::Physics::WireMaterialData::operator[] (size_t index) { return WireMaterialInstance(this, (agx::Index)index); }
306  //-----------------------------------------------------------------------------------------------------
308  AGX_FORCE_INLINE WireMaterialPtr::WireMaterialPtr(agxData::EntityStorage* storage, agx::Index id) : agx::ReferencedPtr(storage, id) {}
309  AGX_FORCE_INLINE WireMaterialPtr::WireMaterialPtr(const agxData::EntityPtr& ptr) : agx::ReferencedPtr(ptr)
310  {
312  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
314  }
315 
316  AGX_FORCE_INLINE WireMaterialPtr::WireMaterialPtr(const agxData::EntityInstance& instance) : agx::ReferencedPtr(instance)
317  {
318  agxAssertN(!instance || instance.isInstanceOf(WireMaterialModel::instance()),
319  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
321  }
322 
323  AGX_FORCE_INLINE WireMaterialPtr& WireMaterialPtr::operator= (const agxData::EntityPtr& ptr)
324  {
326  agxAssertN(!ptr || ptr.isInstanceOf(WireMaterialModel::instance()),
327  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
328  EntityPtr::getModel()->fullPath().c_str(), WireMaterialModel::instance()->fullPath().c_str());
329  return *this;
330  }
331 
332  AGX_FORCE_INLINE WireMaterialPtr& WireMaterialPtr::operator= (const agxData::EntityInstance& instance)
333  {
335  agxAssertN(!instance || instance.isInstanceOf(WireMaterialModel::instance()),
336  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
337  EntityPtr::getModel()->fullPath().c_str(), WireMaterialModel::instance()->fullPath().c_str());
338  return *this;
339  }
340 
341  inline WireMaterialInstance WireMaterialPtr::instance() { return agxData::EntityPtr::instance(); }
342  inline const WireMaterialInstance WireMaterialPtr::instance() const { return agxData::EntityPtr::instance(); }
343  AGX_FORCE_INLINE WireMaterialSemantics* WireMaterialPtr::operator->() { return (WireMaterialSemantics* )this; }
344  AGX_FORCE_INLINE const WireMaterialSemantics* WireMaterialPtr::operator->() const { return (const WireMaterialSemantics* )this; }
345  AGX_FORCE_INLINE WireMaterialData* WireMaterialPtr::getData() { return static_cast<WireMaterialData* >(agxData::EntityPtr::getData()); }
346  AGX_FORCE_INLINE const WireMaterialData* WireMaterialPtr::getData() const { return static_cast<const WireMaterialData* >(agxData::EntityPtr::getData()); }
347 
348  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::youngsModulusStretch() { verifyIndex(); return getData()->youngsModulusStretch[calculateIndex()]; }
349  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::youngsModulusStretch() const { verifyIndex(); return getData()->youngsModulusStretch[calculateIndex()]; }
350 
351  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::youngsModulusBend() { verifyIndex(); return getData()->youngsModulusBend[calculateIndex()]; }
352  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::youngsModulusBend() const { verifyIndex(); return getData()->youngsModulusBend[calculateIndex()]; }
353 
354  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::dampingStretch() { verifyIndex(); return getData()->dampingStretch[calculateIndex()]; }
355  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::dampingStretch() const { verifyIndex(); return getData()->dampingStretch[calculateIndex()]; }
356 
357  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::dampingBend() { verifyIndex(); return getData()->dampingBend[calculateIndex()]; }
358  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::dampingBend() const { verifyIndex(); return getData()->dampingBend[calculateIndex()]; }
359 
360  AGX_FORCE_INLINE agx::Bool& WireMaterialPtr::dirty() { verifyIndex(); return getData()->dirty[calculateIndex()]; }
361  AGX_FORCE_INLINE agx::Bool const& WireMaterialPtr::dirty() const { verifyIndex(); return getData()->dirty[calculateIndex()]; }
362 
363  //-----------------------------------------------------------------------------------------------------
364  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance() {}
365  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(WireMaterialData* data, agx::Index index) : agx::ReferencedInstance(data, index) {}
366  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(agxData::EntityStorage* storage, agx::Index index) : agx::ReferencedInstance(storage, index) {}
367  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(const agxData::EntityInstance& other) : agx::ReferencedInstance(other)
368  {
370  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
372  }
373 
374  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(const agxData::EntityPtr& ptr) : agx::ReferencedInstance(ptr)
375  {
377  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
379  }
380 
381 
382  AGX_FORCE_INLINE WireMaterialData* WireMaterialInstance::getData() { return static_cast<WireMaterialData* >(agxData::EntityInstance::getData()); }
383  AGX_FORCE_INLINE const WireMaterialData* WireMaterialInstance::getData() const { return static_cast<const WireMaterialData* >(agxData::EntityInstance::getData()); }
384 
385  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::youngsModulusStretch() { verifyIndex(); return getData()->youngsModulusStretch[getIndex()]; }
386  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::youngsModulusStretch() const { verifyIndex(); return getData()->youngsModulusStretch[getIndex()]; }
387 
388  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::youngsModulusBend() { verifyIndex(); return getData()->youngsModulusBend[getIndex()]; }
389  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::youngsModulusBend() const { verifyIndex(); return getData()->youngsModulusBend[getIndex()]; }
390 
391  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::dampingStretch() { verifyIndex(); return getData()->dampingStretch[getIndex()]; }
392  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::dampingStretch() const { verifyIndex(); return getData()->dampingStretch[getIndex()]; }
393 
394  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::dampingBend() { verifyIndex(); return getData()->dampingBend[getIndex()]; }
395  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::dampingBend() const { verifyIndex(); return getData()->dampingBend[getIndex()]; }
396 
397  AGX_FORCE_INLINE agx::Bool& WireMaterialInstance::dirty() { verifyIndex(); return getData()->dirty[getIndex()]; }
398  AGX_FORCE_INLINE agx::Bool const& WireMaterialInstance::dirty() const { verifyIndex(); return getData()->dirty[getIndex()]; }
399 
400  //-----------------------------------------------------------------------------------------------------
401  AGX_FORCE_INLINE WireMaterialSemantics::WireMaterialSemantics() {}
402  //-----------------------------------------------------------------------------------------------------
404  }
405 }
406 
407 AGX_TYPE_BINDING(agx::Physics::WireMaterialPtr, "Physics.WireMaterialPtr")
408 AGX_TYPE_BINDING(agx::Physics::WireMaterialInstance, "Physics.WireMaterialInstance")
409 
410 #ifdef _MSC_VER
411 # pragma warning(pop)
412 #endif
413 
414 #undef AGX_ENTITY_WRAPPER
415 #undef AGX_ENTITY_NAMESPACE
416 #endif
417 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
#define AGXPHYSICS_EXPORT
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
Entity instance provides access to a single instance in an EntityStorage.
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:52
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
EntityPtr & operator=(const EntityPtr &other)=default
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
agx::String fullPath() const
Abstract description of the data attributes for the Physics.WireMaterial entity.
void construct(agx::Physics::WireMaterialPtr wireMaterial)
static agxData::ScalarAttributeT< agx::Bool > * dirtyAttribute
WireMaterialModel(const agx::String &name="WireMaterial")
static WireMaterialModel * instance()
static agxData::EntityStorage * defaultStorage()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::ScalarAttributeT< agx::Real > * dampingBendAttribute
static agxData::ScalarAttributeT< agx::Real > * youngsModulusBendAttribute
virtual void initAttributeAccessors() override
virtual void configure(agx::TiXmlElement *eEntity) override
static WireMaterialPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Real > * dampingStretchAttribute
static agxData::ScalarAttributeT< agx::Real > * youngsModulusStretchAttribute
Pointer to a entity instance of type Physics.WireMaterial.
const WireMaterialData * getData() const
WireMaterialData * getData()
AGXPHYSICS_EXPORT agx::Real const & dampingStretch() const
AGXPHYSICS_EXPORT agx::Bool & dirty()
AGXPHYSICS_EXPORT WireMaterialPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Real const & youngsModulusBend() const
AGXPHYSICS_EXPORT WireMaterialPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Real & dampingStretch()
AGXPHYSICS_EXPORT agx::Real const & dampingBend() const
AGXPHYSICS_EXPORT agx::Real & youngsModulusBend()
AGXPHYSICS_EXPORT const WireMaterialInstance instance() const
AGXPHYSICS_EXPORT agx::Real & youngsModulusStretch()
AGXPHYSICS_EXPORT const WireMaterialSemantics * operator->() const
AGXPHYSICS_EXPORT WireMaterialInstance instance()
AGXPHYSICS_EXPORT agx::Real const & youngsModulusStretch() const
AGXPHYSICS_EXPORT WireMaterialPtr()
AGXPHYSICS_EXPORT agx::Bool const & dirty() const
WireMaterialInstance InstanceType
AGXPHYSICS_EXPORT agx::Real & dampingBend()
AGXPHYSICS_EXPORT WireMaterialSemantics * operator->()
AGXPHYSICS_EXPORT WireMaterialPtr(agxData::EntityStorage *storage, agx::Index id)
Abstract description of the data attributes for the Referenced entity.
Pointer to a entity instance of type Referenced.
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define agxAssertN(expr, format,...)
Definition: debug.h:145
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< WireMaterialPtr > WireMaterialRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:48
double Real
Definition: Real.h:42
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52