AGXDynamics  2.35.0.2
ConeEntity.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_GEOMETRY_CONE_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_CONE_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>
48 #include <agx/Real.h>
49 
50 
51 namespace agx
52 {
53  namespace Physics
54  {
55  namespace Geometry
56  {
57 
58  class ConeModel;
59  class ConeData;
60  class ConePtr;
61  class ConeInstance;
62  class ConeSemantics;
63 
64 
66 
71  {
72  public:
73  typedef ConePtr PtrT;
74 
75  ConeModel(const agx::String& name = "Cone");
76 
78  static ConeModel* instance();
79 
81  static ConePtr createInstance();
82 
84  static agxData::EntityStorage* defaultStorage();
85 
87  virtual void shutdownCleanup() override;
88 
89 
90 
91  /* Attributes */
95 
96  protected:
97  virtual ~ConeModel();
98  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
99  virtual void configure(agx::TiXmlElement* eEntity) override;
100  virtual void initAttributeAccessors() override;
101  virtual void construct(agxData::EntityPtr instance) override;
102  void construct(agx::Physics::Geometry::ConePtr cone);
103  };
104 
105 
107  #ifndef AGX_PHYSICS_GEOMETRY_CONE_DATA_SET_OVERRIDE
108  #define AGX_PHYSICS_GEOMETRY_CONE_DATA_SET
109  class AGXPHYSICS_EXPORT ConeData : public agx::Physics::Geometry::ShapeData
110  {
111  public:
112  ConeInstance operator[] (size_t index);
113 
114  public:
115  agxData::Array< ConePtr >& instance;
117  agxData::Array< agx::Real > topRadius;
118  agxData::Array< agx::Real > bottomRadius;
119 
120  public:
121  typedef agx::Real heightType;
122  typedef agx::Real topRadiusType;
123  typedef agx::Real bottomRadiusType;
124 
125  public:
126  ConeData(agxData::EntityStorage* storage);
127  ConeData();
128 
129  protected:
130  virtual ~ConeData() {}
131  virtual void setNumElements(agx::Index numElements) override;
132 
133  private:
134  ConeData& operator= (const ConeData&) { return *this; }
135 
136  };
137  #endif
139 
140 
142  class AGXPHYSICS_EXPORT ConeSemantics : public agx::Physics::Geometry::ShapeSemantics
143  {
144  public:
145 
146  // Automatic getters
147  agx::Real const& getHeight() const;
148  agx::Real const& getTopRadius() const;
149  agx::Real const& getBottomRadius() const;
150 
151  // Semantics defined by explicit kernels
152 
153  // Automatic setters
154  void setHeight(agx::Real const& value);
155  void setTopRadius(agx::Real const& value);
156  void setBottomRadius(agx::Real const& value);
157 
158 
159  protected:
160  friend class ConePtr;
161  friend class ConeInstance;
162  ConeSemantics();
163  };
165 
166 
167 
170  class CALLABLE ConePtr : public agx::Physics::Geometry::ShapePtr
171  {
172  public:
174  typedef ConeData DataType;
175  typedef ConeInstance InstanceType;
176 
177  public:
182  AGXPHYSICS_EXPORT ConePtr& operator= (const agxData::EntityPtr& ptr);
183  AGXPHYSICS_EXPORT ConePtr& operator= (const agxData::EntityInstance& instance);
184  AGXPHYSICS_EXPORT ConeInstance instance();
185  AGXPHYSICS_EXPORT const ConeInstance instance() const;
186 
187  AGXPHYSICS_EXPORT ConeSemantics* operator->();
188  AGXPHYSICS_EXPORT const ConeSemantics* operator->() const;
189 
190  ConeData* getData();
191  const ConeData* getData() const;
192 
193 
195  AGXPHYSICS_EXPORT agx::Real& height();
197  AGXPHYSICS_EXPORT agx::Real const& height() const;
198 
200  AGXPHYSICS_EXPORT agx::Real& topRadius();
202  AGXPHYSICS_EXPORT agx::Real const& topRadius() const;
203 
205  AGXPHYSICS_EXPORT agx::Real& bottomRadius();
207  AGXPHYSICS_EXPORT agx::Real const& bottomRadius() const;
208 
210  // Only used by tolua!
211  #ifdef AGX_GENERATED_TOLUA_WRAPPER
212  inline agx::Real const& getHeight() const { return (*this)->getHeight(); }
213  inline agx::Real const& getTopRadius() const { return (*this)->getTopRadius(); }
214  inline agx::Real const& getBottomRadius() const { return (*this)->getBottomRadius(); }
215 
216 
217  inline void setHeight(agx::Real const& value) { (*this)->setHeight(value); }
218  inline void setTopRadius(agx::Real const& value) { (*this)->setTopRadius(value); }
219  inline void setBottomRadius(agx::Real const& value) { (*this)->setBottomRadius(value); }
220  #endif
222 
223  };
224 
225  // Entity is Referenced
227 
228 
230  class AGXPHYSICS_EXPORT ConeInstance : public agx::Physics::Geometry::ShapeInstance
231  {
232  public:
233  ConeInstance();
234  ConeInstance(ConeData* data, agx::Index index);
235  ConeInstance(agxData::EntityStorage *storage, agx::Index index);
236  ConeInstance(const agxData::EntityInstance& other);
237  ConeInstance(const agxData::EntityPtr& ptr);
238 
239  ConeData* getData();
240  const ConeData* getData() const;
241 
242  public:
244  agx::Real& height();
246  agx::Real const& height() const;
247 
249  agx::Real& topRadius();
251  agx::Real const& topRadius() const;
252 
254  agx::Real& bottomRadius();
256  agx::Real const& bottomRadius() const;
257 
258  };
260 
261 
262 
264  typedef agxData::Array<ConePtr> ConePtrArray;
265 
266 
267 
269  /* Implementation */
270  //-----------------------------------------------------------------------------------------------------
271  //-----------------------------------------------------------------------------------------------------
272  inline ConeInstance agx::Physics::Geometry::ConeData::operator[] (size_t index) { return ConeInstance(this, (agx::Index)index); }
273  //-----------------------------------------------------------------------------------------------------
275  AGX_FORCE_INLINE ConePtr::ConePtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::ShapePtr(storage, id) {}
276  AGX_FORCE_INLINE ConePtr::ConePtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapePtr(ptr)
277  {
279  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
280  EntityPtr::getModel()->fullPath().c_str(), ConeModel::instance()->fullPath().c_str());
281  }
282 
283  AGX_FORCE_INLINE ConePtr::ConePtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::ShapePtr(instance)
284  {
285  agxAssertN(!instance || instance.isInstanceOf(ConeModel::instance()),
286  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
287  EntityPtr::getModel()->fullPath().c_str(), ConeModel::instance()->fullPath().c_str());
288  }
289 
290  AGX_FORCE_INLINE ConePtr& ConePtr::operator= (const agxData::EntityPtr& ptr)
291  {
293  agxAssertN(!ptr || ptr.isInstanceOf(ConeModel::instance()),
294  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
295  EntityPtr::getModel()->fullPath().c_str(), ConeModel::instance()->fullPath().c_str());
296  return *this;
297  }
298 
299  AGX_FORCE_INLINE ConePtr& ConePtr::operator= (const agxData::EntityInstance& instance)
300  {
302  agxAssertN(!instance || instance.isInstanceOf(ConeModel::instance()),
303  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
304  EntityPtr::getModel()->fullPath().c_str(), ConeModel::instance()->fullPath().c_str());
305  return *this;
306  }
307 
308  inline ConeInstance ConePtr::instance() { return agxData::EntityPtr::instance(); }
309  inline const ConeInstance ConePtr::instance() const { return agxData::EntityPtr::instance(); }
310  AGX_FORCE_INLINE ConeSemantics* ConePtr::operator->() { return (ConeSemantics* )this; }
311  AGX_FORCE_INLINE const ConeSemantics* ConePtr::operator->() const { return (const ConeSemantics* )this; }
312  AGX_FORCE_INLINE ConeData* ConePtr::getData() { return static_cast<ConeData* >(agxData::EntityPtr::getData()); }
313  AGX_FORCE_INLINE const ConeData* ConePtr::getData() const { return static_cast<const ConeData* >(agxData::EntityPtr::getData()); }
314 
315  AGX_FORCE_INLINE agx::Real& ConePtr::height() { verifyIndex(); return getData()->height[calculateIndex()]; }
316  AGX_FORCE_INLINE agx::Real const& ConePtr::height() const { verifyIndex(); return getData()->height[calculateIndex()]; }
317 
318  AGX_FORCE_INLINE agx::Real& ConePtr::topRadius() { verifyIndex(); return getData()->topRadius[calculateIndex()]; }
319  AGX_FORCE_INLINE agx::Real const& ConePtr::topRadius() const { verifyIndex(); return getData()->topRadius[calculateIndex()]; }
320 
321  AGX_FORCE_INLINE agx::Real& ConePtr::bottomRadius() { verifyIndex(); return getData()->bottomRadius[calculateIndex()]; }
322  AGX_FORCE_INLINE agx::Real const& ConePtr::bottomRadius() const { verifyIndex(); return getData()->bottomRadius[calculateIndex()]; }
323 
324  //-----------------------------------------------------------------------------------------------------
325  AGX_FORCE_INLINE ConeInstance::ConeInstance() {}
326  AGX_FORCE_INLINE ConeInstance::ConeInstance(ConeData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
327  AGX_FORCE_INLINE ConeInstance::ConeInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
328  AGX_FORCE_INLINE ConeInstance::ConeInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
329  {
330  agxAssertN(!other || other.isInstanceOf(ConeModel::instance()),
331  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
333  }
334 
335  AGX_FORCE_INLINE ConeInstance::ConeInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
336  {
338  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
340  }
341 
342 
343  AGX_FORCE_INLINE ConeData* ConeInstance::getData() { return static_cast<ConeData* >(agxData::EntityInstance::getData()); }
344  AGX_FORCE_INLINE const ConeData* ConeInstance::getData() const { return static_cast<const ConeData* >(agxData::EntityInstance::getData()); }
345 
346  AGX_FORCE_INLINE agx::Real& ConeInstance::height() { verifyIndex(); return getData()->height[getIndex()]; }
347  AGX_FORCE_INLINE agx::Real const& ConeInstance::height() const { verifyIndex(); return getData()->height[getIndex()]; }
348 
349  AGX_FORCE_INLINE agx::Real& ConeInstance::topRadius() { verifyIndex(); return getData()->topRadius[getIndex()]; }
350  AGX_FORCE_INLINE agx::Real const& ConeInstance::topRadius() const { verifyIndex(); return getData()->topRadius[getIndex()]; }
351 
352  AGX_FORCE_INLINE agx::Real& ConeInstance::bottomRadius() { verifyIndex(); return getData()->bottomRadius[getIndex()]; }
353  AGX_FORCE_INLINE agx::Real const& ConeInstance::bottomRadius() const { verifyIndex(); return getData()->bottomRadius[getIndex()]; }
354 
355  //-----------------------------------------------------------------------------------------------------
356  AGX_FORCE_INLINE ConeSemantics::ConeSemantics() {}
357  //-----------------------------------------------------------------------------------------------------
359  }
360  }
361 }
362 
363 AGX_TYPE_BINDING(agx::Physics::Geometry::ConePtr, "Physics.Geometry.ConePtr")
364 AGX_TYPE_BINDING(agx::Physics::Geometry::ConeInstance, "Physics.Geometry.ConeInstance")
365 
366 #ifdef _MSC_VER
367 # pragma warning(pop)
368 #endif
369 
370 #undef AGX_ENTITY_WRAPPER
371 #undef AGX_ENTITY_NAMESPACE
372 #endif
373 
agx::Physics::Geometry::ConePtr::DataType
ConeData DataType
Definition: ConeEntity.h:174
agx::Real
double Real
Definition: Real.h:42
agxData::ScalarAttributeT< agx::Real >
agx::Physics::Geometry::ConePtr::ConePtr
AGXPHYSICS_EXPORT ConePtr()
agx::Physics::Geometry::ConePtr::ModelType
ConeModel ModelType
Definition: ConeEntity.h:173
CALLABLE
#define CALLABLE
Definition: macros.h:72
agx::Physics::Geometry::ConeModel::topRadiusAttribute
static agxData::ScalarAttributeT< agx::Real > * topRadiusAttribute
Definition: ConeEntity.h:93
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxData::EntityPtr::getData
agxData::EntityData * getData()
Definition: EntityStorage.h:594
agx::Physics::Geometry::ConeModel::heightAttribute
static agxData::ScalarAttributeT< agx::Real > * heightAttribute
Definition: ConeEntity.h:92
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
macros.h
agxData::EntityPtr::isInstanceOf
bool isInstanceOf(agxData::EntityModel *model) const
Definition: EntityStorage.h:784
agx::Model::fullPath
agx::String fullPath() const
agxData::EntityStorage
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
EntityModel.h
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agxData::EntityPtr::instance
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
agxData::EntityInstance::isInstanceOf
bool isInstanceOf(agxData::EntityModel *model) const
Definition: EntityStorage.h:829
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxData
Contains classes for low level data storage for AGX.
Definition: Container.h:23
ShapeEntity.h
agx::Physics::Geometry::ConeModel::PtrT
ConePtr PtrT
Definition: ConeEntity.h:73
agxData::Array
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
EntityStorage.h
EntityRef.h
EntityPtr.h
agx::Physics::Geometry::ConePtr
Pointer to a entity instance of type Physics.Geometry.Cone.
Definition: ConeEntity.h:170
agx::Physics::Geometry::ConeModel::bottomRadiusAttribute
static agxData::ScalarAttributeT< agx::Real > * bottomRadiusAttribute
Definition: ConeEntity.h:94
EntityInstance.h
Integer.h
agxData::EntityPtr::operator=
EntityPtr & operator=(const EntityPtr &other)=default
agx::Index
UInt32 Index
Definition: Integer.h:52
agx::Physics::Geometry::ShapeModel
Abstract description of the data attributes for the Physics.Geometry.Shape entity.
Definition: ShapeEntity.h:75
agxData::EntityInstance
Entity instance provides access to a single instance in an EntityStorage.
Definition: EntityInstance.h:43
agxData::EntityInstance::getData
agxData::EntityData * getData()
Definition: EntityInstance.h:149
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agx::Physics::Geometry::ShapePtr
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:195
agx::Physics::Geometry::ConeModel::instance
static ConeModel * instance()
agx::Physics::Geometry::ConeModel
Abstract description of the data attributes for the Physics.Geometry.Cone entity.
Definition: ConeEntity.h:70
agxData::EntityRef
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
Definition: EntityRef.h:34
agx::AgXString< std::string >
agxAssertN
#define agxAssertN(expr, format,...)
Definition: debug.h:145
AGX_TYPE_BINDING
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
agx::Physics::Geometry::ConeRef
agxData::EntityRef< ConePtr > ConeRef
Definition: ConeEntity.h:226
Real.h
agxData::EntityPtr
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::Physics::Geometry::ConePtr::InstanceType
ConeInstance InstanceType
Definition: ConeEntity.h:175
agx::getModel
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364