AGX Dynamics  2.35.0.1
WarmStartingDataEntity.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_WARMSTARTINGDATA_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_WARMSTARTINGDATA_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/Vec3.h>
48 #include <agx/Vec4.h>
49 
50 
51 namespace agx
52 {
53  namespace Physics
54  {
55 
56  class WarmStartingDataModel;
57  class WarmStartingDataData;
58  class WarmStartingDataPtr;
59  class WarmStartingDataInstance;
60  class WarmStartingDataSemantics;
61 
62 
64 
69  {
70  public:
72 
73  WarmStartingDataModel(const agx::String& name = "WarmStartingData");
74 
77 
80 
83 
85  virtual void shutdownCleanup() override;
86 
87 
88 
89  /* Attributes */
95 
96  protected:
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;
103  };
104 
105 
107  #ifndef AGX_PHYSICS_WARMSTARTINGDATA_DATA_SET_OVERRIDE
108  #define AGX_PHYSICS_WARMSTARTINGDATA_DATA_SET
109  class AGXPHYSICS_EXPORT WarmStartingDataData : public agxData::EntityData
110  {
111  public:
112  WarmStartingDataInstance operator[] (size_t index);
113 
114  public:
116  agxData::Array< agx::Vec3 > localForce;
118  agxData::Array< agx::Vec3 > shape1pos;
119  agxData::Array< agx::Vec3 > shape2pos;
120  agxData::Array< agx::Vec3 > shape1normal;
121 
122  public:
123  typedef agx::Vec3 localForceType;
124  typedef agx::Vec4i8 indexSetType;
125  typedef agx::Vec3 shape1posType;
126  typedef agx::Vec3 shape2posType;
127  typedef agx::Vec3 shape1normalType;
128 
129  public:
130  WarmStartingDataData(agxData::EntityStorage* storage);
131  WarmStartingDataData();
132 
133  protected:
134  virtual ~WarmStartingDataData() {}
135  virtual void setNumElements(agx::Index numElements) override;
136 
137  private:
138  WarmStartingDataData& operator= (const WarmStartingDataData&) { return *this; }
139 
140  };
141  #endif
143 
144 
146  class AGXPHYSICS_EXPORT WarmStartingDataSemantics : protected agxData::EntityPtr
147  {
148  public:
149 
150  // Automatic getters
151  agx::Vec3 const& getLocalForce() const;
152  agx::Vec4i8 const& getIndexSet() const;
153  agx::Vec3 const& getShape1pos() const;
154  agx::Vec3 const& getShape2pos() const;
155  agx::Vec3 const& getShape1normal() const;
156 
157  // Semantics defined by explicit kernels
158 
159  // Automatic setters
160  void setLocalForce(agx::Vec3 const& value);
161  void setIndexSet(agx::Vec4i8 const& value);
162  void setShape1pos(agx::Vec3 const& value);
163  void setShape2pos(agx::Vec3 const& value);
164  void setShape1normal(agx::Vec3 const& value);
165 
166 
167  protected:
168  friend class WarmStartingDataPtr;
169  friend class WarmStartingDataInstance;
170  WarmStartingDataSemantics();
171  };
173 
174 
175 
178  class CALLABLE WarmStartingDataPtr : public agxData::EntityPtr
179  {
180  public:
182  typedef WarmStartingDataData DataType;
183  typedef WarmStartingDataInstance InstanceType;
184 
185  public:
192  AGXPHYSICS_EXPORT WarmStartingDataInstance instance();
193  AGXPHYSICS_EXPORT const WarmStartingDataInstance instance() const;
194 
195  AGXPHYSICS_EXPORT WarmStartingDataSemantics* operator->();
196  AGXPHYSICS_EXPORT const WarmStartingDataSemantics* operator->() const;
197 
198  WarmStartingDataData* getData();
199  const WarmStartingDataData* getData() const;
200 
201 
206 
211 
216 
221 
226 
228  // Only used by tolua!
229  #ifdef AGX_GENERATED_TOLUA_WRAPPER
230  inline agx::Vec3 const& getLocalForce() const { return (*this)->getLocalForce(); }
231  inline agx::Vec4i8 const& getIndexSet() const { return (*this)->getIndexSet(); }
232  inline agx::Vec3 const& getShape1pos() const { return (*this)->getShape1pos(); }
233  inline agx::Vec3 const& getShape2pos() const { return (*this)->getShape2pos(); }
234  inline agx::Vec3 const& getShape1normal() const { return (*this)->getShape1normal(); }
235 
236 
237  inline void setLocalForce(agx::Vec3 const& value) { (*this)->setLocalForce(value); }
238  inline void setIndexSet(agx::Vec4i8 const& value) { (*this)->setIndexSet(value); }
239  inline void setShape1pos(agx::Vec3 const& value) { (*this)->setShape1pos(value); }
240  inline void setShape2pos(agx::Vec3 const& value) { (*this)->setShape2pos(value); }
241  inline void setShape1normal(agx::Vec3 const& value) { (*this)->setShape1normal(value); }
242  #endif
244 
245  };
246 
247 
249  class AGXPHYSICS_EXPORT WarmStartingDataInstance : public agxData::EntityInstance
250  {
251  public:
252  WarmStartingDataInstance();
253  WarmStartingDataInstance(WarmStartingDataData* data, agx::Index index);
254  WarmStartingDataInstance(agxData::EntityStorage *storage, agx::Index index);
255  WarmStartingDataInstance(const agxData::EntityInstance& other);
256  WarmStartingDataInstance(const agxData::EntityPtr& ptr);
257 
258  WarmStartingDataData* getData();
259  const WarmStartingDataData* getData() const;
260 
261  public:
263  agx::Vec3& localForce();
265  agx::Vec3 const& localForce() const;
266 
268  agx::Vec4i8& indexSet();
270  agx::Vec4i8 const& indexSet() const;
271 
273  agx::Vec3& shape1pos();
275  agx::Vec3 const& shape1pos() const;
276 
278  agx::Vec3& shape2pos();
280  agx::Vec3 const& shape2pos() const;
281 
283  agx::Vec3& shape1normal();
285  agx::Vec3 const& shape1normal() const;
286 
287  };
289 
290 
291 
294 
295 
296 
298  /* Implementation */
299  //-----------------------------------------------------------------------------------------------------
300  //-----------------------------------------------------------------------------------------------------
301  inline WarmStartingDataInstance agx::Physics::WarmStartingDataData::operator[] (size_t index) { return WarmStartingDataInstance(this, (agx::Index)index); }
302  //-----------------------------------------------------------------------------------------------------
305  AGX_FORCE_INLINE WarmStartingDataPtr::WarmStartingDataPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
306  {
308  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
310  }
311 
312  AGX_FORCE_INLINE WarmStartingDataPtr::WarmStartingDataPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
313  {
315  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
317  }
318 
319  AGX_FORCE_INLINE WarmStartingDataPtr& WarmStartingDataPtr::operator= (const agxData::EntityPtr& ptr)
320  {
322  agxAssertN(!ptr || ptr.isInstanceOf(WarmStartingDataModel::instance()),
323  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
324  EntityPtr::getModel()->fullPath().c_str(), WarmStartingDataModel::instance()->fullPath().c_str());
325  return *this;
326  }
327 
328  AGX_FORCE_INLINE WarmStartingDataPtr& WarmStartingDataPtr::operator= (const agxData::EntityInstance& instance)
329  {
331  agxAssertN(!instance || instance.isInstanceOf(WarmStartingDataModel::instance()),
332  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
333  EntityPtr::getModel()->fullPath().c_str(), WarmStartingDataModel::instance()->fullPath().c_str());
334  return *this;
335  }
336 
337  inline WarmStartingDataInstance WarmStartingDataPtr::instance() { return agxData::EntityPtr::instance(); }
338  inline const WarmStartingDataInstance WarmStartingDataPtr::instance() const { return agxData::EntityPtr::instance(); }
339  AGX_FORCE_INLINE WarmStartingDataSemantics* WarmStartingDataPtr::operator->() { return (WarmStartingDataSemantics* )this; }
340  AGX_FORCE_INLINE const WarmStartingDataSemantics* WarmStartingDataPtr::operator->() const { return (const WarmStartingDataSemantics* )this; }
341  AGX_FORCE_INLINE WarmStartingDataData* WarmStartingDataPtr::getData() { return static_cast<WarmStartingDataData* >(agxData::EntityPtr::getData()); }
342  AGX_FORCE_INLINE const WarmStartingDataData* WarmStartingDataPtr::getData() const { return static_cast<const WarmStartingDataData* >(agxData::EntityPtr::getData()); }
343 
344  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::localForce() { verifyIndex(); return getData()->localForce[calculateIndex()]; }
345  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::localForce() const { verifyIndex(); return getData()->localForce[calculateIndex()]; }
346 
347  AGX_FORCE_INLINE agx::Vec4i8& WarmStartingDataPtr::indexSet() { verifyIndex(); return getData()->indexSet[calculateIndex()]; }
348  AGX_FORCE_INLINE agx::Vec4i8 const& WarmStartingDataPtr::indexSet() const { verifyIndex(); return getData()->indexSet[calculateIndex()]; }
349 
350  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::shape1pos() { verifyIndex(); return getData()->shape1pos[calculateIndex()]; }
351  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::shape1pos() const { verifyIndex(); return getData()->shape1pos[calculateIndex()]; }
352 
353  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::shape2pos() { verifyIndex(); return getData()->shape2pos[calculateIndex()]; }
354  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::shape2pos() const { verifyIndex(); return getData()->shape2pos[calculateIndex()]; }
355 
356  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::shape1normal() { verifyIndex(); return getData()->shape1normal[calculateIndex()]; }
357  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::shape1normal() const { verifyIndex(); return getData()->shape1normal[calculateIndex()]; }
358 
359  //-----------------------------------------------------------------------------------------------------
360  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance() {}
361  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(WarmStartingDataData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
362  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
363  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
364  {
366  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
368  }
369 
370  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
371  {
373  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
375  }
376 
377 
378  AGX_FORCE_INLINE WarmStartingDataData* WarmStartingDataInstance::getData() { return static_cast<WarmStartingDataData* >(agxData::EntityInstance::getData()); }
379  AGX_FORCE_INLINE const WarmStartingDataData* WarmStartingDataInstance::getData() const { return static_cast<const WarmStartingDataData* >(agxData::EntityInstance::getData()); }
380 
381  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::localForce() { verifyIndex(); return getData()->localForce[getIndex()]; }
382  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::localForce() const { verifyIndex(); return getData()->localForce[getIndex()]; }
383 
384  AGX_FORCE_INLINE agx::Vec4i8& WarmStartingDataInstance::indexSet() { verifyIndex(); return getData()->indexSet[getIndex()]; }
385  AGX_FORCE_INLINE agx::Vec4i8 const& WarmStartingDataInstance::indexSet() const { verifyIndex(); return getData()->indexSet[getIndex()]; }
386 
387  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::shape1pos() { verifyIndex(); return getData()->shape1pos[getIndex()]; }
388  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::shape1pos() const { verifyIndex(); return getData()->shape1pos[getIndex()]; }
389 
390  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::shape2pos() { verifyIndex(); return getData()->shape2pos[getIndex()]; }
391  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::shape2pos() const { verifyIndex(); return getData()->shape2pos[getIndex()]; }
392 
393  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::shape1normal() { verifyIndex(); return getData()->shape1normal[getIndex()]; }
394  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::shape1normal() const { verifyIndex(); return getData()->shape1normal[getIndex()]; }
395 
396  //-----------------------------------------------------------------------------------------------------
397  AGX_FORCE_INLINE WarmStartingDataSemantics::WarmStartingDataSemantics() {}
398  //-----------------------------------------------------------------------------------------------------
400  }
401 }
402 
403 AGX_TYPE_BINDING(agx::Physics::WarmStartingDataPtr, "Physics.WarmStartingDataPtr")
404 AGX_TYPE_BINDING(agx::Physics::WarmStartingDataInstance, "Physics.WarmStartingDataInstance")
405 
406 #ifdef _MSC_VER
407 # pragma warning(pop)
408 #endif
409 
410 #undef AGX_ENTITY_WRAPPER
411 #undef AGX_ENTITY_NAMESPACE
412 #endif
413 
#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
agx::String fullPath() const
Abstract description of the data attributes for the Physics.WarmStartingData entity.
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Vec3 > * shape2posAttribute
void construct(agx::Physics::WarmStartingDataPtr warmStartingData)
WarmStartingDataModel(const agx::String &name="WarmStartingData")
virtual void configure(agx::TiXmlElement *eEntity) override
static WarmStartingDataModel * instance()
static WarmStartingDataPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Vec3 > * localForceAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * shape1posAttribute
virtual void initAttributeAccessors() override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::ScalarAttributeT< agx::Vec4i8 > * indexSetAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * shape1normalAttribute
Pointer to a entity instance of type Physics.WarmStartingData.
AGXPHYSICS_EXPORT agx::Vec3 & shape1pos()
AGXPHYSICS_EXPORT agx::Vec3 & shape2pos()
AGXPHYSICS_EXPORT WarmStartingDataPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Vec3 const & shape1pos() const
const WarmStartingDataData * getData() const
AGXPHYSICS_EXPORT agx::Vec4i8 & indexSet()
AGXPHYSICS_EXPORT WarmStartingDataPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::Vec3 & localForce()
AGXPHYSICS_EXPORT agx::Vec3 const & shape1normal() const
AGXPHYSICS_EXPORT agx::Vec4i8 const & indexSet() const
AGXPHYSICS_EXPORT agx::Vec3 const & shape2pos() const
AGXPHYSICS_EXPORT agx::Vec3 const & localForce() const
AGXPHYSICS_EXPORT const WarmStartingDataInstance instance() const
AGXPHYSICS_EXPORT WarmStartingDataInstance instance()
AGXPHYSICS_EXPORT WarmStartingDataPtr()
AGXPHYSICS_EXPORT agx::Vec3 & shape1normal()
AGXPHYSICS_EXPORT const WarmStartingDataSemantics * operator->() const
AGXPHYSICS_EXPORT WarmStartingDataSemantics * operator->()
WarmStartingDataData * getData()
AGXPHYSICS_EXPORT WarmStartingDataPtr(const agxData::EntityPtr &ptr)
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
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