-
Notifications
You must be signed in to change notification settings - Fork 0
/
Average.h
83 lines (70 loc) · 2.13 KB
/
Average.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* @file Average.h
* @author Dan R. Lipsa
* @date 9 June 2010
* @brief Computes a time-average of a foam attribute. %Base
class for 2D and 3D time-average computation classes.
* @ingroup average
*/
#ifndef __AVERAGE_H__
#define __AVERAGE_H__
#include "AverageInterface.h"
#include "Base.h"
class DerivedData;
class Foam;
class Settings;
class Simulation;
class SimulationGroup;
class ViewSettings;
/**
* @brief Computes a time-average of a foam attribute. %Base class for
2D and 3D time-average computation classes.
*
* Computes an average for a time window behind the current time step
* for forward and backward moving time.
*/
class Average : public AverageInterface, public Base
{
public:
Average (ViewNumber::Enum viewNumber,
boost::shared_ptr<Settings> settings,
boost::shared_ptr<const SimulationGroup> simulationGroup,
boost::shared_ptr<DerivedData>* dd);
void AverageStep (int timeDifference, size_t timeWindow);
size_t GetCurrentTimeWindow () const
{
return m_currentTimeWindow;
}
virtual void AverageInit ();
G3D::Vector3 GetTranslation (size_t timeStep) const;
G3D::Vector3 GetTranslation () const;
virtual ViewNumber::Enum GetViewNumber () const;
protected:
/**
* @todo Write and add/remove in one operations instead of two.
*/
virtual void addStep (size_t timeStep, size_t subStep) = 0;
virtual void removeStep (size_t timeStep, size_t subStep) = 0;
/**
* A step is divided in stepSize subSteps. This is used for T1s where
* there are several t1s for one time step.
*/
virtual size_t getStepSize (size_t timeStep) const
{
(void)timeStep;
return 1;
}
private:
typedef void (Average::*Operation) (size_t timeStep, size_t subStep);
typedef boost::function <float (float, float)> TimeOperation;
void forAllSubsteps (Operation op, size_t currentTime);
void executeOperation (
size_t currentTime, Operation op, TimeOperation timeOp,
bool atEnd, size_t timeWindow);
private:
size_t m_currentTimeWindow;
};
#endif //__AVERAGE_H__
// Local Variables:
// mode: c++
// End: