AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
Particle/ContactConstraintEntity.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
18// AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20
21#ifndef GENERATED_AGX_PHYSICS_PARTICLE_CONTACTCONSTRAINT_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_PARTICLE_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>
41#include <agxData/EntityRef.h>
42#include <agxData/EntityPtr.h>
44#include <agx/Integer.h>
45#include <agx/Real.h>
46#include <agx/macros.h>
48#include <agx/Integer.h>
49#include <agx/Jacobian.h>
50
51
52namespace agx
53{
54 namespace Physics
55 {
56 namespace Particle
57 {
58
60 class ContactConstraintData;
62 class ContactConstraintInstance;
63 class ContactConstraintSemantics;
64
65
67
72 {
73 public:
75
76 ContactConstraintModel(const agx::String& name = "ContactConstraint");
77
80
83
86
88 virtual void shutdownCleanup() override;
89
90
91
92 /* Attributes */
100
101 protected:
103 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
104 virtual void configure(agx::TiXmlElement* eEntity) override;
105 virtual void initAttributeAccessors() override;
106 virtual void construct(agxData::EntityPtr instance) override;
108 };
109
110
112 #ifndef AGX_PHYSICS_PARTICLE_CONTACTCONSTRAINT_DATA_SET_OVERRIDE
113 #define AGX_PHYSICS_PARTICLE_CONTACTCONSTRAINT_DATA_SET
114 class AGXPHYSICS_EXPORT ContactConstraintData : public agx::Physics::InteractionData
115 {
116 public:
117 ContactConstraintInstance operator[] (size_t index);
118
119 public:
124 agxData::Array< agx::UInt32 > materialIndex;
125 agxData::Array< agx::Bool > isImpacting;
128
129 public:
130 typedef agx::UInt32 particle1Type;
131 typedef agx::UInt32 particle2Type;
132 typedef agx::UInt32 contactIndexType;
133 typedef agx::UInt32 materialIndexType;
134 typedef agx::Bool isImpactingType;
136 typedef agx::ParticleParticleContactJacobian GMInvType;
137
138 public:
139 ContactConstraintData(agxData::EntityStorage* storage);
140 ContactConstraintData();
141
142 protected:
143 virtual ~ContactConstraintData() {}
144 virtual void setNumElements(agx::Index numElements) override;
145
146 private:
147 ContactConstraintData& operator= (const ContactConstraintData&) { return *this; }
148
149 };
150 #endif
152
153
155 class AGXPHYSICS_EXPORT ContactConstraintSemantics : public agx::Physics::InteractionSemantics
156 {
157 public:
158
159 // Automatic getters
160 agx::UInt32 const& getParticle1() const;
161 agx::UInt32 const& getParticle2() const;
162 agx::UInt32 const& getContactIndex() const;
163 agx::UInt32 const& getMaterialIndex() const;
164 agx::Bool const& getIsImpacting() const;
165 agx::ParticleParticleContactJacobian const& getG() const;
166 agx::ParticleParticleContactJacobian const& getGMInv() const;
167
168 // Semantics defined by explicit kernels
169
170 // Automatic setters
171 void setParticle1(agx::UInt32 const& value);
172 void setParticle2(agx::UInt32 const& value);
173 void setContactIndex(agx::UInt32 const& value);
174 void setMaterialIndex(agx::UInt32 const& value);
175 void setIsImpacting(agx::Bool const& value);
176 void setG(agx::ParticleParticleContactJacobian const& value);
177 void setGMInv(agx::ParticleParticleContactJacobian const& value);
178
179
180 protected:
181 friend class ContactConstraintPtr;
182 friend class ContactConstraintInstance;
183 ContactConstraintSemantics();
184 };
186
187
188
192 {
193 public:
195 typedef ContactConstraintData DataType;
196 typedef ContactConstraintInstance InstanceType;
197
198 public:
205 AGXPHYSICS_EXPORT ContactConstraintInstance instance();
206 AGXPHYSICS_EXPORT const ContactConstraintInstance instance() const;
207
208 AGXPHYSICS_EXPORT ContactConstraintSemantics* operator->();
209 AGXPHYSICS_EXPORT const ContactConstraintSemantics* operator->() const;
210
211 ContactConstraintData* getData();
212 const ContactConstraintData* getData() const;
213
214
219
224
229
234
239
244
249
250 };
251
252
254 class AGXPHYSICS_EXPORT ContactConstraintInstance : public agx::Physics::InteractionInstance
255 {
256 public:
257 ContactConstraintInstance();
258 ContactConstraintInstance(ContactConstraintData* data, agx::Index index);
259 ContactConstraintInstance(agxData::EntityStorage *storage, agx::Index index);
260 ContactConstraintInstance(const agxData::EntityInstance& other);
261 ContactConstraintInstance(const agxData::EntityPtr& ptr);
262
263 ContactConstraintData* getData();
264 const ContactConstraintData* getData() const;
265
266 public:
268 agx::UInt32& particle1();
270 agx::UInt32 const& particle1() const;
271
273 agx::UInt32& particle2();
275 agx::UInt32 const& particle2() const;
276
278 agx::UInt32& contactIndex();
280 agx::UInt32 const& contactIndex() const;
281
283 agx::UInt32& materialIndex();
285 agx::UInt32 const& materialIndex() const;
286
288 agx::Bool& isImpacting();
290 agx::Bool const& isImpacting() const;
291
296
300 agx::ParticleParticleContactJacobian const& GMInv() const;
301
302 };
304
305
306
309
310
311
313 /* Implementation */
314 //-----------------------------------------------------------------------------------------------------
315 //-----------------------------------------------------------------------------------------------------
316 inline ContactConstraintInstance agx::Physics::Particle::ContactConstraintData::operator[] (size_t index) { return ContactConstraintInstance(this, (agx::Index)index); }
317 //-----------------------------------------------------------------------------------------------------
319 AGX_FORCE_INLINE ContactConstraintPtr::ContactConstraintPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::InteractionPtr(storage, id) {}
321 {
323 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
324 EntityPtr::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
325 }
326
327 AGX_FORCE_INLINE ContactConstraintPtr::ContactConstraintPtr(const agxData::EntityInstance& instance) : agx::Physics::InteractionPtr(instance)
328 {
330 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
331 EntityPtr::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
332 }
333
335 {
338 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
339 EntityPtr::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
340 return *this;
341 }
342
344 {
347 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
348 EntityPtr::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
349 return *this;
350 }
351
352 inline ContactConstraintInstance ContactConstraintPtr::instance() { return agxData::EntityPtr::instance(); }
353 inline const ContactConstraintInstance ContactConstraintPtr::instance() const { return agxData::EntityPtr::instance(); }
354 AGX_FORCE_INLINE ContactConstraintSemantics* ContactConstraintPtr::operator->() { return (ContactConstraintSemantics* )this; }
355 AGX_FORCE_INLINE const ContactConstraintSemantics* ContactConstraintPtr::operator->() const { return (const ContactConstraintSemantics* )this; }
356 AGX_FORCE_INLINE ContactConstraintData* ContactConstraintPtr::getData() { return static_cast<ContactConstraintData* >(agxData::EntityPtr::getData()); }
357 AGX_FORCE_INLINE const ContactConstraintData* ContactConstraintPtr::getData() const { return static_cast<const ContactConstraintData* >(agxData::EntityPtr::getData()); }
358
359 AGX_FORCE_INLINE agx::UInt32& ContactConstraintPtr::particle1() { verifyIndex(); return getData()->particle1[calculateIndex()]; }
360 AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintPtr::particle1() const { verifyIndex(); return getData()->particle1[calculateIndex()]; }
361
362 AGX_FORCE_INLINE agx::UInt32& ContactConstraintPtr::particle2() { verifyIndex(); return getData()->particle2[calculateIndex()]; }
363 AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintPtr::particle2() const { verifyIndex(); return getData()->particle2[calculateIndex()]; }
364
367
370
373
374 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian& ContactConstraintPtr::G() { verifyIndex(); return getData()->G[calculateIndex()]; }
375 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian const& ContactConstraintPtr::G() const { verifyIndex(); return getData()->G[calculateIndex()]; }
376
377 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian& ContactConstraintPtr::GMInv() { verifyIndex(); return getData()->GMInv[calculateIndex()]; }
378 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian const& ContactConstraintPtr::GMInv() const { verifyIndex(); return getData()->GMInv[calculateIndex()]; }
379
380 //-----------------------------------------------------------------------------------------------------
381 AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance() {}
382 AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(ContactConstraintData* data, agx::Index index) : agx::Physics::InteractionInstance(data, index) {}
383 AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::InteractionInstance(storage, index) {}
384 AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(const agxData::EntityInstance& other) : agx::Physics::InteractionInstance(other)
385 {
387 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
388 EntityInstance::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
389 }
390
391 AGX_FORCE_INLINE ContactConstraintInstance::ContactConstraintInstance(const agxData::EntityPtr& ptr) : agx::Physics::InteractionInstance(ptr)
392 {
394 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
395 EntityInstance::getModel()->fullPath().c_str(), ContactConstraintModel::instance()->fullPath().c_str());
396 }
397
398
399 AGX_FORCE_INLINE ContactConstraintData* ContactConstraintInstance::getData() { return static_cast<ContactConstraintData* >(agxData::EntityInstance::getData()); }
400 AGX_FORCE_INLINE const ContactConstraintData* ContactConstraintInstance::getData() const { return static_cast<const ContactConstraintData* >(agxData::EntityInstance::getData()); }
401
402 AGX_FORCE_INLINE agx::UInt32& ContactConstraintInstance::particle1() { verifyIndex(); return getData()->particle1[getIndex()]; }
403 AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintInstance::particle1() const { verifyIndex(); return getData()->particle1[getIndex()]; }
404
405 AGX_FORCE_INLINE agx::UInt32& ContactConstraintInstance::particle2() { verifyIndex(); return getData()->particle2[getIndex()]; }
406 AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintInstance::particle2() const { verifyIndex(); return getData()->particle2[getIndex()]; }
407
408 AGX_FORCE_INLINE agx::UInt32& ContactConstraintInstance::contactIndex() { verifyIndex(); return getData()->contactIndex[getIndex()]; }
409 AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintInstance::contactIndex() const { verifyIndex(); return getData()->contactIndex[getIndex()]; }
410
411 AGX_FORCE_INLINE agx::UInt32& ContactConstraintInstance::materialIndex() { verifyIndex(); return getData()->materialIndex[getIndex()]; }
412 AGX_FORCE_INLINE agx::UInt32 const& ContactConstraintInstance::materialIndex() const { verifyIndex(); return getData()->materialIndex[getIndex()]; }
413
414 AGX_FORCE_INLINE agx::Bool& ContactConstraintInstance::isImpacting() { verifyIndex(); return getData()->isImpacting[getIndex()]; }
415 AGX_FORCE_INLINE agx::Bool const& ContactConstraintInstance::isImpacting() const { verifyIndex(); return getData()->isImpacting[getIndex()]; }
416
417 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian& ContactConstraintInstance::G() { verifyIndex(); return getData()->G[getIndex()]; }
418 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian const& ContactConstraintInstance::G() const { verifyIndex(); return getData()->G[getIndex()]; }
419
420 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian& ContactConstraintInstance::GMInv() { verifyIndex(); return getData()->GMInv[getIndex()]; }
421 AGX_FORCE_INLINE agx::ParticleParticleContactJacobian const& ContactConstraintInstance::GMInv() const { verifyIndex(); return getData()->GMInv[getIndex()]; }
422
423 //-----------------------------------------------------------------------------------------------------
424 AGX_FORCE_INLINE ContactConstraintSemantics::ContactConstraintSemantics() {}
425 //-----------------------------------------------------------------------------------------------------
427 }
428 }
429}
430
431AGX_TYPE_BINDING(agx::Physics::Particle::ContactConstraintPtr, "Physics.Particle.ContactConstraintPtr")
432AGX_TYPE_BINDING(agx::Physics::Particle::ContactConstraintInstance, "Physics.Particle.ContactConstraintInstance")
433
434#ifdef _MSC_VER
435# pragma warning(pop)
436#endif
437
438#undef AGX_ENTITY_WRAPPER
439#undef AGX_ENTITY_NAMESPACE
440#endif
441
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#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
agx::Index calculateIndex() const
Calculate the index using the indirect id.
EntityPtr & operator=(const EntityPtr &other)=default
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
void verifyIndex() const
Check for broken ptr, by verifying that the id is active in the storage.
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
agx::String fullPath() const
AGXPHYSICS_EXPORT agx::Bool & isImpacting()
static ContactConstraintModel * instance()
AGXPHYSICS_EXPORT ContactConstraintSemantics * operator->()
AGXPHYSICS_EXPORT agx::UInt32 & materialIndex()
ContactConstraintData * getData()
AGXPHYSICS_EXPORT ContactConstraintPtr & operator=(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT ContactConstraintInstance instance()
AGXPHYSICS_EXPORT ContactConstraintPtr()
AGXPHYSICS_EXPORT agx::UInt32 & contactIndex()
Abstract description of the data attributes for the Physics.Interaction entity.
Pointer to a entity instance of type Physics.Interaction.
Abstract description of the data attributes for the Physics.Particle.ContactConstraint entity.
static agxData::ScalarAttributeT< agx::UInt32 > * particle1Attribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::ScalarAttributeT< agx::Bool > * isImpactingAttribute
static ContactConstraintModel * instance()
void construct(agx::Physics::Particle::ContactConstraintPtr contactConstraint)
static agxData::ScalarAttributeT< agx::UInt32 > * particle2Attribute
static agxData::ScalarAttributeT< agx::UInt32 > * materialIndexAttribute
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void construct(agxData::EntityPtr instance) 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 > * contactIndexAttribute
static agxData::ScalarAttributeT< agx::ParticleParticleContactJacobian > * GAttribute
static agxData::EntityStorage * defaultStorage()
ContactConstraintModel(const agx::String &name="ContactConstraint")
static agxData::ScalarAttributeT< agx::ParticleParticleContactJacobian > * GMInvAttribute
Pointer to a entity instance of type Physics.Particle.ContactConstraint.
AGXPHYSICS_EXPORT agx::ParticleParticleContactJacobian & G()
AGXPHYSICS_EXPORT ContactConstraintPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT ContactConstraintSemantics * operator->()
AGXPHYSICS_EXPORT agx::ParticleParticleContactJacobian const & G() const
AGXPHYSICS_EXPORT agx::UInt32 & contactIndex()
AGXPHYSICS_EXPORT agx::Bool const & isImpacting() const
AGXPHYSICS_EXPORT agx::UInt32 const & particle1() const
AGXPHYSICS_EXPORT agx::UInt32 & particle2()
AGXPHYSICS_EXPORT agx::UInt32 const & particle2() const
AGXPHYSICS_EXPORT const ContactConstraintSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Bool & isImpacting()
AGXPHYSICS_EXPORT ContactConstraintInstance instance()
AGXPHYSICS_EXPORT const ContactConstraintInstance instance() const
AGXPHYSICS_EXPORT agx::UInt32 const & materialIndex() const
AGXPHYSICS_EXPORT agx::UInt32 & materialIndex()
AGXPHYSICS_EXPORT ContactConstraintPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::ParticleParticleContactJacobian const & GMInv() const
const ContactConstraintData * getData() const
AGXPHYSICS_EXPORT ContactConstraintPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::UInt32 & particle1()
AGXPHYSICS_EXPORT agx::ParticleParticleContactJacobian & GMInv()
AGXPHYSICS_EXPORT agx::UInt32 const & contactIndex() const
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:89
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#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:32
bool Bool
Definition: Integer.h:40
UInt32 Index
Definition: Integer.h:44