more small work on grid2
This commit is contained in:
parent
a835ebb3eb
commit
93ecc6ac15
@ -30,16 +30,16 @@
|
||||
/**
|
||||
* Really small value used for something
|
||||
*/
|
||||
#define FLUID_GRID2_REALLY_SMALL_VALUE 0.00001
|
||||
#define FLUID_GRID2_REALLY_SMALL_VALUE 0.00001f
|
||||
|
||||
/**
|
||||
* Diffusion constant
|
||||
*/
|
||||
#define FLUID_GRID2_DIFFUSION_CONSTANT 0.00001
|
||||
#define FLUID_GRID2_DIFFUSION_CONSTANT 0.00001f
|
||||
|
||||
/**
|
||||
* Viscosity constant
|
||||
*/
|
||||
#define FLUID_GRID2_VISCOSITY_CONSTANT 0.00001
|
||||
#define FLUID_GRID2_VISCOSITY_CONSTANT 0.00001f
|
||||
|
||||
#endif
|
||||
@ -16,7 +16,7 @@ void fluid_grid2_add_source(float * x, float * s, float dt);
|
||||
/**
|
||||
* Sets the bounds of this cube to those of its neighbor
|
||||
*/
|
||||
LIBRARY_API void fluid_grid2_setBoundsToNeighborsRaw(
|
||||
LIBRARY_API void fluid_grid2_set_bounds(
|
||||
int vector_dir,
|
||||
float * target
|
||||
);
|
||||
|
||||
@ -51,7 +51,10 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
){
|
||||
Chunk ** chunks = passedInChunks;
|
||||
|
||||
//solve chunk mask
|
||||
|
||||
//
|
||||
//Velocity step
|
||||
//
|
||||
for(int i = 0; i < numChunks; i++){
|
||||
Chunk * currentChunk = chunks[i];
|
||||
|
||||
@ -71,82 +74,82 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
currentChunk->w0,
|
||||
timestep
|
||||
);
|
||||
//swap all vector fields
|
||||
//swap vector fields
|
||||
|
||||
//swap all vector fields
|
||||
fluid_grid2_flip_arrays(currentChunk->u,currentChunk->u0);
|
||||
fluid_grid2_flip_arrays(currentChunk->v,currentChunk->v0);
|
||||
fluid_grid2_flip_arrays(currentChunk->w,currentChunk->w0);
|
||||
|
||||
//solve vector diffusion
|
||||
for(int l = 0; l < FLUID_GRID2_VECTOR_DIFFUSE_TIMES; l++){
|
||||
//solve vector diffusion
|
||||
fluid_grid2_solveVectorDiffuse(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,currentChunk->w0,timestep);
|
||||
//update array for vectors
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w0[CENTER_LOC]);
|
||||
}
|
||||
|
||||
//setup projection
|
||||
fluid_grid2_setupProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,timestep);
|
||||
|
||||
//update array for vectors
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->v0[CENTER_LOC]);
|
||||
|
||||
//samples u0, v0
|
||||
//sets u0
|
||||
//these should have just been mirrored in the above
|
||||
//
|
||||
//Perform main projection solver
|
||||
fluid_grid2_solveProjection(currentChunk->u0,currentChunk->v0,timestep);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
//samples u,v,w,u0
|
||||
//sets u,v,w
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
|
||||
//Finalize projection
|
||||
fluid_grid2_finalizeProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,timestep);
|
||||
|
||||
//set boundaries a final time for u,v,w
|
||||
//...
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
//set boundaries for u,v,w
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w0[CENTER_LOC]);
|
||||
|
||||
//swap all vector fields
|
||||
//swap vector fields
|
||||
fluid_grid2_flip_arrays(currentChunk->u,currentChunk->u0);
|
||||
fluid_grid2_flip_arrays(currentChunk->v,currentChunk->v0);
|
||||
fluid_grid2_flip_arrays(currentChunk->w,currentChunk->w0);
|
||||
|
||||
//advect vectors across boundaries
|
||||
//advect
|
||||
fluid_grid2_advectVectors(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,currentChunk->w0,timestep);
|
||||
//update neighbor arr
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w0[CENTER_LOC]);
|
||||
|
||||
//setup projection
|
||||
fluid_grid2_setupProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,timestep);
|
||||
//update array for vectors
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
//samples u0, v0
|
||||
//sets u0
|
||||
//these should have just been mirrored in the above
|
||||
//
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
//Perform main projection solver
|
||||
for(int l = 0; l < FLUID_GRID2_LINEARSOLVERTIMES; l++){
|
||||
fluid_grid2_solveProjection(currentChunk->u0,currentChunk->v0,timestep);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
}
|
||||
//samples u,v,w,u0
|
||||
//sets u,v,w
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
//Finalize projection
|
||||
fluid_grid2_finalizeProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,timestep);
|
||||
//set boundaries a final time for u,v,w
|
||||
//...
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
//set boundaries for u,v,w
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w0[CENTER_LOC]);
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +164,9 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
|
||||
|
||||
|
||||
//add density
|
||||
//
|
||||
//Density step
|
||||
//
|
||||
double deltaDensity = 0;
|
||||
environment->state.existingDensity = 0;
|
||||
environment->state.newDensity = 0;
|
||||
@ -179,7 +184,7 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
//diffuse density
|
||||
for(int l = 0; l < FLUID_GRID2_LINEARSOLVERTIMES; l++){
|
||||
fluid_grid2_solveDiffuseDensity(currentChunk->d,currentChunk->d0,timestep);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(0,currentChunk->d[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(0,currentChunk->d[CENTER_LOC]);
|
||||
}
|
||||
//swap all density arrays
|
||||
//swap vector fields
|
||||
@ -188,14 +193,22 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
//advect density
|
||||
fluid_grid2_advectDensity(currentChunk->d,currentChunk->d0,currentChunk->u,currentChunk->v,currentChunk->w,timestep);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//mirror densities
|
||||
//
|
||||
{
|
||||
for(int i = 0; i < numChunks; i++){
|
||||
Chunk * currentChunk = chunks[i];
|
||||
fluid_grid2_setBoundsToNeighborsRaw(0,currentChunk->d[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(0,currentChunk->d[CENTER_LOC]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//normalize densities
|
||||
//
|
||||
{
|
||||
double transformedDensity = 0;
|
||||
for(int i = 0; i < numChunks; i++){
|
||||
@ -213,7 +226,10 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
fluid_grid2_normalizeDensity(currentChunk->d,normalizationRatio);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//clear delta arrays
|
||||
//
|
||||
{
|
||||
for(int i = 0; i < numChunks; i++){
|
||||
Chunk * currentChunk = chunks[i];
|
||||
|
||||
@ -27,7 +27,7 @@ void fluid_grid2_add_source(float * x, float * s, float dt){
|
||||
/**
|
||||
* Sets the bounds of this cube to those of its neighbor
|
||||
*/
|
||||
LIBRARY_API void fluid_grid2_setBoundsToNeighborsRaw(
|
||||
LIBRARY_API void fluid_grid2_set_bounds(
|
||||
int vector_dir,
|
||||
float * target
|
||||
){
|
||||
@ -88,7 +88,6 @@ double fluid_grid2_calculateSum(float ** d){
|
||||
rVal = rVal + x[IX(i,j,k)];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ LIBRARY_API void fluid_grid2_setupProjection(
|
||||
){
|
||||
int i, j, k;
|
||||
|
||||
__m256 constScalar = _mm256_set1_ps(-0.5 * FLUID_GRID2_H);
|
||||
__m256 constScalar = _mm256_set1_ps(-0.5f * FLUID_GRID2_H);
|
||||
__m256 zeroVec = _mm256_set1_ps(0);
|
||||
__m256 vector, vector2, vector3;
|
||||
|
||||
@ -176,10 +176,10 @@ LIBRARY_API void fluid_grid2_setupProjection(
|
||||
|
||||
for(k=1; k<DIM-1; k++){
|
||||
for(j=1; j<DIM-1; j++){
|
||||
i = 1;
|
||||
//
|
||||
//lower
|
||||
//
|
||||
i = 1;
|
||||
//first part
|
||||
vector = _mm256_loadu_ps(&u[IX(i+1,j,k)]);
|
||||
vector = _mm256_sub_ps(vector,_mm256_loadu_ps(&u[IX(i-1,j,k)]));
|
||||
@ -195,10 +195,11 @@ LIBRARY_API void fluid_grid2_setupProjection(
|
||||
//store
|
||||
_mm256_storeu_ps(&div[IX(i,j,k)],vector);
|
||||
_mm256_storeu_ps(&p[IX(i,j,k)],zeroVec);
|
||||
i = 9;
|
||||
|
||||
//
|
||||
//upper
|
||||
//
|
||||
i = 9;
|
||||
//first part
|
||||
vector = _mm256_loadu_ps(&u[IX(i+1,j,k)]);
|
||||
vector = _mm256_sub_ps(vector,_mm256_loadu_ps(&u[IX(i-1,j,k)]));
|
||||
@ -242,7 +243,7 @@ LIBRARY_API void fluid_grid2_solveProjection(
|
||||
//perform iteration of v cycle multigrid method
|
||||
for(int l = 0; l < FLUID_GRID2_LINEARSOLVERTIMES; l++){
|
||||
solver_multigrid_iterate(p,div,a,c);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,jru0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,p);
|
||||
}
|
||||
|
||||
// solver_conjugate_gradient_solve_serial(p,div,a,c);
|
||||
|
||||
@ -40,7 +40,7 @@ void solver_multigrid_iterate(float * phi, float * phi0, float a, float c){
|
||||
//
|
||||
//gauss-seidel at highest res
|
||||
solver_gauss_seidel_iterate_parallel(phi,phi0,a,c,DIM);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(0,phi);
|
||||
fluid_grid2_set_bounds(0,phi);
|
||||
|
||||
//
|
||||
//half res
|
||||
|
||||
@ -60,10 +60,10 @@ int fluid_sim_grid2_advect_projection_test1(){
|
||||
|
||||
////project
|
||||
fluid_grid2_setupProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_solveProjection(currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_finalizeProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
|
||||
//advect density
|
||||
@ -125,10 +125,10 @@ int fluid_sim_grid2_advect_projection_compute_error_over_time(){
|
||||
|
||||
////project
|
||||
fluid_grid2_setupProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v0[CENTER_LOC]);
|
||||
fluid_grid2_solveProjection(currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_finalizeProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
|
||||
//advect density
|
||||
|
||||
@ -77,7 +77,7 @@ int fluid_sim_grid2_density_diffuse_test1(){
|
||||
//diffuse density
|
||||
for(int l = 0; l < FLUID_GRID2_LINEARSOLVERTIMES; l++){
|
||||
fluid_grid2_solveDiffuseDensity(currentChunk->d,currentChunk->d0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(0,currentChunk->d[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(0,currentChunk->d[CENTER_LOC]);
|
||||
}
|
||||
//swap all density arrays
|
||||
//swap vector fields
|
||||
@ -135,7 +135,7 @@ int fluid_sim_grid2_density_diffuse_test2(){
|
||||
//diffuse density
|
||||
for(int l = 0; l < FLUID_GRID2_LINEARSOLVERTIMES; l++){
|
||||
fluid_grid2_solveDiffuseDensity(currentChunk->d,currentChunk->d0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(0,currentChunk->d[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(0,currentChunk->d[CENTER_LOC]);
|
||||
}
|
||||
//swap all density arrays
|
||||
//swap vector fields
|
||||
|
||||
@ -37,7 +37,7 @@ int fluid_sim_grid2_finalize_projection_test1(){
|
||||
currentChunk->u[CENTER_LOC][IX(3,3,3)] = 1.0f;
|
||||
fluid_grid2_setupProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_solveProjection(currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
|
||||
//finalize
|
||||
fluid_grid2_finalizeProjection(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
|
||||
@ -39,7 +39,7 @@ int fluid_sim_grid2_solve_projection_test1(){
|
||||
|
||||
//actually solve
|
||||
fluid_grid2_solveProjection(currentChunk->u0,currentChunk->v0,FLUID_GRID2_SIM_STEP);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_NO_DIR,currentChunk->u0[CENTER_LOC]);
|
||||
|
||||
//test the result
|
||||
float expected, actual;
|
||||
|
||||
@ -57,9 +57,9 @@ int fluid_sim_grid2_velocity_diffuse_test1(){
|
||||
//solve vector diffusion
|
||||
fluid_grid2_solveVectorDiffuse(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,currentChunk->w0,FLUID_GRID2_SIM_STEP);
|
||||
//update array for vectors
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
}
|
||||
//swap all density arrays
|
||||
//swap vector fields
|
||||
@ -117,9 +117,9 @@ int fluid_sim_grid2_velocity_diffuse_test2(){
|
||||
//solve vector diffusion
|
||||
fluid_grid2_solveVectorDiffuse(currentChunk->u,currentChunk->v,currentChunk->w,currentChunk->u0,currentChunk->v0,currentChunk->w0,FLUID_GRID2_SIM_STEP);
|
||||
//update array for vectors
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_U,currentChunk->u[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_V,currentChunk->v[CENTER_LOC]);
|
||||
fluid_grid2_set_bounds(FLUID_GRID2_BOUND_DIR_W,currentChunk->w[CENTER_LOC]);
|
||||
}
|
||||
//swap all density arrays
|
||||
//swap vector fields
|
||||
|
||||
Loading…
Reference in New Issue
Block a user