Skip to content
Snippets Groups Projects
Commit 5b1895e3 authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Realized I forgot to implement neighbour relations in 2D Voronoi algorithm....

Realized I forgot to implement neighbour relations in 2D Voronoi algorithm. Implemented them. 2D Sod shock still doesn't work.
parent 297b73f6
No related branches found
No related tags found
1 merge request!3211D and 2D moving mesh algorithm
...@@ -152,6 +152,7 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact( ...@@ -152,6 +152,7 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact(
/* new number of vertices and new vertex coordinates */ /* new number of vertices and new vertex coordinates */
int nvert; int nvert;
float vertices[VORONOI2D_MAXNUMVERT][2]; float vertices[VORONOI2D_MAXNUMVERT][2];
unsigned long long ngbs[VORONOI2D_MAXNUMVERT];
/* The process of cutting the current cell with the midline of the generator /* The process of cutting the current cell with the midline of the generator
and the given relative neighbour position proceeds in two steps: and the given relative neighbour position proceeds in two steps:
...@@ -407,6 +408,7 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact( ...@@ -407,6 +408,7 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact(
while (i != index_above1) { while (i != index_above1) {
vertices[nvert][0] = cell->vertices[i][0]; vertices[nvert][0] = cell->vertices[i][0];
vertices[nvert][1] = cell->vertices[i][1]; vertices[nvert][1] = cell->vertices[i][1];
ngbs[nvert] = cell->ngbs[i];
++nvert; ++nvert;
VORONOI_CHECK_SIZE(); VORONOI_CHECK_SIZE();
++i; ++i;
...@@ -419,12 +421,14 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact( ...@@ -419,12 +421,14 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact(
b1 * cell->vertices[index_above1][0]; b1 * cell->vertices[index_above1][0];
vertices[nvert][1] = a1 * cell->vertices[index_below1][1] + vertices[nvert][1] = a1 * cell->vertices[index_below1][1] +
b1 * cell->vertices[index_above1][1]; b1 * cell->vertices[index_above1][1];
ngbs[nvert] = id;
++nvert; ++nvert;
VORONOI_CHECK_SIZE(); VORONOI_CHECK_SIZE();
vertices[nvert][0] = a2 * cell->vertices[index_below2][0] + vertices[nvert][0] = a2 * cell->vertices[index_below2][0] +
b2 * cell->vertices[index_above2][0]; b2 * cell->vertices[index_above2][0];
vertices[nvert][1] = a2 * cell->vertices[index_below2][1] + vertices[nvert][1] = a2 * cell->vertices[index_below2][1] +
b2 * cell->vertices[index_above2][1]; b2 * cell->vertices[index_above2][1];
ngbs[nvert] = cell->ngbs[index_above1];
++nvert; ++nvert;
VORONOI_CHECK_SIZE(); VORONOI_CHECK_SIZE();
...@@ -433,6 +437,7 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact( ...@@ -433,6 +437,7 @@ __attribute__((always_inline)) INLINE void voronoi_cell_interact(
for (i = 0; i < cell->nvert; ++i) { for (i = 0; i < cell->nvert; ++i) {
cell->vertices[i][0] = vertices[i][0]; cell->vertices[i][0] = vertices[i][0];
cell->vertices[i][1] = vertices[i][1]; cell->vertices[i][1] = vertices[i][1];
cell->ngbs[i] = ngbs[i];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment