-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBoundaries.cpp
65 lines (58 loc) · 2.02 KB
/
Boundaries.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
/*
@file Boundaries.cpp
@brief contains functions for the Boundaries class
@author Luke Eure
@date January 9 2016
*/
#include "Boundaries.h"
/*
@brief constructor for Boundaries class
*/
Boundaries::Boundaries() {}
/*
@brief deconstructor
*/
Boundaries::~Boundaries() {}
/*
@brief set the surfaces into the geometry
@paraam axis 0, 1, or 2 corresponding to x y and z
@param side 0 or 1 corresponding to the minimum or maximum of the geometry
*/
void Boundaries::setSurface(Axes axis, min_max side, Surface* surface) {
_surfaces[2*axis + side] = surface;
}
/*
@brief return the position of the surface
@paraam axis 0, 1, or 2 corresponding to x y and z
@param side 0 or 1 corresponding to the minimum or maximum of the geometry
@return the position of the surface within the geometry
*/
float Boundaries::getSurfaceCoord(int axis, int side) {
return _surfaces[axis*2+side]->getPosition();
}
/*
@brief return the type of a surface
@paraam axis 0, 1, or 2 corresponding to x y and z
@param side 0 or 1 corresponding to the minimum or maximum of the geometry
@return the type of the surface, 0 = vacuum 1 = reflective
*/
BoundaryType Boundaries::getSurfaceType(int axis, int side) {
return _surfaces[axis*2+side]->getType();
}
/*
@brief function that samples a random location within a bounding box.
@details a point is randomly and uniformally sampled in the bounding box
provided in the input.
@param bounds a Boundaries object containing the limits of the
bounding box
@return _dist_location a vector that contains the coordinates of a point
*/
std::vector <double> Boundaries::sampleLocation(Neutron* neutron) {
std::vector <double> _dist_location(3);
for (int axis=0; axis<3; ++axis) {
double width = getSurfaceCoord(axis, MAX) - getSurfaceCoord(axis, MIN);
double coord = getSurfaceCoord(axis, MIN) + width * neutron->arand();
_dist_location[axis] = coord;
}
return _dist_location;
}