AGXDynamics
2.35.0.3
StrongInteraction.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 having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
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
17
#pragma once
18
19
#include <
agx/Interaction.h
>
20
21
#if defined(_MSC_VER)
22
#pragma warning( push )
23
#pragma warning( disable : 4589 ) // Disable: 4589: Constructor of abstract class 'agx::FrictionModel' ignores initializer for virtual base class 'agxStream::Serializable'
24
#endif
25
26
27
namespace
agxRender
28
{
29
class
RenderManager;
30
}
31
32
namespace
agx
33
{
34
class
SparseRangeReal;
35
36
AGX_DECLARE_POINTER_TYPES
(
StrongInteraction
);
37
42
class
AGXPHYSICS_EXPORT
StrongInteraction
:
public
agx::Interaction
43
{
44
public
:
45
46
#if (!defined SWIG ) || (!defined SWIGCSHARP && !defined SWIGJAVA)
47
struct
AGXPHYSICS_EXPORT
MatrixData
48
{
49
MatrixData
(
agx::Physics::RigidBodyPtr
rb ) : rb( rb ), data( nullptr ), writeTranspose( false ), leadingDimension(
agx
::
InvalidIndex
), blockRowIndex(
agx
::
InvalidIndex
) {}
50
51
template
<
typename
T >
52
void
plusEqual(
const
T& rhs,
const
agx::UInt
numRows,
const
agx::UInt
numCols );
53
54
agx::Physics::RigidBodyPtr
rb
;
55
agx::Real
*
data
;
56
bool
writeTranspose
;
57
unsigned
int
leadingDimension
;
// Argument to Sabre, has to be 'unsigned int'.
58
agx::UInt
blockRowIndex
;
59
};
60
#endif
61
62
public
:
67
void
setEnable(
agx::Bool
enable );
68
72
agx::Bool
getEnable()
const
;
73
77
agx::Bool
getValid()
const
;
78
79
public
:
83
virtual
agx::RigidBody
* getRigidBody1()
const
= 0;
84
88
virtual
agx::RigidBody
* getRigidBody2()
const
= 0;
89
93
virtual
void
addNotification()
override
;
94
98
virtual
void
removeNotification()
override
;
99
103
virtual
void
preSystemCallback(
agx::DynamicsSystem
* dynamicsSystem )
override
;
104
108
virtual
void
postSystemCallback(
agx::DynamicsSystem
* dynamicsSystem )
override
;
109
113
virtual
void
render(
agxRender::RenderManager
* mgr,
float
scale );
114
118
virtual
void
prepare();
119
120
#if (!defined SWIG ) || (!defined SWIGCSHARP && !defined SWIGJAVA)
121
124
virtual
void
writeMatrixData(
agx::StrongInteraction::MatrixData
rb1DiagonalBlock,
125
agx::StrongInteraction::MatrixData
rb2DiagonalBlock,
126
agx::StrongInteraction::MatrixData
offDiagonalBlock ) = 0;
127
136
virtual
void
writeRhs(
agx::Physics::RigidBodyPtr
rb1,
137
agx::Real
* rb1Rhs,
138
agx::Physics::RigidBodyPtr
rb2,
139
agx::Real
* rb2Rhs,
140
agx::Bool
isRestingSolve ) = 0;
141
#endif
142
146
virtual
void
addNlCallbacks(
agx::SparseRangeReal
& sparseRangeReal )
const
;
147
148
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE
(
agx::StrongInteraction
);
149
150
protected
:
154
StrongInteraction
();
155
159
virtual
~
StrongInteraction
();
160
165
void
setValid(
agx::Bool
valid );
166
170
virtual
void
store(
agxStream::OutputArchive
&
out
)
const override
;
171
175
virtual
void
restore(
agxStream::InputArchive
&
in
)
override
;
176
177
private
:
178
Bool
m_valid;
179
Bool
m_enable;
180
};
181
182
template
<
typename
T >
183
void
StrongInteraction::MatrixData::plusEqual
(
const
T& rhs,
const
agx::UInt
numRows,
const
agx::UInt
numCols )
184
{
185
agxAssert
(
data
!=
nullptr
);
186
if
(
writeTranspose
)
187
for
(
agx::UInt
i = 0; i < numRows; ++i )
188
for
(
agx::UInt
j = 0; j < numCols; ++j )
189
data
[ j *
leadingDimension
+ i ] += rhs[ i ][ j ];
190
else
191
for
(
agx::UInt
i = 0; i < numRows; ++i )
192
for
(
agx::UInt
j = 0; j < numCols; ++j )
193
data
[ i *
leadingDimension
+ j ] += rhs[ i ][ j ];
194
}
195
}
196
197
#if defined(_MSC_VER)
198
#pragma warning( pop ) // restoring: warning( disable : 4127 )
199
#endif
agx::StrongInteraction::MatrixData::writeTranspose
bool writeTranspose
Definition:
StrongInteraction.h:56
agx::Real
double Real
Definition:
Real.h:42
agxRender
Namespace containing classes for handling debug rendering of collision geometries,...
Definition:
Constraint.h:35
agxStream::out
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
Definition:
OutputArchive.h:412
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition:
RigidBody.h:54
agx::StrongInteraction
Base class for a strong interaction concept where there interaction is defined in the mass matrix par...
Definition:
StrongInteraction.h:42
agxRender::RenderManager
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Definition:
RenderManager.h:106
agx::StrongInteraction::MatrixData::blockRowIndex
agx::UInt blockRowIndex
Definition:
StrongInteraction.h:58
agxAssert
#define agxAssert(expr)
Definition:
debug.h:143
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition:
Serializable.h:221
agx::Physics::RigidBodyPtr
Pointer to a entity instance of type Physics.RigidBody.
Definition:
RigidBodyEntity.h:371
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition:
AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
Interaction.h
agxStream::in
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition:
InputArchive.h:400
agx::StrongInteraction::MatrixData::leadingDimension
unsigned int leadingDimension
Definition:
StrongInteraction.h:57
agx::StrongInteraction::MatrixData::rb
agx::Physics::RigidBodyPtr rb
Definition:
StrongInteraction.h:54
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition:
OutputArchive.h:56
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition:
InputArchive.h:51
agx::Interaction
The base class for interactions.
Definition:
Interaction.h:31
agx::StrongInteraction::MatrixData
Definition:
StrongInteraction.h:47
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:248
agx::StrongInteraction::MatrixData::MatrixData
MatrixData(agx::Physics::RigidBodyPtr rb)
Definition:
StrongInteraction.h:49
agx::UInt
uint32_t UInt
Definition:
Integer.h:34
agx::Bool
bool Bool
Definition:
Integer.h:48
agx::StrongInteraction::MatrixData::data
agx::Real * data
Definition:
StrongInteraction.h:55
agx::StrongInteraction::MatrixData::plusEqual
void plusEqual(const T &rhs, const agx::UInt numRows, const agx::UInt numCols)
Definition:
StrongInteraction.h:183
agx::InvalidIndex
const AGXCORE_EXPORT InvalidIndexStruct InvalidIndex
agx::DynamicsSystem
The complete physical system with bodies, interactions, data layout, time stepper,...
Definition:
DynamicsSystem.h:65
agx::SparseRangeReal
Essentially a sparse array of bounds.
Definition:
SparseTypes.h:73
include
agx
StrongInteraction.h
Generated on Fri Feb 10 2023 14:06:18 for AGXDynamics by
1.8.17