AGX Dynamics  2.35.0.1
Cell2DEntity.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_CELL2D_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_HIERARCHICALGRID_CELL2D_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/Integer.h>
48 #include <agx/Vec2.h>
49 #include <agx/Real.h>
50 #include <agx/IndexRange.h>
51 
52 
53 namespace agx
54 {
55  namespace Physics
56  {
57  namespace HierarchicalGrid
58  {
59 
60  class Cell2DModel;
61  class Cell2DData;
62  class Cell2DPtr;
63  class Cell2DInstance;
64  class Cell2DSemantics;
65 
66 
68 
73  {
74  public:
75  typedef Cell2DPtr PtrT;
76 
77  Cell2DModel(const agx::String& name = "Cell2D");
78 
80  static Cell2DModel* instance();
81 
84 
87 
89  virtual void shutdownCleanup() override;
90 
91 
92 
93  /* Attributes */
104  static const size_t childrenArraySize = 4;
107  static const size_t neighborsArraySize = 12;
111 
112  protected:
113  virtual ~Cell2DModel();
114  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
115  virtual void configure(agx::TiXmlElement* eEntity) override;
116  virtual void initAttributeAccessors() override;
117  virtual void construct(agxData::EntityPtr instance) override;
119  };
120 
121 
123  #ifndef AGX_PHYSICS_HIERARCHICALGRID_CELL2D_DATA_SET_OVERRIDE
124  #define AGX_PHYSICS_HIERARCHICALGRID_CELL2D_DATA_SET
125  class AGXPHYSICS_EXPORT Cell2DData : public agxData::EntityData
126  {
127  public:
128  Cell2DInstance operator[] (size_t index);
129 
130  public:
131  agxData::Array< Cell2DPtr >& instance;
138  agxData::Array< agx::IndexRange32 > collisionObjects;
142  static const size_t childrenArraySize = 4;
143  agxData::Array< agx::UInt8 > numChildren;
145  static const size_t neighborsArraySize = 12;
147  agx::Real32 emptyThreshold;
148  agx::Real sizeAlignment;
149 
150  public:
151  typedef agx::UInt8 tierType;
152  typedef agx::Vec2i idType;
153  typedef agx::Vec2f positionType;
154  typedef agx::UInt64 linearIdType;
155  typedef agx::UInt8 stateType;
156  typedef agx::Real32 emptyTimeType;
157  typedef agx::IndexRange32 collisionObjectsType;
158  typedef agx::UInt8 zoneTypeType;
159  typedef agx::UInt32 parentType;
160  typedef agx::UInt32 childrenType;
161  typedef agx::UInt8 numChildrenType;
162  typedef agx::UInt32 neighborsType;
163  typedef agx::UInt32 searchCostType;
164  typedef agx::Real32 emptyThresholdType;
165  typedef agx::Real sizeAlignmentType;
166 
167  public:
168  Cell2DData(agxData::EntityStorage* storage);
169  Cell2DData();
170 
171  protected:
172  virtual ~Cell2DData() {}
173  virtual void setNumElements(agx::Index numElements) override;
174  virtual void synchronizeSharedAttribute(agxData::Value* value) override;
175 
176  private:
177  Cell2DData& operator= (const Cell2DData&) { return *this; }
178 
179  };
180  #endif
182 
183 
185  class AGXPHYSICS_EXPORT Cell2DSemantics : protected agxData::EntityPtr
186  {
187  public:
188 
189  // Automatic getters
190  agx::UInt8 const& getTier() const;
191  agx::Vec2i const& getId() const;
192  agx::Vec2f const& getPosition() const;
193  agx::UInt64 const& getLinearId() const;
194  agx::UInt8 const& getState() const;
195  agx::Real32 const& getEmptyTime() const;
196  agx::IndexRange32 const& getCollisionObjects() const;
197  agx::UInt8 const& getZoneType() const;
198  agx::UInt32 const& getParent() const;
199  agx::UInt8 const& getNumChildren() const;
200  agx::UInt32 const& getSearchCost() const;
201 
202  // Semantics defined by explicit kernels
203 
204  // Automatic setters
205  void setTier(agx::UInt8 const& value);
206  void setId(agx::Vec2i const& value);
207  void setPosition(agx::Vec2f const& value);
208  void setLinearId(agx::UInt64 const& value);
209  void setState(agx::UInt8 const& value);
210  void setEmptyTime(agx::Real32 const& value);
211  void setCollisionObjects(agx::IndexRange32 const& value);
212  void setZoneType(agx::UInt8 const& value);
213  void setParent(agx::UInt32 const& value);
214  void setNumChildren(agx::UInt8 const& value);
215  void setSearchCost(agx::UInt32 const& value);
216 
217 
218  protected:
219  friend class Cell2DPtr;
220  friend class Cell2DInstance;
221  Cell2DSemantics();
222  };
224 
225 
226 
229  class CALLABLE Cell2DPtr : public agxData::EntityPtr
230  {
231  public:
233  typedef Cell2DData DataType;
234  typedef Cell2DInstance InstanceType;
235 
236  public:
243  AGXPHYSICS_EXPORT Cell2DInstance instance();
244  AGXPHYSICS_EXPORT const Cell2DInstance instance() const;
245 
246  AGXPHYSICS_EXPORT Cell2DSemantics* operator->();
247  AGXPHYSICS_EXPORT const Cell2DSemantics* operator->() const;
248 
249  Cell2DData* getData();
250  const Cell2DData* getData() const;
251 
252 
257 
262 
267 
272 
277 
282 
287 
292 
297 
301  AGXPHYSICS_EXPORT agx::UInt32 const& children(size_t index) const;
302 
307 
311  AGXPHYSICS_EXPORT agx::UInt32 const& neighbors(size_t index) const;
312 
317 
322 
327 
329  // Only used by tolua!
330  #ifdef AGX_GENERATED_TOLUA_WRAPPER
331  inline agx::UInt8 const& getTier() const { return (*this)->getTier(); }
332  inline agx::Vec2i const& getId() const { return (*this)->getId(); }
333  inline agx::Vec2f const& getPosition() const { return (*this)->getPosition(); }
334  inline agx::UInt64 const& getLinearId() const { return (*this)->getLinearId(); }
335  inline agx::UInt8 const& getState() const { return (*this)->getState(); }
336  inline agx::Real32 const& getEmptyTime() const { return (*this)->getEmptyTime(); }
337  inline agx::IndexRange32 const& getCollisionObjects() const { return (*this)->getCollisionObjects(); }
338  inline agx::UInt8 const& getZoneType() const { return (*this)->getZoneType(); }
339  inline agx::UInt32 const& getParent() const { return (*this)->getParent(); }
340  inline agx::UInt8 const& getNumChildren() const { return (*this)->getNumChildren(); }
341  inline agx::UInt32 const& getSearchCost() const { return (*this)->getSearchCost(); }
342 
343 
344  inline void setTier(agx::UInt8 const& value) { (*this)->setTier(value); }
345  inline void setId(agx::Vec2i const& value) { (*this)->setId(value); }
346  inline void setPosition(agx::Vec2f const& value) { (*this)->setPosition(value); }
347  inline void setLinearId(agx::UInt64 const& value) { (*this)->setLinearId(value); }
348  inline void setState(agx::UInt8 const& value) { (*this)->setState(value); }
349  inline void setEmptyTime(agx::Real32 const& value) { (*this)->setEmptyTime(value); }
350  inline void setCollisionObjects(agx::IndexRange32 const& value) { (*this)->setCollisionObjects(value); }
351  inline void setZoneType(agx::UInt8 const& value) { (*this)->setZoneType(value); }
352  inline void setParent(agx::UInt32 const& value) { (*this)->setParent(value); }
353  inline void setNumChildren(agx::UInt8 const& value) { (*this)->setNumChildren(value); }
354  inline void setSearchCost(agx::UInt32 const& value) { (*this)->setSearchCost(value); }
355  #endif
357 
358  };
359 
360 
362  class AGXPHYSICS_EXPORT Cell2DInstance : public agxData::EntityInstance
363  {
364  public:
365  Cell2DInstance();
366  Cell2DInstance(Cell2DData* data, agx::Index index);
367  Cell2DInstance(agxData::EntityStorage *storage, agx::Index index);
368  Cell2DInstance(const agxData::EntityInstance& other);
369  Cell2DInstance(const agxData::EntityPtr& ptr);
370 
371  Cell2DData* getData();
372  const Cell2DData* getData() const;
373 
374  public:
376  agx::UInt8& tier();
378  agx::UInt8 const& tier() const;
379 
381  agx::Vec2i& id();
383  agx::Vec2i const& id() const;
384 
386  agx::Vec2f& position();
388  agx::Vec2f const& position() const;
389 
391  agx::UInt64& linearId();
393  agx::UInt64 const& linearId() const;
394 
396  agx::UInt8& state();
398  agx::UInt8 const& state() const;
399 
401  agx::Real32& emptyTime();
403  agx::Real32 const& emptyTime() const;
404 
406  agx::IndexRange32& collisionObjects();
408  agx::IndexRange32 const& collisionObjects() const;
409 
411  agx::UInt8& zoneType();
413  agx::UInt8 const& zoneType() const;
414 
416  agx::UInt32& parent();
418  agx::UInt32 const& parent() const;
419 
421  agxData::Array< agx::UInt32 > const children() const;
422  agx::UInt32& children(size_t index);
423  agx::UInt32 const& children(size_t index) const;
424 
426  agx::UInt8& numChildren();
428  agx::UInt8 const& numChildren() const;
429 
430  agxData::Array< agx::UInt32 > neighbors();
431  agxData::Array< agx::UInt32 > const neighbors() const;
432  agx::UInt32& neighbors(size_t index);
433  agx::UInt32 const& neighbors(size_t index) const;
434 
436  agx::UInt32& searchCost();
438  agx::UInt32 const& searchCost() const;
439 
441  agx::Real32& emptyThreshold();
443  agx::Real32 const& emptyThreshold() const;
444 
446  agx::Real& sizeAlignment();
448  agx::Real const& sizeAlignment() const;
449 
450  };
452 
453 
454 
457 
458 
459 
461  /* Implementation */
462  //-----------------------------------------------------------------------------------------------------
463  //-----------------------------------------------------------------------------------------------------
464  inline Cell2DInstance agx::Physics::HierarchicalGrid::Cell2DData::operator[] (size_t index) { return Cell2DInstance(this, (agx::Index)index); }
465  //-----------------------------------------------------------------------------------------------------
467  AGX_FORCE_INLINE Cell2DPtr::Cell2DPtr(agxData::EntityStorage* storage, agx::Index id) : agxData::EntityPtr(storage, id) {}
468  AGX_FORCE_INLINE Cell2DPtr::Cell2DPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
469  {
471  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
472  EntityPtr::getModel()->fullPath().c_str(), Cell2DModel::instance()->fullPath().c_str());
473  }
474 
475  AGX_FORCE_INLINE Cell2DPtr::Cell2DPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
476  {
477  agxAssertN(!instance || instance.isInstanceOf(Cell2DModel::instance()),
478  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
479  EntityPtr::getModel()->fullPath().c_str(), Cell2DModel::instance()->fullPath().c_str());
480  }
481 
482  AGX_FORCE_INLINE Cell2DPtr& Cell2DPtr::operator= (const agxData::EntityPtr& ptr)
483  {
485  agxAssertN(!ptr || ptr.isInstanceOf(Cell2DModel::instance()),
486  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
487  EntityPtr::getModel()->fullPath().c_str(), Cell2DModel::instance()->fullPath().c_str());
488  return *this;
489  }
490 
491  AGX_FORCE_INLINE Cell2DPtr& Cell2DPtr::operator= (const agxData::EntityInstance& instance)
492  {
494  agxAssertN(!instance || instance.isInstanceOf(Cell2DModel::instance()),
495  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
496  EntityPtr::getModel()->fullPath().c_str(), Cell2DModel::instance()->fullPath().c_str());
497  return *this;
498  }
499 
500  inline Cell2DInstance Cell2DPtr::instance() { return agxData::EntityPtr::instance(); }
501  inline const Cell2DInstance Cell2DPtr::instance() const { return agxData::EntityPtr::instance(); }
502  AGX_FORCE_INLINE Cell2DSemantics* Cell2DPtr::operator->() { return (Cell2DSemantics* )this; }
503  AGX_FORCE_INLINE const Cell2DSemantics* Cell2DPtr::operator->() const { return (const Cell2DSemantics* )this; }
504  AGX_FORCE_INLINE Cell2DData* Cell2DPtr::getData() { return static_cast<Cell2DData* >(agxData::EntityPtr::getData()); }
505  AGX_FORCE_INLINE const Cell2DData* Cell2DPtr::getData() const { return static_cast<const Cell2DData* >(agxData::EntityPtr::getData()); }
506 
507  AGX_FORCE_INLINE agx::UInt8& Cell2DPtr::tier() { verifyIndex(); return getData()->tier[calculateIndex()]; }
508  AGX_FORCE_INLINE agx::UInt8 const& Cell2DPtr::tier() const { verifyIndex(); return getData()->tier[calculateIndex()]; }
509 
510  AGX_FORCE_INLINE agx::Vec2i& Cell2DPtr::id() { verifyIndex(); return getData()->id[calculateIndex()]; }
511  AGX_FORCE_INLINE agx::Vec2i const& Cell2DPtr::id() const { verifyIndex(); return getData()->id[calculateIndex()]; }
512 
513  AGX_FORCE_INLINE agx::Vec2f& Cell2DPtr::position() { verifyIndex(); return getData()->position[calculateIndex()]; }
514  AGX_FORCE_INLINE agx::Vec2f const& Cell2DPtr::position() const { verifyIndex(); return getData()->position[calculateIndex()]; }
515 
516  AGX_FORCE_INLINE agx::UInt64& Cell2DPtr::linearId() { verifyIndex(); return getData()->linearId[calculateIndex()]; }
517  AGX_FORCE_INLINE agx::UInt64 const& Cell2DPtr::linearId() const { verifyIndex(); return getData()->linearId[calculateIndex()]; }
518 
519  AGX_FORCE_INLINE agx::UInt8& Cell2DPtr::state() { verifyIndex(); return getData()->state[calculateIndex()]; }
520  AGX_FORCE_INLINE agx::UInt8 const& Cell2DPtr::state() const { verifyIndex(); return getData()->state[calculateIndex()]; }
521 
522  AGX_FORCE_INLINE agx::Real32& Cell2DPtr::emptyTime() { verifyIndex(); return getData()->emptyTime[calculateIndex()]; }
523  AGX_FORCE_INLINE agx::Real32 const& Cell2DPtr::emptyTime() const { verifyIndex(); return getData()->emptyTime[calculateIndex()]; }
524 
525  AGX_FORCE_INLINE agx::IndexRange32& Cell2DPtr::collisionObjects() { verifyIndex(); return getData()->collisionObjects[calculateIndex()]; }
526  AGX_FORCE_INLINE agx::IndexRange32 const& Cell2DPtr::collisionObjects() const { verifyIndex(); return getData()->collisionObjects[calculateIndex()]; }
527 
528  AGX_FORCE_INLINE agx::UInt8& Cell2DPtr::zoneType() { verifyIndex(); return getData()->zoneType[calculateIndex()]; }
529  AGX_FORCE_INLINE agx::UInt8 const& Cell2DPtr::zoneType() const { verifyIndex(); return getData()->zoneType[calculateIndex()]; }
530 
531  AGX_FORCE_INLINE agx::UInt32& Cell2DPtr::parent() { verifyIndex(); return getData()->parent[calculateIndex()]; }
532  AGX_FORCE_INLINE agx::UInt32 const& Cell2DPtr::parent() const { verifyIndex(); return getData()->parent[calculateIndex()]; }
533 
534  AGX_FORCE_INLINE agxData::Array< agx::UInt32 > Cell2DPtr::children() { verifyIndex(); return getData()->children.slice(agx::IndexRange32(calculateIndex() * (agx::Index)Cell2DData::childrenArraySize, (calculateIndex()+1) * (agx::Index)Cell2DData::childrenArraySize)); }
535  AGX_FORCE_INLINE const agxData::Array< agx::UInt32 > Cell2DPtr::children() const { verifyIndex(); return getData()->children.slice(agx::IndexRange32(calculateIndex() * (agx::Index)Cell2DData::childrenArraySize, (calculateIndex()+1) * (agx::Index)Cell2DData::childrenArraySize)); }
536  AGX_FORCE_INLINE agx::UInt32& Cell2DPtr::children(size_t index) { return this->children()[index]; }
537  AGX_FORCE_INLINE agx::UInt32 const& Cell2DPtr::children(size_t index) const { return this->children()[index]; }
538 
539  AGX_FORCE_INLINE agx::UInt8& Cell2DPtr::numChildren() { verifyIndex(); return getData()->numChildren[calculateIndex()]; }
540  AGX_FORCE_INLINE agx::UInt8 const& Cell2DPtr::numChildren() const { verifyIndex(); return getData()->numChildren[calculateIndex()]; }
541 
542  AGX_FORCE_INLINE agxData::Array< agx::UInt32 > Cell2DPtr::neighbors() { verifyIndex(); return getData()->neighbors.slice(agx::IndexRange32(calculateIndex() * (agx::Index)Cell2DData::neighborsArraySize, (calculateIndex()+1) * (agx::Index)Cell2DData::neighborsArraySize)); }
543  AGX_FORCE_INLINE const agxData::Array< agx::UInt32 > Cell2DPtr::neighbors() const { verifyIndex(); return getData()->neighbors.slice(agx::IndexRange32(calculateIndex() * (agx::Index)Cell2DData::neighborsArraySize, (calculateIndex()+1) * (agx::Index)Cell2DData::neighborsArraySize)); }
544  AGX_FORCE_INLINE agx::UInt32& Cell2DPtr::neighbors(size_t index) { return this->neighbors()[index]; }
545  AGX_FORCE_INLINE agx::UInt32 const& Cell2DPtr::neighbors(size_t index) const { return this->neighbors()[index]; }
546 
547  AGX_FORCE_INLINE agx::UInt32& Cell2DPtr::searchCost() { verifyIndex(); return getData()->searchCost[calculateIndex()]; }
548  AGX_FORCE_INLINE agx::UInt32 const& Cell2DPtr::searchCost() const { verifyIndex(); return getData()->searchCost[calculateIndex()]; }
549 
550  AGX_FORCE_INLINE agx::Real32& Cell2DPtr::emptyThreshold() { verifyIndex(); return getData()->emptyThreshold; }
551  AGX_FORCE_INLINE agx::Real32 const& Cell2DPtr::emptyThreshold() const { verifyIndex(); return getData()->emptyThreshold; }
552 
553  AGX_FORCE_INLINE agx::Real& Cell2DPtr::sizeAlignment() { verifyIndex(); return getData()->sizeAlignment; }
554  AGX_FORCE_INLINE agx::Real const& Cell2DPtr::sizeAlignment() const { verifyIndex(); return getData()->sizeAlignment; }
555 
556  //-----------------------------------------------------------------------------------------------------
557  AGX_FORCE_INLINE Cell2DInstance::Cell2DInstance() {}
558  AGX_FORCE_INLINE Cell2DInstance::Cell2DInstance(Cell2DData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
559  AGX_FORCE_INLINE Cell2DInstance::Cell2DInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
560  AGX_FORCE_INLINE Cell2DInstance::Cell2DInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
561  {
562  agxAssertN(!other || other.isInstanceOf(Cell2DModel::instance()),
563  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
565  }
566 
567  AGX_FORCE_INLINE Cell2DInstance::Cell2DInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
568  {
570  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
572  }
573 
574 
575  AGX_FORCE_INLINE Cell2DData* Cell2DInstance::getData() { return static_cast<Cell2DData* >(agxData::EntityInstance::getData()); }
576  AGX_FORCE_INLINE const Cell2DData* Cell2DInstance::getData() const { return static_cast<const Cell2DData* >(agxData::EntityInstance::getData()); }
577 
578  AGX_FORCE_INLINE agx::UInt8& Cell2DInstance::tier() { verifyIndex(); return getData()->tier[getIndex()]; }
579  AGX_FORCE_INLINE agx::UInt8 const& Cell2DInstance::tier() const { verifyIndex(); return getData()->tier[getIndex()]; }
580 
581  AGX_FORCE_INLINE agx::Vec2i& Cell2DInstance::id() { verifyIndex(); return getData()->id[getIndex()]; }
582  AGX_FORCE_INLINE agx::Vec2i const& Cell2DInstance::id() const { verifyIndex(); return getData()->id[getIndex()]; }
583 
584  AGX_FORCE_INLINE agx::Vec2f& Cell2DInstance::position() { verifyIndex(); return getData()->position[getIndex()]; }
585  AGX_FORCE_INLINE agx::Vec2f const& Cell2DInstance::position() const { verifyIndex(); return getData()->position[getIndex()]; }
586 
587  AGX_FORCE_INLINE agx::UInt64& Cell2DInstance::linearId() { verifyIndex(); return getData()->linearId[getIndex()]; }
588  AGX_FORCE_INLINE agx::UInt64 const& Cell2DInstance::linearId() const { verifyIndex(); return getData()->linearId[getIndex()]; }
589 
590  AGX_FORCE_INLINE agx::UInt8& Cell2DInstance::state() { verifyIndex(); return getData()->state[getIndex()]; }
591  AGX_FORCE_INLINE agx::UInt8 const& Cell2DInstance::state() const { verifyIndex(); return getData()->state[getIndex()]; }
592 
593  AGX_FORCE_INLINE agx::Real32& Cell2DInstance::emptyTime() { verifyIndex(); return getData()->emptyTime[getIndex()]; }
594  AGX_FORCE_INLINE agx::Real32 const& Cell2DInstance::emptyTime() const { verifyIndex(); return getData()->emptyTime[getIndex()]; }
595 
596  AGX_FORCE_INLINE agx::IndexRange32& Cell2DInstance::collisionObjects() { verifyIndex(); return getData()->collisionObjects[getIndex()]; }
597  AGX_FORCE_INLINE agx::IndexRange32 const& Cell2DInstance::collisionObjects() const { verifyIndex(); return getData()->collisionObjects[getIndex()]; }
598 
599  AGX_FORCE_INLINE agx::UInt8& Cell2DInstance::zoneType() { verifyIndex(); return getData()->zoneType[getIndex()]; }
600  AGX_FORCE_INLINE agx::UInt8 const& Cell2DInstance::zoneType() const { verifyIndex(); return getData()->zoneType[getIndex()]; }
601 
602  AGX_FORCE_INLINE agx::UInt32& Cell2DInstance::parent() { verifyIndex(); return getData()->parent[getIndex()]; }
603  AGX_FORCE_INLINE agx::UInt32 const& Cell2DInstance::parent() const { verifyIndex(); return getData()->parent[getIndex()]; }
604 
605  AGX_FORCE_INLINE agxData::Array< agx::UInt32 > Cell2DInstance::children() { verifyIndex(); return getData()->children.slice(agx::IndexRange32(getIndex() * (agx::Index)Cell2DData::childrenArraySize, (getIndex()+1) * (agx::Index)Cell2DData::childrenArraySize)); }
606  AGX_FORCE_INLINE const agxData::Array< agx::UInt32 > Cell2DInstance::children() const { verifyIndex(); return getData()->children.slice(agx::IndexRange32(getIndex() * (agx::Index)Cell2DData::childrenArraySize, (getIndex()+1) * (agx::Index)Cell2DData::childrenArraySize)); }
607  AGX_FORCE_INLINE agx::UInt32& Cell2DInstance::children(size_t index) { return this->children()[index]; }
608  AGX_FORCE_INLINE agx::UInt32 const& Cell2DInstance::children(size_t index) const { return this->children()[index]; }
609 
610  AGX_FORCE_INLINE agx::UInt8& Cell2DInstance::numChildren() { verifyIndex(); return getData()->numChildren[getIndex()]; }
611  AGX_FORCE_INLINE agx::UInt8 const& Cell2DInstance::numChildren() const { verifyIndex(); return getData()->numChildren[getIndex()]; }
612 
613  AGX_FORCE_INLINE agxData::Array< agx::UInt32 > Cell2DInstance::neighbors() { verifyIndex(); return getData()->neighbors.slice(agx::IndexRange32(getIndex() * (agx::Index)Cell2DData::neighborsArraySize, (getIndex()+1) * (agx::Index)Cell2DData::neighborsArraySize)); }
614  AGX_FORCE_INLINE const agxData::Array< agx::UInt32 > Cell2DInstance::neighbors() const { verifyIndex(); return getData()->neighbors.slice(agx::IndexRange32(getIndex() * (agx::Index)Cell2DData::neighborsArraySize, (getIndex()+1) * (agx::Index)Cell2DData::neighborsArraySize)); }
615  AGX_FORCE_INLINE agx::UInt32& Cell2DInstance::neighbors(size_t index) { return this->neighbors()[index]; }
616  AGX_FORCE_INLINE agx::UInt32 const& Cell2DInstance::neighbors(size_t index) const { return this->neighbors()[index]; }
617 
618  AGX_FORCE_INLINE agx::UInt32& Cell2DInstance::searchCost() { verifyIndex(); return getData()->searchCost[getIndex()]; }
619  AGX_FORCE_INLINE agx::UInt32 const& Cell2DInstance::searchCost() const { verifyIndex(); return getData()->searchCost[getIndex()]; }
620 
621  AGX_FORCE_INLINE agx::Real32& Cell2DInstance::emptyThreshold() { verifyIndex(); return getData()->emptyThreshold; }
622  AGX_FORCE_INLINE agx::Real32 const& Cell2DInstance::emptyThreshold() const { verifyIndex(); return getData()->emptyThreshold; }
623 
624  AGX_FORCE_INLINE agx::Real& Cell2DInstance::sizeAlignment() { verifyIndex(); return getData()->sizeAlignment; }
625  AGX_FORCE_INLINE agx::Real const& Cell2DInstance::sizeAlignment() const { verifyIndex(); return getData()->sizeAlignment; }
626 
627  //-----------------------------------------------------------------------------------------------------
628  AGX_FORCE_INLINE Cell2DSemantics::Cell2DSemantics() {}
629  //-----------------------------------------------------------------------------------------------------
631  }
632  }
633 }
634 
635 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::Cell2DPtr, "Physics.HierarchicalGrid.Cell2DPtr")
636 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::Cell2DInstance, "Physics.HierarchicalGrid.Cell2DInstance")
637 
638 #ifdef _MSC_VER
639 # pragma warning(pop)
640 #endif
641 
642 #undef AGX_ENTITY_WRAPPER
643 #undef AGX_ENTITY_NAMESPACE
644 #endif
645 
#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
Abstract representation of a value.
Definition: Value.h:43
A range of indices.
Definition: IndexRange.h:33
agx::String fullPath() const
Abstract description of the data attributes for the Physics.HierarchicalGrid.Cell2D entity.
Definition: Cell2DEntity.h:73
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void construct(agxData::EntityPtr instance) override
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::ScalarAttributeT< agx::UInt32 > * neighborsAttribute
Definition: Cell2DEntity.h:106
static agxData::ScalarAttributeT< agx::UInt8 > * stateAttribute
Definition: Cell2DEntity.h:98
static agxData::ScalarAttributeT< agx::UInt8 > * tierAttribute
Definition: Cell2DEntity.h:94
static Cell2DPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::UInt32 > * childrenAttribute
Definition: Cell2DEntity.h:103
static agxData::ScalarAttributeT< agx::UInt32 > * parentAttribute
Definition: Cell2DEntity.h:102
static agxData::ScalarAttributeT< agx::Vec2i > * idAttribute
Definition: Cell2DEntity.h:95
static agxData::ScalarAttributeT< agx::UInt8 > * numChildrenAttribute
Definition: Cell2DEntity.h:105
static agxData::SharedAttributeT< agx::Real32 > * emptyThresholdAttribute
Definition: Cell2DEntity.h:109
static agxData::ScalarAttributeT< agx::Real32 > * emptyTimeAttribute
Definition: Cell2DEntity.h:99
static agxData::ScalarAttributeT< agx::UInt64 > * linearIdAttribute
Definition: Cell2DEntity.h:97
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::ScalarAttributeT< agx::Vec2f > * positionAttribute
Definition: Cell2DEntity.h:96
static agxData::SharedAttributeT< agx::Real > * sizeAlignmentAttribute
Definition: Cell2DEntity.h:110
static agxData::ScalarAttributeT< agx::UInt32 > * searchCostAttribute
Definition: Cell2DEntity.h:108
void construct(agx::Physics::HierarchicalGrid::Cell2DPtr cell2D)
static agxData::ScalarAttributeT< agx::UInt8 > * zoneTypeAttribute
Definition: Cell2DEntity.h:101
Cell2DModel(const agx::String &name="Cell2D")
static agxData::EntityStorage * defaultStorage()
virtual void initAttributeAccessors() override
static agxData::ScalarAttributeT< agx::IndexRange32 > * collisionObjectsAttribute
Definition: Cell2DEntity.h:100
Pointer to a entity instance of type Physics.HierarchicalGrid.Cell2D.
Definition: Cell2DEntity.h:230
AGXPHYSICS_EXPORT agx::Real32 & emptyThreshold()
AGXPHYSICS_EXPORT Cell2DSemantics * operator->()
AGXPHYSICS_EXPORT agx::UInt8 const & state() const
AGXPHYSICS_EXPORT Cell2DPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::UInt8 const & numChildren() const
AGXPHYSICS_EXPORT agx::Vec2i & id()
AGXPHYSICS_EXPORT agx::Vec2f const & position() const
AGXPHYSICS_EXPORT agx::UInt8 & state()
AGXPHYSICS_EXPORT Cell2DPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const Cell2DSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Real32 const & emptyThreshold() const
AGXPHYSICS_EXPORT agxData::Array< agx::UInt32 > const neighbors() const
AGXPHYSICS_EXPORT Cell2DInstance instance()
const Cell2DData * getData() const
AGXPHYSICS_EXPORT agxData::Array< agx::UInt32 > children()
AGXPHYSICS_EXPORT agx::Real32 const & emptyTime() const
AGXPHYSICS_EXPORT agx::UInt32 & children(size_t index)
AGXPHYSICS_EXPORT agx::Real & sizeAlignment()
AGXPHYSICS_EXPORT agxData::Array< agx::UInt32 > const children() const
AGXPHYSICS_EXPORT agx::UInt32 & parent()
AGXPHYSICS_EXPORT agx::UInt32 & neighbors(size_t index)
AGXPHYSICS_EXPORT agxData::Array< agx::UInt32 > neighbors()
AGXPHYSICS_EXPORT agx::UInt32 const & neighbors(size_t index) const
AGXPHYSICS_EXPORT Cell2DPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::UInt8 & tier()
AGXPHYSICS_EXPORT agx::Vec2f & position()
AGXPHYSICS_EXPORT agx::UInt8 const & zoneType() const
AGXPHYSICS_EXPORT agx::UInt32 & searchCost()
AGXPHYSICS_EXPORT agx::IndexRange32 & collisionObjects()
AGXPHYSICS_EXPORT const Cell2DInstance instance() const
AGXPHYSICS_EXPORT agx::UInt64 & linearId()
AGXPHYSICS_EXPORT agx::UInt8 const & tier() const
AGXPHYSICS_EXPORT agx::UInt64 const & linearId() const
AGXPHYSICS_EXPORT agx::UInt8 & numChildren()
AGXPHYSICS_EXPORT agx::Vec2i const & id() const
AGXPHYSICS_EXPORT agx::Real32 & emptyTime()
AGXPHYSICS_EXPORT agx::UInt32 const & children(size_t index) const
AGXPHYSICS_EXPORT agx::Real const & sizeAlignment() const
AGXPHYSICS_EXPORT agx::UInt32 const & searchCost() const
AGXPHYSICS_EXPORT agx::UInt32 const & parent() const
AGXPHYSICS_EXPORT agx::UInt8 & zoneType()
AGXPHYSICS_EXPORT agx::IndexRange32 const & collisionObjects() 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.
uint32_t UInt32
Definition: Integer.h:40
uint64_t UInt64
Definition: Integer.h:41
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:38
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