AGX Dynamics  2.35.0.1
ContactConstraintRowEntity.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_PARTICLE_CONTACTCONSTRAINTROW_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_PARTICLE_CONTACTCONSTRAINTROW_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/Real.h>
48 
49 
50 namespace agx
51 {
52  namespace Physics
53  {
54  namespace Particle
55  {
56 
57  class ContactConstraintRowModel;
58  class ContactConstraintRowData;
59  class ContactConstraintRowPtr;
60  class ContactConstraintRowInstance;
61  class ContactConstraintRowSemantics;
62 
63 
65 
70  {
71  public:
73 
74  ContactConstraintRowModel(const agx::String& name = "ContactConstraintRow");
75 
78 
81 
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
99 
100  protected:
102  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
103  virtual void configure(agx::TiXmlElement* eEntity) override;
104  virtual void initAttributeAccessors() override;
105  virtual void construct(agxData::EntityPtr instance) override;
107  };
108 
109 
111  #ifndef AGX_PHYSICS_PARTICLE_CONTACTCONSTRAINTROW_DATA_SET_OVERRIDE
112  #define AGX_PHYSICS_PARTICLE_CONTACTCONSTRAINTROW_DATA_SET
113  class AGXPHYSICS_EXPORT ContactConstraintRowData : public agxData::EntityData
114  {
115  public:
116  ContactConstraintRowInstance operator[] (size_t index);
117 
118  public:
121  agxData::Array< agx::Real > impactLambda;
126  agxData::Array< agx::Real > violation;
128 
129  public:
130  typedef agx::Real lambdaType;
131  typedef agx::Real impactLambdaType;
132  typedef agx::Real rhsType;
133  typedef agx::Real epsilonType;
134  typedef agx::Real velocityType;
135  typedef agx::Real invDType;
136  typedef agx::Real violationType;
137  typedef agx::Real residualType;
138 
139  public:
140  ContactConstraintRowData(agxData::EntityStorage* storage);
141  ContactConstraintRowData();
142 
143  protected:
144  virtual ~ContactConstraintRowData() {}
145  virtual void setNumElements(agx::Index numElements) override;
146 
147  private:
148  ContactConstraintRowData& operator= (const ContactConstraintRowData&) { return *this; }
149 
150  };
151  #endif
153 
154 
156  class AGXPHYSICS_EXPORT ContactConstraintRowSemantics : protected agxData::EntityPtr
157  {
158  public:
159 
160  // Automatic getters
161  agx::Real const& getLambda() const;
162  agx::Real const& getImpactLambda() const;
163  agx::Real const& getRhs() const;
164  agx::Real const& getEpsilon() const;
165  agx::Real const& getVelocity() const;
166  agx::Real const& getInvD() const;
167  agx::Real const& getViolation() const;
168  agx::Real const& getResidual() const;
169 
170  // Semantics defined by explicit kernels
171 
172  // Automatic setters
173  void setLambda(agx::Real const& value);
174  void setImpactLambda(agx::Real const& value);
175  void setRhs(agx::Real const& value);
176  void setEpsilon(agx::Real const& value);
177  void setVelocity(agx::Real const& value);
178  void setInvD(agx::Real const& value);
179  void setViolation(agx::Real const& value);
180  void setResidual(agx::Real const& value);
181 
182 
183  protected:
184  friend class ContactConstraintRowPtr;
185  friend class ContactConstraintRowInstance;
186  ContactConstraintRowSemantics();
187  };
189 
190 
191 
194  class CALLABLE ContactConstraintRowPtr : public agxData::EntityPtr
195  {
196  public:
198  typedef ContactConstraintRowData DataType;
199  typedef ContactConstraintRowInstance InstanceType;
200 
201  public:
208  AGXPHYSICS_EXPORT ContactConstraintRowInstance instance();
209  AGXPHYSICS_EXPORT const ContactConstraintRowInstance instance() const;
210 
211  AGXPHYSICS_EXPORT ContactConstraintRowSemantics* operator->();
212  AGXPHYSICS_EXPORT const ContactConstraintRowSemantics* operator->() const;
213 
214  ContactConstraintRowData* getData();
215  const ContactConstraintRowData* getData() const;
216 
217 
222 
227 
232 
237 
242 
247 
252 
257 
259  // Only used by tolua!
260  #ifdef AGX_GENERATED_TOLUA_WRAPPER
261  inline agx::Real const& getLambda() const { return (*this)->getLambda(); }
262  inline agx::Real const& getImpactLambda() const { return (*this)->getImpactLambda(); }
263  inline agx::Real const& getRhs() const { return (*this)->getRhs(); }
264  inline agx::Real const& getEpsilon() const { return (*this)->getEpsilon(); }
265  inline agx::Real const& getVelocity() const { return (*this)->getVelocity(); }
266  inline agx::Real const& getInvD() const { return (*this)->getInvD(); }
267  inline agx::Real const& getViolation() const { return (*this)->getViolation(); }
268  inline agx::Real const& getResidual() const { return (*this)->getResidual(); }
269 
270 
271  inline void setLambda(agx::Real const& value) { (*this)->setLambda(value); }
272  inline void setImpactLambda(agx::Real const& value) { (*this)->setImpactLambda(value); }
273  inline void setRhs(agx::Real const& value) { (*this)->setRhs(value); }
274  inline void setEpsilon(agx::Real const& value) { (*this)->setEpsilon(value); }
275  inline void setVelocity(agx::Real const& value) { (*this)->setVelocity(value); }
276  inline void setInvD(agx::Real const& value) { (*this)->setInvD(value); }
277  inline void setViolation(agx::Real const& value) { (*this)->setViolation(value); }
278  inline void setResidual(agx::Real const& value) { (*this)->setResidual(value); }
279  #endif
281 
282  };
283 
284 
286  class AGXPHYSICS_EXPORT ContactConstraintRowInstance : public agxData::EntityInstance
287  {
288  public:
289  ContactConstraintRowInstance();
290  ContactConstraintRowInstance(ContactConstraintRowData* data, agx::Index index);
291  ContactConstraintRowInstance(agxData::EntityStorage *storage, agx::Index index);
292  ContactConstraintRowInstance(const agxData::EntityInstance& other);
293  ContactConstraintRowInstance(const agxData::EntityPtr& ptr);
294 
295  ContactConstraintRowData* getData();
296  const ContactConstraintRowData* getData() const;
297 
298  public:
300  agx::Real& lambda();
302  agx::Real const& lambda() const;
303 
305  agx::Real& impactLambda();
307  agx::Real const& impactLambda() const;
308 
310  agx::Real& rhs();
312  agx::Real const& rhs() const;
313 
315  agx::Real& epsilon();
317  agx::Real const& epsilon() const;
318 
320  agx::Real& velocity();
322  agx::Real const& velocity() const;
323 
325  agx::Real& invD();
327  agx::Real const& invD() const;
328 
330  agx::Real& violation();
332  agx::Real const& violation() const;
333 
335  agx::Real& residual();
337  agx::Real const& residual() const;
338 
339  };
341 
342 
343 
346 
347 
348 
350  /* Implementation */
351  //-----------------------------------------------------------------------------------------------------
352  //-----------------------------------------------------------------------------------------------------
353  inline ContactConstraintRowInstance agx::Physics::Particle::ContactConstraintRowData::operator[] (size_t index) { return ContactConstraintRowInstance(this, (agx::Index)index); }
354  //-----------------------------------------------------------------------------------------------------
357  AGX_FORCE_INLINE ContactConstraintRowPtr::ContactConstraintRowPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
358  {
360  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
362  }
363 
364  AGX_FORCE_INLINE ContactConstraintRowPtr::ContactConstraintRowPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
365  {
367  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
369  }
370 
371  AGX_FORCE_INLINE ContactConstraintRowPtr& ContactConstraintRowPtr::operator= (const agxData::EntityPtr& ptr)
372  {
374  agxAssertN(!ptr || ptr.isInstanceOf(ContactConstraintRowModel::instance()),
375  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
376  EntityPtr::getModel()->fullPath().c_str(), ContactConstraintRowModel::instance()->fullPath().c_str());
377  return *this;
378  }
379 
380  AGX_FORCE_INLINE ContactConstraintRowPtr& ContactConstraintRowPtr::operator= (const agxData::EntityInstance& instance)
381  {
383  agxAssertN(!instance || instance.isInstanceOf(ContactConstraintRowModel::instance()),
384  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
385  EntityPtr::getModel()->fullPath().c_str(), ContactConstraintRowModel::instance()->fullPath().c_str());
386  return *this;
387  }
388 
389  inline ContactConstraintRowInstance ContactConstraintRowPtr::instance() { return agxData::EntityPtr::instance(); }
390  inline const ContactConstraintRowInstance ContactConstraintRowPtr::instance() const { return agxData::EntityPtr::instance(); }
391  AGX_FORCE_INLINE ContactConstraintRowSemantics* ContactConstraintRowPtr::operator->() { return (ContactConstraintRowSemantics* )this; }
392  AGX_FORCE_INLINE const ContactConstraintRowSemantics* ContactConstraintRowPtr::operator->() const { return (const ContactConstraintRowSemantics* )this; }
393  AGX_FORCE_INLINE ContactConstraintRowData* ContactConstraintRowPtr::getData() { return static_cast<ContactConstraintRowData* >(agxData::EntityPtr::getData()); }
394  AGX_FORCE_INLINE const ContactConstraintRowData* ContactConstraintRowPtr::getData() const { return static_cast<const ContactConstraintRowData* >(agxData::EntityPtr::getData()); }
395 
396  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::lambda() { verifyIndex(); return getData()->lambda[calculateIndex()]; }
397  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::lambda() const { verifyIndex(); return getData()->lambda[calculateIndex()]; }
398 
399  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::impactLambda() { verifyIndex(); return getData()->impactLambda[calculateIndex()]; }
400  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::impactLambda() const { verifyIndex(); return getData()->impactLambda[calculateIndex()]; }
401 
402  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::rhs() { verifyIndex(); return getData()->rhs[calculateIndex()]; }
403  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::rhs() const { verifyIndex(); return getData()->rhs[calculateIndex()]; }
404 
405  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::epsilon() { verifyIndex(); return getData()->epsilon[calculateIndex()]; }
406  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::epsilon() const { verifyIndex(); return getData()->epsilon[calculateIndex()]; }
407 
408  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::velocity() { verifyIndex(); return getData()->velocity[calculateIndex()]; }
409  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::velocity() const { verifyIndex(); return getData()->velocity[calculateIndex()]; }
410 
411  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::invD() { verifyIndex(); return getData()->invD[calculateIndex()]; }
412  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::invD() const { verifyIndex(); return getData()->invD[calculateIndex()]; }
413 
414  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::violation() { verifyIndex(); return getData()->violation[calculateIndex()]; }
415  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::violation() const { verifyIndex(); return getData()->violation[calculateIndex()]; }
416 
417  AGX_FORCE_INLINE agx::Real& ContactConstraintRowPtr::residual() { verifyIndex(); return getData()->residual[calculateIndex()]; }
418  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowPtr::residual() const { verifyIndex(); return getData()->residual[calculateIndex()]; }
419 
420  //-----------------------------------------------------------------------------------------------------
421  AGX_FORCE_INLINE ContactConstraintRowInstance::ContactConstraintRowInstance() {}
422  AGX_FORCE_INLINE ContactConstraintRowInstance::ContactConstraintRowInstance(ContactConstraintRowData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
423  AGX_FORCE_INLINE ContactConstraintRowInstance::ContactConstraintRowInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
424  AGX_FORCE_INLINE ContactConstraintRowInstance::ContactConstraintRowInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
425  {
427  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
429  }
430 
431  AGX_FORCE_INLINE ContactConstraintRowInstance::ContactConstraintRowInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
432  {
434  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
436  }
437 
438 
439  AGX_FORCE_INLINE ContactConstraintRowData* ContactConstraintRowInstance::getData() { return static_cast<ContactConstraintRowData* >(agxData::EntityInstance::getData()); }
440  AGX_FORCE_INLINE const ContactConstraintRowData* ContactConstraintRowInstance::getData() const { return static_cast<const ContactConstraintRowData* >(agxData::EntityInstance::getData()); }
441 
442  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::lambda() { verifyIndex(); return getData()->lambda[getIndex()]; }
443  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::lambda() const { verifyIndex(); return getData()->lambda[getIndex()]; }
444 
445  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::impactLambda() { verifyIndex(); return getData()->impactLambda[getIndex()]; }
446  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::impactLambda() const { verifyIndex(); return getData()->impactLambda[getIndex()]; }
447 
448  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::rhs() { verifyIndex(); return getData()->rhs[getIndex()]; }
449  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::rhs() const { verifyIndex(); return getData()->rhs[getIndex()]; }
450 
451  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::epsilon() { verifyIndex(); return getData()->epsilon[getIndex()]; }
452  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::epsilon() const { verifyIndex(); return getData()->epsilon[getIndex()]; }
453 
454  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::velocity() { verifyIndex(); return getData()->velocity[getIndex()]; }
455  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::velocity() const { verifyIndex(); return getData()->velocity[getIndex()]; }
456 
457  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::invD() { verifyIndex(); return getData()->invD[getIndex()]; }
458  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::invD() const { verifyIndex(); return getData()->invD[getIndex()]; }
459 
460  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::violation() { verifyIndex(); return getData()->violation[getIndex()]; }
461  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::violation() const { verifyIndex(); return getData()->violation[getIndex()]; }
462 
463  AGX_FORCE_INLINE agx::Real& ContactConstraintRowInstance::residual() { verifyIndex(); return getData()->residual[getIndex()]; }
464  AGX_FORCE_INLINE agx::Real const& ContactConstraintRowInstance::residual() const { verifyIndex(); return getData()->residual[getIndex()]; }
465 
466  //-----------------------------------------------------------------------------------------------------
467  AGX_FORCE_INLINE ContactConstraintRowSemantics::ContactConstraintRowSemantics() {}
468  //-----------------------------------------------------------------------------------------------------
470  }
471  }
472 }
473 
474 AGX_TYPE_BINDING(agx::Physics::Particle::ContactConstraintRowPtr, "Physics.Particle.ContactConstraintRowPtr")
475 AGX_TYPE_BINDING(agx::Physics::Particle::ContactConstraintRowInstance, "Physics.Particle.ContactConstraintRowInstance")
476 
477 #ifdef _MSC_VER
478 # pragma warning(pop)
479 #endif
480 
481 #undef AGX_ENTITY_WRAPPER
482 #undef AGX_ENTITY_NAMESPACE
483 #endif
484 
#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()
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:64
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.Particle.ContactConstraintRow entity.
void construct(agx::Physics::Particle::ContactConstraintRowPtr contactConstraintRow)
virtual void construct(agxData::EntityPtr instance) override
static agxData::EntityStorage * defaultStorage()
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::ScalarAttributeT< agx::Real > * rhsAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
ContactConstraintRowModel(const agx::String &name="ContactConstraintRow")
static ContactConstraintRowModel * instance()
static agxData::ScalarAttributeT< agx::Real > * velocityAttribute
static agxData::ScalarAttributeT< agx::Real > * impactLambdaAttribute
static agxData::ScalarAttributeT< agx::Real > * residualAttribute
static ContactConstraintRowPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::Real > * violationAttribute
static agxData::ScalarAttributeT< agx::Real > * invDAttribute
static agxData::ScalarAttributeT< agx::Real > * epsilonAttribute
static agxData::ScalarAttributeT< agx::Real > * lambdaAttribute
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
Pointer to a entity instance of type Physics.Particle.ContactConstraintRow.
const ContactConstraintRowData * getData() const
AGXPHYSICS_EXPORT ContactConstraintRowPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const ContactConstraintRowSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Real const & epsilon() const
AGXPHYSICS_EXPORT agx::Real const & velocity() const
AGXPHYSICS_EXPORT agx::Real & impactLambda()
AGXPHYSICS_EXPORT agx::Real & invD()
AGXPHYSICS_EXPORT agx::Real const & violation() const
AGXPHYSICS_EXPORT ContactConstraintRowPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::Real & epsilon()
AGXPHYSICS_EXPORT agx::Real const & impactLambda() const
AGXPHYSICS_EXPORT ContactConstraintRowInstance instance()
AGXPHYSICS_EXPORT agx::Real const & rhs() const
AGXPHYSICS_EXPORT ContactConstraintRowPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Real & residual()
AGXPHYSICS_EXPORT agx::Real const & invD() const
AGXPHYSICS_EXPORT agx::Real & violation()
AGXPHYSICS_EXPORT agx::Real & lambda()
AGXPHYSICS_EXPORT agx::Real const & lambda() const
AGXPHYSICS_EXPORT ContactConstraintRowSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real & rhs()
AGXPHYSICS_EXPORT agx::Real const & residual() const
AGXPHYSICS_EXPORT agx::Real & velocity()
AGXPHYSICS_EXPORT const ContactConstraintRowInstance instance() 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: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.
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