Peano
Loading...
Searching...
No Matches
GlobalDatabase.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <iomanip>
6#include <list>
7#include <map>
8#include <string>
9
11#include "tarch/la/Vector.h"
12#include "tarch/logging/Log.h"
14
15namespace toolbox {
16 namespace blockstructured {
17 class GlobalDatabase;
18 } // namespace blockstructured
19} // namespace toolbox
20
30private:
32
33 std::string _fileName;
34 std::string _dataName;
35
36 double _dataDelta;
39
40 double _timeDelta;
41
45
58
59 static constexpr double _deltaCutOffThreshold = 1e-6;
60
67 int _rank;
69
70 struct Entry {
71 double timestamp;
72 double* data;
78
79 Entry(const Entry&);
80 ~Entry();
81 Entry(const GlobalDatabase& database, double timestamp_);
82 };
83
84 std::list<Entry> _data;
85
87
89
98 double timestamp
99 );
100
112 double timestamp,
113 int numberOfDataEntries,
114 double* data
115 );
116
129
130public:
191 int growthBetweenTwoDatabaseFlushes = 0,
192 double dataDelta = 1e-8,
193 double timeDelta = 0.0,
194 bool clearDatabaseAfterFlush = true,
195 bool deltasAreRelative = false
196 );
198
205 void clear(bool lockSemaphore = true);
206
207
219 void dumpCSVFile();
220
221 void setDeltaBetweenTwoDatabaseFlushes(const int deltaBetweenTwoDatabaseFlushes);
222 void setOutputFileName(const std::string& filename);
223 void setDataName(const std::string& dataname);
224 void setOutputPrecision(int precision);
225 void setDataDeltaBetweenTwoSnapshots(double value, bool deltasAreRelative = false);
226 void setTimeDeltaBetweenTwoSnapshots(double value);
227
228 void clearDatabaseAfterFlush(bool value);
229
255 double timestamp
256 );
257
259 double timestamp,
260 int numberOfDataEntries,
261 double* data
262 );
263
264};
Log Device.
Definition Log.h:516
bool _clearDatabaseAfterFlush
Flag that indicates if we erase the database after a flush.
void clear(bool lockSemaphore=true)
tarch::multicore::BooleanSemaphore _semaphore
void setOutputFileName(const std::string &filename)
void setDeltaBetweenTwoDatabaseFlushes(const int deltaBetweenTwoDatabaseFlushes)
void dumpCSVFile()
Dump data into CSV file.
GlobalDatabase(int growthBetweenTwoDatabaseFlushes=0, double dataDelta=1e-8, double timeDelta=0.0, bool clearDatabaseAfterFlush=true, bool deltasAreRelative=false)
Global database.
void setDataDeltaBetweenTwoSnapshots(double value, bool deltasAreRelative=false)
int _rank
This is a hack: Usually, I'd just ask the rank what its number is.
void setDataName(const std::string &dataname)
void addGlobalSnapshot(double timestamp)
Add snapshot.
AddSnapshotAction getAction(double timestamp)
Determine what to do with new entry.
static constexpr double _deltaCutOffThreshold
const int numberOfDataEntries
Have to memorise this guy to be able to write a proper copy constructor.