-
Notifications
You must be signed in to change notification settings - Fork 0
/
AttributeAverages.cpp
144 lines (120 loc) · 3.82 KB
/
AttributeAverages.cpp
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**
* @file AttributeAverages.cpp
* @author Dan R. Lipsa
* @date 11 Feb 2013
*
* Definitions for the view average
*/
#include "AttributeAverages.h"
#include "ForceAverage.h"
#include "Utils.h"
#include "ViewSettings.h"
// Private Functions
// ======================================================================
// Methods
// ======================================================================
AttributeAverages::AttributeAverages (
ViewNumber::Enum viewNumber,
boost::shared_ptr<Settings> settings,
boost::shared_ptr<const SimulationGroup> simulationGroup,
boost::shared_ptr<DerivedData>* dd) :
AverageInterface (viewNumber),
m_forceAverage (
new ForceAverage (viewNumber, settings, simulationGroup, dd)),
m_initViewType (ViewType::COUNT)
{
}
const Settings& AttributeAverages::GetSettings () const
{
return m_scalarAverage->GetSettings ();
}
const ViewSettings& AttributeAverages::GetViewSettings () const
{
return m_scalarAverage->GetViewSettings ();
}
const Simulation& AttributeAverages::GetSimulation () const
{
return m_scalarAverage->GetSimulation ();
}
const Foam& AttributeAverages::GetFoam (ViewNumber::Enum viewNumber) const
{
return m_scalarAverage->GetFoam (viewNumber);
}
void AttributeAverages::AverageInit ()
{
const ViewSettings& vs = GetViewSettings ();
switch (vs.GetViewType ())
{
case ViewType::AVERAGE:
m_scalarAverage->AverageInit ();
m_forceAverage->AverageInit ();
CALL_IF_NOT_NULL(m_velocityAverage,AverageInit) ();
CALL_IF_NOT_NULL(m_deformationAverage,AverageInit) ();
m_initViewType = ViewType::AVERAGE;
break;
case ViewType::T1_KDE:
CALL_IF_NOT_NULL(m_t1KDE,AverageInit) ();
m_forceAverage->AverageInit ();
CALL_IF_NOT_NULL(m_velocityAverage,AverageInit) ();
m_initViewType = ViewType::T1_KDE;
break;
default:
m_initViewType = ViewType::COUNT;
break;
}
}
void AttributeAverages::AverageRelease ()
{
m_scalarAverage->AverageRelease ();
m_forceAverage->AverageRelease ();
CALL_IF_NOT_NULL(m_velocityAverage,AverageRelease) ();
CALL_IF_NOT_NULL(m_deformationAverage,AverageRelease) ();
CALL_IF_NOT_NULL(m_t1KDE,AverageRelease) ();
}
void AttributeAverages::AverageStep (int direction, size_t timeWindow)
{
const ViewSettings& vs = GetViewSettings ();
switch (vs.GetViewType ())
{
case ViewType::AVERAGE:
m_scalarAverage->AverageStep (direction, timeWindow);
m_forceAverage->AverageStep (direction, timeWindow);
CALL_IF_NOT_NULL(m_velocityAverage,AverageStep) (direction, timeWindow);
CALL_IF_NOT_NULL(m_deformationAverage,AverageStep) (
direction, timeWindow);
break;
case ViewType::T1_KDE:
CALL_IF_NOT_NULL(m_t1KDE,AverageStep) (direction, timeWindow);
CALL_IF_NOT_NULL(m_velocityAverage,AverageStep) (direction, timeWindow);
break;
default:
break;
}
}
void AttributeAverages::AverageRotateAndDisplay (
StatisticsType::Enum displayType,
G3D::Vector2 rotationCenter, float angleDegrees) const
{
const ViewSettings& vs = GetViewSettings ();
switch (vs.GetViewType ())
{
case ViewType::AVERAGE:
m_scalarAverage->AverageRotateAndDisplay (
displayType, rotationCenter, angleDegrees);
m_forceAverage->AverageRotateAndDisplay (
displayType, rotationCenter, angleDegrees);
if (vs.IsDeformationShown ())
CALL_IF_NOT_NULL(m_deformationAverage,AverageRotateAndDisplay) (
displayType, rotationCenter, angleDegrees);
break;
case ViewType::T1_KDE:
CALL_IF_NOT_NULL(m_t1KDE,AverageRotateAndDisplay) (
displayType, rotationCenter, angleDegrees);
break;
default:
break;
}
if (vs.IsVelocityShown ())
CALL_IF_NOT_NULL(m_velocityAverage,AverageRotateAndDisplay) (
displayType, rotationCenter, angleDegrees);
}