AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
SolveParticleEntity.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_SOLVEPARTICLE_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_SOLVEPARTICLE_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/Vec3.h>
48#include <agx/Real.h>
49#include <agx/Integer.h>
50
51
52namespace agx
53{
54 namespace Physics
55 {
56
57 class SolveParticleModel;
58 class SolveParticleData;
59 class SolveParticlePtr;
60 class SolveParticleInstance;
61 class SolveParticleSemantics;
62
63
65
70 {
71 public:
73
74 SolveParticleModel(const agx::String& name = "SolveParticle");
75
78
81
84
86 virtual void shutdownCleanup() override;
87
88
89
90 /* 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_SOLVEPARTICLE_DATA_SET_OVERRIDE
111 #define AGX_PHYSICS_SOLVEPARTICLE_DATA_SET
112 class AGXPHYSICS_EXPORT SolveParticleData : public agxData::EntityData
113 {
114 public:
115 SolveParticleInstance operator[] (size_t index);
116
117 public:
126
127 public:
128 typedef agx::Vec3 positionType;
129 typedef agx::Vec3 velocityType;
130 typedef agx::Vec3 forceType;
131 typedef agx::Real densityType;
132 typedef agx::UInt32 sourceIndexType;
133 typedef agx::UInt32 solveIndexType;
134 typedef agxData::Array< agx::UInt32 > contactListType;
135
136 public:
137 SolveParticleData(agxData::EntityStorage* storage);
138 SolveParticleData();
139
140 protected:
141 virtual ~SolveParticleData() {}
142 virtual void setNumElements(agx::Index numElements) override;
143
144 private:
145 SolveParticleData& operator= (const SolveParticleData&) { return *this; }
146
147 };
148 #endif
150
151
153 class AGXPHYSICS_EXPORT SolveParticleSemantics : protected agxData::EntityPtr
154 {
155 public:
156
157 // Automatic getters
158 agx::Vec3 const& getPosition() const;
159 agx::Vec3 const& getVelocity() const;
160 agx::Vec3 const& getForce() const;
161 agx::Real const& getDensity() const;
162 agx::UInt32 const& getSourceIndex() const;
163 agx::UInt32 const& getSolveIndex() const;
164 agxData::Array< agx::UInt32 > const& getContactList() const;
165
166 // Semantics defined by explicit kernels
167
168 // Automatic setters
169 void setPosition(agx::Vec3 const& value);
170 void setVelocity(agx::Vec3 const& value);
171 void setForce(agx::Vec3 const& value);
172 void setDensity(agx::Real const& value);
173 void setSourceIndex(agx::UInt32 const& value);
174 void setSolveIndex(agx::UInt32 const& value);
175 void setContactList(agxData::Array< agx::UInt32 > const& value);
176
177
178 protected:
179 friend class SolveParticlePtr;
180 friend class SolveParticleInstance;
181 SolveParticleSemantics();
182 };
184
185
186
189 class CALLABLE SolveParticlePtr : public agxData::EntityPtr
190 {
191 public:
193 typedef SolveParticleData DataType;
194 typedef SolveParticleInstance InstanceType;
195
196 public:
203 AGXPHYSICS_EXPORT SolveParticleInstance instance();
204 AGXPHYSICS_EXPORT const SolveParticleInstance instance() const;
205
206 AGXPHYSICS_EXPORT SolveParticleSemantics* operator->();
207 AGXPHYSICS_EXPORT const SolveParticleSemantics* operator->() const;
208
209 SolveParticleData* getData();
210 const SolveParticleData* getData() const;
211
212
217
222
227
232
237
242
247
248 };
249
250
252 class AGXPHYSICS_EXPORT SolveParticleInstance : public agxData::EntityInstance
253 {
254 public:
255 SolveParticleInstance();
256 SolveParticleInstance(SolveParticleData* data, agx::Index index);
257 SolveParticleInstance(agxData::EntityStorage *storage, agx::Index index);
258 SolveParticleInstance(const agxData::EntityInstance& other);
259 SolveParticleInstance(const agxData::EntityPtr& ptr);
260
261 SolveParticleData* getData();
262 const SolveParticleData* getData() const;
263
264 public:
266 agx::Vec3& position();
268 agx::Vec3 const& position() const;
269
271 agx::Vec3& velocity();
273 agx::Vec3 const& velocity() const;
274
276 agx::Vec3& force();
278 agx::Vec3 const& force() const;
279
281 agx::Real& density();
283 agx::Real const& density() const;
284
286 agx::UInt32& sourceIndex();
288 agx::UInt32 const& sourceIndex() const;
289
291 agx::UInt32& solveIndex();
293 agx::UInt32 const& solveIndex() const;
294
296 agxData::Array< agx::UInt32 >& contactList();
298 agxData::Array< agx::UInt32 > const& contactList() const;
299
300 };
302
303
304
307
308
309
311 /* Implementation */
312 //-----------------------------------------------------------------------------------------------------
313 //-----------------------------------------------------------------------------------------------------
314 inline SolveParticleInstance agx::Physics::SolveParticleData::operator[] (size_t index) { return SolveParticleInstance(this, (agx::Index)index); }
315 //-----------------------------------------------------------------------------------------------------
318 AGX_FORCE_INLINE SolveParticlePtr::SolveParticlePtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
319 {
321 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
322 EntityPtr::getModel()->fullPath().c_str(), SolveParticleModel::instance()->fullPath().c_str());
323 }
324
325 AGX_FORCE_INLINE SolveParticlePtr::SolveParticlePtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
326 {
328 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
329 EntityPtr::getModel()->fullPath().c_str(), SolveParticleModel::instance()->fullPath().c_str());
330 }
331
332 AGX_FORCE_INLINE SolveParticlePtr& SolveParticlePtr::operator= (const agxData::EntityPtr& ptr)
333 {
335 agxAssertN(!ptr || ptr.isInstanceOf(SolveParticleModel::instance()),
336 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
337 EntityPtr::getModel()->fullPath().c_str(), SolveParticleModel::instance()->fullPath().c_str());
338 return *this;
339 }
340
341 AGX_FORCE_INLINE SolveParticlePtr& SolveParticlePtr::operator= (const agxData::EntityInstance& instance)
342 {
344 agxAssertN(!instance || instance.isInstanceOf(SolveParticleModel::instance()),
345 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
346 EntityPtr::getModel()->fullPath().c_str(), SolveParticleModel::instance()->fullPath().c_str());
347 return *this;
348 }
349
350 inline SolveParticleInstance SolveParticlePtr::instance() { return agxData::EntityPtr::instance(); }
351 inline const SolveParticleInstance SolveParticlePtr::instance() const { return agxData::EntityPtr::instance(); }
352 AGX_FORCE_INLINE SolveParticleSemantics* SolveParticlePtr::operator->() { return (SolveParticleSemantics* )this; }
353 AGX_FORCE_INLINE const SolveParticleSemantics* SolveParticlePtr::operator->() const { return (const SolveParticleSemantics* )this; }
354 AGX_FORCE_INLINE SolveParticleData* SolveParticlePtr::getData() { return static_cast<SolveParticleData* >(agxData::EntityPtr::getData()); }
355 AGX_FORCE_INLINE const SolveParticleData* SolveParticlePtr::getData() const { return static_cast<const SolveParticleData* >(agxData::EntityPtr::getData()); }
356
357 AGX_FORCE_INLINE agx::Vec3& SolveParticlePtr::position() { verifyIndex(); return getData()->position[calculateIndex()]; }
358 AGX_FORCE_INLINE agx::Vec3 const& SolveParticlePtr::position() const { verifyIndex(); return getData()->position[calculateIndex()]; }
359
360 AGX_FORCE_INLINE agx::Vec3& SolveParticlePtr::velocity() { verifyIndex(); return getData()->velocity[calculateIndex()]; }
361 AGX_FORCE_INLINE agx::Vec3 const& SolveParticlePtr::velocity() const { verifyIndex(); return getData()->velocity[calculateIndex()]; }
362
363 AGX_FORCE_INLINE agx::Vec3& SolveParticlePtr::force() { verifyIndex(); return getData()->force[calculateIndex()]; }
364 AGX_FORCE_INLINE agx::Vec3 const& SolveParticlePtr::force() const { verifyIndex(); return getData()->force[calculateIndex()]; }
365
366 AGX_FORCE_INLINE agx::Real& SolveParticlePtr::density() { verifyIndex(); return getData()->density[calculateIndex()]; }
367 AGX_FORCE_INLINE agx::Real const& SolveParticlePtr::density() const { verifyIndex(); return getData()->density[calculateIndex()]; }
368
369 AGX_FORCE_INLINE agx::UInt32& SolveParticlePtr::sourceIndex() { verifyIndex(); return getData()->sourceIndex[calculateIndex()]; }
370 AGX_FORCE_INLINE agx::UInt32 const& SolveParticlePtr::sourceIndex() const { verifyIndex(); return getData()->sourceIndex[calculateIndex()]; }
371
372 AGX_FORCE_INLINE agx::UInt32& SolveParticlePtr::solveIndex() { verifyIndex(); return getData()->solveIndex[calculateIndex()]; }
373 AGX_FORCE_INLINE agx::UInt32 const& SolveParticlePtr::solveIndex() const { verifyIndex(); return getData()->solveIndex[calculateIndex()]; }
374
375 AGX_FORCE_INLINE agxData::Array< agx::UInt32 >& SolveParticlePtr::contactList() { verifyIndex(); return getData()->contactList[calculateIndex()]; }
376 AGX_FORCE_INLINE agxData::Array< agx::UInt32 > const& SolveParticlePtr::contactList() const { verifyIndex(); return getData()->contactList[calculateIndex()]; }
377
378 //-----------------------------------------------------------------------------------------------------
379 AGX_FORCE_INLINE SolveParticleInstance::SolveParticleInstance() {}
380 AGX_FORCE_INLINE SolveParticleInstance::SolveParticleInstance(SolveParticleData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
381 AGX_FORCE_INLINE SolveParticleInstance::SolveParticleInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
382 AGX_FORCE_INLINE SolveParticleInstance::SolveParticleInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
383 {
385 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
386 EntityInstance::getModel()->fullPath().c_str(), SolveParticleModel::instance()->fullPath().c_str());
387 }
388
389 AGX_FORCE_INLINE SolveParticleInstance::SolveParticleInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
390 {
392 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
393 EntityInstance::getModel()->fullPath().c_str(), SolveParticleModel::instance()->fullPath().c_str());
394 }
395
396
397 AGX_FORCE_INLINE SolveParticleData* SolveParticleInstance::getData() { return static_cast<SolveParticleData* >(agxData::EntityInstance::getData()); }
398 AGX_FORCE_INLINE const SolveParticleData* SolveParticleInstance::getData() const { return static_cast<const SolveParticleData* >(agxData::EntityInstance::getData()); }
399
400 AGX_FORCE_INLINE agx::Vec3& SolveParticleInstance::position() { verifyIndex(); return getData()->position[getIndex()]; }
401 AGX_FORCE_INLINE agx::Vec3 const& SolveParticleInstance::position() const { verifyIndex(); return getData()->position[getIndex()]; }
402
403 AGX_FORCE_INLINE agx::Vec3& SolveParticleInstance::velocity() { verifyIndex(); return getData()->velocity[getIndex()]; }
404 AGX_FORCE_INLINE agx::Vec3 const& SolveParticleInstance::velocity() const { verifyIndex(); return getData()->velocity[getIndex()]; }
405
406 AGX_FORCE_INLINE agx::Vec3& SolveParticleInstance::force() { verifyIndex(); return getData()->force[getIndex()]; }
407 AGX_FORCE_INLINE agx::Vec3 const& SolveParticleInstance::force() const { verifyIndex(); return getData()->force[getIndex()]; }
408
409 AGX_FORCE_INLINE agx::Real& SolveParticleInstance::density() { verifyIndex(); return getData()->density[getIndex()]; }
410 AGX_FORCE_INLINE agx::Real const& SolveParticleInstance::density() const { verifyIndex(); return getData()->density[getIndex()]; }
411
412 AGX_FORCE_INLINE agx::UInt32& SolveParticleInstance::sourceIndex() { verifyIndex(); return getData()->sourceIndex[getIndex()]; }
413 AGX_FORCE_INLINE agx::UInt32 const& SolveParticleInstance::sourceIndex() const { verifyIndex(); return getData()->sourceIndex[getIndex()]; }
414
415 AGX_FORCE_INLINE agx::UInt32& SolveParticleInstance::solveIndex() { verifyIndex(); return getData()->solveIndex[getIndex()]; }
416 AGX_FORCE_INLINE agx::UInt32 const& SolveParticleInstance::solveIndex() const { verifyIndex(); return getData()->solveIndex[getIndex()]; }
417
418 AGX_FORCE_INLINE agxData::Array< agx::UInt32 >& SolveParticleInstance::contactList() { verifyIndex(); return getData()->contactList[getIndex()]; }
419 AGX_FORCE_INLINE agxData::Array< agx::UInt32 > const& SolveParticleInstance::contactList() const { verifyIndex(); return getData()->contactList[getIndex()]; }
420
421 //-----------------------------------------------------------------------------------------------------
422 AGX_FORCE_INLINE SolveParticleSemantics::SolveParticleSemantics() {}
423 //-----------------------------------------------------------------------------------------------------
425 }
426}
427
428AGX_TYPE_BINDING(agx::Physics::SolveParticlePtr, "Physics.SolveParticlePtr")
429AGX_TYPE_BINDING(agx::Physics::SolveParticleInstance, "Physics.SolveParticleInstance")
430
431#ifdef _MSC_VER
432# pragma warning(pop)
433#endif
434
435#undef AGX_ENTITY_WRAPPER
436#undef AGX_ENTITY_NAMESPACE
437#endif
438
#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.SolveParticle entity.
virtual void construct(agxData::EntityPtr instance) override
SolveParticleModel(const agx::String &name="SolveParticle")
static agxData::ScalarAttributeT< agx::UInt32 > * solveIndexAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void initAttributeAccessors() override
static SolveParticleModel * instance()
static agxData::ScalarAttributeT< agx::UInt32 > * sourceIndexAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * forceAttribute
void construct(agx::Physics::SolveParticlePtr solveParticle)
static agxData::EntityStorage * defaultStorage()
virtual void configure(agx::TiXmlElement *eEntity) override
static SolveParticlePtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ArrayAttributeT< agx::UInt32 > * contactListAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * positionAttribute
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::ScalarAttributeT< agx::Vec3 > * velocityAttribute
static agxData::ScalarAttributeT< agx::Real > * densityAttribute
Pointer to a entity instance of type Physics.SolveParticle.
AGXPHYSICS_EXPORT agx::UInt32 & sourceIndex()
AGXPHYSICS_EXPORT agx::Vec3 const & velocity() const
AGXPHYSICS_EXPORT const SolveParticleSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Real & density()
AGXPHYSICS_EXPORT agx::Vec3 const & force() const
AGXPHYSICS_EXPORT SolveParticlePtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const SolveParticleInstance instance() const
AGXPHYSICS_EXPORT agx::UInt32 & solveIndex()
AGXPHYSICS_EXPORT agx::Vec3 const & position() const
AGXPHYSICS_EXPORT SolveParticlePtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT SolveParticlePtr()
AGXPHYSICS_EXPORT agxData::Array< agx::UInt32 > & contactList()
AGXPHYSICS_EXPORT agx::UInt32 const & sourceIndex() const
AGXPHYSICS_EXPORT agx::Vec3 & velocity()
AGXPHYSICS_EXPORT SolveParticleInstance instance()
AGXPHYSICS_EXPORT agx::UInt32 const & solveIndex() const
AGXPHYSICS_EXPORT agx::Vec3 & position()
const SolveParticleData * getData() const
SolveParticleData * getData()
AGXPHYSICS_EXPORT SolveParticleSemantics * operator->()
AGXPHYSICS_EXPORT SolveParticlePtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Real const & density() const
AGXPHYSICS_EXPORT agxData::Array< agx::UInt32 > const & contactList() const
AGXPHYSICS_EXPORT agx::Vec3 & force()
SolveParticleInstance InstanceType
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
double Real
Definition: Real.h:41
UInt32 Index
Definition: Integer.h:44