AGX Dynamics  2.37.2.0
SurfaceMaterialEntity.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_SURFACEMATERIAL_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_SURFACEMATERIAL_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 SurfaceMaterialModel;
58  class SurfaceMaterialData;
59  class SurfaceMaterialPtr;
60  class SurfaceMaterialInstance;
61  class SurfaceMaterialSemantics;
62 
63 
65 
70  {
71  public:
73 
74  SurfaceMaterialModel(const agx::String& name = "SurfaceMaterial");
75 
77  static SurfaceMaterialModel* instance();
78 
80  static SurfaceMaterialPtr createInstance();
81 
83  static agxData::EntityStorage* defaultStorage();
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
97 
98  protected:
99  virtual ~SurfaceMaterialModel();
100  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
101  virtual void configure(agx::TiXmlElement* eEntity) override;
102  virtual void initAttributeAccessors() override;
103  virtual void construct(agxData::EntityPtr instance) override;
104  void construct(agx::Physics::SurfaceMaterialPtr surfaceMaterial);
105  };
106 
107 
109  #ifndef AGX_PHYSICS_SURFACEMATERIAL_DATA_SET_OVERRIDE
110  #define AGX_PHYSICS_SURFACEMATERIAL_DATA_SET
111  class AGXPHYSICS_EXPORT SurfaceMaterialData : public agx::ReferencedData
112  {
113  public:
114  SurfaceMaterialInstance operator[] (size_t index);
115 
116  public:
118  agxData::Array< agx::Real > roughness;
120  agxData::Array< agx::Real > adhesiveOverlap;
121  agxData::Array< agx::Real > viscosity;
122  agxData::Array< agx::Bool > frictionEnabled;
124 
125  public:
126  typedef agx::Real roughnessType;
127  typedef agx::Real adhesionType;
128  typedef agx::Real adhesiveOverlapType;
129  typedef agx::Real viscosityType;
130  typedef agx::Bool frictionEnabledType;
131  typedef agx::Bool dirtyType;
132 
133  public:
134  SurfaceMaterialData(agxData::EntityStorage* storage);
135  SurfaceMaterialData();
136 
137  protected:
138  virtual ~SurfaceMaterialData() {}
139  virtual void setNumElements(agx::Index numElements) override;
140 
141  private:
142  SurfaceMaterialData& operator= (const SurfaceMaterialData&) { return *this; }
143 
144  };
145  #endif
147 
148 
150  class AGXPHYSICS_EXPORT SurfaceMaterialSemantics : public agx::ReferencedSemantics
151  {
152  public:
153 
154  // Automatic getters
155  agx::Real const& getRoughness() const;
156  agx::Real const& getAdhesion() const;
157  agx::Real const& getAdhesiveOverlap() const;
158  agx::Real const& getViscosity() const;
159  agx::Bool const& getFrictionEnabled() const;
160  agx::Bool const& getDirty() const;
161 
162  // Semantics defined by explicit kernels
163 
164  // Automatic setters
165  void setRoughness(agx::Real const& value);
166  void setAdhesion(agx::Real const& value);
167  void setAdhesiveOverlap(agx::Real const& value);
168  void setViscosity(agx::Real const& value);
169  void setFrictionEnabled(agx::Bool const& value);
170  void setDirty(agx::Bool const& value);
171 
172 
173  protected:
174  friend class SurfaceMaterialPtr;
175  friend class SurfaceMaterialInstance;
176  SurfaceMaterialSemantics();
177  };
179 
180 
181 
185  {
186  public:
188  typedef SurfaceMaterialData DataType;
189  typedef SurfaceMaterialInstance InstanceType;
190 
191  public:
197  AGXPHYSICS_EXPORT SurfaceMaterialPtr& operator= (const agxData::EntityInstance& instance);
198  AGXPHYSICS_EXPORT SurfaceMaterialInstance instance();
199  AGXPHYSICS_EXPORT const SurfaceMaterialInstance instance() const;
200 
201  AGXPHYSICS_EXPORT SurfaceMaterialSemantics* operator->();
202  AGXPHYSICS_EXPORT const SurfaceMaterialSemantics* operator->() const;
203 
204  SurfaceMaterialData* getData();
205  const SurfaceMaterialData* getData() const;
206 
207 
209  AGXPHYSICS_EXPORT agx::Real& roughness();
211  AGXPHYSICS_EXPORT agx::Real const& roughness() const;
212 
214  AGXPHYSICS_EXPORT agx::Real& adhesion();
216  AGXPHYSICS_EXPORT agx::Real const& adhesion() const;
217 
219  AGXPHYSICS_EXPORT agx::Real& adhesiveOverlap();
221  AGXPHYSICS_EXPORT agx::Real const& adhesiveOverlap() const;
222 
224  AGXPHYSICS_EXPORT agx::Real& viscosity();
226  AGXPHYSICS_EXPORT agx::Real const& viscosity() const;
227 
229  AGXPHYSICS_EXPORT agx::Bool& frictionEnabled();
231  AGXPHYSICS_EXPORT agx::Bool const& frictionEnabled() const;
232 
234  AGXPHYSICS_EXPORT agx::Bool& dirty();
236  AGXPHYSICS_EXPORT agx::Bool const& dirty() const;
237 
238  };
239 
240  // Entity is Referenced
242 
243 
245  class AGXPHYSICS_EXPORT SurfaceMaterialInstance : public agx::ReferencedInstance
246  {
247  public:
248  SurfaceMaterialInstance();
249  SurfaceMaterialInstance(SurfaceMaterialData* data, agx::Index index);
250  SurfaceMaterialInstance(agxData::EntityStorage *storage, agx::Index index);
251  SurfaceMaterialInstance(const agxData::EntityInstance& other);
252  SurfaceMaterialInstance(const agxData::EntityPtr& ptr);
253 
254  SurfaceMaterialData* getData();
255  const SurfaceMaterialData* getData() const;
256 
257  public:
259  agx::Real& roughness();
261  agx::Real const& roughness() const;
262 
264  agx::Real& adhesion();
266  agx::Real const& adhesion() const;
267 
269  agx::Real& adhesiveOverlap();
271  agx::Real const& adhesiveOverlap() const;
272 
274  agx::Real& viscosity();
276  agx::Real const& viscosity() const;
277 
279  agx::Bool& frictionEnabled();
281  agx::Bool const& frictionEnabled() const;
282 
284  agx::Bool& dirty();
286  agx::Bool const& dirty() const;
287 
288  };
290 
291 
292 
295 
296 
297 
299  /* Implementation */
300  //-----------------------------------------------------------------------------------------------------
301  //-----------------------------------------------------------------------------------------------------
302  inline SurfaceMaterialInstance agx::Physics::SurfaceMaterialData::operator[] (size_t index) { return SurfaceMaterialInstance(this, (agx::Index)index); }
303  //-----------------------------------------------------------------------------------------------------
307  {
309  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
311  }
312 
314  {
315  agxAssertN(!instance || instance.isInstanceOf(SurfaceMaterialModel::instance()),
316  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
318  }
319 
321  {
324  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
326  return *this;
327  }
328 
330  {
332  agxAssertN(!instance || instance.isInstanceOf(SurfaceMaterialModel::instance()),
333  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
335  return *this;
336  }
337 
338  inline SurfaceMaterialInstance SurfaceMaterialPtr::instance() { return agxData::EntityPtr::instance(); }
339  inline const SurfaceMaterialInstance SurfaceMaterialPtr::instance() const { return agxData::EntityPtr::instance(); }
340  AGX_FORCE_INLINE SurfaceMaterialSemantics* SurfaceMaterialPtr::operator->() { return (SurfaceMaterialSemantics* )this; }
341  AGX_FORCE_INLINE const SurfaceMaterialSemantics* SurfaceMaterialPtr::operator->() const { return (const SurfaceMaterialSemantics* )this; }
342  AGX_FORCE_INLINE SurfaceMaterialData* SurfaceMaterialPtr::getData() { return static_cast<SurfaceMaterialData* >(agxData::EntityPtr::getData()); }
343  AGX_FORCE_INLINE const SurfaceMaterialData* SurfaceMaterialPtr::getData() const { return static_cast<const SurfaceMaterialData* >(agxData::EntityPtr::getData()); }
344 
345  AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::roughness() { verifyIndex(); return getData()->roughness[calculateIndex()]; }
346  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::roughness() const { verifyIndex(); return getData()->roughness[calculateIndex()]; }
347 
348  AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::adhesion() { verifyIndex(); return getData()->adhesion[calculateIndex()]; }
349  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::adhesion() const { verifyIndex(); return getData()->adhesion[calculateIndex()]; }
350 
351  AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::adhesiveOverlap() { verifyIndex(); return getData()->adhesiveOverlap[calculateIndex()]; }
352  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::adhesiveOverlap() const { verifyIndex(); return getData()->adhesiveOverlap[calculateIndex()]; }
353 
354  AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::viscosity() { verifyIndex(); return getData()->viscosity[calculateIndex()]; }
355  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::viscosity() const { verifyIndex(); return getData()->viscosity[calculateIndex()]; }
356 
357  AGX_FORCE_INLINE agx::Bool& SurfaceMaterialPtr::frictionEnabled() { verifyIndex(); return getData()->frictionEnabled[calculateIndex()]; }
358  AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialPtr::frictionEnabled() const { verifyIndex(); return getData()->frictionEnabled[calculateIndex()]; }
359 
360  AGX_FORCE_INLINE agx::Bool& SurfaceMaterialPtr::dirty() { verifyIndex(); return getData()->dirty[calculateIndex()]; }
361  AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialPtr::dirty() const { verifyIndex(); return getData()->dirty[calculateIndex()]; }
362 
363  //-----------------------------------------------------------------------------------------------------
364  AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance() {}
365  AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(SurfaceMaterialData* data, agx::Index index) : agx::ReferencedInstance(data, index) {}
366  AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(agxData::EntityStorage* storage, agx::Index index) : agx::ReferencedInstance(storage, index) {}
367  AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(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 SurfaceMaterialInstance::SurfaceMaterialInstance(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 SurfaceMaterialData* SurfaceMaterialInstance::getData() { return static_cast<SurfaceMaterialData* >(agxData::EntityInstance::getData()); }
383  AGX_FORCE_INLINE const SurfaceMaterialData* SurfaceMaterialInstance::getData() const { return static_cast<const SurfaceMaterialData* >(agxData::EntityInstance::getData()); }
384 
385  AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::roughness() { verifyIndex(); return getData()->roughness[getIndex()]; }
386  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::roughness() const { verifyIndex(); return getData()->roughness[getIndex()]; }
387 
388  AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::adhesion() { verifyIndex(); return getData()->adhesion[getIndex()]; }
389  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::adhesion() const { verifyIndex(); return getData()->adhesion[getIndex()]; }
390 
391  AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::adhesiveOverlap() { verifyIndex(); return getData()->adhesiveOverlap[getIndex()]; }
392  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::adhesiveOverlap() const { verifyIndex(); return getData()->adhesiveOverlap[getIndex()]; }
393 
394  AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::viscosity() { verifyIndex(); return getData()->viscosity[getIndex()]; }
395  AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::viscosity() const { verifyIndex(); return getData()->viscosity[getIndex()]; }
396 
397  AGX_FORCE_INLINE agx::Bool& SurfaceMaterialInstance::frictionEnabled() { verifyIndex(); return getData()->frictionEnabled[getIndex()]; }
398  AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialInstance::frictionEnabled() const { verifyIndex(); return getData()->frictionEnabled[getIndex()]; }
399 
400  AGX_FORCE_INLINE agx::Bool& SurfaceMaterialInstance::dirty() { verifyIndex(); return getData()->dirty[getIndex()]; }
401  AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialInstance::dirty() const { verifyIndex(); return getData()->dirty[getIndex()]; }
402 
403  //-----------------------------------------------------------------------------------------------------
404  AGX_FORCE_INLINE SurfaceMaterialSemantics::SurfaceMaterialSemantics() {}
405  //-----------------------------------------------------------------------------------------------------
407  }
408 }
409 
410 AGX_TYPE_BINDING(agx::Physics::SurfaceMaterialPtr, "Physics.SurfaceMaterialPtr")
411 AGX_TYPE_BINDING(agx::Physics::SurfaceMaterialInstance, "Physics.SurfaceMaterialInstance")
412 
413 #ifdef _MSC_VER
414 # pragma warning(pop)
415 #endif
416 
417 #undef AGX_ENTITY_WRAPPER
418 #undef AGX_ENTITY_NAMESPACE
419 #endif
420 
AGXPHYSICS_EXPORT agx::Real & viscosity()
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
bool Bool
Definition: Integer.h:48
AGXPHYSICS_EXPORT agx::Real & adhesion()
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
static SurfaceMaterialModel * instance()
AGXPHYSICS_EXPORT SurfaceMaterialPtr & operator=(const agxData::EntityPtr &ptr)
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agxData::EntityData * getData()
agx::String fullPath() const
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363
AGXPHYSICS_EXPORT SurfaceMaterialInstance instance()
#define AGXPHYSICS_EXPORT
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
AGXPHYSICS_EXPORT agx::Real & roughness()
static agxData::ScalarAttributeT< agx::Bool > * dirtyAttribute
#define AGX_FORCE_INLINE
Definition: Object.h:59
static agxData::ScalarAttributeT< agx::Real > * adhesionAttribute
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
AGXPHYSICS_EXPORT agx::Real & adhesiveOverlap()
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
SurfaceMaterialData * getData()
static agxData::ScalarAttributeT< agx::Real > * adhesiveOverlapAttribute
Abstract description of the data attributes for the Physics.SurfaceMaterial entity.
#define CALLABLE
Definition: Object.h:73
Abstract description of the data attributes for the Referenced entity.
static agxData::ScalarAttributeT< agx::Real > * roughnessAttribute
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityRef< SurfaceMaterialPtr > SurfaceMaterialRef
Pointer to a entity instance of type Referenced.
static agxData::ScalarAttributeT< agx::Bool > * frictionEnabledAttribute
static agxData::ScalarAttributeT< agx::Real > * viscosityAttribute
AGXPHYSICS_EXPORT SurfaceMaterialSemantics * operator->()
AGXPHYSICS_EXPORT agx::Bool & frictionEnabled()
double Real
Definition: Real.h:42
AGXPHYSICS_EXPORT SurfaceMaterialPtr()
Pointer to a entity instance of type Physics.SurfaceMaterial.
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
AGXPHYSICS_EXPORT agx::Bool & dirty()