AGX Dynamics  2.37.2.0
WarmStartingDataEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
76  static WarmStartingDataModel* instance();
77 
79  static WarmStartingDataPtr createInstance();
80 
82  static agxData::EntityStorage* defaultStorage();
83 
85  virtual void shutdownCleanup() override;
86 
87 
88 
89  /* Attributes */
95 
96  protected:
97  virtual ~WarmStartingDataModel();
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::WarmStartingDataPtr warmStartingData);
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 
203  AGXPHYSICS_EXPORT agx::Vec3& localForce();
205  AGXPHYSICS_EXPORT agx::Vec3 const& localForce() const;
206 
208  AGXPHYSICS_EXPORT agx::Vec4i8& indexSet();
210  AGXPHYSICS_EXPORT agx::Vec4i8 const& indexSet() const;
211 
213  AGXPHYSICS_EXPORT agx::Vec3& shape1pos();
215  AGXPHYSICS_EXPORT agx::Vec3 const& shape1pos() const;
216 
218  AGXPHYSICS_EXPORT agx::Vec3& shape2pos();
220  AGXPHYSICS_EXPORT agx::Vec3 const& shape2pos() const;
221 
223  AGXPHYSICS_EXPORT agx::Vec3& shape1normal();
225  AGXPHYSICS_EXPORT agx::Vec3 const& shape1normal() const;
226 
227  };
228 
229 
231  class AGXPHYSICS_EXPORT WarmStartingDataInstance : public agxData::EntityInstance
232  {
233  public:
234  WarmStartingDataInstance();
235  WarmStartingDataInstance(WarmStartingDataData* data, agx::Index index);
236  WarmStartingDataInstance(agxData::EntityStorage *storage, agx::Index index);
237  WarmStartingDataInstance(const agxData::EntityInstance& other);
238  WarmStartingDataInstance(const agxData::EntityPtr& ptr);
239 
240  WarmStartingDataData* getData();
241  const WarmStartingDataData* getData() const;
242 
243  public:
245  agx::Vec3& localForce();
247  agx::Vec3 const& localForce() const;
248 
250  agx::Vec4i8& indexSet();
252  agx::Vec4i8 const& indexSet() const;
253 
255  agx::Vec3& shape1pos();
257  agx::Vec3 const& shape1pos() const;
258 
260  agx::Vec3& shape2pos();
262  agx::Vec3 const& shape2pos() const;
263 
265  agx::Vec3& shape1normal();
267  agx::Vec3 const& shape1normal() const;
268 
269  };
271 
272 
273 
276 
277 
278 
280  /* Implementation */
281  //-----------------------------------------------------------------------------------------------------
282  //-----------------------------------------------------------------------------------------------------
283  inline WarmStartingDataInstance agx::Physics::WarmStartingDataData::operator[] (size_t index) { return WarmStartingDataInstance(this, (agx::Index)index); }
284  //-----------------------------------------------------------------------------------------------------
288  {
290  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
292  }
293 
295  {
297  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
299  }
300 
302  {
305  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
307  return *this;
308  }
309 
311  {
314  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
316  return *this;
317  }
318 
319  inline WarmStartingDataInstance WarmStartingDataPtr::instance() { return agxData::EntityPtr::instance(); }
320  inline const WarmStartingDataInstance WarmStartingDataPtr::instance() const { return agxData::EntityPtr::instance(); }
321  AGX_FORCE_INLINE WarmStartingDataSemantics* WarmStartingDataPtr::operator->() { return (WarmStartingDataSemantics* )this; }
322  AGX_FORCE_INLINE const WarmStartingDataSemantics* WarmStartingDataPtr::operator->() const { return (const WarmStartingDataSemantics* )this; }
323  AGX_FORCE_INLINE WarmStartingDataData* WarmStartingDataPtr::getData() { return static_cast<WarmStartingDataData* >(agxData::EntityPtr::getData()); }
324  AGX_FORCE_INLINE const WarmStartingDataData* WarmStartingDataPtr::getData() const { return static_cast<const WarmStartingDataData* >(agxData::EntityPtr::getData()); }
325 
326  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::localForce() { verifyIndex(); return getData()->localForce[calculateIndex()]; }
327  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::localForce() const { verifyIndex(); return getData()->localForce[calculateIndex()]; }
328 
329  AGX_FORCE_INLINE agx::Vec4i8& WarmStartingDataPtr::indexSet() { verifyIndex(); return getData()->indexSet[calculateIndex()]; }
330  AGX_FORCE_INLINE agx::Vec4i8 const& WarmStartingDataPtr::indexSet() const { verifyIndex(); return getData()->indexSet[calculateIndex()]; }
331 
332  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::shape1pos() { verifyIndex(); return getData()->shape1pos[calculateIndex()]; }
333  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::shape1pos() const { verifyIndex(); return getData()->shape1pos[calculateIndex()]; }
334 
335  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::shape2pos() { verifyIndex(); return getData()->shape2pos[calculateIndex()]; }
336  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::shape2pos() const { verifyIndex(); return getData()->shape2pos[calculateIndex()]; }
337 
338  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataPtr::shape1normal() { verifyIndex(); return getData()->shape1normal[calculateIndex()]; }
339  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataPtr::shape1normal() const { verifyIndex(); return getData()->shape1normal[calculateIndex()]; }
340 
341  //-----------------------------------------------------------------------------------------------------
342  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance() {}
343  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(WarmStartingDataData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
344  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
345  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
346  {
348  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
350  }
351 
352  AGX_FORCE_INLINE WarmStartingDataInstance::WarmStartingDataInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
353  {
355  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
357  }
358 
359 
360  AGX_FORCE_INLINE WarmStartingDataData* WarmStartingDataInstance::getData() { return static_cast<WarmStartingDataData* >(agxData::EntityInstance::getData()); }
361  AGX_FORCE_INLINE const WarmStartingDataData* WarmStartingDataInstance::getData() const { return static_cast<const WarmStartingDataData* >(agxData::EntityInstance::getData()); }
362 
363  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::localForce() { verifyIndex(); return getData()->localForce[getIndex()]; }
364  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::localForce() const { verifyIndex(); return getData()->localForce[getIndex()]; }
365 
366  AGX_FORCE_INLINE agx::Vec4i8& WarmStartingDataInstance::indexSet() { verifyIndex(); return getData()->indexSet[getIndex()]; }
367  AGX_FORCE_INLINE agx::Vec4i8 const& WarmStartingDataInstance::indexSet() const { verifyIndex(); return getData()->indexSet[getIndex()]; }
368 
369  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::shape1pos() { verifyIndex(); return getData()->shape1pos[getIndex()]; }
370  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::shape1pos() const { verifyIndex(); return getData()->shape1pos[getIndex()]; }
371 
372  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::shape2pos() { verifyIndex(); return getData()->shape2pos[getIndex()]; }
373  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::shape2pos() const { verifyIndex(); return getData()->shape2pos[getIndex()]; }
374 
375  AGX_FORCE_INLINE agx::Vec3& WarmStartingDataInstance::shape1normal() { verifyIndex(); return getData()->shape1normal[getIndex()]; }
376  AGX_FORCE_INLINE agx::Vec3 const& WarmStartingDataInstance::shape1normal() const { verifyIndex(); return getData()->shape1normal[getIndex()]; }
377 
378  //-----------------------------------------------------------------------------------------------------
379  AGX_FORCE_INLINE WarmStartingDataSemantics::WarmStartingDataSemantics() {}
380  //-----------------------------------------------------------------------------------------------------
382  }
383 }
384 
385 AGX_TYPE_BINDING(agx::Physics::WarmStartingDataPtr, "Physics.WarmStartingDataPtr")
386 AGX_TYPE_BINDING(agx::Physics::WarmStartingDataInstance, "Physics.WarmStartingDataInstance")
387 
388 #ifdef _MSC_VER
389 # pragma warning(pop)
390 #endif
391 
392 #undef AGX_ENTITY_WRAPPER
393 #undef AGX_ENTITY_NAMESPACE
394 #endif
395 
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
static agxData::ScalarAttributeT< agx::Vec3 > * shape2posAttribute
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
#define agxAssertN(expr, format,...)
Definition: debug.h:145
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
agxData::EntityData * getData()
agx::String fullPath() const
static agxData::ScalarAttributeT< agx::Vec3 > * shape1posAttribute
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
Abstract description of the data attributes for the Physics.WarmStartingData entity.
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363
#define AGXPHYSICS_EXPORT
AGXPHYSICS_EXPORT agx::Vec3 & shape2pos()
AGXPHYSICS_EXPORT WarmStartingDataPtr & operator=(const agxData::EntityPtr &ptr)
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
#define AGX_FORCE_INLINE
Definition: Object.h:59
static agxData::ScalarAttributeT< agx::Vec3 > * shape1normalAttribute
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXPHYSICS_EXPORT WarmStartingDataInstance instance()
AGXPHYSICS_EXPORT WarmStartingDataPtr()
AGXPHYSICS_EXPORT WarmStartingDataSemantics * operator->()
AGXPHYSICS_EXPORT agx::Vec3 & shape1normal()
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
AGXPHYSICS_EXPORT agx::Vec4i8 & indexSet()
static agxData::ScalarAttributeT< agx::Vec3 > * localForceAttribute
Pointer to a entity instance of type Physics.WarmStartingData.
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:63
#define CALLABLE
Definition: Object.h:73
AGXPHYSICS_EXPORT agx::Vec3 & localForce()
bool isInstanceOf(agxData::EntityModel *model) const
AGXPHYSICS_EXPORT agx::Vec3 & shape1pos()
static agxData::ScalarAttributeT< agx::Vec4i8 > * indexSetAttribute
WarmStartingDataData * getData()
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
static WarmStartingDataModel * instance()