AGX Dynamics  2.35.0.1
ImpactAnalysis.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 #ifndef AGXQT_IMPACTANALYSIS_H
18 #define AGXQT_IMPACTANALYSIS_H
19 
20 #include <functional>
22 #include <QThread>
23 #include <agx/PopDisableWarnings.h>
26 
27 namespace agxQt
28 {
29  // Time settings struct. Used in the export function for exporting data in time intervals.
30  struct TimeSettings
31  {
35  };
36 
41  {
42  public:
43  typedef std::function<bool(int, double)> StepforwardCallback;
44 
46  static bool writeSimulationDataToFile(agx::String filename,
47  agx::String sessionName,
48  const agx::Bound3& bound,
49  const TimeSettings& settings,
51  StepforwardCallback callback);
52  };
53 
55  class ContactWriterThread : public QThread
56  {
57  Q_OBJECT
58 
59  public:
70 
73 
75  void update(agx::String filename, agx::String sessionName, agx::AnalysisBox* bound);
76 
78  void setTimeSettings(const TimeSettings& timeSettings);
79 
81  void reset();
82 
83  // Set if the AnalysisBox should be used in the export.
84  void setShouldUseBound(bool enable);
85 
86  // Get if the AnalysisBox should be used in the export.
87  bool getShouldUseBound() const;
88 
89  public slots:
91 
92  signals:
93  void update(int);
94  void updateTimeLeft(double);
95 
96  protected:
97  void run();
98 
100  // Variables
102  public:
104  bool m_running;
105  protected:
106  agxSDK::SimulationController* m_controller;
113  };
114 }
115 
116 #endif
Thread class for writing simulation information to file.
void setTimeSettings(const TimeSettings &timeSettings)
Updates the time settings used in the export thread.
void reset()
Reset the writer thread.
agxSDK::SimulationController * m_controller
void setShouldUseBound(bool enable)
agx::GranularDataExporter::ExporterDataType m_exportType
void update(agx::String filename, agx::String sessionName, agx::AnalysisBox *bound)
Updates the export information used in the thread.
bool getShouldUseBound() const
ContactWriterThread(agx::GranularDataExporter::ExporterDataType type, agx::String filename, agx::String sessionName, const TimeSettings &timeSettings, agx::AnalysisBox *bound)
Data Export thread class that opens up the specified journal and writes the specified export informat...
agx::AnalysisBox * m_bound
void setExportType(agx::GranularDataExporter::ExporterDataType type)
Set export type of the writing thread.
Class containing utility functions for exporting simulation data.
static bool writeSimulationDataToFile(agx::String filename, agx::String sessionName, const agx::Bound3 &bound, const TimeSettings &settings, agx::GranularDataExporter::ExporterDataType exportType, StepforwardCallback callback)
Write simulation data to file.
std::function< bool(int, double)> StepforwardCallback
Class that can be used to extract data from elements in a simulation within a specified bound.
Definition: AnalysisBox.h:32
Contains classes/utility functions for connecting AGX to QT with OSG.
double Real
Definition: Real.h:42