AGX Dynamics  2.35.0.1
ContactConstraintEntity.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_CONTACTCONSTRAINT_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_CONTACTCONSTRAINT_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>
48 #include <agx/Integer.h>
49 #include <agx/IndexRange.h>
50 
51 
52 namespace agx
53 {
54  namespace Physics
55  {
56 
57  class ContactConstraintModel;
58  class ContactConstraintData;
59  class ContactConstraintPtr;
60  class ContactConstraintInstance;
61  class ContactConstraintSemantics;
62 
63 
65 
70  {
71  public:
73 
74  ContactConstraintModel(const agx::String& name = "ContactConstraint");
75 
78 
81 
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
94 
95  protected:
97  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
98  virtual void configure(agx::TiXmlElement* eEntity) override;
99  virtual void initAttributeAccessors() override;
100  virtual void construct(agxData::EntityPtr instance) override;
102  };
103 
104 
106  #ifndef AGX_PHYSICS_CONTACTCONSTRAINT_DATA_SET_OVERRIDE
107  #define AGX_PHYSICS_CONTACTCONSTRAINT_DATA_SET
108  class AGXPHYSICS_EXPORT ContactConstraintData : public agx::Physics::BinaryConstraintData
109  {
110  public:
111  ContactConstraintInstance operator[] (size_t index);
112 
113  public:
115  agxData::Array< agx::UInt32 > contactIndex;
116  agxData::Array< agx::UInt32 > materialIndex;
117  agxData::Array< agx::IndexRange > contactPointRange;
118 
119  public:
120  typedef agx::UInt32 contactIndexType;
121  typedef agx::UInt32 materialIndexType;
122  typedef agx::IndexRange contactPointRangeType;
123 
124  public:
125  ContactConstraintData(agxData::EntityStorage* storage);
126  ContactConstraintData();
127 
128  protected:
129  virtual ~ContactConstraintData() {}
130  virtual void setNumElements(agx::Index numElements) override;
131 
132  private:
133  ContactConstraintData& operator= (const ContactConstraintData&) { return *this; }
134 
135  };
136  #endif
138 
139 
141  class AGXPHYSICS_EXPORT ContactConstraintSemantics : public agx::Physics::BinaryConstraintSemantics
142  {
143  public:
144 
145  // Automatic getters
146  agx::UInt32 const& getContactIndex() const;
147  agx::UInt32 const& getMaterialIndex() const;
148  agx::IndexRange const& getContactPointRange() const;
149 
150  // Semantics defined by explicit kernels
151 
152  // Automatic setters
153  void setContactIndex(agx::UInt32 const& value);
154  void setMaterialIndex(agx::UInt32 const& value);
155  void setContactPointRange(agx::IndexRange const& value);
156 
157 
158  protected:
159  friend class ContactConstraintPtr;
160  friend class ContactConstraintInstance;
161  ContactConstraintSemantics();
162  };
164 
165 
166 
170  {
171  public:
173  typedef ContactConstraintData DataType;
174  typedef ContactConstraintInstance InstanceType;
175 
176  public:
183  AGXPHYSICS_EXPORT ContactConstraintInstance instance();
184  AGXPHYSICS_EXPORT const ContactConstraintInstance instance() const;
185 
186  AGXPHYSICS_EXPORT ContactConstraintSemantics* operator->();
187  AGXPHYSICS_EXPORT const ContactConstraintSemantics* operator->() const;
188 
189  ContactConstraintData* getData();
190  const ContactConstraintData* getData() const;
191 
192 
197 
202 
207 
209  // Only used by tolua!
210  #ifdef AGX_GENERATED_TOLUA_WRAPPER
211  inline agx::UInt32 const& getContactIndex() const { return (*this)->getContactIndex(); }
212  inline agx::UInt32 const& getMaterialIndex() const { return (*this)->getMaterialIndex(); }
213  inline agx::IndexRange const& getContactPointRange() const { return (*this)->getContactPointRange(); }
214 
215 
216  inline void setContactIndex(agx::UInt32 const& value) { (*this)->setContactIndex(value); }
217  inline void setMaterialIndex(agx::UInt32 const& value) { (*this)->setMaterialIndex(value); }
218  inline void setContactPointRange(agx::IndexRange const& value) { (*this)->setContactPointRange(value); }
219  #endif
221 
222  };
223 
224 
226  class AGXPHYSICS_EXPORT ContactConstraintInstance : public agx::Physics::BinaryConstraintInstance
227  {
228  public:
229  ContactConstraintInstance();
230  ContactConstraintInstance(ContactConstraintData* data, agx::Index index);
231  ContactConstraintInstance(agxData::EntityStorage *storage, agx::Index index);
232  ContactConstraintInstance(const agxData::EntityInstance& other);
233  ContactConstraintInstance(const agxData::EntityPtr& ptr);
234 
235  ContactConstraintData* getData();
236  const ContactConstraintData* getData() const;
237 
238  public:
240  agx::UInt32& contactIndex();
242  agx::UInt32 const& contactIndex() const;
243 
245  agx::UInt32& materialIndex();
247  agx::UInt32 const& materialIndex() const;
248 
250  agx::IndexRange& contactPointRange();
252  agx::IndexRange const& contactPointRange() const;
253 
254  };
256 
257 
258 
261 
262 
263 
265  /* Implementation */
266  //-----------------------------------------------------------------------------------------------------
267  //-----------------------------------------------------------------------------------------------------
268  inline ContactConstraintInstance agx::Physics::ContactConstraintData::operator[] (size_t index) { return ContactConstraintInstance(this, (agx::Index)index); }
269  //-----------------------------------------------------------------------------------------------------
271  AGX_FORCE_INLINE ContactConstraintPtr::ContactConstraintPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::BinaryConstraintPtr(storage, id) {}
272  AGX_FORCE_INLINE ContactConstraintPtr::ContactConstraintPtr(const agxData::EntityPtr& ptr) : agx::Physics::BinaryConstraintPtr(ptr)
273  {
275  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
277  }
278 
279  AGX_FORCE_INLINE ContactConstraintPtr::ContactConstraintPtr(const agxData::EntityInstance& instance) : agx::Physics::BinaryConstraintPtr(instance)
280  {
282  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
284  }
285 
286  AGX_FORCE_INLINE ContactConstraintPtr& ContactConstraintPtr::operator= (const agxData::EntityPtr& ptr)
287  {
289  agxAssertN(!ptr || ptr.isInstanceOf(ContactConstraintModel::instance()),
290  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
291  EntityPtr::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
292  return *this;
293  }
294 
295  AGX_FORCE_INLINE ContactConstraintPtr& ContactConstraintPtr::operator= (const agxData::EntityInstance& instance)
296  {
298  agxAssertN(!instance || instance.isInstanceOf(ContactConstraintModel::instance()),
299  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
300  EntityPtr::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
301  return *this;
302  }
303 
304  inline ContactConstraintInstance ContactConstraintPtr::instance() { return agxData::EntityPtr::instance(); }
305  inline const ContactConstraintInstance ContactConstraintPtr::instance() const { return agxData::EntityPtr::instance(); }
306  AGX_FORCE_INLINE ContactConstraintSemantics* ContactConstraintPtr::operator->() { return (ContactConstraintSemantics* )this; }
307  AGX_FORCE_INLINE const ContactConstraintSemantics* ContactConstraintPtr::operator->() const { return (const ContactConstraintSemantics* )this; }
308  AGX_FORCE_INLINE ContactConstraintData* ContactConstraintPtr::getData() { return static_cast<ContactConstraintData* >(agxData::EntityPtr::getData()); }
309  AGX_FORCE_INLINE const ContactConstraintData* ContactConstraintPtr::getData() const { return static_cast<const ContactConstraintData* >(agxData::EntityPtr::getData()); }
310 
311  AGX_FORCE_INLINE agx::UInt32& ContactConstraintPtr::contactIndex() { verifyIndex(); return getData()->contactIndex[calculateIndex()]; }
312  AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintPtr::contactIndex() const { verifyIndex(); return getData()->contactIndex[calculateIndex()]; }
313 
314  AGX_FORCE_INLINE agx::UInt32& ContactConstraintPtr::materialIndex() { verifyIndex(); return getData()->materialIndex[calculateIndex()]; }
315  AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintPtr::materialIndex() const { verifyIndex(); return getData()->materialIndex[calculateIndex()]; }
316 
317  AGX_FORCE_INLINE agx::IndexRange& ContactConstraintPtr::contactPointRange() { verifyIndex(); return getData()->contactPointRange[calculateIndex()]; }
318  AGX_FORCE_INLINE agx::IndexRange const& ContactConstraintPtr::contactPointRange() const { verifyIndex(); return getData()->contactPointRange[calculateIndex()]; }
319 
320  //-----------------------------------------------------------------------------------------------------
321  AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance() {}
322  AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(ContactConstraintData* data, agx::Index index) : agx::Physics::BinaryConstraintInstance(data, index) {}
323  AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::BinaryConstraintInstance(storage, index) {}
324  AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(const agxData::EntityInstance& other) : agx::Physics::BinaryConstraintInstance(other)
325  {
327  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
329  }
330 
331  AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(const agxData::EntityPtr& ptr) : agx::Physics::BinaryConstraintInstance(ptr)
332  {
334  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
336  }
337 
338 
339  AGX_FORCE_INLINE ContactConstraintData* ContactConstraintInstance::getData() { return static_cast<ContactConstraintData* >(agxData::EntityInstance::getData()); }
340  AGX_FORCE_INLINE const ContactConstraintData* ContactConstraintInstance::getData() const { return static_cast<const ContactConstraintData* >(agxData::EntityInstance::getData()); }
341 
342  AGX_FORCE_INLINE agx::UInt32& ContactConstraintInstance::contactIndex() { verifyIndex(); return getData()->contactIndex[getIndex()]; }
343  AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintInstance::contactIndex() const { verifyIndex(); return getData()->contactIndex[getIndex()]; }
344 
345  AGX_FORCE_INLINE agx::UInt32& ContactConstraintInstance::materialIndex() { verifyIndex(); return getData()->materialIndex[getIndex()]; }
346  AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintInstance::materialIndex() const { verifyIndex(); return getData()->materialIndex[getIndex()]; }
347 
348  AGX_FORCE_INLINE agx::IndexRange& ContactConstraintInstance::contactPointRange() { verifyIndex(); return getData()->contactPointRange[getIndex()]; }
349  AGX_FORCE_INLINE agx::IndexRange const& ContactConstraintInstance::contactPointRange() const { verifyIndex(); return getData()->contactPointRange[getIndex()]; }
350 
351  //-----------------------------------------------------------------------------------------------------
352  AGX_FORCE_INLINE ContactConstraintSemantics::ContactConstraintSemantics() {}
353  //-----------------------------------------------------------------------------------------------------
355  }
356 }
357 
358 AGX_TYPE_BINDING(agx::Physics::ContactConstraintPtr, "Physics.ContactConstraintPtr")
359 AGX_TYPE_BINDING(agx::Physics::ContactConstraintInstance, "Physics.ContactConstraintInstance")
360 
361 #ifdef _MSC_VER
362 # pragma warning(pop)
363 #endif
364 
365 #undef AGX_ENTITY_WRAPPER
366 #undef AGX_ENTITY_NAMESPACE
367 #endif
368 
#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.BinaryConstraint entity.
Pointer to a entity instance of type Physics.BinaryConstraint.
Abstract description of the data attributes for the Physics.ContactConstraint entity.
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void construct(agxData::EntityPtr instance) override
ContactConstraintModel(const agx::String &name="ContactConstraint")
virtual void initAttributeAccessors() override
static ContactConstraintPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::UInt32 > * materialIndexAttribute
static ContactConstraintModel * instance()
static agxData::ScalarAttributeT< agx::IndexRange > * contactPointRangeAttribute
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::UInt32 > * contactIndexAttribute
void construct(agx::Physics::ContactConstraintPtr contactConstraint)
Pointer to a entity instance of type Physics.ContactConstraint.
AGXPHYSICS_EXPORT ContactConstraintPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::UInt32 & materialIndex()
AGXPHYSICS_EXPORT ContactConstraintPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::IndexRange const & contactPointRange() const
const ContactConstraintData * getData() const
AGXPHYSICS_EXPORT agx::UInt32 & contactIndex()
AGXPHYSICS_EXPORT agx::UInt32 const & materialIndex() const
AGXPHYSICS_EXPORT const ContactConstraintSemantics * operator->() const
AGXPHYSICS_EXPORT agx::UInt32 const & contactIndex() const
AGXPHYSICS_EXPORT const ContactConstraintInstance instance() const
AGXPHYSICS_EXPORT ContactConstraintInstance instance()
AGXPHYSICS_EXPORT ContactConstraintSemantics * operator->()
AGXPHYSICS_EXPORT ContactConstraintPtr()
ContactConstraintData * getData()
AGXPHYSICS_EXPORT agx::IndexRange & contactPointRange()
AGXPHYSICS_EXPORT ContactConstraintPtr(agxData::EntityStorage *storage, agx::Index id)
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
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52