AGX Dynamics  2.38.0.2
WireMaterialEntity.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
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 
77  static WireMaterialModel* instance();
78 
80  static WireMaterialPtr createInstance();
81 
83  static agxData::EntityStorage* defaultStorage();
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;
103  void construct(agx::Physics::WireMaterialPtr wireMaterial);
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:
191  AGXPHYSICS_EXPORT WireMaterialPtr& operator= (const agxData::EntityPtr& ptr);
192  AGXPHYSICS_EXPORT WireMaterialPtr& operator= (const agxData::EntityInstance& instance);
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 
204  AGXPHYSICS_EXPORT agx::Real& youngsModulusStretch();
206  AGXPHYSICS_EXPORT agx::Real const& youngsModulusStretch() const;
207 
209  AGXPHYSICS_EXPORT agx::Real& youngsModulusBend();
211  AGXPHYSICS_EXPORT agx::Real const& youngsModulusBend() const;
212 
214  AGXPHYSICS_EXPORT agx::Real& dampingStretch();
216  AGXPHYSICS_EXPORT agx::Real const& dampingStretch() const;
217 
219  AGXPHYSICS_EXPORT agx::Real& dampingBend();
221  AGXPHYSICS_EXPORT agx::Real const& dampingBend() const;
222 
224  AGXPHYSICS_EXPORT agx::Bool& dirty();
226  AGXPHYSICS_EXPORT agx::Bool const& dirty() const;
227 
228  };
229 
230  // Entity is Referenced
232 
233 
235  class AGXPHYSICS_EXPORT WireMaterialInstance : public agx::ReferencedInstance
236  {
237  public:
238  WireMaterialInstance();
239  WireMaterialInstance(WireMaterialData* data, agx::Index index);
240  WireMaterialInstance(agxData::EntityStorage *storage, agx::Index index);
241  WireMaterialInstance(const agxData::EntityInstance& other);
242  WireMaterialInstance(const agxData::EntityPtr& ptr);
243 
244  WireMaterialData* getData();
245  const WireMaterialData* getData() const;
246 
247  public:
249  agx::Real& youngsModulusStretch();
251  agx::Real const& youngsModulusStretch() const;
252 
254  agx::Real& youngsModulusBend();
256  agx::Real const& youngsModulusBend() const;
257 
259  agx::Real& dampingStretch();
261  agx::Real const& dampingStretch() const;
262 
264  agx::Real& dampingBend();
266  agx::Real const& dampingBend() const;
267 
269  agx::Bool& dirty();
271  agx::Bool const& dirty() const;
272 
273  };
275 
276 
277 
280 
281 
282 
284  /* Implementation */
285  //-----------------------------------------------------------------------------------------------------
286  //-----------------------------------------------------------------------------------------------------
287  inline WireMaterialInstance agx::Physics::WireMaterialData::operator[] (size_t index) { return WireMaterialInstance(this, (agx::Index)index); }
288  //-----------------------------------------------------------------------------------------------------
290  AGX_FORCE_INLINE WireMaterialPtr::WireMaterialPtr(agxData::EntityStorage* storage, agx::Index id) : agx::ReferencedPtr(storage, id) {}
291  AGX_FORCE_INLINE WireMaterialPtr::WireMaterialPtr(const agxData::EntityPtr& ptr) : agx::ReferencedPtr(ptr)
292  {
294  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
296  }
297 
298  AGX_FORCE_INLINE WireMaterialPtr::WireMaterialPtr(const agxData::EntityInstance& instance) : agx::ReferencedPtr(instance)
299  {
300  agxAssertN(!instance || instance.isInstanceOf(WireMaterialModel::instance()),
301  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
303  }
304 
305  AGX_FORCE_INLINE WireMaterialPtr& WireMaterialPtr::operator= (const agxData::EntityPtr& ptr)
306  {
308  agxAssertN(!ptr || ptr.isInstanceOf(WireMaterialModel::instance()),
309  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
310  EntityPtr::getModel()->fullPath().c_str(), WireMaterialModel::instance()->fullPath().c_str());
311  return *this;
312  }
313 
314  AGX_FORCE_INLINE WireMaterialPtr& WireMaterialPtr::operator= (const agxData::EntityInstance& instance)
315  {
317  agxAssertN(!instance || instance.isInstanceOf(WireMaterialModel::instance()),
318  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
319  EntityPtr::getModel()->fullPath().c_str(), WireMaterialModel::instance()->fullPath().c_str());
320  return *this;
321  }
322 
323  inline WireMaterialInstance WireMaterialPtr::instance() { return agxData::EntityPtr::instance(); }
324  inline const WireMaterialInstance WireMaterialPtr::instance() const { return agxData::EntityPtr::instance(); }
325  AGX_FORCE_INLINE WireMaterialSemantics* WireMaterialPtr::operator->() { return (WireMaterialSemantics* )this; }
326  AGX_FORCE_INLINE const WireMaterialSemantics* WireMaterialPtr::operator->() const { return (const WireMaterialSemantics* )this; }
327  AGX_FORCE_INLINE WireMaterialData* WireMaterialPtr::getData() { return static_cast<WireMaterialData* >(agxData::EntityPtr::getData()); }
328  AGX_FORCE_INLINE const WireMaterialData* WireMaterialPtr::getData() const { return static_cast<const WireMaterialData* >(agxData::EntityPtr::getData()); }
329 
330  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::youngsModulusStretch() { verifyIndex(); return getData()->youngsModulusStretch[calculateIndex()]; }
331  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::youngsModulusStretch() const { verifyIndex(); return getData()->youngsModulusStretch[calculateIndex()]; }
332 
333  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::youngsModulusBend() { verifyIndex(); return getData()->youngsModulusBend[calculateIndex()]; }
334  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::youngsModulusBend() const { verifyIndex(); return getData()->youngsModulusBend[calculateIndex()]; }
335 
336  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::dampingStretch() { verifyIndex(); return getData()->dampingStretch[calculateIndex()]; }
337  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::dampingStretch() const { verifyIndex(); return getData()->dampingStretch[calculateIndex()]; }
338 
339  AGX_FORCE_INLINE agx::Real& WireMaterialPtr::dampingBend() { verifyIndex(); return getData()->dampingBend[calculateIndex()]; }
340  AGX_FORCE_INLINE agx::Real const& WireMaterialPtr::dampingBend() const { verifyIndex(); return getData()->dampingBend[calculateIndex()]; }
341 
342  AGX_FORCE_INLINE agx::Bool& WireMaterialPtr::dirty() { verifyIndex(); return getData()->dirty[calculateIndex()]; }
343  AGX_FORCE_INLINE agx::Bool const& WireMaterialPtr::dirty() const { verifyIndex(); return getData()->dirty[calculateIndex()]; }
344 
345  //-----------------------------------------------------------------------------------------------------
346  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance() {}
347  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(WireMaterialData* data, agx::Index index) : agx::ReferencedInstance(data, index) {}
348  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(agxData::EntityStorage* storage, agx::Index index) : agx::ReferencedInstance(storage, index) {}
349  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(const agxData::EntityInstance& other) : agx::ReferencedInstance(other)
350  {
352  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
354  }
355 
356  AGX_FORCE_INLINE WireMaterialInstance::WireMaterialInstance(const agxData::EntityPtr& ptr) : agx::ReferencedInstance(ptr)
357  {
359  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
361  }
362 
363 
364  AGX_FORCE_INLINE WireMaterialData* WireMaterialInstance::getData() { return static_cast<WireMaterialData* >(agxData::EntityInstance::getData()); }
365  AGX_FORCE_INLINE const WireMaterialData* WireMaterialInstance::getData() const { return static_cast<const WireMaterialData* >(agxData::EntityInstance::getData()); }
366 
367  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::youngsModulusStretch() { verifyIndex(); return getData()->youngsModulusStretch[getIndex()]; }
368  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::youngsModulusStretch() const { verifyIndex(); return getData()->youngsModulusStretch[getIndex()]; }
369 
370  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::youngsModulusBend() { verifyIndex(); return getData()->youngsModulusBend[getIndex()]; }
371  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::youngsModulusBend() const { verifyIndex(); return getData()->youngsModulusBend[getIndex()]; }
372 
373  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::dampingStretch() { verifyIndex(); return getData()->dampingStretch[getIndex()]; }
374  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::dampingStretch() const { verifyIndex(); return getData()->dampingStretch[getIndex()]; }
375 
376  AGX_FORCE_INLINE agx::Real& WireMaterialInstance::dampingBend() { verifyIndex(); return getData()->dampingBend[getIndex()]; }
377  AGX_FORCE_INLINE agx::Real const& WireMaterialInstance::dampingBend() const { verifyIndex(); return getData()->dampingBend[getIndex()]; }
378 
379  AGX_FORCE_INLINE agx::Bool& WireMaterialInstance::dirty() { verifyIndex(); return getData()->dirty[getIndex()]; }
380  AGX_FORCE_INLINE agx::Bool const& WireMaterialInstance::dirty() const { verifyIndex(); return getData()->dirty[getIndex()]; }
381 
382  //-----------------------------------------------------------------------------------------------------
383  AGX_FORCE_INLINE WireMaterialSemantics::WireMaterialSemantics() {}
384  //-----------------------------------------------------------------------------------------------------
386  }
387 }
388 
389 AGX_TYPE_BINDING(agx::Physics::WireMaterialPtr, "Physics.WireMaterialPtr")
390 AGX_TYPE_BINDING(agx::Physics::WireMaterialInstance, "Physics.WireMaterialInstance")
391 
392 #ifdef _MSC_VER
393 # pragma warning(pop)
394 #endif
395 
396 #undef AGX_ENTITY_WRAPPER
397 #undef AGX_ENTITY_NAMESPACE
398 #endif
399 
agx::Physics::WireMaterialModel::dampingBendAttribute
static agxData::ScalarAttributeT< agx::Real > * dampingBendAttribute
Definition: WireMaterialEntity.h:94
agx::Real
double Real
Definition: Real.h:42
agx::Physics::WireMaterialModel::youngsModulusBendAttribute
static agxData::ScalarAttributeT< agx::Real > * youngsModulusBendAttribute
Definition: WireMaterialEntity.h:92
agxData::ScalarAttributeT< agx::Real >
CALLABLE
#define CALLABLE
Definition: macros.h:72
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxData::EntityPtr::getData
agxData::EntityData * getData()
Definition: EntityStorage.h:594
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agx::ReferencedModel
Abstract description of the data attributes for the Referenced entity.
Definition: ReferencedEntity.h:66
agx::ReferencedPtr
Pointer to a entity instance of type Referenced.
Definition: ReferencedEntity.h:166
macros.h
agxData::EntityPtr::isInstanceOf
bool isInstanceOf(agxData::EntityModel *model) const
Definition: EntityStorage.h:784
agx::Model::fullPath
agx::String fullPath() const
agxData::EntityStorage
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
EntityModel.h
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agxData::EntityPtr::instance
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
agxData::EntityInstance::isInstanceOf
bool isInstanceOf(agxData::EntityModel *model) const
Definition: EntityStorage.h:829
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxData
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::Array
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
EntityStorage.h
EntityRef.h
agx::Physics::WireMaterialPtr::WireMaterialPtr
AGXPHYSICS_EXPORT WireMaterialPtr()
agx::Physics::WireMaterialModel::PtrT
WireMaterialPtr PtrT
Definition: WireMaterialEntity.h:72
EntityPtr.h
agx::Physics::WireMaterialPtr::ModelType
WireMaterialModel ModelType
Definition: WireMaterialEntity.h:182
agx::Physics::WireMaterialModel
Abstract description of the data attributes for the Physics.WireMaterial entity.
Definition: WireMaterialEntity.h:69
EntityInstance.h
agx::Physics::WireMaterialModel::youngsModulusStretchAttribute
static agxData::ScalarAttributeT< agx::Real > * youngsModulusStretchAttribute
Definition: WireMaterialEntity.h:91
Integer.h
ReferencedEntity.h
agx::Physics::WireMaterialRef
agxData::EntityRef< WireMaterialPtr > WireMaterialRef
Definition: WireMaterialEntity.h:231
agxData::EntityPtr::operator=
EntityPtr & operator=(const EntityPtr &other)=default
agx::Index
UInt32 Index
Definition: Integer.h:44
agx::Physics::WireMaterialPtr
Pointer to a entity instance of type Physics.WireMaterial.
Definition: WireMaterialEntity.h:179
agxData::EntityInstance
Entity instance provides access to a single instance in an EntityStorage.
Definition: EntityInstance.h:43
agx::Physics::WireMaterialModel::instance
static WireMaterialModel * instance()
agxData::EntityInstance::getData
agxData::EntityData * getData()
Definition: EntityInstance.h:149
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::Bool
bool Bool
Definition: Integer.h:40
agxData::EntityRef< WireMaterialPtr >
agx::Physics::WireMaterialModel::dampingStretchAttribute
static agxData::ScalarAttributeT< agx::Real > * dampingStretchAttribute
Definition: WireMaterialEntity.h:93
agx::AgXString< std::string >
agxAssertN
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agx::Physics::WireMaterialPtr::InstanceType
WireMaterialInstance InstanceType
Definition: WireMaterialEntity.h:184
AGX_TYPE_BINDING
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
Real.h
agx::Physics::WireMaterialModel::dirtyAttribute
static agxData::ScalarAttributeT< agx::Bool > * dirtyAttribute
Definition: WireMaterialEntity.h:95
agx::Physics::WireMaterialPtr::DataType
WireMaterialData DataType
Definition: WireMaterialEntity.h:183
agxData::EntityPtr
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::getModel
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363