forked from jacobwjs/MC-Boost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabsorber.cpp
65 lines (50 loc) · 1.19 KB
/
absorber.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
//
// absorber.cpp
// Xcode
//
// Created by jacob on 6/20/11.
//
#include "absorber.h"
#include "vector3D.h"
#include "logger.h"
Absorber::Absorber(const double x, const double y, const double z)
{
center = boost::shared_ptr<Vector3d> (new Vector3d);
center->location.x = x;
center->location.y = y;
center->location.z = z;
InitCommon();
}
Absorber::Absorber(const Vector3d &c)
{
center = boost::shared_ptr<Vector3d> (new Vector3d);
center->location.x = c.location.x;
center->location.y = c.location.y;
center->location.z = c.location.z;
InitCommon();
}
Absorber::Absorber(const boost::shared_ptr<Vector3d> c)
{
center = boost::shared_ptr<Vector3d> (new Vector3d);
center->location.x = c->location.x;
center->location.y = c->location.y;
center->location.z = c->location.z;
InitCommon();
}
void Absorber::InitCommon(void)
{
absorbedWeight = 0.0f;
}
void Absorber::updateAbsorbedWeight(const double absorbed)
{
boost::mutex::scoped_lock lock(m_mutex);
this->absorbedWeight += absorbed;
}
void Absorber::writeData(void)
{
Logger::getInstance()->writeAbsorberData(absorbedWeight);
}
Absorber::~Absorber()
{
// STUB
}