From 86da26675fa50c8958f27c8e8d426bdb98355128 Mon Sep 17 00:00:00 2001 From: austin Date: Fri, 6 Dec 2024 19:31:05 -0500 Subject: [PATCH] fix cellular sim --- buildNumber.properties | 4 +- docs/src/progress/renderertodo.md | 2 + src/main/c/src/fluid/queue/boundsolver.c | 73 ++++++++++++------------ 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/buildNumber.properties b/buildNumber.properties index 3f3dd96d..6c4f96a6 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Fri Dec 06 19:27:15 EST 2024 -buildNumber=569 +#Fri Dec 06 19:29:52 EST 2024 +buildNumber=570 diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index b00dcb00..e4ff7c6e 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1258,6 +1258,8 @@ Fix fluid dispatcher array deref Bounds array allocation Store world pos on native side Native bounds solver +Fix cellular sim bounds check +Add hard walls to bounds solver diff --git a/src/main/c/src/fluid/queue/boundsolver.c b/src/main/c/src/fluid/queue/boundsolver.c index ffa110b2..e450272c 100644 --- a/src/main/c/src/fluid/queue/boundsolver.c +++ b/src/main/c/src/fluid/queue/boundsolver.c @@ -1,13 +1,14 @@ #include "fluid/queue/boundsolver.h" +#include "fluid/queue/chunk.h" #include "fluid/queue/chunkmask.h" #include "fluid/env/utilities.h" -static inline void fluid_solve_bounds_checker(float ** arrays){ +static inline void fluid_solve_bounds_checker(float ** arrays, int fillVal){ int i, j; int neighborIndex; //x+ face @@ -21,7 +22,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } else { for(i = 1; i < DIM; i++){ for(j = 1; j < DIM; j++){ - arrays[CENTER_LOC][IX(DIM-1, i, j)] = 0; + arrays[CENTER_LOC][IX(DIM-1, i, j)] = fillVal; } } } @@ -37,7 +38,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } else { for(i = 1; i < DIM-1; i++){ for(j = 1; j < DIM-1; j++){ - arrays[CENTER_LOC][IX(0, i, j)] = 0; + arrays[CENTER_LOC][IX(0, i, j)] = fillVal; } } } @@ -53,7 +54,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } else { for(i = 1; i < DIM-1; i++){ for(j = 1; j < DIM-1; j++){ - arrays[CENTER_LOC][IX( i, DIM-1, j)] = 0; + arrays[CENTER_LOC][IX( i, DIM-1, j)] = fillVal; } } } @@ -69,7 +70,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } else { for(i = 1; i < DIM-1; i++){ for(j = 1; j < DIM-1; j++){ - arrays[CENTER_LOC][IX(i, 0, j)] = 0; + arrays[CENTER_LOC][IX(i, 0, j)] = fillVal; } } } @@ -85,7 +86,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } else { for(i = 1; i < DIM-1; i++){ for(j = 1; j < DIM-1; j++){ - arrays[CENTER_LOC][IX( i, j, DIM-1)] = 0; + arrays[CENTER_LOC][IX( i, j, DIM-1)] = fillVal; } } } @@ -101,7 +102,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } else { for(i = 1; i < DIM-1; i++){ for(j = 1; j < DIM-1; j++){ - arrays[CENTER_LOC][IX(i, j, 0)] = 0; + arrays[CENTER_LOC][IX(i, j, 0)] = fillVal; } } } @@ -119,7 +120,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX(DIM-1, DIM-1, i)] = 0; + arrays[CENTER_LOC][IX(DIM-1, DIM-1, i)] = fillVal; } } @@ -131,7 +132,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX(DIM-1, 0, i)] = 0; + arrays[CENTER_LOC][IX(DIM-1, 0, i)] = fillVal; } } @@ -143,7 +144,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( 0, DIM-1, i)] = 0; + arrays[CENTER_LOC][IX( 0, DIM-1, i)] = fillVal; } } @@ -155,7 +156,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( 0, 0, i)] = 0; + arrays[CENTER_LOC][IX( 0, 0, i)] = fillVal; } } @@ -175,7 +176,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX(DIM-1, i, DIM-1)] = 0; + arrays[CENTER_LOC][IX(DIM-1, i, DIM-1)] = fillVal; } } @@ -187,7 +188,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX(DIM-1, i, 0)] = 0; + arrays[CENTER_LOC][IX(DIM-1, i, 0)] = fillVal; } } @@ -199,7 +200,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( 0, i, DIM-1)] = 0; + arrays[CENTER_LOC][IX( 0, i, DIM-1)] = fillVal; } } @@ -211,7 +212,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( 0, i, 0)] = 0; + arrays[CENTER_LOC][IX( 0, i, 0)] = fillVal; } } @@ -230,7 +231,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( i, DIM-1, DIM-1)] = 0; + arrays[CENTER_LOC][IX( i, DIM-1, DIM-1)] = fillVal; } } @@ -242,7 +243,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( i,DIM-1, 0)] = 0; + arrays[CENTER_LOC][IX( i,DIM-1, 0)] = fillVal; } } @@ -254,7 +255,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( i, 0, DIM-1)] = 0; + arrays[CENTER_LOC][IX( i, 0, DIM-1)] = fillVal; } } @@ -266,7 +267,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ } } else { for(i = 1; i < DIM; i++){ - arrays[CENTER_LOC][IX( i, 0, 0)] = 0; + arrays[CENTER_LOC][IX( i, 0, 0)] = fillVal; } } @@ -280,7 +281,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = arrays[neighborIndex][IX( 1, 1, 1)]; } else { - arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = 0; + arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = fillVal; } //x+ y+ z- corner @@ -288,7 +289,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = arrays[neighborIndex][IX( 1, 1, DIM-2)]; } else { - arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = 0; + arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = fillVal; } @@ -298,7 +299,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = arrays[neighborIndex][IX( 1, DIM-2, 1)]; } else { - arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = 0; + arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = fillVal; } //x+ y- z- corner @@ -306,7 +307,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = arrays[neighborIndex][IX( 1, DIM-2, DIM-2)]; } else { - arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = 0; + arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = fillVal; } @@ -316,7 +317,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = arrays[neighborIndex][IX( DIM-2, 1, 1)]; } else { - arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = 0; + arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = fillVal; } //x- y+ z- corner @@ -324,7 +325,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(0, DIM-1, 0)] = arrays[neighborIndex][IX( DIM-2, 1, DIM-2)]; } else { - arrays[CENTER_LOC][IX(0, DIM-1, 0)] = 0; + arrays[CENTER_LOC][IX(0, DIM-1, 0)] = fillVal; } @@ -334,7 +335,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(0, 0, DIM-1)] = arrays[neighborIndex][IX( DIM-2, DIM-2, 1)]; } else { - arrays[CENTER_LOC][IX(0, 0, DIM-1)] = 0; + arrays[CENTER_LOC][IX(0, 0, DIM-1)] = fillVal; } //x- y- z- corner @@ -342,7 +343,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){ if(arrays[neighborIndex] != NULL){ arrays[CENTER_LOC][IX(0, 0, 0)] = arrays[neighborIndex][IX( DIM-2, DIM-2, DIM-2)]; } else { - arrays[CENTER_LOC][IX(0, 0, 0)] = 0; + arrays[CENTER_LOC][IX(0, 0, 0)] = fillVal; } } @@ -359,15 +360,15 @@ LIBRARY_API void fluid_solve_bounds(int numReadIn, Chunk ** chunkViewC, Environm int neighborIndex; for(chunkIndex = 0; chunkIndex < numReadIn; chunkIndex++){ Chunk * current = chunkViewC[chunkIndex]; - fluid_solve_bounds_checker(current->d); - fluid_solve_bounds_checker(current->d0); - fluid_solve_bounds_checker(current->u); - fluid_solve_bounds_checker(current->v); - fluid_solve_bounds_checker(current->w); - fluid_solve_bounds_checker(current->u0); - fluid_solve_bounds_checker(current->v0); - fluid_solve_bounds_checker(current->w0); - fluid_solve_bounds_checker(current->bounds); + fluid_solve_bounds_checker(current->d,0); + fluid_solve_bounds_checker(current->d0,0); + fluid_solve_bounds_checker(current->u,0); + fluid_solve_bounds_checker(current->v,0); + fluid_solve_bounds_checker(current->w,0); + fluid_solve_bounds_checker(current->u0,0); + fluid_solve_bounds_checker(current->v0,0); + fluid_solve_bounds_checker(current->w0,0); + fluid_solve_bounds_checker(current->bounds,BOUND_MAX_VALUE); } }