AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
DataSeries.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#pragma once
18
21#include <agxPlot/Queue.h>
22
23#include <agx/Uuid.h>
25#include <agx/Event.h>
26
27#include <agxUtil/Statistic.h>
28
29#include <functional>
30#include <memory>
31
32namespace agxSDK
33{
34 class Simulation;
35}
36
37namespace agxPlot
38{
39
45 {
46 public:
48 {
49 DATASERIES_SETTINGS_NONE = 0,
50 DATASERIES_SETTINGS_ISTIME = 1
51 };
52
57 DataSeries(const agx::Uuid& entityId, const agx::String& dataPath, agxSDK::Simulation* simulation, const agx::String& name);
58
62 DataSeries(std::function<double()> lambdaFunction, const agx::String& name);
63
68
72 DataSeries(agxPlot::DataGenerator* dataGenerator, const agx::String& name);
73
77 DataSeries(const agx::String& dataPath, agxSDK::Simulation* simulation, const agx::String& name);
78
83
91
95 DataSeries(const agx::String& name = "");
96
101 void push(agx::Real value);
102
108
112 size_t getNewValueMarker() const;
113
118
122 void clearData();
123
128
132 void setName(const agx::String& name);
133
137 const agx::String& getName() const;
138
142 void setUnit(const agx::String& unit);
143
147 const agx::String& getUnit() const;
148
152 void setLogarithmic(bool isLogarithmic);
153
154 bool getLogarithmic() const;
155
159 void setSettings(agx::UInt16 settings);
160
170 void getDescription(agxJson::Value& root) const;
174 void setFromDescription(const agxJson::Value& root);
175
184
194
200
201 // INTERNAL
206 bool isTime() const;
208 bool hasDataPath() const;
211 const agx::String& getDataPath() const;
213
215
216 protected:
217 virtual ~DataSeries();
218
219 void init(DataGeneratorRef generator, const agx::String& name);
220
221 private:
222 void addOutput(Queue* queue);
223 void setID(agx::UInt id);
224 bool isMultipleSource() const;
225 void pushSecondary(agx::Real value);
226 void sumValues();
227
228 agx::RealVector m_values;
229 agx::RealVector m_secondaryValues;
230 agx::RealVector m_sumValues;
231 size_t m_currentSumIndex;
232
233 agx::String m_name;
234 agx::String m_unit;
235 bool m_isLogarithmic;
236 bool m_journalDataImported;
237 agx::UInt16 m_settings;
238
239 agx::UInt m_id;
240
241 size_t m_currentIndex;
242
243 DataGeneratorRef m_generator;
244 std::unique_ptr<agxUtil::Statistic> m_statistic;
245
246 agx::Uuid m_entityId;
247 agx::String m_dataPath;
248
249 QueueRef m_inputQueue;
250 QueueRef m_secondaryInputQueue;
251 agx::Vector<Queue*> m_outputQueues;
252 };
253
256
257
262 {
263 public:
264 // Create a data series that makes a time lambda function connected to the selected simulation
266
267 protected:
269
270 private:
271 agxSDK::Simulation* m_simulation;
272 };
273
276}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition agx/Vector.h:34
Abstract base class for creating data to be plotted.
Event listener that will generate plotting data.
Class that encapsulates data to be plotted, including methods for accessing the data,...
Definition DataSeries.h:45
DataSeries(agxPlot::DataSeries *sourceA, agxPlot::DataSeries *sourceB)
Create a DataSeries that gets fed by two sources and adding their data.
const agx::String & getName() const
Get the name of the data series.
DataSeries(const agx::Uuid &entityId, const agx::String &dataPath, agxSDK::Simulation *simulation, const agx::String &name)
Create a DataSeries that takes fields from the object specified by the entity ID.
const agxUtil::Statistic * getStatistic() const
Return the statistic, if any, through which data from generator is passed before being added to the d...
bool hasImportedJournalData() const
agx::Event representationChanged
Definition DataSeries.h:214
void setFromDescription(const agxJson::Value &root)
Set from a description of the format from getDescription.
void init(DataGeneratorRef generator, const agx::String &name)
DataSeries(agxPlot::DataGenerator *dataGenerator, const agx::String &name)
Create a DataSeries that calls getValue on the given DataGenerator to generate data.
DataSeries(agxPlot::DataSeries *source)
Create a DataSeries that gets fed by the source specified.
void setUnit(const agx::String &unit)
Set a string representing the unit of the data series.
void setName(const agx::String &name)
Set the name of the data series.
size_t getNewValueMarker() const
Get the index of the oldest new value.
DataSeries(agxPlot::DataListener *listener, const agx::String &name)
Create a DataSeries that calls the getValue operator of the DataListener to generate data.
const agx::String & getUnit() const
Get the unit of the data series.
agx::Uuid getEntityId() const
void setLogarithmic(bool isLogarithmic)
Should the axis be logarithmic if displayed.
void setStatistic(agxUtil::StatisticHandleRef statistic)
Pass data read from the data generator through the given statistic before adding it to the data serie...
void getDescription(agxJson::Value &root) const
Get the description of the following format.
void setSettings(agx::UInt16 settings)
Set special settings for the data series.
void resetDirty()
All current values are now observed and dirty flags can be cleaned up.
void generateCurrentValue()
Fetches the current value from the specified way of generation and append it to the series.
DataSeries(const agx::String &dataPath, agxSDK::Simulation *simulation, const agx::String &name)
Create a DataSeries that calls the getValue operator of the DataListener to generate data.
bool getLogarithmic() const
DataSeries(std::function< double()> lambdaFunction, const agx::String &name)
Create a DataSeries that calls the specified function to generate data.
bool hasDataPath() const
void push(agx::Real value)
Manually add a value at the end of the DataSeries.
void setStatistic(agxUtil::Statistic *statistic)
Pass data read from the data generator through the given statistic before adding it to the data serie...
const agx::String & getDataPath() const
bool isTime() const
Time works different, thus the time data series have this flag.
DataSeries(const agx::String &name="")
Create a DataSeries that can only get values by manually pushing them.
void clearData()
Remove all values in stored.
agx::UInt getID() const
const agx::RealVector & getAllValues() const
Get all values that have been generated so far.
Class for generating a data serie containg simulation time.
Definition DataSeries.h:262
TimeDataSeries(agxSDK::Simulation *)
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
Pure virtual statistic class containing the fundamentals for implementing a statistics method.
Definition Statistic.h:37
An event with no arguments.
Definition Event.h:90
Base class providing referencing counted objects.
Definition Referenced.h:120
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition Uuid.h:42
Templated vector class.
Definition agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition ref_ptr.h:30
Namespace contains functionality related to plotting.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
uint16_t UInt16
Definition Integer.h:31
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42