-
Notifications
You must be signed in to change notification settings - Fork 0
/
AttributeAverages3D.cpp
79 lines (66 loc) · 2.24 KB
/
AttributeAverages3D.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
/**
* @file AttributeAverages3D.cpp
* @author Dan R. Lipsa
* @date 7 Feb 2013
*
* Definitions for the view average
*/
#include "AttributeAverages3D.h"
#include "ForceAverage.h"
#include "RegularGridAverage.h"
#include "Settings.h"
#include "Utils.h"
#include "ViewSettings.h"
AttributeAverages3D::AttributeAverages3D (
ViewNumber::Enum viewNumber,
boost::shared_ptr<Settings> settings,
boost::shared_ptr<const SimulationGroup> simulationGroup,
boost::shared_ptr<DerivedData>* dd) :
AttributeAverages (viewNumber, settings, simulationGroup, dd)
{
m_scalarAverage.reset (
new RegularGridAverage (viewNumber, settings, simulationGroup, dd));
boost::shared_ptr<RegularGridAverage> average;
average.reset (
new RegularGridAverage (viewNumber, settings, simulationGroup, dd));
average->SetBodyAttribute (BodyAttribute::VELOCITY);
m_velocityAverage = average;
average.reset (
new RegularGridAverage (viewNumber, settings, simulationGroup, dd));
average->SetBodyAttribute (OtherScalar::T1_KDE);
m_t1KDE = average;
/*
boost::shared_ptr<RegularGridAverage> deformationAverage (
new RegularGridAverage (viewNumber, settings, simulationGroup));
deformationAverage->SetBodyAttribute (BodyAttribute::DEFORMATION);
m_deformationAverage = deformationAverage;
*/
m_forceAverage.reset (
new ForceAverage (viewNumber, settings, simulationGroup, dd));
}
void AttributeAverages3D::ComputeAverage ()
{
const ViewSettings& vs = GetViewSettings ();
switch (vs.GetViewType ())
{
case ViewType::AVERAGE:
GetScalarAverage ()->ComputeAverage ();
CALL_IF_NOT_NULL(GetVelocityAverage (),ComputeAverage) ();
CALL_IF_NOT_NULL(GetDeformationAverage (),ComputeAverage) ();
break;
case ViewType::T1_KDE:
CALL_IF_NOT_NULL(GetT1KDE (),ComputeAverage) ();
CALL_IF_NOT_NULL(GetVelocityAverage (),ComputeAverage) ();
break;
default:
break;
}
}
boost::shared_ptr<RegularGridAverage>
AttributeAverages3D::GetBodyOrOtherScalarAverage ()
{
const ViewSettings& vs = GetViewSettings ();
size_t bodyOrOtherScalar = vs.GetBodyOrOtherScalar ();
return (bodyOrOtherScalar == OtherScalar::T1_KDE) ?
GetT1KDE () : GetScalarAverage ();
}