AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
SolveMaterialEntity.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_SOLVEMATERIAL_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_SOLVEMATERIAL_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>
47#include <agx/Real.h>
48#include <agx/Vec2.h>
49
50
51namespace agx
52{
53 namespace Physics
54 {
55
56 class SolveMaterialModel;
57 class SolveMaterialData;
58 class SolveMaterialPtr;
59 class SolveMaterialInstance;
60 class SolveMaterialSemantics;
61
62
64
69 {
70 public:
72
73 SolveMaterialModel(const agx::String& name = "SolveMaterial");
74
77
80
83
85 virtual void shutdownCleanup() override;
86
87
88
89 /* Attributes */
93
94 protected:
96 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
97 virtual void configure(agx::TiXmlElement* eEntity) override;
98 virtual void initAttributeAccessors() override;
99 virtual void construct(agxData::EntityPtr instance) override;
101 };
102
103
105 #ifndef AGX_PHYSICS_SOLVEMATERIAL_DATA_SET_OVERRIDE
106 #define AGX_PHYSICS_SOLVEMATERIAL_DATA_SET
107 class AGXPHYSICS_EXPORT SolveMaterialData : public agxData::EntityData
108 {
109 public:
110 SolveMaterialInstance operator[] (size_t index);
111
112 public:
114 agxData::Array< agx::Real > adhesiveImpulse;
116 agxData::Array< agx::Vec2 > tangentialCohesionImpulse;
117
118 public:
119 typedef agx::Real adhesiveImpulseType;
120 typedef agx::Vec2 frictionType;
121 typedef agx::Vec2 tangentialCohesionImpulseType;
122
123 public:
124 SolveMaterialData(agxData::EntityStorage* storage);
125 SolveMaterialData();
126
127 protected:
128 virtual ~SolveMaterialData() {}
129 virtual void setNumElements(agx::Index numElements) override;
130
131 private:
132 SolveMaterialData& operator= (const SolveMaterialData&) { return *this; }
133
134 };
135 #endif
137
138
140 class AGXPHYSICS_EXPORT SolveMaterialSemantics : protected agxData::EntityPtr
141 {
142 public:
143
144 // Automatic getters
145 agx::Real const& getAdhesiveImpulse() const;
146 agx::Vec2 const& getFriction() const;
147 agx::Vec2 const& getTangentialCohesionImpulse() const;
148
149 // Semantics defined by explicit kernels
150
151 // Automatic setters
152 void setAdhesiveImpulse(agx::Real const& value);
153 void setFriction(agx::Vec2 const& value);
154 void setTangentialCohesionImpulse(agx::Vec2 const& value);
155
156
157 protected:
158 friend class SolveMaterialPtr;
159 friend class SolveMaterialInstance;
160 SolveMaterialSemantics();
161 };
163
164
165
168 class CALLABLE SolveMaterialPtr : public agxData::EntityPtr
169 {
170 public:
172 typedef SolveMaterialData DataType;
173 typedef SolveMaterialInstance InstanceType;
174
175 public:
182 AGXPHYSICS_EXPORT SolveMaterialInstance instance();
183 AGXPHYSICS_EXPORT const SolveMaterialInstance instance() const;
184
185 AGXPHYSICS_EXPORT SolveMaterialSemantics* operator->();
186 AGXPHYSICS_EXPORT const SolveMaterialSemantics* operator->() const;
187
188 SolveMaterialData* getData();
189 const SolveMaterialData* getData() const;
190
191
196
201
206
207 };
208
209
211 class AGXPHYSICS_EXPORT SolveMaterialInstance : public agxData::EntityInstance
212 {
213 public:
214 SolveMaterialInstance();
215 SolveMaterialInstance(SolveMaterialData* data, agx::Index index);
216 SolveMaterialInstance(agxData::EntityStorage *storage, agx::Index index);
217 SolveMaterialInstance(const agxData::EntityInstance& other);
218 SolveMaterialInstance(const agxData::EntityPtr& ptr);
219
220 SolveMaterialData* getData();
221 const SolveMaterialData* getData() const;
222
223 public:
225 agx::Real& adhesiveImpulse();
227 agx::Real const& adhesiveImpulse() const;
228
230 agx::Vec2& friction();
232 agx::Vec2 const& friction() const;
233
235 agx::Vec2& tangentialCohesionImpulse();
237 agx::Vec2 const& tangentialCohesionImpulse() const;
238
239 };
241
242
243
246
247
248
250 /* Implementation */
251 //-----------------------------------------------------------------------------------------------------
252 //-----------------------------------------------------------------------------------------------------
253 inline SolveMaterialInstance agx::Physics::SolveMaterialData::operator[] (size_t index) { return SolveMaterialInstance(this, (agx::Index)index); }
254 //-----------------------------------------------------------------------------------------------------
257 AGX_FORCE_INLINE SolveMaterialPtr::SolveMaterialPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
258 {
260 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
261 EntityPtr::getModel()->fullPath().c_str(), SolveMaterialModel::instance()->fullPath().c_str());
262 }
263
264 AGX_FORCE_INLINE SolveMaterialPtr::SolveMaterialPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
265 {
267 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
268 EntityPtr::getModel()->fullPath().c_str(), SolveMaterialModel::instance()->fullPath().c_str());
269 }
270
271 AGX_FORCE_INLINE SolveMaterialPtr& SolveMaterialPtr::operator= (const agxData::EntityPtr& ptr)
272 {
274 agxAssertN(!ptr || ptr.isInstanceOf(SolveMaterialModel::instance()),
275 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
276 EntityPtr::getModel()->fullPath().c_str(), SolveMaterialModel::instance()->fullPath().c_str());
277 return *this;
278 }
279
280 AGX_FORCE_INLINE SolveMaterialPtr& SolveMaterialPtr::operator= (const agxData::EntityInstance& instance)
281 {
283 agxAssertN(!instance || instance.isInstanceOf(SolveMaterialModel::instance()),
284 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
285 EntityPtr::getModel()->fullPath().c_str(), SolveMaterialModel::instance()->fullPath().c_str());
286 return *this;
287 }
288
289 inline SolveMaterialInstance SolveMaterialPtr::instance() { return agxData::EntityPtr::instance(); }
290 inline const SolveMaterialInstance SolveMaterialPtr::instance() const { return agxData::EntityPtr::instance(); }
291 AGX_FORCE_INLINE SolveMaterialSemantics* SolveMaterialPtr::operator->() { return (SolveMaterialSemantics* )this; }
292 AGX_FORCE_INLINE const SolveMaterialSemantics* SolveMaterialPtr::operator->() const { return (const SolveMaterialSemantics* )this; }
293 AGX_FORCE_INLINE SolveMaterialData* SolveMaterialPtr::getData() { return static_cast<SolveMaterialData* >(agxData::EntityPtr::getData()); }
294 AGX_FORCE_INLINE const SolveMaterialData* SolveMaterialPtr::getData() const { return static_cast<const SolveMaterialData* >(agxData::EntityPtr::getData()); }
295
296 AGX_FORCE_INLINE agx::Real& SolveMaterialPtr::adhesiveImpulse() { verifyIndex(); return getData()->adhesiveImpulse[calculateIndex()]; }
297 AGX_FORCE_INLINE agx::Real const& SolveMaterialPtr::adhesiveImpulse() const { verifyIndex(); return getData()->adhesiveImpulse[calculateIndex()]; }
298
299 AGX_FORCE_INLINE agx::Vec2& SolveMaterialPtr::friction() { verifyIndex(); return getData()->friction[calculateIndex()]; }
300 AGX_FORCE_INLINE agx::Vec2 const& SolveMaterialPtr::friction() const { verifyIndex(); return getData()->friction[calculateIndex()]; }
301
302 AGX_FORCE_INLINE agx::Vec2& SolveMaterialPtr::tangentialCohesionImpulse() { verifyIndex(); return getData()->tangentialCohesionImpulse[calculateIndex()]; }
303 AGX_FORCE_INLINE agx::Vec2 const& SolveMaterialPtr::tangentialCohesionImpulse() const { verifyIndex(); return getData()->tangentialCohesionImpulse[calculateIndex()]; }
304
305 //-----------------------------------------------------------------------------------------------------
306 AGX_FORCE_INLINE SolveMaterialInstance::SolveMaterialInstance() {}
307 AGX_FORCE_INLINE SolveMaterialInstance::SolveMaterialInstance(SolveMaterialData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
308 AGX_FORCE_INLINE SolveMaterialInstance::SolveMaterialInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
309 AGX_FORCE_INLINE SolveMaterialInstance::SolveMaterialInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
310 {
312 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
313 EntityInstance::getModel()->fullPath().c_str(), SolveMaterialModel::instance()->fullPath().c_str());
314 }
315
316 AGX_FORCE_INLINE SolveMaterialInstance::SolveMaterialInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
317 {
319 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
320 EntityInstance::getModel()->fullPath().c_str(), SolveMaterialModel::instance()->fullPath().c_str());
321 }
322
323
324 AGX_FORCE_INLINE SolveMaterialData* SolveMaterialInstance::getData() { return static_cast<SolveMaterialData* >(agxData::EntityInstance::getData()); }
325 AGX_FORCE_INLINE const SolveMaterialData* SolveMaterialInstance::getData() const { return static_cast<const SolveMaterialData* >(agxData::EntityInstance::getData()); }
326
327 AGX_FORCE_INLINE agx::Real& SolveMaterialInstance::adhesiveImpulse() { verifyIndex(); return getData()->adhesiveImpulse[getIndex()]; }
328 AGX_FORCE_INLINE agx::Real const& SolveMaterialInstance::adhesiveImpulse() const { verifyIndex(); return getData()->adhesiveImpulse[getIndex()]; }
329
330 AGX_FORCE_INLINE agx::Vec2& SolveMaterialInstance::friction() { verifyIndex(); return getData()->friction[getIndex()]; }
331 AGX_FORCE_INLINE agx::Vec2 const& SolveMaterialInstance::friction() const { verifyIndex(); return getData()->friction[getIndex()]; }
332
333 AGX_FORCE_INLINE agx::Vec2& SolveMaterialInstance::tangentialCohesionImpulse() { verifyIndex(); return getData()->tangentialCohesionImpulse[getIndex()]; }
334 AGX_FORCE_INLINE agx::Vec2 const& SolveMaterialInstance::tangentialCohesionImpulse() const { verifyIndex(); return getData()->tangentialCohesionImpulse[getIndex()]; }
335
336 //-----------------------------------------------------------------------------------------------------
337 AGX_FORCE_INLINE SolveMaterialSemantics::SolveMaterialSemantics() {}
338 //-----------------------------------------------------------------------------------------------------
340 }
341}
342
343AGX_TYPE_BINDING(agx::Physics::SolveMaterialPtr, "Physics.SolveMaterialPtr")
344AGX_TYPE_BINDING(agx::Physics::SolveMaterialInstance, "Physics.SolveMaterialInstance")
345
346#ifdef _MSC_VER
347# pragma warning(pop)
348#endif
349
350#undef AGX_ENTITY_WRAPPER
351#undef AGX_ENTITY_NAMESPACE
352#endif
353
#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()
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
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.SolveMaterial entity.
static SolveMaterialModel * instance()
virtual void construct(agxData::EntityPtr instance) override
virtual void initAttributeAccessors() override
static SolveMaterialPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
void construct(agx::Physics::SolveMaterialPtr solveMaterial)
static agxData::ScalarAttributeT< agx::Vec2 > * frictionAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::ScalarAttributeT< agx::Vec2 > * tangentialCohesionImpulseAttribute
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
SolveMaterialModel(const agx::String &name="SolveMaterial")
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Real > * adhesiveImpulseAttribute
Pointer to a entity instance of type Physics.SolveMaterial.
const SolveMaterialData * getData() const
AGXPHYSICS_EXPORT SolveMaterialPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const SolveMaterialInstance instance() const
AGXPHYSICS_EXPORT SolveMaterialSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real const & adhesiveImpulse() const
AGXPHYSICS_EXPORT SolveMaterialInstance instance()
AGXPHYSICS_EXPORT agx::Vec2 & friction()
AGXPHYSICS_EXPORT agx::Vec2 & tangentialCohesionImpulse()
SolveMaterialInstance InstanceType
AGXPHYSICS_EXPORT SolveMaterialPtr()
AGXPHYSICS_EXPORT agx::Vec2 const & tangentialCohesionImpulse() const
AGXPHYSICS_EXPORT agx::Real & adhesiveImpulse()
AGXPHYSICS_EXPORT const SolveMaterialSemantics * operator->() const
SolveMaterialData * getData()
AGXPHYSICS_EXPORT SolveMaterialPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::Vec2 const & friction() const
AGXPHYSICS_EXPORT SolveMaterialPtr(const agxData::EntityPtr &ptr)
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.
double Real
Definition: Real.h:41
UInt32 Index
Definition: Integer.h:44