Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
e4e7f588
Commit
e4e7f588
authored
Jun 23, 2016
by
LEFEBVREJP email
Browse files
Cleaning up radixgeometry grid.
parent
76a12f0a
Pipeline
#7008
skipped
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixgeometry/grid.cc
View file @
e4e7f588
...
...
@@ -38,10 +38,12 @@ std::vector<Real>& Grid::zplanes()
}
Grid
::
Grid
()
{
Grid
::
Grid
()
:
mTranslation
(
0
,
0
,
0
){
}
Grid
::
Grid
(
const
Grid
&
orig
)
:
mXPlanes
(
orig
.
mXPlanes
)
:
mTranslation
(
0
,
0
,
0
)
,
mXPlanes
(
orig
.
mXPlanes
)
,
mYPlanes
(
orig
.
mYPlanes
)
,
mZPlanes
(
orig
.
mZPlanes
)
{
}
...
...
@@ -49,7 +51,8 @@ Grid::Grid(const Grid& orig)
Grid
::
Grid
(
Point3D
lowerLeftCorner
,
Real
deltaX
,
Real
deltaY
,
Real
deltaZ
,
int
numX
,
int
numY
,
int
numZ
)
:
mXPlanes
(
numX
+
1
)
:
mTranslation
(
lowerLeftCorner
)
,
mXPlanes
(
numX
+
1
)
,
mYPlanes
(
numY
+
1
)
,
mZPlanes
(
numZ
+
1
)
{
...
...
@@ -58,9 +61,9 @@ Grid::Grid(Point3D lowerLeftCorner
radix_check
(
mZPlanes
.
size
()
>=
2
);
//
// Initialize first planes with lower left corner
mXPlanes
[
0
]
=
lowerLeftCorner
.
x
;
mYPlanes
[
0
]
=
lowerLeftCorner
.
y
;
mZPlanes
[
0
]
=
lowerLeftCorner
.
z
;
mXPlanes
[
0
]
=
0
;
mYPlanes
[
0
]
=
0
;
mZPlanes
[
0
]
=
0
;
//
// auto populate grid with delta#
for
(
size_t
i
=
1
;
i
<
mXPlanes
.
size
();
++
i
)
...
...
@@ -90,6 +93,14 @@ Grid::Grid(Point3D lowerLeftCorner
Grid
::~
Grid
()
{
}
void
Grid
::
arrayCoordinates
(
Real
&
xo
,
Real
&
yo
,
Real
&
zo
)
const
{
xo
+=
mTranslation
.
x
;
yo
+=
mTranslation
.
y
;
zo
+=
mTranslation
.
z
;
}
void
Grid
::
origin
(
int
xi
,
int
yi
,
int
zi
,
Point3D
&
o
)
const
{
radix_require
(
!
mXPlanes
.
empty
());
...
...
@@ -142,6 +153,10 @@ Grid::Grid(Point3D lowerLeftCorner
return
in
;
}
bool
Grid
::
start
(
const
Ray
&
r
,
int
&
xi
,
int
&
yi
,
int
&
zi
)
const
{
return
start
(
r
.
o
.
x
,
r
.
o
.
y
,
r
.
o
.
z
,
r
.
d
.
x
,
r
.
d
.
y
,
r
.
d
.
z
,
xi
,
yi
,
zi
);
}
/**
* Determine the starting array index for the given point
* @return true, if and only if the point starts inside the array
...
...
radixgeometry/grid.hh
View file @
e4e7f588
...
...
@@ -10,6 +10,7 @@
#include
"radixmath/constants.hh"
#include
"radixmath/point3d.hh"
#include
"radixmath/vector3d.hh"
#include
"radixmath/ray.hh"
namespace
radix
{
...
...
@@ -21,10 +22,6 @@ protected:
std
::
vector
<
Real
>
mZPlanes
;
public:
Grid
();
/**
* @brief Grid - initialize the cuboidal array with the given array data
* @param arrayData
*/
Grid
(
const
Grid
&
orig
);
Grid
(
Point3D
lowerLeftCorner
,
Real
deltaX
,
Real
deltaY
,
Real
deltaZ
...
...
@@ -34,12 +31,12 @@ public:
,
const
std
::
vector
<
Real
>&
zplanes
);
~
Grid
();
/**
* @brief origin - acquire the origin of the desired array index in array space coordinates
* @param xi - x index [0,xsize-1]
* @param yi - y index [0,ysize-1]
* @param zi - z index [0,zsize-1]
* @param o - the point to populate with the origin
*/
* @brief origin - acquire the origin of the desired array index in array space coordinates
* @param xi - x index [0,xsize-1]
* @param yi - y index [0,ysize-1]
* @param zi - z index [0,zsize-1]
* @param o - the point to populate with the origin
*/
void
origin
(
int
xi
,
int
yi
,
int
zi
,
Point3D
&
o
)
const
;
inline
size_t
xcount
()
const
{
...
...
@@ -55,51 +52,59 @@ public:
}
std
::
string
toString
()
const
;
/**
* Determine if the given x,y,z is inside (or on) the array
*/
* Determine if the given x,y,z is inside (or on) the array
*/
bool
inside
(
Real
x
,
Real
y
,
Real
z
)
const
;
/**
* @brief start convenience method for \code start(Real, Real, Real, Real, Real, Real, int&, int&Grid, int&)
* @param r const Ray&
* @param xi - the x index to be populated if xo starts inside the array
* @param yi - the y index to be populated if yo starts inside the array
* @param zi - the z index to be populated if zo starts inside the array
* @return true, if and only if the point starts inside the array
* @return
*/
bool
start
(
const
Ray
&
r
,
int
&
xi
,
int
&
yi
,
int
&
zi
)
const
;
/**
* Determine the starting array index for the given point
* @param xo - the x origin
* @param yo - the y origin
* @param zo - the z origin
* @param xd - the x direction
* @param yd - the y direction
* @param zd - the z direction
* @param xi - the x index to be populated if xo starts inside the array
* @param yi - the y index to be populated if yo starts inside the array
* @param zi - the z index to be populated if zo starts inside the array
* @return true, if and only if the point starts inside the array
*/
* Determine the starting array index for the given point
* @param xo - the x origin
* @param yo - the y origin
* @param zo - the z origin
* @param xd - the x direction
* @param yd - the y direction
* @param zd - the z direction
* @param xi - the x index to be populated if xo starts inside the array
* @param yi - the y index to be populated if yo starts inside the array
* @param zi - the z index to be populated if zo starts inside the array
* @return true, if and only if the point starts inside the array
*/
bool
start
(
Real
xo
,
Real
yo
,
Real
zo
,
Real
xd
,
Real
yd
,
Real
zd
,
int
&
xi
,
int
&
yi
,
int
&
zi
)
const
;
/**
* Determine the next array index that the given ray will move into
* @param xo - the x origin
* @param yo - the y origin
* @param zo - the z origin
* @param xd - the x direction
* @param yd - the y direction
* @param zd - the z direction
* @param xi - the xi index that contains xo, and once complete the new x index
* @param yi - the yi index that contains yo, and once complete the new y index
* @param zi - the zi index that contains zo, and once complete the new z index
* @param t - the track length to populate with the distance to the next index (if any)
* NOTE: It is assumed that the boundary conditions are managed by the caller
*/
* Determine the next array index that the given ray will move into
* @param xo - the x origin
* @param yo - the y origin
* @param zo - the z origin
* @param xd - the x direction
* @param yd - the y direction
* @param zd - the z direction
* @param xi - the xi index that contains xo, and once complete the new x index
* @param yi - the yi index that contains yo, and once complete the new y index
* @param zi - the zi index that contains zo, and once complete the new z index
* @param t - the track length to populate with the distance to the next index (if any)
* NOTE: It is assumed that the boundary conditions are managed by the caller
*/
void
next
(
Real
xo
,
Real
yo
,
Real
zo
,
Real
xd
,
Real
yd
,
Real
zd
,
int
&
xi
,
int
&
yi
,
int
&
zi
,
Real
&
t
)
const
;
void
setTranslation
(
const
Vector3D
&
t
){
mTranslation
=
t
;}
void
arrayCoordinates
(
Real
&
xo
,
Real
&
yo
,
Real
&
zo
)
const
{
xo
+=
mTranslation
.
x
;
yo
+=
mTranslation
.
y
;
zo
+=
mTranslation
.
z
;
}
void
arrayCoordinates
(
Real
&
xo
,
Real
&
yo
,
Real
&
zo
)
const
;
const
std
::
vector
<
Real
>&
xplanes
()
const
;
...
...
radixgeometry/tests/tstGrid.cc
View file @
e4e7f588
...
...
@@ -21,12 +21,12 @@ TEST(Grid, Constructor)
EXPECT_EQ
(
grid
.
ycount
(),
21
);
EXPECT_EQ
(
grid
.
zcount
(),
6
);
EXPECT_FLOAT_EQ
(
grid
.
xplanes
()[
0
],
point
.
x
);
EXPECT_FLOAT_EQ
(
grid
.
yplanes
()[
0
],
point
.
y
);
EXPECT_FLOAT_EQ
(
grid
.
zplanes
()[
0
],
point
.
z
);
EXPECT_FLOAT_EQ
(
grid
.
xplanes
()[
0
],
0
);
EXPECT_FLOAT_EQ
(
grid
.
yplanes
()[
0
],
0
);
EXPECT_FLOAT_EQ
(
grid
.
zplanes
()[
0
],
0
);
EXPECT_FLOAT_EQ
(
grid
.
xplanes
()[
40
],
point
.
x
+
(
40
*
.05
)
)
;
EXPECT_FLOAT_EQ
(
grid
.
yplanes
()[
20
],
point
.
y
+
(
20
*
.05
)
)
;
EXPECT_FLOAT_EQ
(
grid
.
xplanes
()[
40
],
40
*
.05
);
EXPECT_FLOAT_EQ
(
grid
.
yplanes
()[
20
],
20
*
.05
);
EXPECT_FLOAT_EQ
(
grid
.
zplanes
()[
5
],
5000
);
// override the zplanes
...
...
@@ -71,33 +71,33 @@ TEST(Grid, Uniform)
EXPECT_TRUE
(
array
.
inside
(
xo
,
yo
,
zo
));
zo
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
!
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
!
array
.
inside
(
xo
,
yo
,
zo
));
yo
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
!
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
!
array
.
inside
(
xo
,
yo
,
zo
));
xo
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
!
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
!
array
.
inside
(
xo
,
yo
,
zo
));
xo
=
1
;
yo
=
1
;
zo
=
3
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
array
.
inside
(
xo
,
yo
,
zo
));
yo
=
3
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
array
.
inside
(
xo
,
yo
,
zo
));
xo
=
3
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
array
.
inside
(
xo
,
yo
,
zo
));
zo
=
4
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
!
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
!
array
.
inside
(
xo
,
yo
,
zo
));
yo
=
4
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
!
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
!
array
.
inside
(
xo
,
yo
,
zo
));
xo
=
4
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" inside ? "
<<
array
.
inside
(
xo
,
yo
,
zo
));
radix_insist
(
!
array
.
inside
(
xo
,
yo
,
zo
)
,
"Point result not as expected!"
);
EXPECT_TRUE
(
!
array
.
inside
(
xo
,
yo
,
zo
));
//
// start
//
...
...
@@ -108,89 +108,89 @@ TEST(Grid, Uniform)
yd
=
0
;
zd
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
,
"Indices not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
);
xo
=
1.2
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
,
"Indices not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
);
xo
=
1
;
zo
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
yo
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
xo
=
0
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
xo
=
1
;
yo
=
1
;
zo
=
3
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
2
,
"indices not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
2
);
yo
=
3
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
radix_insist
(
xi
==
0
&&
yi
==
2
&&
zi
==
2
,
"indices not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
2
&&
zi
==
2
);
xo
=
3
;
// NOTE xd=1, which is heading away from the array, so start should fail
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
xd
=
0
;
zd
=
-
1
;
// headed towards the array
zo
=
4
;
// but z is well outside array
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
yd
=
-
1
;
// headed towards the array
yo
=
4
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
xd
=
-
1
;
// headed towards the array
xo
=
4
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
zd
=
-
1
;
// headed towards the array
zo
=
3
;
// with z on the surface, but y and are not proper yet
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
yd
=
-
1
;
// headed towards the array
yo
=
3
;
// x still not proper
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
xd
=
-
1
;
// headed towards the array
xo
=
3
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_tagged_line
(
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
);
//
// NOTE: While xo=yo=zo=3, all their directions pointed negative
// so they sit on plane=3, but will interact with plane=2
// so the index of that plane is 1
//
radix_insist
(
xi
==
1
&&
yi
==
1
&&
zi
==
1
,
"indices not as expected!"
);
EXPECT_TRUE
(
xi
==
1
&&
yi
==
1
&&
zi
==
1
);
xd
=
yd
=
zd
=
1
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
!
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
xo
=
yo
=
zo
=
2
;
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" start ? "
<<
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start result not as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
radix_insist
(
xi
==
1
&&
yi
==
1
&&
zi
==
1
,
"indices not as expected!"
);
EXPECT_TRUE
(
xi
==
1
&&
yi
==
1
&&
zi
==
1
);
{
// test next
Real
t
=
0
;
...
...
@@ -200,28 +200,28 @@ TEST(Grid, Uniform)
xd
=
1
;
yd
=
zd
=
0
;
xo
=
yo
=
zo
=
p
[
0
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
);
for
(
int
i
=
0
;
i
<
int
(
array
.
xcount
())
-
1
;
i
++
)
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
<<
" for i = "
<<
i
);
radix_insist
(
xi
==
i
+
1
&&
yi
==
0
&&
zi
==
0
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
(
i
+
1
))
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
i
+
1
&&
yi
==
0
&&
zi
==
0
);
EXPECT_TRUE
(
std
::
abs
(
t
-
(
i
+
1
))
<
kEpsilon
);
}
xd
=
-
1
;
yd
=
zd
=
0
;
xo
=
yo
=
zo
=
p
[
2
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
1
&&
yi
==
2
&&
zi
==
2
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
1
&&
yi
==
2
&&
zi
==
2
);
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
);
radix_insist
(
xi
==
0
&&
yi
==
2
&&
zi
==
2
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
1
)
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
2
&&
zi
==
2
);
EXPECT_TRUE
(
std
::
abs
(
t
-
1
)
<
kEpsilon
);
}
//
// across y axis
...
...
@@ -229,28 +229,28 @@ TEST(Grid, Uniform)
yd
=
1
;
xd
=
zd
=
0
;
xo
=
yo
=
zo
=
p
[
0
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
);
for
(
int
i
=
0
;
i
<
int
(
array
.
xcount
())
-
1
;
i
++
)
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
<<
" for i = "
<<
i
);
radix_insist
(
xi
==
0
&&
yi
==
i
+
1
&&
zi
==
0
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
(
i
+
1
))
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
i
+
1
&&
zi
==
0
);
EXPECT_TRUE
(
std
::
abs
(
t
-
(
i
+
1
))
<
kEpsilon
);
}
yd
=
-
1
;
xd
=
zd
=
0
;
xo
=
yo
=
zo
=
p
[
2
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
2
&&
yi
==
1
&&
zi
==
2
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
2
&&
yi
==
1
&&
zi
==
2
);
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
);
radix_insist
(
yi
==
0
&&
xi
==
2
&&
zi
==
2
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
1
)
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
yi
==
0
&&
xi
==
2
&&
zi
==
2
);
EXPECT_TRUE
(
std
::
abs
(
t
-
1
)
<
kEpsilon
);
}
//
// across z axis
...
...
@@ -258,57 +258,57 @@ TEST(Grid, Uniform)
zd
=
1
;
xd
=
yd
=
0
;
xo
=
yo
=
zo
=
p
[
0
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
);
for
(
int
i
=
0
;
i
<
int
(
array
.
xcount
())
-
1
;
i
++
)
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
<<
" for i = "
<<
i
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
i
+
1
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
(
i
+
1
))
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
i
+
1
);
EXPECT_TRUE
(
std
::
abs
(
t
-
(
i
+
1
))
<
kEpsilon
);
}
zd
=
-
1
;
xd
=
yd
=
0
;
xo
=
yo
=
zo
=
p
[
2
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
2
&&
zi
==
1
&&
yi
==
2
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
2
&&
zi
==
1
&&
yi
==
2
);
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
);
radix_insist
(
xi
==
2
&&
zi
==
0
&&
yi
==
2
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
1
)
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
2
&&
zi
==
0
&&
yi
==
2
);
EXPECT_TRUE
(
std
::
abs
(
t
-
1
)
<
kEpsilon
);
}
// across xy
xd
=
yd
=
.5
;
zd
=
0
;
xo
=
yo
=
zo
=
p
[
0
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
0
&&
yi
==
0
&&
zi
==
0
);
for
(
int
i
=
0
;
i
<
int
(
array
.
xcount
())
-
1
;
i
++
)
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
Real
expected
=
std
::
sqrt
(
2
*
(
std
::
pow
(
static_cast
<
Real
>
(
i
+
1
),
2
)
+
std
::
pow
(
static_cast
<
Real
>
(
i
+
1
),
2
)));
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
<<
" with expected = "
<<
expected
<<
" for i = "
<<
i
);
radix_insist
(
xi
==
i
+
1
&&
yi
==
i
+
1
&&
zi
==
0
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
expected
)
<
kEpsilon
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
i
+
1
&&
yi
==
i
+
1
&&
zi
==
0
);
EXPECT_TRUE
(
std
::
abs
(
t
-
expected
)
<
kEpsilon
);
}
xd
=
yd
=
-
0.707107
;
zd
=
0
;
xo
=
yo
=
zo
=
p
[
2
];
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
1
&&
yi
==
1
&&
zi
==
2
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
1
&&
yi
==
1
&&
zi
==
2
);
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
<<
" expected t="
<<
std
::
sqrt
(
1.0
+
1.0
)
);
radix_insist
(
yi
==
0
&&
xi
==
0
&&
zi
==
2
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
std
::
sqrt
(
1.0
+
1.0
))
<
0.00001
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
yi
==
0
&&
xi
==
0
&&
zi
==
2
);
EXPECT_TRUE
(
std
::
abs
(
t
-
std
::
sqrt
(
1.0
+
1.0
))
<
0.00001
);
}
xd
=
0.5
*
std
::
sqrt
(
3.0
);
yd
=
-
0.5
;
...
...
@@ -317,15 +317,15 @@ TEST(Grid, Uniform)
xo
=
p
[
1
];
Real
fuzz
=
1.0e-13
;
yo
=
p
[
1
]
+
1.0
/
std
::
sqrt
(
3.0
)
+
fuzz
;
radix_insist
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
)
,
"Start not as expected!"
);
radix_insist
(
xi
==
1
&&
yi
==
1
&&
zi
==
2
,
"Indices do not start as expected!"
);
EXPECT_TRUE
(
array
.
start
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
));
EXPECT_TRUE
(
xi
==
1
&&
yi
==
1
&&
zi
==
2
);
{
array
.
next
(
xo
,
yo
,
zo
,
xd
,
yd
,
zd
,
xi
,
yi
,
zi
,
t
);
radix_tagged_line
(
xo
<<
","
<<
yo
<<
","
<<
zo
<<
" - "
<<
xd
<<
","
<<
yd
<<
","
<<
zd
<<
" - "
<<
"xi="
<<
xi
<<
",yi="
<<
yi
<<
",zi="
<<
zi
<<
" t="
<<
t
<<
" expected t="
<<
2.0
/
std
::
sqrt
(
3.0
)
);
radix_insist
(
xi
==
2
&&
yi
==
0
&&
zi
==
2
,
"Indices are not as expected!"
);
radix_insist
(
std
::
abs
(
t
-
2.0
/
std
::
sqrt
(
3.0
))
<
0.00001
,
"Tracklength is not as expected!"
);
EXPECT_TRUE
(
xi
==
2
&&
yi
==
0
&&
zi
==
2
);
EXPECT_TRUE
(
std
::
abs
(
t
-
2.0
/
std
::
sqrt
(
3.0
))
<
0.00001
);
}
// across xz
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment