AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
GridTierEntity.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_HIERARCHICALGRID_GRIDTIER_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_HIERARCHICALGRID_GRIDTIER_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/Real.h>
49
50
51namespace agx
52{
53 namespace Physics
54 {
55 namespace HierarchicalGrid
56 {
57
58 class GridTierModel;
59 class GridTierData;
60 class GridTierPtr;
61 class GridTierInstance;
62 class GridTierSemantics;
63
64
66
71 {
72 public:
74
75 GridTierModel(const agx::String& name = "GridTier");
76
79
82
85
87 virtual void shutdownCleanup() override;
88
89
90
91 /* Attributes */
97
98 protected:
99 virtual ~GridTierModel();
100 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
101 virtual void configure(agx::TiXmlElement* eEntity) override;
102 virtual void initAttributeAccessors() override;
103 virtual void construct(agxData::EntityPtr instance) override;
105 };
106
107
109 #ifndef AGX_PHYSICS_HIERARCHICALGRID_GRIDTIER_DATA_SET_OVERRIDE
110 #define AGX_PHYSICS_HIERARCHICALGRID_GRIDTIER_DATA_SET
111 class AGXPHYSICS_EXPORT GridTierData : public agxData::EntityData
112 {
113 public:
114 GridTierInstance operator[] (size_t index);
115
116 public:
120 agxData::Array< agx::Real32 > boundingRadius;
123
124 public:
125 typedef agx::Real sizeType;
126 typedef agx::Real invSizeType;
127 typedef agx::Real32 boundingRadiusType;
128 typedef agx::GridCellTable* cellTableType;
129 typedef agx::ContactZoneTable* zoneTableType;
130
131 public:
132 GridTierData(agxData::EntityStorage* storage);
133 GridTierData();
134
135 protected:
136 virtual ~GridTierData() {}
137 virtual void setNumElements(agx::Index numElements) override;
138
139 private:
140 GridTierData& operator= (const GridTierData&) { return *this; }
141
142 };
143 #endif
145
146
148 class AGXPHYSICS_EXPORT GridTierSemantics : protected agxData::EntityPtr
149 {
150 public:
151
152 // Automatic getters
153 agx::Real const& getSize() const;
154 agx::Real const& getInvSize() const;
155 agx::Real32 const& getBoundingRadius() const;
156 agx::GridCellTable* const& getCellTable() const;
157 agx::ContactZoneTable* const& getZoneTable() const;
158
159 // Semantics defined by explicit kernels
160
161 // Automatic setters
162 void setSize(agx::Real const& value);
163 void setInvSize(agx::Real const& value);
164 void setBoundingRadius(agx::Real32 const& value);
165 void setCellTable(agx::GridCellTable* const& value);
166 void setZoneTable(agx::ContactZoneTable* const& value);
167
168
169 protected:
170 friend class GridTierPtr;
171 friend class GridTierInstance;
172 GridTierSemantics();
173 };
175
176
177
180 class CALLABLE GridTierPtr : public agxData::EntityPtr
181 {
182 public:
184 typedef GridTierData DataType;
185 typedef GridTierInstance InstanceType;
186
187 public:
194 AGXPHYSICS_EXPORT GridTierInstance instance();
195 AGXPHYSICS_EXPORT const GridTierInstance instance() const;
196
197 AGXPHYSICS_EXPORT GridTierSemantics* operator->();
198 AGXPHYSICS_EXPORT const GridTierSemantics* operator->() const;
199
200 GridTierData* getData();
201 const GridTierData* getData() const;
202
203
208
213
218
223
228
229 };
230
231
233 class AGXPHYSICS_EXPORT GridTierInstance : public agxData::EntityInstance
234 {
235 public:
236 GridTierInstance();
237 GridTierInstance(GridTierData* data, agx::Index index);
238 GridTierInstance(agxData::EntityStorage *storage, agx::Index index);
239 GridTierInstance(const agxData::EntityInstance& other);
240 GridTierInstance(const agxData::EntityPtr& ptr);
241
242 GridTierData* getData();
243 const GridTierData* getData() const;
244
245 public:
247 agx::Real& size();
249 agx::Real const& size() const;
250
252 agx::Real& invSize();
254 agx::Real const& invSize() const;
255
257 agx::Real32& boundingRadius();
259 agx::Real32 const& boundingRadius() const;
260
262 agx::GridCellTable*& cellTable();
264 agx::GridCellTable* const& cellTable() const;
265
267 agx::ContactZoneTable*& zoneTable();
269 agx::ContactZoneTable* const& zoneTable() const;
270
271 };
273
274
275
278
279
280
282 /* Implementation */
283 //-----------------------------------------------------------------------------------------------------
284 //-----------------------------------------------------------------------------------------------------
285 inline GridTierInstance agx::Physics::HierarchicalGrid::GridTierData::operator[] (size_t index) { return GridTierInstance(this, (agx::Index)index); }
286 //-----------------------------------------------------------------------------------------------------
289 AGX_FORCE_INLINE GridTierPtr::GridTierPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
290 {
292 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
293 EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
294 }
295
296 AGX_FORCE_INLINE GridTierPtr::GridTierPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
297 {
298 agxAssertN(!instance || instance.isInstanceOf(GridTierModel::instance()),
299 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
300 EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
301 }
302
303 AGX_FORCE_INLINE GridTierPtr& GridTierPtr::operator= (const agxData::EntityPtr& ptr)
304 {
306 agxAssertN(!ptr || ptr.isInstanceOf(GridTierModel::instance()),
307 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
308 EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
309 return *this;
310 }
311
312 AGX_FORCE_INLINE GridTierPtr& GridTierPtr::operator= (const agxData::EntityInstance& instance)
313 {
315 agxAssertN(!instance || instance.isInstanceOf(GridTierModel::instance()),
316 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
317 EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
318 return *this;
319 }
320
321 inline GridTierInstance GridTierPtr::instance() { return agxData::EntityPtr::instance(); }
322 inline const GridTierInstance GridTierPtr::instance() const { return agxData::EntityPtr::instance(); }
323 AGX_FORCE_INLINE GridTierSemantics* GridTierPtr::operator->() { return (GridTierSemantics* )this; }
324 AGX_FORCE_INLINE const GridTierSemantics* GridTierPtr::operator->() const { return (const GridTierSemantics* )this; }
325 AGX_FORCE_INLINE GridTierData* GridTierPtr::getData() { return static_cast<GridTierData* >(agxData::EntityPtr::getData()); }
326 AGX_FORCE_INLINE const GridTierData* GridTierPtr::getData() const { return static_cast<const GridTierData* >(agxData::EntityPtr::getData()); }
327
328 AGX_FORCE_INLINE agx::Real& GridTierPtr::size() { verifyIndex(); return getData()->size[calculateIndex()]; }
329 AGX_FORCE_INLINE agx::Real const& GridTierPtr::size() const { verifyIndex(); return getData()->size[calculateIndex()]; }
330
331 AGX_FORCE_INLINE agx::Real& GridTierPtr::invSize() { verifyIndex(); return getData()->invSize[calculateIndex()]; }
332 AGX_FORCE_INLINE agx::Real const& GridTierPtr::invSize() const { verifyIndex(); return getData()->invSize[calculateIndex()]; }
333
334 AGX_FORCE_INLINE agx::Real32& GridTierPtr::boundingRadius() { verifyIndex(); return getData()->boundingRadius[calculateIndex()]; }
335 AGX_FORCE_INLINE agx::Real32 const& GridTierPtr::boundingRadius() const { verifyIndex(); return getData()->boundingRadius[calculateIndex()]; }
336
337 AGX_FORCE_INLINE agx::GridCellTable*& GridTierPtr::cellTable() { verifyIndex(); return getData()->cellTable[calculateIndex()]; }
338 AGX_FORCE_INLINE agx::GridCellTable* const& GridTierPtr::cellTable() const { verifyIndex(); return getData()->cellTable[calculateIndex()]; }
339
340 AGX_FORCE_INLINE agx::ContactZoneTable*& GridTierPtr::zoneTable() { verifyIndex(); return getData()->zoneTable[calculateIndex()]; }
341 AGX_FORCE_INLINE agx::ContactZoneTable* const& GridTierPtr::zoneTable() const { verifyIndex(); return getData()->zoneTable[calculateIndex()]; }
342
343 //-----------------------------------------------------------------------------------------------------
344 AGX_FORCE_INLINE GridTierInstance::GridTierInstance() {}
345 AGX_FORCE_INLINE GridTierInstance::GridTierInstance(GridTierData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
346 AGX_FORCE_INLINE GridTierInstance::GridTierInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
347 AGX_FORCE_INLINE GridTierInstance::GridTierInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
348 {
350 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
351 EntityInstance::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
352 }
353
354 AGX_FORCE_INLINE GridTierInstance::GridTierInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
355 {
357 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
358 EntityInstance::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
359 }
360
361
362 AGX_FORCE_INLINE GridTierData* GridTierInstance::getData() { return static_cast<GridTierData* >(agxData::EntityInstance::getData()); }
363 AGX_FORCE_INLINE const GridTierData* GridTierInstance::getData() const { return static_cast<const GridTierData* >(agxData::EntityInstance::getData()); }
364
365 AGX_FORCE_INLINE agx::Real& GridTierInstance::size() { verifyIndex(); return getData()->size[getIndex()]; }
366 AGX_FORCE_INLINE agx::Real const& GridTierInstance::size() const { verifyIndex(); return getData()->size[getIndex()]; }
367
368 AGX_FORCE_INLINE agx::Real& GridTierInstance::invSize() { verifyIndex(); return getData()->invSize[getIndex()]; }
369 AGX_FORCE_INLINE agx::Real const& GridTierInstance::invSize() const { verifyIndex(); return getData()->invSize[getIndex()]; }
370
371 AGX_FORCE_INLINE agx::Real32& GridTierInstance::boundingRadius() { verifyIndex(); return getData()->boundingRadius[getIndex()]; }
372 AGX_FORCE_INLINE agx::Real32 const& GridTierInstance::boundingRadius() const { verifyIndex(); return getData()->boundingRadius[getIndex()]; }
373
374 AGX_FORCE_INLINE agx::GridCellTable*& GridTierInstance::cellTable() { verifyIndex(); return getData()->cellTable[getIndex()]; }
375 AGX_FORCE_INLINE agx::GridCellTable* const& GridTierInstance::cellTable() const { verifyIndex(); return getData()->cellTable[getIndex()]; }
376
377 AGX_FORCE_INLINE agx::ContactZoneTable*& GridTierInstance::zoneTable() { verifyIndex(); return getData()->zoneTable[getIndex()]; }
378 AGX_FORCE_INLINE agx::ContactZoneTable* const& GridTierInstance::zoneTable() const { verifyIndex(); return getData()->zoneTable[getIndex()]; }
379
380 //-----------------------------------------------------------------------------------------------------
381 AGX_FORCE_INLINE GridTierSemantics::GridTierSemantics() {}
382 //-----------------------------------------------------------------------------------------------------
384 }
385 }
386}
387
388AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::GridTierPtr, "Physics.HierarchicalGrid.GridTierPtr")
389AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::GridTierInstance, "Physics.HierarchicalGrid.GridTierInstance")
390
391#ifdef _MSC_VER
392# pragma warning(pop)
393#endif
394
395#undef AGX_ENTITY_WRAPPER
396#undef AGX_ENTITY_NAMESPACE
397#endif
398
#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
Inheritance with partial specialization due to bug with ref_ptr containers.
agx::String fullPath() const
Abstract description of the data attributes for the Physics.HierarchicalGrid.GridTier entity.
virtual void configure(agx::TiXmlElement *eEntity) override
static GridTierPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Real32 > * boundingRadiusAttribute
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::ScalarAttributeT< agx::Real > * invSizeAttribute
GridTierModel(const agx::String &name="GridTier")
static agxData::ScalarAttributeT< agx::Real > * sizeAttribute
void construct(agx::Physics::HierarchicalGrid::GridTierPtr gridTier)
virtual void construct(agxData::EntityPtr instance) override
virtual void initAttributeAccessors() override
static agxData::PointerAttributeT< agx::ContactZoneTable * > * zoneTableAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::PointerAttributeT< agx::GridCellTable * > * cellTableAttribute
Pointer to a entity instance of type Physics.HierarchicalGrid.GridTier.
AGXPHYSICS_EXPORT agx::Real const & size() const
AGXPHYSICS_EXPORT agx::Real32 & boundingRadius()
AGXPHYSICS_EXPORT GridTierPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Real const & invSize() const
AGXPHYSICS_EXPORT agx::ContactZoneTable *const & zoneTable() const
AGXPHYSICS_EXPORT agx::ContactZoneTable *& zoneTable()
AGXPHYSICS_EXPORT const GridTierSemantics * operator->() const
AGXPHYSICS_EXPORT const GridTierInstance instance() const
AGXPHYSICS_EXPORT GridTierPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT GridTierSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real & invSize()
AGXPHYSICS_EXPORT GridTierInstance instance()
AGXPHYSICS_EXPORT agx::GridCellTable *const & cellTable() const
AGXPHYSICS_EXPORT agx::Real32 const & boundingRadius() const
AGXPHYSICS_EXPORT agx::GridCellTable *& cellTable()
AGXPHYSICS_EXPORT GridTierPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Real & size()
const GridTierData * getData() 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.
double Real
Definition: Real.h:41
float Real32
Definition: Real.h:43
UInt32 Index
Definition: Integer.h:44