AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
StrongInteractionEntity.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
18// AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20
21#ifndef GENERATED_AGX_PHYSICS_STRONGINTERACTION_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_STRONGINTERACTION_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>
41#include <agxData/EntityRef.h>
42#include <agxData/EntityPtr.h>
44#include <agx/Integer.h>
45#include <agx/Real.h>
46#include <agx/macros.h>
48#include <agx/Integer.h>
49namespace agx { class StrongInteraction; }
50
51
52namespace agx
53{
54 namespace Physics
55 {
56
57 class StrongInteractionModel;
58 class StrongInteractionData;
59 class StrongInteractionPtr;
60 class StrongInteractionInstance;
61 class StrongInteractionSemantics;
62
63
65
70 {
71 public:
73
74 StrongInteractionModel(const agx::String& name = "StrongInteraction");
75
78
81
84
86 virtual void shutdownCleanup() override;
87
88
89
90 /* Attributes */
94
95 protected:
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_STRONGINTERACTION_DATA_SET_OVERRIDE
107 #define AGX_PHYSICS_STRONGINTERACTION_DATA_SET
108 class AGXPHYSICS_EXPORT StrongInteractionData : public agx::Physics::InteractionData
109 {
110 public:
111 StrongInteractionInstance operator[] (size_t index);
112
113 public:
118
119 public:
120 typedef agx::StrongInteraction* modelType;
121 typedef agx::UInt body1Type;
122 typedef agx::UInt body2Type;
123
124 public:
125 StrongInteractionData(agxData::EntityStorage* storage);
126 StrongInteractionData();
127
128 protected:
129 virtual ~StrongInteractionData() {}
130 virtual void setNumElements(agx::Index numElements) override;
131
132 private:
133 StrongInteractionData& operator= (const StrongInteractionData&) { return *this; }
134
135 };
136 #endif
138
139
141 class AGXPHYSICS_EXPORT StrongInteractionSemantics : public agx::Physics::InteractionSemantics
142 {
143 public:
144
145 // Automatic getters
146 agx::StrongInteraction* const& getModel() const;
147 agx::UInt const& getBody1() const;
148 agx::UInt const& getBody2() const;
149
150 // Semantics defined by explicit kernels
151
152 // Automatic setters
153 void setModel(agx::StrongInteraction* const& value);
154 void setBody1(agx::UInt const& value);
155 void setBody2(agx::UInt const& value);
156
157
158 protected:
159 friend class StrongInteractionPtr;
160 friend class StrongInteractionInstance;
161 StrongInteractionSemantics();
162 };
164
165
166
170 {
171 public:
173 typedef StrongInteractionData DataType;
174 typedef StrongInteractionInstance InstanceType;
175
176 public:
183 AGXPHYSICS_EXPORT StrongInteractionInstance instance();
184 AGXPHYSICS_EXPORT const StrongInteractionInstance instance() const;
185
186 AGXPHYSICS_EXPORT StrongInteractionSemantics* operator->();
187 AGXPHYSICS_EXPORT const StrongInteractionSemantics* operator->() const;
188
189 StrongInteractionData* getData();
190 const StrongInteractionData* getData() const;
191
192
197
202
207
208 };
209
210
212 class AGXPHYSICS_EXPORT StrongInteractionInstance : public agx::Physics::InteractionInstance
213 {
214 public:
215 StrongInteractionInstance();
216 StrongInteractionInstance(StrongInteractionData* data, agx::Index index);
217 StrongInteractionInstance(agxData::EntityStorage *storage, agx::Index index);
218 StrongInteractionInstance(const agxData::EntityInstance& other);
219 StrongInteractionInstance(const agxData::EntityPtr& ptr);
220
221 StrongInteractionData* getData();
222 const StrongInteractionData* getData() const;
223
224 public:
226 agx::StrongInteraction*& model();
228 agx::StrongInteraction* const& model() const;
229
231 agx::UInt& body1();
233 agx::UInt const& body1() const;
234
236 agx::UInt& body2();
238 agx::UInt const& body2() const;
239
240 };
242
243
244
247
248
249
251 /* Implementation */
252 //-----------------------------------------------------------------------------------------------------
253 //-----------------------------------------------------------------------------------------------------
254 inline StrongInteractionInstance agx::Physics::StrongInteractionData::operator[] (size_t index) { return StrongInteractionInstance(this, (agx::Index)index); }
255 //-----------------------------------------------------------------------------------------------------
257 AGX_FORCE_INLINE StrongInteractionPtr::StrongInteractionPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::InteractionPtr(storage, id) {}
258 AGX_FORCE_INLINE StrongInteractionPtr::StrongInteractionPtr(const agxData::EntityPtr& ptr) : agx::Physics::InteractionPtr(ptr)
259 {
261 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
262 EntityPtr::getModel()->fullPath().c_str(), StrongInteractionModel::instance()->fullPath().c_str());
263 }
264
265 AGX_FORCE_INLINE StrongInteractionPtr::StrongInteractionPtr(const agxData::EntityInstance& instance) : agx::Physics::InteractionPtr(instance)
266 {
268 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
269 EntityPtr::getModel()->fullPath().c_str(), StrongInteractionModel::instance()->fullPath().c_str());
270 }
271
272 AGX_FORCE_INLINE StrongInteractionPtr& StrongInteractionPtr::operator= (const agxData::EntityPtr& ptr)
273 {
275 agxAssertN(!ptr || ptr.isInstanceOf(StrongInteractionModel::instance()),
276 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
277 EntityPtr::getModel()->fullPath().c_str(), StrongInteractionModel::instance()->fullPath().c_str());
278 return *this;
279 }
280
281 AGX_FORCE_INLINE StrongInteractionPtr& StrongInteractionPtr::operator= (const agxData::EntityInstance& instance)
282 {
284 agxAssertN(!instance || instance.isInstanceOf(StrongInteractionModel::instance()),
285 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
286 EntityPtr::getModel()->fullPath().c_str(), StrongInteractionModel::instance()->fullPath().c_str());
287 return *this;
288 }
289
290 inline StrongInteractionInstance StrongInteractionPtr::instance() { return agxData::EntityPtr::instance(); }
291 inline const StrongInteractionInstance StrongInteractionPtr::instance() const { return agxData::EntityPtr::instance(); }
292 AGX_FORCE_INLINE StrongInteractionSemantics* StrongInteractionPtr::operator->() { return (StrongInteractionSemantics* )this; }
293 AGX_FORCE_INLINE const StrongInteractionSemantics* StrongInteractionPtr::operator->() const { return (const StrongInteractionSemantics* )this; }
294 AGX_FORCE_INLINE StrongInteractionData* StrongInteractionPtr::getData() { return static_cast<StrongInteractionData* >(agxData::EntityPtr::getData()); }
295 AGX_FORCE_INLINE const StrongInteractionData* StrongInteractionPtr::getData() const { return static_cast<const StrongInteractionData* >(agxData::EntityPtr::getData()); }
296
297 AGX_FORCE_INLINE agx::StrongInteraction*& StrongInteractionPtr::model() { verifyIndex(); return getData()->model[calculateIndex()]; }
298 AGX_FORCE_INLINE agx::StrongInteraction* const& StrongInteractionPtr::model() const { verifyIndex(); return getData()->model[calculateIndex()]; }
299
300 AGX_FORCE_INLINE agx::UInt& StrongInteractionPtr::body1() { verifyIndex(); return getData()->body1[calculateIndex()]; }
301 AGX_FORCE_INLINE agx::UInt const& StrongInteractionPtr::body1() const { verifyIndex(); return getData()->body1[calculateIndex()]; }
302
303 AGX_FORCE_INLINE agx::UInt& StrongInteractionPtr::body2() { verifyIndex(); return getData()->body2[calculateIndex()]; }
304 AGX_FORCE_INLINE agx::UInt const& StrongInteractionPtr::body2() const { verifyIndex(); return getData()->body2[calculateIndex()]; }
305
306 //-----------------------------------------------------------------------------------------------------
307 AGX_FORCE_INLINE StrongInteractionInstance::StrongInteractionInstance() {}
308 AGX_FORCE_INLINE StrongInteractionInstance::StrongInteractionInstance(StrongInteractionData* data, agx::Index index) : agx::Physics::InteractionInstance(data, index) {}
309 AGX_FORCE_INLINE StrongInteractionInstance::StrongInteractionInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::InteractionInstance(storage, index) {}
310 AGX_FORCE_INLINE StrongInteractionInstance::StrongInteractionInstance(const agxData::EntityInstance& other) : agx::Physics::InteractionInstance(other)
311 {
313 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
314 EntityInstance::getModel()->fullPath().c_str(), StrongInteractionModel::instance()->fullPath().c_str());
315 }
316
317 AGX_FORCE_INLINE StrongInteractionInstance::StrongInteractionInstance(const agxData::EntityPtr& ptr) : agx::Physics::InteractionInstance(ptr)
318 {
320 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
321 EntityInstance::getModel()->fullPath().c_str(), StrongInteractionModel::instance()->fullPath().c_str());
322 }
323
324
325 AGX_FORCE_INLINE StrongInteractionData* StrongInteractionInstance::getData() { return static_cast<StrongInteractionData* >(agxData::EntityInstance::getData()); }
326 AGX_FORCE_INLINE const StrongInteractionData* StrongInteractionInstance::getData() const { return static_cast<const StrongInteractionData* >(agxData::EntityInstance::getData()); }
327
328 AGX_FORCE_INLINE agx::StrongInteraction*& StrongInteractionInstance::model() { verifyIndex(); return getData()->model[getIndex()]; }
329 AGX_FORCE_INLINE agx::StrongInteraction* const& StrongInteractionInstance::model() const { verifyIndex(); return getData()->model[getIndex()]; }
330
331 AGX_FORCE_INLINE agx::UInt& StrongInteractionInstance::body1() { verifyIndex(); return getData()->body1[getIndex()]; }
332 AGX_FORCE_INLINE agx::UInt const& StrongInteractionInstance::body1() const { verifyIndex(); return getData()->body1[getIndex()]; }
333
334 AGX_FORCE_INLINE agx::UInt& StrongInteractionInstance::body2() { verifyIndex(); return getData()->body2[getIndex()]; }
335 AGX_FORCE_INLINE agx::UInt const& StrongInteractionInstance::body2() const { verifyIndex(); return getData()->body2[getIndex()]; }
336
337 //-----------------------------------------------------------------------------------------------------
338 AGX_FORCE_INLINE StrongInteractionSemantics::StrongInteractionSemantics() {}
339 //-----------------------------------------------------------------------------------------------------
341 }
342}
343
344AGX_TYPE_BINDING(agx::Physics::StrongInteractionPtr, "Physics.StrongInteractionPtr")
345AGX_TYPE_BINDING(agx::Physics::StrongInteractionInstance, "Physics.StrongInteractionInstance")
346
347#ifdef _MSC_VER
348# pragma warning(pop)
349#endif
350
351#undef AGX_ENTITY_WRAPPER
352#undef AGX_ENTITY_NAMESPACE
353#endif
354
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#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
EntityPtr & operator=(const EntityPtr &other)=default
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
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.Interaction entity.
Pointer to a entity instance of type Physics.Interaction.
Abstract description of the data attributes for the Physics.StrongInteraction entity.
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void construct(agxData::EntityPtr instance) override
StrongInteractionModel(const agx::String &name="StrongInteraction")
static agxData::EntityStorage * defaultStorage()
static agxData::PointerAttributeT< agx::StrongInteraction * > * modelAttribute
static StrongInteractionModel * instance()
static StrongInteractionPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
void construct(agx::Physics::StrongInteractionPtr strongInteraction)
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::ScalarAttributeT< agx::UInt > * body1Attribute
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void initAttributeAccessors() override
static agxData::ScalarAttributeT< agx::UInt > * body2Attribute
Pointer to a entity instance of type Physics.StrongInteraction.
AGXPHYSICS_EXPORT StrongInteractionInstance instance()
StrongInteractionData * getData()
AGXPHYSICS_EXPORT StrongInteractionPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::UInt const & body2() const
AGXPHYSICS_EXPORT agx::StrongInteraction *& model()
AGXPHYSICS_EXPORT StrongInteractionPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::StrongInteraction *const & model() const
AGXPHYSICS_EXPORT agx::UInt const & body1() const
const StrongInteractionData * getData() const
AGXPHYSICS_EXPORT StrongInteractionSemantics * operator->()
AGXPHYSICS_EXPORT agx::UInt & body2()
AGXPHYSICS_EXPORT const StrongInteractionSemantics * operator->() const
AGXPHYSICS_EXPORT StrongInteractionPtr()
AGXPHYSICS_EXPORT const StrongInteractionInstance instance() const
AGXPHYSICS_EXPORT agx::UInt & body1()
AGXPHYSICS_EXPORT StrongInteractionPtr(agxData::EntityStorage *storage, agx::Index id)
Base class for a strong interaction concept where there interaction is defined in the mass matrix par...
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:89
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#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.
uint64_t UInt
Definition: Integer.h:27
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
UInt32 Index
Definition: Integer.h:44