AGX Dynamics  2.35.0.1
SolveGroupEntity.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_SOLVEGROUP_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_SOLVEGROUP_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>
49 namespace agx { class SolveModel; }
50 
51 namespace agx { namespace Physics { class SolveIslandPtr; }}
52 
53 namespace agx
54 {
55  namespace Physics
56  {
57 
58  class SolveGroupModel;
59  class SolveGroupData;
60  class SolveGroupPtr;
61  class SolveGroupInstance;
62  class SolveGroupSemantics;
63 
64 
66 
71  {
72  public:
74 
75  SolveGroupModel(const agx::String& name = "SolveGroup");
76 
79 
82 
85 
87  virtual void shutdownCleanup() override;
88 
89 
90 
91  /* Attributes */
94 
95  protected:
96  virtual ~SolveGroupModel();
97  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
98  virtual void configure(agx::TiXmlElement* eEntity) override;
99  virtual void initAttributeAccessors() override;
100  virtual void construct(agxData::EntityPtr instance) override;
102  };
103 
104 
106  #ifndef AGX_PHYSICS_SOLVEGROUP_DATA_SET_OVERRIDE
107  #define AGX_PHYSICS_SOLVEGROUP_DATA_SET
108  class AGXPHYSICS_EXPORT SolveGroupData : public agx::Physics::InteractionGroupData
109  {
110  public:
111  SolveGroupInstance operator[] (size_t index);
112 
113  public:
117 
118  public:
119  typedef agx::Physics::SolveIslandPtr islandType;
120  typedef agx::SolveModel* solveModelType;
121 
122  public:
123  SolveGroupData(agxData::EntityStorage* storage);
124  SolveGroupData();
125 
126  protected:
127  virtual ~SolveGroupData() {}
128  virtual void setNumElements(agx::Index numElements) override;
129 
130  private:
131  SolveGroupData& operator= (const SolveGroupData&) { return *this; }
132 
133  };
134  #endif
136 
137 
139  class AGXPHYSICS_EXPORT SolveGroupSemantics : public agx::Physics::InteractionGroupSemantics
140  {
141  public:
142 
143  // Automatic getters
144  agx::Physics::SolveIslandPtr const& getIsland() const;
145  agx::SolveModel* const& getSolveModel() const;
146 
147  // Semantics defined by explicit kernels
148 
149  // Automatic setters
150  void setIsland(agx::Physics::SolveIslandPtr const& value);
151  void setSolveModel(agx::SolveModel* const& value);
152 
153 
154  protected:
155  friend class SolveGroupPtr;
156  friend class SolveGroupInstance;
157  SolveGroupSemantics();
158  };
160 
161 
162 
166  {
167  public:
169  typedef SolveGroupData DataType;
170  typedef SolveGroupInstance InstanceType;
171 
172  public:
179  AGXPHYSICS_EXPORT SolveGroupInstance instance();
180  AGXPHYSICS_EXPORT const SolveGroupInstance instance() const;
181 
182  AGXPHYSICS_EXPORT SolveGroupSemantics* operator->();
183  AGXPHYSICS_EXPORT const SolveGroupSemantics* operator->() const;
184 
185  SolveGroupData* getData();
186  const SolveGroupData* getData() const;
187 
188 
193 
195  AGXPHYSICS_EXPORT agx::SolveModel*& solveModel();
197  AGXPHYSICS_EXPORT agx::SolveModel* const& solveModel() const;
198 
200  // Only used by tolua!
201  #ifdef AGX_GENERATED_TOLUA_WRAPPER
202  inline agx::Physics::SolveIslandPtr const& getIsland() const { return (*this)->getIsland(); }
203  inline agx::SolveModel* const& getSolveModel() const { return (*this)->getSolveModel(); }
204 
205 
206  inline void setIsland(agx::Physics::SolveIslandPtr const& value) { (*this)->setIsland(value); }
207  inline void setSolveModel(agx::SolveModel* const& value) { (*this)->setSolveModel(value); }
208  #endif
210 
211  };
212 
213 
215  class AGXPHYSICS_EXPORT SolveGroupInstance : public agx::Physics::InteractionGroupInstance
216  {
217  public:
218  SolveGroupInstance();
219  SolveGroupInstance(SolveGroupData* data, agx::Index index);
220  SolveGroupInstance(agxData::EntityStorage *storage, agx::Index index);
221  SolveGroupInstance(const agxData::EntityInstance& other);
222  SolveGroupInstance(const agxData::EntityPtr& ptr);
223 
224  SolveGroupData* getData();
225  const SolveGroupData* getData() const;
226 
227  public:
231  agx::Physics::SolveIslandPtr const& island() const;
232 
234  agx::SolveModel*& solveModel();
236  agx::SolveModel* const& solveModel() const;
237 
238  };
240 
241 
242 
245 
246 
247 
249  /* Implementation */
250  //-----------------------------------------------------------------------------------------------------
251  //-----------------------------------------------------------------------------------------------------
252  inline SolveGroupInstance agx::Physics::SolveGroupData::operator[] (size_t index) { return SolveGroupInstance(this, (agx::Index)index); }
253  //-----------------------------------------------------------------------------------------------------
255  AGX_FORCE_INLINE SolveGroupPtr::SolveGroupPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::InteractionGroupPtr(storage, id) {}
256  AGX_FORCE_INLINE SolveGroupPtr::SolveGroupPtr(const agxData::EntityPtr& ptr) : agx::Physics::InteractionGroupPtr(ptr)
257  {
259  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
261  }
262 
263  AGX_FORCE_INLINE SolveGroupPtr::SolveGroupPtr(const agxData::EntityInstance& instance) : agx::Physics::InteractionGroupPtr(instance)
264  {
265  agxAssertN(!instance || instance.isInstanceOf(SolveGroupModel::instance()),
266  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
268  }
269 
270  AGX_FORCE_INLINE SolveGroupPtr& SolveGroupPtr::operator= (const agxData::EntityPtr& ptr)
271  {
273  agxAssertN(!ptr || ptr.isInstanceOf(SolveGroupModel::instance()),
274  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
275  EntityPtr::getModel()->fullPath().c_str(), SolveGroupModel::instance()->fullPath().c_str());
276  return *this;
277  }
278 
279  AGX_FORCE_INLINE SolveGroupPtr& SolveGroupPtr::operator= (const agxData::EntityInstance& instance)
280  {
282  agxAssertN(!instance || instance.isInstanceOf(SolveGroupModel::instance()),
283  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
284  EntityPtr::getModel()->fullPath().c_str(), SolveGroupModel::instance()->fullPath().c_str());
285  return *this;
286  }
287 
288  inline SolveGroupInstance SolveGroupPtr::instance() { return agxData::EntityPtr::instance(); }
289  inline const SolveGroupInstance SolveGroupPtr::instance() const { return agxData::EntityPtr::instance(); }
290  AGX_FORCE_INLINE SolveGroupSemantics* SolveGroupPtr::operator->() { return (SolveGroupSemantics* )this; }
291  AGX_FORCE_INLINE const SolveGroupSemantics* SolveGroupPtr::operator->() const { return (const SolveGroupSemantics* )this; }
292  AGX_FORCE_INLINE SolveGroupData* SolveGroupPtr::getData() { return static_cast<SolveGroupData* >(agxData::EntityPtr::getData()); }
293  AGX_FORCE_INLINE const SolveGroupData* SolveGroupPtr::getData() const { return static_cast<const SolveGroupData* >(agxData::EntityPtr::getData()); }
294 
295  AGX_FORCE_INLINE agx::Physics::SolveIslandPtr& SolveGroupPtr::island() { verifyIndex(); return getData()->island[calculateIndex()]; }
296  AGX_FORCE_INLINE agx::Physics::SolveIslandPtr const& SolveGroupPtr::island() const { verifyIndex(); return getData()->island[calculateIndex()]; }
297 
298  AGX_FORCE_INLINE agx::SolveModel*& SolveGroupPtr::solveModel() { verifyIndex(); return getData()->solveModel[calculateIndex()]; }
299  AGX_FORCE_INLINE agx::SolveModel* const& SolveGroupPtr::solveModel() const { verifyIndex(); return getData()->solveModel[calculateIndex()]; }
300 
301  //-----------------------------------------------------------------------------------------------------
302  AGX_FORCE_INLINE SolveGroupInstance::SolveGroupInstance() {}
303  AGX_FORCE_INLINE SolveGroupInstance::SolveGroupInstance(SolveGroupData* data, agx::Index index) : agx::Physics::InteractionGroupInstance(data, index) {}
304  AGX_FORCE_INLINE SolveGroupInstance::SolveGroupInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::InteractionGroupInstance(storage, index) {}
305  AGX_FORCE_INLINE SolveGroupInstance::SolveGroupInstance(const agxData::EntityInstance& other) : agx::Physics::InteractionGroupInstance(other)
306  {
308  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
310  }
311 
312  AGX_FORCE_INLINE SolveGroupInstance::SolveGroupInstance(const agxData::EntityPtr& ptr) : agx::Physics::InteractionGroupInstance(ptr)
313  {
315  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
317  }
318 
319 
320  AGX_FORCE_INLINE SolveGroupData* SolveGroupInstance::getData() { return static_cast<SolveGroupData* >(agxData::EntityInstance::getData()); }
321  AGX_FORCE_INLINE const SolveGroupData* SolveGroupInstance::getData() const { return static_cast<const SolveGroupData* >(agxData::EntityInstance::getData()); }
322 
323  AGX_FORCE_INLINE agx::Physics::SolveIslandPtr& SolveGroupInstance::island() { verifyIndex(); return getData()->island[getIndex()]; }
324  AGX_FORCE_INLINE agx::Physics::SolveIslandPtr const& SolveGroupInstance::island() const { verifyIndex(); return getData()->island[getIndex()]; }
325 
326  AGX_FORCE_INLINE agx::SolveModel*& SolveGroupInstance::solveModel() { verifyIndex(); return getData()->solveModel[getIndex()]; }
327  AGX_FORCE_INLINE agx::SolveModel* const& SolveGroupInstance::solveModel() const { verifyIndex(); return getData()->solveModel[getIndex()]; }
328 
329  //-----------------------------------------------------------------------------------------------------
330  AGX_FORCE_INLINE SolveGroupSemantics::SolveGroupSemantics() {}
331  //-----------------------------------------------------------------------------------------------------
333  }
334 }
335 
336 AGX_TYPE_BINDING(agx::Physics::SolveGroupPtr, "Physics.SolveGroupPtr")
337 AGX_TYPE_BINDING(agx::Physics::SolveGroupInstance, "Physics.SolveGroupInstance")
338 
339 #ifdef _MSC_VER
340 # pragma warning(pop)
341 #endif
342 
343 #undef AGX_ENTITY_WRAPPER
344 #undef AGX_ENTITY_NAMESPACE
345 #endif
346 
#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()
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
agx::String fullPath() const
Abstract description of the data attributes for the Physics.InteractionGroup entity.
Pointer to a entity instance of type Physics.InteractionGroup.
Abstract description of the data attributes for the Physics.SolveGroup entity.
void construct(agx::Physics::SolveGroupPtr solveGroup)
static agxData::EntityStorage * defaultStorage()
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Physics::SolveIslandPtr > * islandAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::PointerAttributeT< agx::SolveModel * > * solveModelAttribute
static SolveGroupModel * instance()
static SolveGroupPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
SolveGroupModel(const agx::String &name="SolveGroup")
virtual void initAttributeAccessors() override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
Pointer to a entity instance of type Physics.SolveGroup.
const SolveGroupData * getData() const
AGXPHYSICS_EXPORT agx::SolveModel *const & solveModel() const
SolveGroupInstance InstanceType
AGXPHYSICS_EXPORT SolveGroupPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const SolveGroupInstance instance() const
SolveGroupData * getData()
AGXPHYSICS_EXPORT agx::Physics::SolveIslandPtr & island()
AGXPHYSICS_EXPORT SolveGroupSemantics * operator->()
AGXPHYSICS_EXPORT SolveGroupPtr()
AGXPHYSICS_EXPORT SolveGroupPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT SolveGroupPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT const SolveGroupSemantics * operator->() const
AGXPHYSICS_EXPORT SolveGroupInstance instance()
AGXPHYSICS_EXPORT agx::Physics::SolveIslandPtr const & island() const
AGXPHYSICS_EXPORT agx::SolveModel *& solveModel()
Pointer to a entity instance of type Physics.SolveIsland.
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.
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52