AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
CachedGranularContactEntity.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_GRANULARBODY_CACHEDGRANULARCONTACT_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_GRANULARBODY_CACHEDGRANULARCONTACT_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>
47#include <agx/Integer.h>
49#include <agx/Vec3.h>
50
51
52namespace agx
53{
54 namespace Physics
55 {
56 namespace GranularBody
57 {
58
59 class CachedGranularContactModel;
60 class CachedGranularContactData;
61 class CachedGranularContactPtr;
62 class CachedGranularContactInstance;
63 class CachedGranularContactSemantics;
64
65
67
72 {
73 public:
75
76 CachedGranularContactModel(const agx::String& name = "CachedGranularContact");
77
80
83
86
88 virtual void shutdownCleanup() override;
89
90
91
92 /* Attributes */
98
99 protected:
101 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
102 virtual void configure(agx::TiXmlElement* eEntity) override;
103 virtual void initAttributeAccessors() override;
104 virtual void construct(agxData::EntityPtr instance) override;
106 };
107
108
110 #ifndef AGX_PHYSICS_GRANULARBODY_CACHEDGRANULARCONTACT_DATA_SET_OVERRIDE
111 #define AGX_PHYSICS_GRANULARBODY_CACHEDGRANULARCONTACT_DATA_SET
112 class AGXPHYSICS_EXPORT CachedGranularContactData : public agxData::EntityData
113 {
114 public:
115 CachedGranularContactInstance operator[] (size_t index);
116
117 public:
122 agxData::Array< agx::Vec3f > contactNormal;
123 agxData::Array< agx::Bool > shouldWarmStart;
124
125 public:
126 typedef agx::Bool keepType;
127 typedef agx::Bool duplicateType;
128 typedef agx::Physics::GranularBody::ContactLambda contactLambdasType;
129 typedef agx::Vec3f contactNormalType;
130 typedef agx::Bool shouldWarmStartType;
131
132 public:
133 CachedGranularContactData(agxData::EntityStorage* storage);
134 CachedGranularContactData();
135
136 protected:
137 virtual ~CachedGranularContactData() {}
138 virtual void setNumElements(agx::Index numElements) override;
139
140 private:
141 CachedGranularContactData& operator= (const CachedGranularContactData&) { return *this; }
142
143 };
144 #endif
146
147
149 class AGXPHYSICS_EXPORT CachedGranularContactSemantics : protected agxData::EntityPtr
150 {
151 public:
152
153 // Automatic getters
154 agx::Bool const& getKeep() const;
155 agx::Bool const& getDuplicate() const;
156 agx::Physics::GranularBody::ContactLambda const& getContactLambdas() const;
157 agx::Vec3f const& getContactNormal() const;
158 agx::Bool const& getShouldWarmStart() const;
159
160 // Semantics defined by explicit kernels
161
162 // Automatic setters
163 void setKeep(agx::Bool const& value);
164 void setDuplicate(agx::Bool const& value);
165 void setContactLambdas(agx::Physics::GranularBody::ContactLambda const& value);
166 void setContactNormal(agx::Vec3f const& value);
167 void setShouldWarmStart(agx::Bool const& value);
168
169
170 protected:
171 friend class CachedGranularContactPtr;
172 friend class CachedGranularContactInstance;
173 CachedGranularContactSemantics();
174 };
176
177
178
181 class CALLABLE CachedGranularContactPtr : public agxData::EntityPtr
182 {
183 public:
185 typedef CachedGranularContactData DataType;
186 typedef CachedGranularContactInstance InstanceType;
187
188 public:
195 AGXPHYSICS_EXPORT CachedGranularContactInstance instance();
196 AGXPHYSICS_EXPORT const CachedGranularContactInstance instance() const;
197
198 AGXPHYSICS_EXPORT CachedGranularContactSemantics* operator->();
199 AGXPHYSICS_EXPORT const CachedGranularContactSemantics* operator->() const;
200
201 CachedGranularContactData* getData();
202 const CachedGranularContactData* getData() const;
203
204
209
214
219
224
229
230 };
231
232
234 class AGXPHYSICS_EXPORT CachedGranularContactInstance : public agxData::EntityInstance
235 {
236 public:
237 CachedGranularContactInstance();
238 CachedGranularContactInstance(CachedGranularContactData* data, agx::Index index);
239 CachedGranularContactInstance(agxData::EntityStorage *storage, agx::Index index);
240 CachedGranularContactInstance(const agxData::EntityInstance& other);
241 CachedGranularContactInstance(const agxData::EntityPtr& ptr);
242
243 CachedGranularContactData* getData();
244 const CachedGranularContactData* getData() const;
245
246 public:
248 agx::Bool& keep();
250 agx::Bool const& keep() const;
251
253 agx::Bool& duplicate();
255 agx::Bool const& duplicate() const;
256
260 agx::Physics::GranularBody::ContactLambda const& contactLambdas() const;
261
263 agx::Vec3f& contactNormal();
265 agx::Vec3f const& contactNormal() const;
266
268 agx::Bool& shouldWarmStart();
270 agx::Bool const& shouldWarmStart() const;
271
272 };
274
275
276
279
280
281
283 /* Implementation */
284 //-----------------------------------------------------------------------------------------------------
285 //-----------------------------------------------------------------------------------------------------
286 inline CachedGranularContactInstance agx::Physics::GranularBody::CachedGranularContactData::operator[] (size_t index) { return CachedGranularContactInstance(this, (agx::Index)index); }
287 //-----------------------------------------------------------------------------------------------------
290 AGX_FORCE_INLINE CachedGranularContactPtr::CachedGranularContactPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
291 {
293 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
294 EntityPtr::getModel()->fullPath().c_str(), CachedGranularContactModel::instance()->fullPath().c_str());
295 }
296
297 AGX_FORCE_INLINE CachedGranularContactPtr::CachedGranularContactPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
298 {
300 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
301 EntityPtr::getModel()->fullPath().c_str(), CachedGranularContactModel::instance()->fullPath().c_str());
302 }
303
304 AGX_FORCE_INLINE CachedGranularContactPtr& CachedGranularContactPtr::operator= (const agxData::EntityPtr& ptr)
305 {
307 agxAssertN(!ptr || ptr.isInstanceOf(CachedGranularContactModel::instance()),
308 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
309 EntityPtr::getModel()->fullPath().c_str(), CachedGranularContactModel::instance()->fullPath().c_str());
310 return *this;
311 }
312
313 AGX_FORCE_INLINE CachedGranularContactPtr& CachedGranularContactPtr::operator= (const agxData::EntityInstance& instance)
314 {
316 agxAssertN(!instance || instance.isInstanceOf(CachedGranularContactModel::instance()),
317 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
318 EntityPtr::getModel()->fullPath().c_str(), CachedGranularContactModel::instance()->fullPath().c_str());
319 return *this;
320 }
321
322 inline CachedGranularContactInstance CachedGranularContactPtr::instance() { return agxData::EntityPtr::instance(); }
323 inline const CachedGranularContactInstance CachedGranularContactPtr::instance() const { return agxData::EntityPtr::instance(); }
324 AGX_FORCE_INLINE CachedGranularContactSemantics* CachedGranularContactPtr::operator->() { return (CachedGranularContactSemantics* )this; }
325 AGX_FORCE_INLINE const CachedGranularContactSemantics* CachedGranularContactPtr::operator->() const { return (const CachedGranularContactSemantics* )this; }
326 AGX_FORCE_INLINE CachedGranularContactData* CachedGranularContactPtr::getData() { return static_cast<CachedGranularContactData* >(agxData::EntityPtr::getData()); }
327 AGX_FORCE_INLINE const CachedGranularContactData* CachedGranularContactPtr::getData() const { return static_cast<const CachedGranularContactData* >(agxData::EntityPtr::getData()); }
328
329 AGX_FORCE_INLINE agx::Bool& CachedGranularContactPtr::keep() { verifyIndex(); return getData()->keep[calculateIndex()]; }
330 AGX_FORCE_INLINE agx::Bool const& CachedGranularContactPtr::keep() const { verifyIndex(); return getData()->keep[calculateIndex()]; }
331
332 AGX_FORCE_INLINE agx::Bool& CachedGranularContactPtr::duplicate() { verifyIndex(); return getData()->duplicate[calculateIndex()]; }
333 AGX_FORCE_INLINE agx::Bool const& CachedGranularContactPtr::duplicate() const { verifyIndex(); return getData()->duplicate[calculateIndex()]; }
334
335 AGX_FORCE_INLINE agx::Physics::GranularBody::ContactLambda& CachedGranularContactPtr::contactLambdas() { verifyIndex(); return getData()->contactLambdas[calculateIndex()]; }
336 AGX_FORCE_INLINE agx::Physics::GranularBody::ContactLambda const& CachedGranularContactPtr::contactLambdas() const { verifyIndex(); return getData()->contactLambdas[calculateIndex()]; }
337
338 AGX_FORCE_INLINE agx::Vec3f& CachedGranularContactPtr::contactNormal() { verifyIndex(); return getData()->contactNormal[calculateIndex()]; }
339 AGX_FORCE_INLINE agx::Vec3f const& CachedGranularContactPtr::contactNormal() const { verifyIndex(); return getData()->contactNormal[calculateIndex()]; }
340
341 AGX_FORCE_INLINE agx::Bool& CachedGranularContactPtr::shouldWarmStart() { verifyIndex(); return getData()->shouldWarmStart[calculateIndex()]; }
342 AGX_FORCE_INLINE agx::Bool const& CachedGranularContactPtr::shouldWarmStart() const { verifyIndex(); return getData()->shouldWarmStart[calculateIndex()]; }
343
344 //-----------------------------------------------------------------------------------------------------
345 AGX_FORCE_INLINE CachedGranularContactInstance::CachedGranularContactInstance() {}
346 AGX_FORCE_INLINE CachedGranularContactInstance::CachedGranularContactInstance(CachedGranularContactData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
347 AGX_FORCE_INLINE CachedGranularContactInstance::CachedGranularContactInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
348 AGX_FORCE_INLINE CachedGranularContactInstance::CachedGranularContactInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
349 {
351 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
352 EntityInstance::getModel()->fullPath().c_str(), CachedGranularContactModel::instance()->fullPath().c_str());
353 }
354
355 AGX_FORCE_INLINE CachedGranularContactInstance::CachedGranularContactInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
356 {
358 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
359 EntityInstance::getModel()->fullPath().c_str(), CachedGranularContactModel::instance()->fullPath().c_str());
360 }
361
362
363 AGX_FORCE_INLINE CachedGranularContactData* CachedGranularContactInstance::getData() { return static_cast<CachedGranularContactData* >(agxData::EntityInstance::getData()); }
364 AGX_FORCE_INLINE const CachedGranularContactData* CachedGranularContactInstance::getData() const { return static_cast<const CachedGranularContactData* >(agxData::EntityInstance::getData()); }
365
366 AGX_FORCE_INLINE agx::Bool& CachedGranularContactInstance::keep() { verifyIndex(); return getData()->keep[getIndex()]; }
367 AGX_FORCE_INLINE agx::Bool const& CachedGranularContactInstance::keep() const { verifyIndex(); return getData()->keep[getIndex()]; }
368
369 AGX_FORCE_INLINE agx::Bool& CachedGranularContactInstance::duplicate() { verifyIndex(); return getData()->duplicate[getIndex()]; }
370 AGX_FORCE_INLINE agx::Bool const& CachedGranularContactInstance::duplicate() const { verifyIndex(); return getData()->duplicate[getIndex()]; }
371
372 AGX_FORCE_INLINE agx::Physics::GranularBody::ContactLambda& CachedGranularContactInstance::contactLambdas() { verifyIndex(); return getData()->contactLambdas[getIndex()]; }
373 AGX_FORCE_INLINE agx::Physics::GranularBody::ContactLambda const& CachedGranularContactInstance::contactLambdas() const { verifyIndex(); return getData()->contactLambdas[getIndex()]; }
374
375 AGX_FORCE_INLINE agx::Vec3f& CachedGranularContactInstance::contactNormal() { verifyIndex(); return getData()->contactNormal[getIndex()]; }
376 AGX_FORCE_INLINE agx::Vec3f const& CachedGranularContactInstance::contactNormal() const { verifyIndex(); return getData()->contactNormal[getIndex()]; }
377
378 AGX_FORCE_INLINE agx::Bool& CachedGranularContactInstance::shouldWarmStart() { verifyIndex(); return getData()->shouldWarmStart[getIndex()]; }
379 AGX_FORCE_INLINE agx::Bool const& CachedGranularContactInstance::shouldWarmStart() const { verifyIndex(); return getData()->shouldWarmStart[getIndex()]; }
380
381 //-----------------------------------------------------------------------------------------------------
382 AGX_FORCE_INLINE CachedGranularContactSemantics::CachedGranularContactSemantics() {}
383 //-----------------------------------------------------------------------------------------------------
385 }
386 }
387}
388
389AGX_TYPE_BINDING(agx::Physics::GranularBody::CachedGranularContactPtr, "Physics.GranularBody.CachedGranularContactPtr")
390AGX_TYPE_BINDING(agx::Physics::GranularBody::CachedGranularContactInstance, "Physics.GranularBody.CachedGranularContactInstance")
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
#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()
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
EntityPtr & operator=(const EntityPtr &other)=default
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
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.GranularBody.CachedGranularContact entity...
virtual void construct(agxData::EntityPtr instance) override
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
void construct(agx::Physics::GranularBody::CachedGranularContactPtr cachedGranularContact)
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
CachedGranularContactModel(const agx::String &name="CachedGranularContact")
static agxData::ScalarAttributeT< agx::Bool > * shouldWarmStartAttribute
static agxData::ScalarAttributeT< agx::Physics::GranularBody::ContactLambda > * contactLambdasAttribute
static agxData::ScalarAttributeT< agx::Vec3f > * contactNormalAttribute
static CachedGranularContactModel * instance()
static agxData::ScalarAttributeT< agx::Bool > * duplicateAttribute
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Bool > * keepAttribute
static CachedGranularContactPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
Pointer to a entity instance of type Physics.GranularBody.CachedGranularContact.
const CachedGranularContactData * getData() const
AGXPHYSICS_EXPORT const CachedGranularContactInstance instance() const
AGXPHYSICS_EXPORT const CachedGranularContactSemantics * operator->() const
AGXPHYSICS_EXPORT CachedGranularContactSemantics * operator->()
AGXPHYSICS_EXPORT agx::Vec3f const & contactNormal() const
AGXPHYSICS_EXPORT CachedGranularContactInstance instance()
AGXPHYSICS_EXPORT agx::Physics::GranularBody::ContactLambda & contactLambdas()
AGXPHYSICS_EXPORT CachedGranularContactPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Bool & shouldWarmStart()
AGXPHYSICS_EXPORT agx::Bool const & duplicate() const
AGXPHYSICS_EXPORT agx::Vec3f & contactNormal()
AGXPHYSICS_EXPORT CachedGranularContactPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::Bool const & keep() const
AGXPHYSICS_EXPORT agx::Physics::GranularBody::ContactLambda const & contactLambdas() const
AGXPHYSICS_EXPORT CachedGranularContactPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Bool const & shouldWarmStart() 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.
bool Bool
Definition: Integer.h:40
UInt32 Index
Definition: Integer.h:44