AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
RecordParticlesOperations.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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 having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid 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
17#ifndef AGXCONTROL_RECORDPARTICLESOPERATIONS_H
18#define AGXCONTROL_RECORDPARTICLESOPERATIONS_H
19
20#include <agx/String.h>
22#include <agx/Journal.h>
23
24#ifndef SWIG
25namespace agx
26{
27 class Uuid;
28}
29#endif
30
31/*
32This file contains SensorOperation classes that gives the sensor functionality to record colliding particles to separate journals.
33The operations can be used for recording continuous flow of particles in a sensor or store single frame snapshots/states. The
34created journals can later be loaded into the simulation by other operations.
35This creates an easy way to create and load different types of precomputed particle states into other simulations.
36*/
37namespace agxControl
38{
39
46 {
47 public:
48 BaseRecordParticleJournalOperation(const agx::Name& name, const agx::String& journalPath, agx::Frame * sourceOffset = nullptr);
49
50 virtual void update(const agx::TimeStamp&) override;
51
52 virtual void addNotification(EventSensor * sensor) override;
53
58
61 agx::Physics::ParticleGeometryContactInstance ,
62 agx::Physics::ParticleData& ,
63 agx::Physics::GeometryData& ,
64 agxControl::EventSensor*) override {}
65
66 virtual void postContactHandling(agxSDK::Simulation *, EventSensor *) override {}
67
69
70 protected:
73
75
77
79
81
83 // Variables
85 protected:
92 };
93
94
95
100 {
101 public:
102 RecordParticleJournalOperation(const agx::Name& name, const agx::String& journalPath, bool shouldAttachJournalOnContact = true, agx::Frame * sourceOffset = nullptr);
103
104 void addNotification(EventSensor * sensor) override;
105
106 void triggerEvent(const agx::TimeStamp& /*t*/,
107 agxSDK::Simulation * /*simulation*/,
109 agxControl::EventSensor* /*sensor*/) override;
110
112 agxSDK::Simulation* simulation,
113 agx::Physics::ParticleGeometryContactInstance /*contact*/,
114 agx::Physics::ParticleData& /*particleData*/,
115 agx::Physics::GeometryData& /*geometryData*/,
116 agxControl::EventSensor* /*sensor*/) override;
117
118 void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
119
121
122 protected:
125
127 // Variables
129 protected:
131 };
132
133
134
139 {
140 public:
141 RecordParticleShapshotJournalOperation(const agx::Name& name, const agx::String& journalPath, agx::Real snapShotTime = 0, agx::Frame * sourceOffset = nullptr);
142
143 virtual void update(const agx::TimeStamp& /*t*/) override;
144
145 virtual void addNotification(EventSensor * sensor) override;
146
147 void triggerEvent(const agx::TimeStamp& /*t*/,
148 agxSDK::Simulation * /*simulation*/,
150 agxControl::EventSensor* /*sensor*/) override;
151
153 agxSDK::Simulation* simulation,
154 agx::Physics::ParticleGeometryContactInstance /*contact*/,
155 agx::Physics::ParticleData& /*particleData*/,
156 agx::Physics::GeometryData& /*geometryData*/,
157 agxControl::EventSensor* /*sensor*/) override;
158
159 void postContactHandling(agxSDK::Simulation *simulation, EventSensor * sensor) override;
160
162
163 protected:
166
168 // Variables
170 protected:
173 };
174
175
176
182 {
183 public:
185 const agx::String& journalPath,
186 agx::Real startAfter = 0,
187 agx::Material* startMaterial = nullptr,
188 agx::Frame * targetOffsetFrame = nullptr);
189
190 void addNotification(EventSensor * sensor) override;
191
192 void triggerEvent(const agx::TimeStamp& /*t*/,
193 agxSDK::Simulation * /*simulation*/,
195 agxControl::EventSensor* /*sensor*/) override;
196
198 agxSDK::Simulation* /*simulation*/,
199 agx::Physics::ParticleGeometryContactInstance /*contact*/,
200 agx::Physics::ParticleData& /*particleData*/,
201 agx::Physics::GeometryData& /*geometryData*/,
202 agxControl::EventSensor* /*sensor*/) override;
203
205
207
208 protected:
211
213
215
217
219 // Variables
221 protected:
229 };
230
231
232
237 {
238 public:
240 const agx::String& filepath,
241 agx::Real snapShotTime,
242 agx::Frame * sourceOffset = nullptr );
243
244 virtual void update( const agx::TimeStamp& ) override;
245
246 virtual void addNotification( EventSensor * sensor ) override;
247
252
255 agx::Physics::ParticleGeometryContactInstance,
256 agx::Physics::ParticleData&,
257 agx::Physics::GeometryData&,
258 agxControl::EventSensor* ) override {}
259
261
263
265
266 protected:
269
271 // Variables
273 protected:
278 };
279
280
281
286 {
287 public:
289 const agx::String& filePath,
290 agx::Real startAfter = 0,
291 agx::Material* startMaterial = nullptr,
292 agx::Frame * targetOffsetFrame = nullptr );
293
294 void addNotification( EventSensor * sensor ) override;
295
296 void triggerEvent( const agx::TimeStamp& /*t*/,
297 agxSDK::Simulation * /*simulation*/,
299 agxControl::EventSensor* /*sensor*/ ) override {}
300
302 agxSDK::Simulation* /*simulation*/,
303 agx::Physics::ParticleGeometryContactInstance /*contact*/,
304 agx::Physics::ParticleData& /*particleData*/,
305 agx::Physics::GeometryData& /*geometryData*/,
306 agxControl::EventSensor* /*sensor*/ ) override {}
307
308 void postContactHandling( agxSDK::Simulation * simulation, agxControl::EventSensor *sensor ) override;
309
311
312 protected:
315
317
319 // Variables
321 protected:
327 };
328
329}
330#endif /*SENSOROPERATIONS_H_*/
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
A contact between two geometries.
Definition Contacts.h:271
Base virtual class for storing particle states to an external journal file.
virtual void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
BaseRecordParticleJournalOperation(const agx::Name &name, const agx::String &journalPath, agx::Frame *sourceOffset=nullptr)
void attachJournal(agxSDK::Simulation *simulation)
virtual void update(const agx::TimeStamp &) override
Used to update the sensor operation each time step, if they have time dependent components.
BaseRecordParticleJournalOperation(const agx::Name &name=agx::Name())
virtual void postContactHandling(agxSDK::Simulation *, EventSensor *) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
void initDataStructure(agxSDK::Simulation *simulation)
virtual void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
virtual void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
void copyContactingParticlesToStorage(EventSensor *sensor)
This is a sensor class that can be attached to an geometry in the simulation.
Definition EventSensor.h:48
Loads particle data from an external agx file into a simulation relative to the coupled sensor object...
void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
LoadParticleAGXFileOperation(const agx::Name &name, const agx::String &filePath, agx::Real startAfter=0, agx::Material *startMaterial=nullptr, agx::Frame *targetOffsetFrame=nullptr)
void postContactHandling(agxSDK::Simulation *simulation, agxControl::EventSensor *sensor) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
LoadParticleAGXFileOperation(const agx::Name &name=agx::Name())
void loadParticlesFromFile(EventSensor *sensor)
Loads particle data from an external journal file into a simulation relative to the coupled sensor ob...
void loadAndAttachJournal(EventSensor *sensor)
void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
LoadParticleJournalOperation(const agx::Name &name, const agx::String &journalPath, agx::Real startAfter=0, agx::Material *startMaterial=nullptr, agx::Frame *targetOffsetFrame=nullptr)
void postContactHandling(agxSDK::Simulation *simulation, agxControl::EventSensor *sensor) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
LoadParticleJournalOperation(const agx::Name &name=agx::Name())
bool loadParticleStorageFromSimulation(EventSensor *sensor)
void loadParticlesFromStorage(EventSensor *sensor)
void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
Class that stores particle data from a continuous flow in the coupled sensor to a separate specified ...
RecordParticleJournalOperation(const agx::Name &name, const agx::String &journalPath, bool shouldAttachJournalOnContact=true, agx::Frame *sourceOffset=nullptr)
void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
void postContactHandling(agxSDK::Simulation *simulation, EventSensor *sensor) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
RecordParticleJournalOperation(const agx::Name &name=agx::Name())
Class that stores a single frame of the current particle configuration in the coupled sensor.
void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *simulation, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
RecordParticleShapshotJournalOperation(agx::Name name=agx::Name())
void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
RecordParticleShapshotJournalOperation(const agx::Name &name, const agx::String &journalPath, agx::Real snapShotTime=0, agx::Frame *sourceOffset=nullptr)
void postContactHandling(agxSDK::Simulation *simulation, EventSensor *sensor) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
virtual void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
virtual void update(const agx::TimeStamp &) override
Used to update the sensor operation each time step, if they have time dependent components.
A specific type of sensor event that triggers a change in the simulation when activated by a contact.
Class that stores particles in contact with the sensor to an binary .agx file.
virtual void update(const agx::TimeStamp &) override
Used to update the sensor operation each time step, if they have time dependent components.
WriteParticleDataToAGXOperation(const agx::Name &name, const agx::String &filepath, agx::Real snapShotTime, agx::Frame *sourceOffset=nullptr)
virtual void triggerParticleEvent(const agx::TimeStamp &, agxSDK::Simulation *, agx::Physics::ParticleGeometryContactInstance, agx::Physics::ParticleData &, agx::Physics::GeometryData &, agxControl::EventSensor *) override
Triggers the sensor event by passing particle contact information.
virtual void triggerEvent(const agx::TimeStamp &, agxSDK::Simulation *, agxCollide::GeometryContact *, agxControl::EventSensor *) override
Triggers the sensor event by passing contact information.
void writeParticlesToFile(EventSensor *sensor)
virtual void postContactHandling(agxSDK::Simulation *, EventSensor *) override
Post function that will be triggered for the event after all the contacts have handled in the operati...
WriteParticleDataToAGXOperation(const agx::Name &name=agx::Name())
virtual void addNotification(EventSensor *sensor) override
Function will be executed when the sensor that the operations is added to is added to a simulation.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
The object defining a frame of reference and providing transformations operations.
Definition agx/Frame.h:68
Inheritance with partial specialization due to bug with ref_ptr containers.
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition Material.h:376
Representation of a name string.
Definition Name.h:33
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition Uuid.h:42
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition Real.h:42
agx::Real TimeStamp
Definition TimeStamp.h:26