AGXDynamics  2.35.0.3
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:
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:
106  agxSDK::SimulationController* m_controller;
113  };
114 }
115 
116 #endif
SimulationController.h
agxQt::ContactWriterThread::getShouldUseBound
bool getShouldUseBound() const
agxQt::ContactWriterThread::m_exportType
agx::GranularDataExporter::ExporterDataType m_exportType
Definition: ImpactAnalysis.h:109
agx::Real
double Real
Definition: Real.h:42
agxQt::ContactWriterThread::reset
void reset()
Reset the writer thread.
agxQt
Contains classes/utility functions for connecting AGX to QT with OSG.
Definition: AnalysisBoundWidget.h:33
agxQt::ContactWriterThread::m_timeSettings
TimeSettings m_timeSettings
Definition: ImpactAnalysis.h:111
agxQt::ContactWriterThread::m_bound
agx::AnalysisBox * m_bound
Definition: ImpactAnalysis.h:110
agxQt::TimeSettings::useSnapShot
bool useSnapShot
Definition: ImpactAnalysis.h:34
agxQt::ContactWriterThread::m_fileName
agx::String m_fileName
Definition: ImpactAnalysis.h:107
agxQt::ContactWriterThread::m_sessionName
agx::String m_sessionName
Definition: ImpactAnalysis.h:108
agx::AnalysisBox
Class that can be used to extract data from elements in a simulation within a specified bound.
Definition: AnalysisBox.h:31
agxQt::ContactWriterThread::m_useBound
bool m_useBound
Definition: ImpactAnalysis.h:112
agxQt::ContactWriterThread::update
void update(agx::String filename, agx::String sessionName, agx::AnalysisBox *bound)
Updates the export information used in the thread.
agxQt::ContactWriterThread::run
void run()
agxQt::TimeSettings::startTime
agx::Real startTime
Definition: ImpactAnalysis.h:32
agx::BoundT< Vec3 >
agx::GranularDataExporter::ExporterDataType
ExporterDataType
Export Data Type.
Definition: GranularDataExporter.h:65
agxQt::ImpactInformationWriter
Class containing utility functions for exporting simulation data.
Definition: ImpactAnalysis.h:40
agxQt::ContactWriterThread
Thread class for writing simulation information to file.
Definition: ImpactAnalysis.h:55
PushDisableWarnings.h
agxQt::ContactWriterThread::setExportType
void setExportType(agx::GranularDataExporter::ExporterDataType type)
Set export type of the writing thread.
agxQt::ContactWriterThread::m_running
bool m_running
Definition: ImpactAnalysis.h:104
agxQt::ContactWriterThread::setTimeSettings
void setTimeSettings(const TimeSettings &timeSettings)
Updates the time settings used in the export thread.
agxQt::ImpactInformationWriter::writeSimulationDataToFile
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.
agxQt::ContactWriterThread::updateTimeLeft
void updateTimeLeft(double)
agxQt::TimeSettings
Definition: ImpactAnalysis.h:30
agxQt::ContactWriterThread::m_controller
agxSDK::SimulationController * m_controller
Definition: ImpactAnalysis.h:106
GranularDataExporter.h
agxQt::ContactWriterThread::m_shouldAbort
bool m_shouldAbort
Definition: ImpactAnalysis.h:103
agxQt::TimeSettings::endTime
agx::Real endTime
Definition: ImpactAnalysis.h:33
agx::AgXString< std::string >
agxQt::ContactWriterThread::ContactWriterThread
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...
agxQt::ContactWriterThread::setShouldUseBound
void setShouldUseBound(bool enable)
agxQt::ImpactInformationWriter::StepforwardCallback
std::function< bool(int, double)> StepforwardCallback
Definition: ImpactAnalysis.h:43
agxQt::ContactWriterThread::slotAbortThread
void slotAbortThread()
PopDisableWarnings.h