AGX Dynamics  2.35.0.1
GridTierEntity.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_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>
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>
49 
50 
51 namespace 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:
73  typedef GridTierPtr PtrT;
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 
230  // Only used by tolua!
231  #ifdef AGX_GENERATED_TOLUA_WRAPPER
232  inline agx::Real const& getSize() const { return (*this)->getSize(); }
233  inline agx::Real const& getInvSize() const { return (*this)->getInvSize(); }
234  inline agx::Real32 const& getBoundingRadius() const { return (*this)->getBoundingRadius(); }
235  inline agx::GridCellTable* const& getCellTable() const { return (*this)->getCellTable(); }
236  inline agx::ContactZoneTable* const& getZoneTable() const { return (*this)->getZoneTable(); }
237 
238 
239  inline void setSize(agx::Real const& value) { (*this)->setSize(value); }
240  inline void setInvSize(agx::Real const& value) { (*this)->setInvSize(value); }
241  inline void setBoundingRadius(agx::Real32 const& value) { (*this)->setBoundingRadius(value); }
242  inline void setCellTable(agx::GridCellTable* const& value) { (*this)->setCellTable(value); }
243  inline void setZoneTable(agx::ContactZoneTable* const& value) { (*this)->setZoneTable(value); }
244  #endif
246 
247  };
248 
249 
251  class AGXPHYSICS_EXPORT GridTierInstance : public agxData::EntityInstance
252  {
253  public:
254  GridTierInstance();
255  GridTierInstance(GridTierData* data, agx::Index index);
256  GridTierInstance(agxData::EntityStorage *storage, agx::Index index);
257  GridTierInstance(const agxData::EntityInstance& other);
258  GridTierInstance(const agxData::EntityPtr& ptr);
259 
260  GridTierData* getData();
261  const GridTierData* getData() const;
262 
263  public:
265  agx::Real& size();
267  agx::Real const& size() const;
268 
270  agx::Real& invSize();
272  agx::Real const& invSize() const;
273 
275  agx::Real32& boundingRadius();
277  agx::Real32 const& boundingRadius() const;
278 
280  agx::GridCellTable*& cellTable();
282  agx::GridCellTable* const& cellTable() const;
283 
285  agx::ContactZoneTable*& zoneTable();
287  agx::ContactZoneTable* const& zoneTable() const;
288 
289  };
291 
292 
293 
296 
297 
298 
300  /* Implementation */
301  //-----------------------------------------------------------------------------------------------------
302  //-----------------------------------------------------------------------------------------------------
303  inline GridTierInstance agx::Physics::HierarchicalGrid::GridTierData::operator[] (size_t index) { return GridTierInstance(this, (agx::Index)index); }
304  //-----------------------------------------------------------------------------------------------------
306  AGX_FORCE_INLINE GridTierPtr::GridTierPtr(agxData::EntityStorage* storage, agx::Index id) : agxData::EntityPtr(storage, id) {}
307  AGX_FORCE_INLINE GridTierPtr::GridTierPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
308  {
310  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
311  EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
312  }
313 
314  AGX_FORCE_INLINE GridTierPtr::GridTierPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
315  {
316  agxAssertN(!instance || instance.isInstanceOf(GridTierModel::instance()),
317  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
318  EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
319  }
320 
321  AGX_FORCE_INLINE GridTierPtr& GridTierPtr::operator= (const agxData::EntityPtr& ptr)
322  {
324  agxAssertN(!ptr || ptr.isInstanceOf(GridTierModel::instance()),
325  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
326  EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
327  return *this;
328  }
329 
330  AGX_FORCE_INLINE GridTierPtr& GridTierPtr::operator= (const agxData::EntityInstance& instance)
331  {
333  agxAssertN(!instance || instance.isInstanceOf(GridTierModel::instance()),
334  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
335  EntityPtr::getModel()->fullPath().c_str(), GridTierModel::instance()->fullPath().c_str());
336  return *this;
337  }
338 
339  inline GridTierInstance GridTierPtr::instance() { return agxData::EntityPtr::instance(); }
340  inline const GridTierInstance GridTierPtr::instance() const { return agxData::EntityPtr::instance(); }
341  AGX_FORCE_INLINE GridTierSemantics* GridTierPtr::operator->() { return (GridTierSemantics* )this; }
342  AGX_FORCE_INLINE const GridTierSemantics* GridTierPtr::operator->() const { return (const GridTierSemantics* )this; }
343  AGX_FORCE_INLINE GridTierData* GridTierPtr::getData() { return static_cast<GridTierData* >(agxData::EntityPtr::getData()); }
344  AGX_FORCE_INLINE const GridTierData* GridTierPtr::getData() const { return static_cast<const GridTierData* >(agxData::EntityPtr::getData()); }
345 
346  AGX_FORCE_INLINE agx::Real& GridTierPtr::size() { verifyIndex(); return getData()->size[calculateIndex()]; }
347  AGX_FORCE_INLINE agx::Real const& GridTierPtr::size() const { verifyIndex(); return getData()->size[calculateIndex()]; }
348 
349  AGX_FORCE_INLINE agx::Real& GridTierPtr::invSize() { verifyIndex(); return getData()->invSize[calculateIndex()]; }
350  AGX_FORCE_INLINE agx::Real const& GridTierPtr::invSize() const { verifyIndex(); return getData()->invSize[calculateIndex()]; }
351 
352  AGX_FORCE_INLINE agx::Real32& GridTierPtr::boundingRadius() { verifyIndex(); return getData()->boundingRadius[calculateIndex()]; }
353  AGX_FORCE_INLINE agx::Real32 const& GridTierPtr::boundingRadius() const { verifyIndex(); return getData()->boundingRadius[calculateIndex()]; }
354 
355  AGX_FORCE_INLINE agx::GridCellTable*& GridTierPtr::cellTable() { verifyIndex(); return getData()->cellTable[calculateIndex()]; }
356  AGX_FORCE_INLINE agx::GridCellTable* const& GridTierPtr::cellTable() const { verifyIndex(); return getData()->cellTable[calculateIndex()]; }
357 
358  AGX_FORCE_INLINE agx::ContactZoneTable*& GridTierPtr::zoneTable() { verifyIndex(); return getData()->zoneTable[calculateIndex()]; }
359  AGX_FORCE_INLINE agx::ContactZoneTable* const& GridTierPtr::zoneTable() const { verifyIndex(); return getData()->zoneTable[calculateIndex()]; }
360 
361  //-----------------------------------------------------------------------------------------------------
362  AGX_FORCE_INLINE GridTierInstance::GridTierInstance() {}
363  AGX_FORCE_INLINE GridTierInstance::GridTierInstance(GridTierData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
364  AGX_FORCE_INLINE GridTierInstance::GridTierInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
365  AGX_FORCE_INLINE GridTierInstance::GridTierInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
366  {
368  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
370  }
371 
372  AGX_FORCE_INLINE GridTierInstance::GridTierInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
373  {
375  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
377  }
378 
379 
380  AGX_FORCE_INLINE GridTierData* GridTierInstance::getData() { return static_cast<GridTierData* >(agxData::EntityInstance::getData()); }
381  AGX_FORCE_INLINE const GridTierData* GridTierInstance::getData() const { return static_cast<const GridTierData* >(agxData::EntityInstance::getData()); }
382 
383  AGX_FORCE_INLINE agx::Real& GridTierInstance::size() { verifyIndex(); return getData()->size[getIndex()]; }
384  AGX_FORCE_INLINE agx::Real const& GridTierInstance::size() const { verifyIndex(); return getData()->size[getIndex()]; }
385 
386  AGX_FORCE_INLINE agx::Real& GridTierInstance::invSize() { verifyIndex(); return getData()->invSize[getIndex()]; }
387  AGX_FORCE_INLINE agx::Real const& GridTierInstance::invSize() const { verifyIndex(); return getData()->invSize[getIndex()]; }
388 
389  AGX_FORCE_INLINE agx::Real32& GridTierInstance::boundingRadius() { verifyIndex(); return getData()->boundingRadius[getIndex()]; }
390  AGX_FORCE_INLINE agx::Real32 const& GridTierInstance::boundingRadius() const { verifyIndex(); return getData()->boundingRadius[getIndex()]; }
391 
392  AGX_FORCE_INLINE agx::GridCellTable*& GridTierInstance::cellTable() { verifyIndex(); return getData()->cellTable[getIndex()]; }
393  AGX_FORCE_INLINE agx::GridCellTable* const& GridTierInstance::cellTable() const { verifyIndex(); return getData()->cellTable[getIndex()]; }
394 
395  AGX_FORCE_INLINE agx::ContactZoneTable*& GridTierInstance::zoneTable() { verifyIndex(); return getData()->zoneTable[getIndex()]; }
396  AGX_FORCE_INLINE agx::ContactZoneTable* const& GridTierInstance::zoneTable() const { verifyIndex(); return getData()->zoneTable[getIndex()]; }
397 
398  //-----------------------------------------------------------------------------------------------------
399  AGX_FORCE_INLINE GridTierSemantics::GridTierSemantics() {}
400  //-----------------------------------------------------------------------------------------------------
402  }
403  }
404 }
405 
406 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::GridTierPtr, "Physics.HierarchicalGrid.GridTierPtr")
407 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::GridTierInstance, "Physics.HierarchicalGrid.GridTierInstance")
408 
409 #ifdef _MSC_VER
410 # pragma warning(pop)
411 #endif
412 
413 #undef AGX_ENTITY_WRAPPER
414 #undef AGX_ENTITY_NAMESPACE
415 #endif
416 
#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
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.
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
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::EntityStorage * defaultStorage()
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
static agxData::PointerAttributeT< agx::GridCellTable * > * cellTableAttribute
Pointer to a entity instance of type Physics.HierarchicalGrid.GridTier.
AGXPHYSICS_EXPORT GridTierPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Real & invSize()
AGXPHYSICS_EXPORT agx::ContactZoneTable *const & zoneTable() const
AGXPHYSICS_EXPORT const GridTierSemantics * operator->() const
const GridTierData * getData() const
AGXPHYSICS_EXPORT agx::Real & size()
AGXPHYSICS_EXPORT const GridTierInstance instance() const
AGXPHYSICS_EXPORT GridTierSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real const & invSize() const
AGXPHYSICS_EXPORT agx::GridCellTable *const & cellTable() const
AGXPHYSICS_EXPORT agx::Real32 & boundingRadius()
AGXPHYSICS_EXPORT agx::Real32 const & boundingRadius() const
AGXPHYSICS_EXPORT GridTierPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT GridTierInstance instance()
AGXPHYSICS_EXPORT agx::GridCellTable *& cellTable()
AGXPHYSICS_EXPORT agx::ContactZoneTable *& zoneTable()
AGXPHYSICS_EXPORT GridTierPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Real const & size() 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
float Real32
Definition: Real.h:44
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52