Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
504111bc
Commit
504111bc
authored
8 years ago
by
Bert Vandenbroucke
Browse files
Options
Downloads
Patches
Plain Diff
First part of 3D Voronoi algorithm is now completely covered by unit tests.
parent
7a2ad0b9
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!321
1D and 2D moving mesh algorithm
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hydro/Shadowswift/voronoi3d_algorithm.h
+18
-0
18 additions, 0 deletions
src/hydro/Shadowswift/voronoi3d_algorithm.h
tests/testVoronoi3D.c
+780
-14
780 additions, 14 deletions
tests/testVoronoi3D.c
with
798 additions
and
14 deletions
src/hydro/Shadowswift/voronoi3d_algorithm.h
+
18
−
0
View file @
504111bc
...
...
@@ -432,9 +432,13 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
// if lp is also above the plane, replace up by lp and repeat the process
// until lp is below the plane
while
((
*
lw
)
==
1
)
{
/* PATH 1.4 */
*
u
=
(
*
l
);
*
up
=
(
*
lp
);
*
us
=
0
;
/* no while: PATH 1.4.0 */
/* somewhere in while: PATH 1.4.1 */
/* last valid option of while: PATH 1.4.2 */
while
((
*
us
)
<
(
*
ls
)
&&
(
*
l
)
>=
(
*
u
))
{
*
lp
=
voronoi_get_edge
(
c
,
(
*
up
),
(
*
us
));
*
lw
=
voronoi_test_vertex
(
&
c
->
vertices
[
3
*
(
*
lp
)],
dx
,
r2
,
l
,
...
...
@@ -443,6 +447,9 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
}
if
((
*
l
)
>=
(
*
u
))
{
(
*
us
)
++
;
/* no while: PATH 1.4.3 */
/* somewhere in while: PATH 1.4.4 */
/* last valid option of while: PATH 1.4.5 */
while
((
*
us
)
<
c
->
orders
[(
*
up
)]
&&
(
*
l
)
>=
(
*
u
))
{
*
lp
=
voronoi_get_edge
(
c
,
(
*
up
),
(
*
us
));
*
lw
=
voronoi_test_vertex
(
&
c
->
vertices
[
3
*
(
*
lp
)],
dx
,
r2
,
l
,
...
...
@@ -450,6 +457,7 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
(
*
us
)
++
;
}
if
((
*
l
)
>=
(
*
u
))
{
/* PATH 1.4.6 */
message
(
"Cell completely gone! This should not happen. (l >= u, l = "
"%g, u = %g)"
,
...
...
@@ -463,6 +471,7 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
// if lp is too close to the plane, replace up by lp and proceed to
// complicated setup
if
((
*
lw
)
==
0
)
{
/* PATH 1.5 */
*
up
=
(
*
lp
);
complicated
=
1
;
}
...
...
@@ -503,10 +512,14 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
// repeat the above process until qp is closer or above the plane
while
((
*
qw
)
==
-
1
)
{
/* PATH 2.4 */
*
qs
=
voronoi_get_edgeindex
(
c
,
(
*
up
),
(
*
us
));
*
u
=
(
*
q
);
*
up
=
(
*
qp
);
*
us
=
0
;
/* no while: PATH 2.4.0 */
/* somewhere in while: PATH 2.4.1 */
/* last valid option of while: 2.4.2 */
while
((
*
us
)
<
(
*
qs
)
&&
(
*
u
)
>=
(
*
q
))
{
*
qp
=
voronoi_get_edge
(
c
,
(
*
up
),
(
*
us
));
*
qw
=
voronoi_test_vertex
(
&
c
->
vertices
[
3
*
(
*
qp
)],
dx
,
r2
,
q
,
...
...
@@ -515,6 +528,9 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
}
if
((
*
u
)
>=
(
*
q
))
{
(
*
us
)
++
;
/* no while: PATH 2.4.3 */
/* somewhere in while: PATH 2.4.4 */
/* last valid option of while: PATH 2.4.5 */
while
((
*
us
)
<
c
->
orders
[(
*
up
)]
&&
(
*
u
)
>=
(
*
q
))
{
*
qp
=
voronoi_get_edge
(
c
,
(
*
up
),
(
*
us
));
*
qw
=
voronoi_test_vertex
(
&
c
->
vertices
[
3
*
(
*
qp
)],
dx
,
r2
,
q
,
...
...
@@ -522,6 +538,7 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
(
*
us
)
++
;
}
if
((
*
u
)
>=
(
*
q
))
{
/* PATH 2.4.6 */
/* cell unaltered */
return
0
;
}
...
...
@@ -537,6 +554,7 @@ __attribute__((always_inline)) INLINE int voronoi_intersect_find_closest_vertex(
*
us
=
voronoi_get_edgeindex
(
c
,
(
*
lp
),
(
*
ls
));
*
u
=
(
*
q
);
}
else
{
/* PATH 2.5 */
// too close to call: go to complicated setup
*
up
=
(
*
qp
);
complicated
=
1
;
...
...
This diff is collapsed.
Click to expand it.
tests/testVoronoi3D.c
+
780
−
14
View file @
504111bc
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment