e2e pressurecell test
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
abf819e5fd
commit
a6cc3addf7
@ -6,11 +6,25 @@
|
|||||||
#include "fluid/env/environment.h"
|
#include "fluid/env/environment.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not override dispatcher
|
||||||
|
*/
|
||||||
#define FLUID_DISPATCHER_OVERRIDE_NONE 0
|
#define FLUID_DISPATCHER_OVERRIDE_NONE 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only dispatch to cellular
|
||||||
|
*/
|
||||||
#define FLUID_DISPATCHER_OVERRIDE_CELLULAR 1
|
#define FLUID_DISPATCHER_OVERRIDE_CELLULAR 1
|
||||||
|
|
||||||
#define FLUID_DISPATCHER_OVERRIDE_GRID2 1
|
/**
|
||||||
|
* Only dispatch to grid2
|
||||||
|
*/
|
||||||
|
#define FLUID_DISPATCHER_OVERRIDE_GRID2 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only dispatch to pressurecell
|
||||||
|
*/
|
||||||
|
#define FLUID_DISPATCHER_OVERRIDE_PRESSURECELL 3
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
#ifndef METADATACALC
|
#ifndef METADATACALC
|
||||||
#define METADATACALC
|
#define METADATACALC
|
||||||
|
|
||||||
|
#include<jni.h>
|
||||||
|
|
||||||
|
#include "public.h"
|
||||||
#include "fluid/queue/chunk.h"
|
#include "fluid/queue/chunk.h"
|
||||||
#include "fluid/env/environment.h"
|
#include "fluid/env/environment.h"
|
||||||
|
|
||||||
@ -12,7 +15,7 @@
|
|||||||
* @param passedInChunks The chunks that were passed in
|
* @param passedInChunks The chunks that were passed in
|
||||||
* @param environment The environment data
|
* @param environment The environment data
|
||||||
*/
|
*/
|
||||||
void updateMetadata(JNIEnv * env, int numChunks, Chunk ** passedInChunks, Environment * environment);
|
LIBRARY_API void updateMetadata(JNIEnv * env, int numChunks, Chunk ** passedInChunks, Environment * environment);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,25 @@ LIBRARY_API void fluid_dispatch(int numReadIn, Chunk ** chunkViewC, Environment
|
|||||||
arrput(environment->queue.cellularQueue,currentChunk);
|
arrput(environment->queue.cellularQueue,currentChunk);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
} else if(override == FLUID_DISPATCHER_OVERRIDE_GRID2){
|
||||||
|
//queue new chunks
|
||||||
|
for(int i = 0; i < numReadIn; i++){
|
||||||
|
Chunk * currentChunk = chunkViewC[i];
|
||||||
|
//TODO: conditionally add to queues based on some values (ie lod, spatial loc, etc)
|
||||||
|
arrput(environment->queue.grid2Queue,currentChunk);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
} else if(override == FLUID_DISPATCHER_OVERRIDE_PRESSURECELL){
|
||||||
|
//queue new chunks
|
||||||
|
for(int i = 0; i < numReadIn; i++){
|
||||||
|
Chunk * currentChunk = chunkViewC[i];
|
||||||
|
//TODO: conditionally add to queues based on some values (ie lod, spatial loc, etc)
|
||||||
|
arrput(environment->queue.pressurecellQueue,currentChunk);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//queue new chunks
|
//queue new chunks
|
||||||
for(int i = 0; i < numReadIn; i++){
|
for(int i = 0; i < numReadIn; i++){
|
||||||
|
|||||||
@ -538,3 +538,5 @@ LIBRARY_API void fluid_solve_bounds_set_bounds(float * arrays, float fillVal){
|
|||||||
//x- y- z- corner
|
//x- y- z- corner
|
||||||
arrays[IX(0, 0, 0)] = fillVal;
|
arrays[IX(0, 0, 0)] = fillVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <jni.h>
|
||||||
|
|
||||||
#include "fluid/env/utilities.h"
|
#include "fluid/env/utilities.h"
|
||||||
#include "fluid/queue/chunkmask.h"
|
#include "fluid/queue/chunkmask.h"
|
||||||
@ -15,7 +16,7 @@
|
|||||||
* @param passedInChunks The chunks that were passed in
|
* @param passedInChunks The chunks that were passed in
|
||||||
* @param environment The environment data
|
* @param environment The environment data
|
||||||
*/
|
*/
|
||||||
void updateMetadata(JNIEnv * env, int numChunks, Chunk ** passedInChunks, Environment * environment){
|
LIBRARY_API void updateMetadata(JNIEnv * env, int numChunks, Chunk ** passedInChunks, Environment * environment){
|
||||||
jfieldID totalDensityId = environment->lookupTable.serverFluidChunkTable.totalDensityId;
|
jfieldID totalDensityId = environment->lookupTable.serverFluidChunkTable.totalDensityId;
|
||||||
jfieldID updatedId = environment->lookupTable.serverFluidChunkTable.updatedId;
|
jfieldID updatedId = environment->lookupTable.serverFluidChunkTable.updatedId;
|
||||||
int N = DIM;
|
int N = DIM;
|
||||||
|
|||||||
@ -79,3 +79,4 @@ int fluid_sim_pressurecell_normalization_tests(int argc, char **argv){
|
|||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,15 +5,23 @@
|
|||||||
#include "fluid/queue/boundsolver.h"
|
#include "fluid/queue/boundsolver.h"
|
||||||
#include "fluid/queue/chunkmask.h"
|
#include "fluid/queue/chunkmask.h"
|
||||||
#include "fluid/queue/chunk.h"
|
#include "fluid/queue/chunk.h"
|
||||||
|
#include "fluid/queue/metadatacalc.h"
|
||||||
#include "fluid/env/environment.h"
|
#include "fluid/env/environment.h"
|
||||||
#include "fluid/env/utilities.h"
|
#include "fluid/env/utilities.h"
|
||||||
|
#include "fluid/dispatch/dispatcher.h"
|
||||||
|
#include "fluid/sim/simulator.h"
|
||||||
#include "fluid/sim/pressurecell/pressure.h"
|
#include "fluid/sim/pressurecell/pressure.h"
|
||||||
#include "fluid/sim/pressurecell/pressurecell.h"
|
#include "fluid/sim/pressurecell/pressurecell.h"
|
||||||
#include "fluid/sim/pressurecell/solver_consts.h"
|
#include "fluid/sim/pressurecell/solver_consts.h"
|
||||||
|
#include "fluid/tracking/tracking.h"
|
||||||
#include "math/ode/multigrid.h"
|
#include "math/ode/multigrid.h"
|
||||||
#include "../../../util/chunk_test_utils.h"
|
#include "../../../util/chunk_test_utils.h"
|
||||||
#include "../../../util/test.h"
|
#include "../../../util/test.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error margin for tests
|
||||||
|
*/
|
||||||
|
#define FLUID_PRESSURE_CELL_ERROR_MARGIN 0.01f
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of chunks
|
* Number of chunks
|
||||||
@ -48,6 +56,56 @@ int fluid_sim_pressurecell_sim_e2e_test1(){
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Testing normalizing values
|
||||||
|
*/
|
||||||
|
int fluid_sim_pressurecell_sim_e2e_test2(){
|
||||||
|
printf("fluid_sim_pressurecell_sim_e2e_test2\n");
|
||||||
|
int rVal = 0;
|
||||||
|
Environment * env = fluid_environment_create();
|
||||||
|
Chunk ** queue = NULL;
|
||||||
|
queue = createChunkGrid(env,1,1,1);
|
||||||
|
int chunkCount = arrlen(queue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//setup chunk values
|
||||||
|
float deltaDensity = 0.01f;
|
||||||
|
Chunk * currentChunk = queue[0];
|
||||||
|
for(int x = 0; x < DIM; x++){
|
||||||
|
for(int y = 0; y < DIM; y++){
|
||||||
|
currentChunk->d[CENTER_LOC][IX(x,1,y)] = MAX_FLUID_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//actually simulate
|
||||||
|
fluid_tracking_reset(env);
|
||||||
|
fluid_solve_bounds(chunkCount,queue,env);
|
||||||
|
fluid_dispatch(chunkCount,queue,env,FLUID_DISPATCHER_OVERRIDE_PRESSURECELL);
|
||||||
|
fluid_simulate(env);
|
||||||
|
fluid_solve_bounds(chunkCount,queue,env);
|
||||||
|
|
||||||
|
//test the result
|
||||||
|
float expected, actual;
|
||||||
|
|
||||||
|
//
|
||||||
|
// cell that originall had values
|
||||||
|
//
|
||||||
|
expected = MAX_FLUID_VALUE;
|
||||||
|
actual = currentChunk->d[CENTER_LOC][IX(1,1,1)];
|
||||||
|
if(fabs(expected - actual) > FLUID_PRESSURE_CELL_ERROR_MARGIN){
|
||||||
|
rVal += assertEqualsFloat(expected,actual,"Failed to recapture density into (1,1,1)! expected: %f actual: %f \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
expected = MAX_FLUID_VALUE;
|
||||||
|
actual = currentChunk->d[CENTER_LOC][IX(DIM-2,1,DIM-2)];
|
||||||
|
if(fabs(expected - actual) > FLUID_PRESSURE_CELL_ERROR_MARGIN){
|
||||||
|
rVal += assertEqualsFloat(expected,actual,"Failed to recapture density into (DIM-2,DIM-2,DIM-2)! expected: %f actual: %f \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing pressure values
|
* Testing pressure values
|
||||||
*/
|
*/
|
||||||
@ -55,6 +113,7 @@ int fluid_sim_pressurecell_sim_e2e_tests(int argc, char **argv){
|
|||||||
int rVal = 0;
|
int rVal = 0;
|
||||||
|
|
||||||
rVal += fluid_sim_pressurecell_sim_e2e_test1();
|
rVal += fluid_sim_pressurecell_sim_e2e_test1();
|
||||||
|
rVal += fluid_sim_pressurecell_sim_e2e_test2();
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user