AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ImpactAnalysis.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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:
90  void slotAbortThread();
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:
113  };
114 }
115 
116 #endif
void setTimeSettings(const TimeSettings &timeSettings)
Updates the time settings used in the export thread.
agxSDK::SimulationController * m_controller
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...
void setShouldUseBound(bool enable)
agx::GranularDataExporter::ExporterDataType m_exportType
ExporterDataType
Export Data Type.
void reset()
Reset the writer thread.
Thread class for writing simulation information to file.
std::function< bool(int, double)> StepforwardCallback
Class containing utility functions for exporting simulation data.
agx::AnalysisBox * m_bound
Class that can be used to extract data from elements in a simulation within a specified bound...
Definition: AnalysisBox.h:31
void update(agx::String filename, agx::String sessionName, agx::AnalysisBox *bound)
Updates the export information used in the thread.
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.
double Real
Definition: Real.h:42
void setExportType(agx::GranularDataExporter::ExporterDataType type)
Set export type of the writing thread.
GLenum type
Definition: gl.h:5539