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
910cf09e
Commit
910cf09e
authored
4 years ago
by
Bert Vandenbroucke
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug in Voronoi grid pair list construction. Added function to output pair information.
parent
91f57f53
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/shadowfax/cell_shadowfax.h
+0
-6
0 additions, 6 deletions
src/shadowfax/cell_shadowfax.h
src/shadowfax/delaunay.h
+1
-0
1 addition, 0 deletions
src/shadowfax/delaunay.h
src/shadowfax/voronoi.h
+36
-8
36 additions, 8 deletions
src/shadowfax/voronoi.h
with
37 additions
and
14 deletions
src/shadowfax/cell_shadowfax.h
+
0
−
6
View file @
910cf09e
...
...
@@ -45,12 +45,6 @@ __attribute__((always_inline)) INLINE static void cell_shadowfax_do_self1(
const
int
count
=
c
->
hydro
.
count
;
struct
part
*
restrict
parts
=
c
->
hydro
.
parts
;
for
(
int
pd
=
0
;
pd
<
count
;
pd
++
)
{
/* Get a pointer to the ith particle. */
struct
part
*
restrict
p
=
&
parts
[
pd
];
p
->
voronoi
.
flag
=
0
;
}
/* Loop over the parts in c. */
for
(
int
pd
=
0
;
pd
<
count
;
pd
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/shadowfax/delaunay.h
+
1
−
0
View file @
910cf09e
...
...
@@ -1582,6 +1582,7 @@ inline static void delaunay_add_new_vertex(struct delaunay* restrict d,
d
->
ngb_indices
=
(
int
*
)
swift_realloc
(
"delaunay ngb indices"
,
d
->
ngb_indices
,
d
->
ngb_size
*
sizeof
(
int
));
}
delaunay_assert
(
d
->
ngb_index
==
v
-
d
->
ngb_offset
);
d
->
ngb_cells
[
d
->
ngb_index
]
=
cell_index
;
d
->
ngb_indices
[
d
->
ngb_index
]
=
index_in_cell
;
++
d
->
ngb_index
;
...
...
This diff is collapsed.
Click to expand it.
src/shadowfax/voronoi.h
+
36
−
8
View file @
910cf09e
...
...
@@ -32,6 +32,10 @@
#include
<string.h>
/*! @brief Store the edges of faces (so that the actual Voronoi grid can be
* reconstructed). */
#define VORONOI_STORE_CONNECTIONS
/**
* @brief Voronoi interface.
*
...
...
@@ -344,8 +348,9 @@ static inline void voronoi_init(struct voronoi *restrict v,
/* Get a triangle containing this generator and the index of the generator
within that triangle */
int
t0
=
d
->
vertex_triangles
[
i
+
d
->
vertex_start
];
int
vi0
=
d
->
vertex_triangle_index
[
i
+
d
->
vertex_start
];
int
dverti
=
i
+
d
->
vertex_start
;
int
t0
=
d
->
vertex_triangles
[
dverti
];
int
vi0
=
d
->
vertex_triangle_index
[
dverti
];
/* Add the first vertex for this cell: the circumcircle midpoint of this
triangle */
v
->
vertex_number
[
i
]
=
1
;
...
...
@@ -399,17 +404,17 @@ static inline void voronoi_init(struct voronoi *restrict v,
/* the neighbour corresponding to the face is the same vertex that
determines the next triangle */
int
other_vertex
=
d
->
triangles
[
t
0
].
vertices
[
vi1p2
];
int
other_vertex
=
d
->
triangles
[
t
1
].
vertices
[
vi1p2
];
if
(
other_vertex
<
d
->
ngb_offset
)
{
if
(
other_vertex
>
i
)
{
if
(
other_vertex
>
dvert
i
)
{
/* only store pairs once */
voronoi_add_pair
(
v
,
0
,
i
,
other_vertex
,
bx
,
by
,
cx
,
cy
);
voronoi_add_pair
(
v
,
0
,
dvert
i
,
other_vertex
,
bx
,
by
,
cx
,
cy
);
}
}
else
{
/* no check on other_vertex > i required, since this is always true */
int
sid
=
d
->
ngb_cells
[
other_vertex
-
d
->
ngb_offset
];
int
pid
=
d
->
ngb_indices
[
other_vertex
-
d
->
ngb_offset
];
voronoi_add_pair
(
v
,
sid
,
i
,
pid
,
bx
,
by
,
cx
,
cy
);
voronoi_add_pair
(
v
,
sid
,
dvert
i
,
pid
,
bx
,
by
,
cx
,
cy
);
}
vi1
=
d
->
triangles
[
t1
].
index_in_neighbour
[
vi1p2
];
...
...
@@ -435,9 +440,9 @@ static inline void voronoi_init(struct voronoi *restrict v,
v
->
face_midpoints
[
2
*
c0
+
1
]
=
face_midpoint
[
1
];
if
(
first_vertex
<
d
->
ngb_offset
)
{
if
(
first_vertex
>
i
)
{
if
(
first_vertex
>
dvert
i
)
{
/* only store pairs once */
voronoi_add_pair
(
v
,
0
,
i
,
first_vertex
,
bx
,
by
,
cx
,
cy
);
voronoi_add_pair
(
v
,
0
,
dvert
i
,
first_vertex
,
bx
,
by
,
cx
,
cy
);
}
}
else
{
/* no check on other_vertex > i required, since this is always true */
...
...
@@ -484,6 +489,29 @@ static inline void voronoi_check_grid(const struct voronoi *restrict v) {
printf
(
"Total volume: %g
\n
"
,
V
);
}
static
inline
void
voronoi_write_grid_new
(
const
struct
voronoi
*
restrict
v
,
const
char
*
file_name
)
{
FILE
*
file
=
fopen
(
file_name
,
"w"
);
for
(
int
i
=
0
;
i
<
v
->
number_of_cells
;
++
i
)
{
fprintf
(
file
,
"G
\t
%g
\t
%g
\n
"
,
v
->
generators
[
2
*
i
],
v
->
generators
[
2
*
i
+
1
]);
}
for
(
int
i
=
0
;
i
<
v
->
pair_index
[
0
];
++
i
)
{
struct
voronoi_pair
*
pair
=
&
v
->
pairs
[
0
][
i
];
fprintf
(
file
,
"F
\t
%g
\t
%g
\t
%g
\t
%g
\t
%i
\t
%i
\n
"
,
pair
->
a
[
0
],
pair
->
a
[
1
],
pair
->
b
[
0
],
pair
->
b
[
1
],
pair
->
left
,
pair
->
right
);
}
for
(
int
ngb
=
1
;
ngb
<
27
;
++
ngb
)
{
for
(
int
i
=
0
;
i
<
v
->
pair_index
[
ngb
];
++
i
)
{
struct
voronoi_pair
*
pair
=
&
v
->
pairs
[
ngb
][
i
];
fprintf
(
file
,
"F
\t
%g
\t
%g
\t
%g
\t
%g
\t
%i
\t
%i
\n
"
,
pair
->
a
[
0
],
pair
->
a
[
1
],
pair
->
b
[
0
],
pair
->
b
[
1
],
pair
->
left
,
-
1
);
}
}
fclose
(
file
);
}
static
inline
void
voronoi_write_grid
(
const
struct
voronoi
*
restrict
v
,
FILE
*
file
,
size_t
*
offset
)
{
...
...
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