static inline core functions
All checks were successful
studiorailgun/fluid-sim/pipeline/head This commit looks good
All checks were successful
studiorailgun/fluid-sim/pipeline/head This commit looks good
This commit is contained in:
parent
a69fc20cfb
commit
63e3d3a878
@ -41,20 +41,20 @@ rm -f ./*.dll
|
||||
|
||||
|
||||
#compile object files
|
||||
COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
INPUT_FILES="./src/densitystep.c"
|
||||
OUTPUT_FILE="./densitystep.o"
|
||||
gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
# COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
# INPUT_FILES="./src/densitystep.c"
|
||||
# OUTPUT_FILE="./densitystep.o"
|
||||
# gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
INPUT_FILES="./src/velocitystep.c"
|
||||
OUTPUT_FILE="./velocitystep.o"
|
||||
gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
# COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
# INPUT_FILES="./src/velocitystep.c"
|
||||
# OUTPUT_FILE="./velocitystep.o"
|
||||
# gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
INPUT_FILES="./src/chunkmask.c"
|
||||
OUTPUT_FILE="./chunkmask.o"
|
||||
gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
# COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
# INPUT_FILES="./src/chunkmask.c"
|
||||
# OUTPUT_FILE="./chunkmask.o"
|
||||
# gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
COMPILE_FLAGS="-c -fPIC -m64 -mavx -mavx2 -march=native -Ofast -msse -msse2 -msse3 -mmmx -m3dnow"
|
||||
INPUT_FILES="./src/javainterface.c"
|
||||
@ -71,7 +71,7 @@ gcc $COMPILE_FLAGS -I"$BASE_INCLUDE_DIR" -I"$OS_INCLUDE_DIR" $INPUT_FILES -o $OU
|
||||
#compile shared object file
|
||||
OUTPUT_FILE="libfluidsim$LIB_ENDING"
|
||||
COMPILE_FLAGS="-shared"
|
||||
INPUT_FILES="fluidsim.o javainterface.o chunkmask.o velocitystep.o densitystep.o"
|
||||
INPUT_FILES="fluidsim.o javainterface.o"
|
||||
gcc $COMPILE_FLAGS $INPUT_FILES -o $OUTPUT_FILE
|
||||
|
||||
#move to resources
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
#ifndef MAINFUNC
|
||||
#define MAINFUNC
|
||||
|
||||
#include "./chunk.h"
|
||||
|
||||
void simulate(int numChunks, Chunk ** passedInChunks, jfloat timestep);
|
||||
|
||||
/*
|
||||
* Class: electrosphere_FluidSim
|
||||
* Method: addSourceToVectors
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void addSourceToVectors
|
||||
static inline void addSourceToVectors
|
||||
(int, int, float **, float **, float **, float **, float **, float **, float, float, float);
|
||||
|
||||
/*
|
||||
@ -18,7 +15,7 @@ void addSourceToVectors
|
||||
* Method: solveVectorDiffuse
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void solveVectorDiffuse
|
||||
static inline void solveVectorDiffuse
|
||||
(int, int, float **, float **, float **, float **, float **, float **, float, float, float);
|
||||
|
||||
/*
|
||||
@ -26,7 +23,7 @@ void solveVectorDiffuse
|
||||
* Method: setupProjection
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void setupProjection
|
||||
static inline void setupProjection
|
||||
(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
@ -44,7 +41,7 @@ void setupProjection
|
||||
* Method: solveProjection
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void solveProjection
|
||||
static inline void solveProjection
|
||||
(int, int, float **, float **, float **, float **, float **, float **, float, float, float);
|
||||
|
||||
/*
|
||||
@ -52,7 +49,7 @@ void solveProjection
|
||||
* Method: finalizeProjection
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void finalizeProjection
|
||||
static inline void finalizeProjection
|
||||
(int, int, float **, float **, float **, float **, float **, float **, float, float, float);
|
||||
|
||||
/*
|
||||
@ -60,7 +57,7 @@ void finalizeProjection
|
||||
* Method: advectVectors
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void advectVectors
|
||||
static inline void advectVectors
|
||||
(int, int, float **, float **, float **, float **, float **, float **, float, float, float);
|
||||
|
||||
/*
|
||||
@ -68,7 +65,7 @@ void advectVectors
|
||||
* Method: addDensity
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;F)V
|
||||
*/
|
||||
void addDensity
|
||||
static inline void addDensity
|
||||
(int, int, float **, float **, float);
|
||||
|
||||
/*
|
||||
@ -76,7 +73,7 @@ void addDensity
|
||||
* Method: solveDiffuseDensity
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void solveDiffuseDensity
|
||||
static inline void solveDiffuseDensity
|
||||
(int, int, float **, float **, float **, float **, float **, float, float, float);
|
||||
|
||||
/*
|
||||
@ -84,16 +81,16 @@ void solveDiffuseDensity
|
||||
* Method: advectDensity
|
||||
* Signature: (II[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;[Ljava/nio/ByteBuffer;FFF)V
|
||||
*/
|
||||
void advectDensity(uint32_t chunk_mask, int N, float ** d, float ** d0, float ** ur, float ** vr, float ** wr, float dt);
|
||||
static inline void advectDensity(uint32_t chunk_mask, int N, float ** d, float ** d0, float ** ur, float ** vr, float ** wr, float dt);
|
||||
|
||||
void setBoundsToNeighborsRaw
|
||||
static inline void setBoundsToNeighborsRaw
|
||||
(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
int vector_dir,
|
||||
float ** neighborArray);
|
||||
|
||||
void copyNeighborsRaw
|
||||
static inline void copyNeighborsRaw
|
||||
(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
|
||||
8
src/main/c/includes/simulation.h
Normal file
8
src/main/c/includes/simulation.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef SIMULATION_H
|
||||
#define SIMULATION_H
|
||||
|
||||
#include "./chunk.h"
|
||||
|
||||
void simulate(int numChunks, Chunk ** passedInChunks, float timestep);
|
||||
|
||||
#endif
|
||||
@ -9,7 +9,7 @@
|
||||
/**
|
||||
* Adds density to the density array
|
||||
*/
|
||||
void addDensity(
|
||||
static inline void addDensity(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** d,
|
||||
@ -28,7 +28,7 @@ void addDensity(
|
||||
/*
|
||||
* A single iteration of the jacobi to solve density diffusion
|
||||
*/
|
||||
void solveDiffuseDensity(
|
||||
static inline void solveDiffuseDensity(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** d,
|
||||
@ -79,7 +79,7 @@ void solveDiffuseDensity(
|
||||
/**
|
||||
* Advects the density based on the vectors
|
||||
*/
|
||||
void advectDensity(uint32_t chunk_mask, int N, float ** d, float ** d0, float ** ur, float ** vr, float ** wr, float dt){
|
||||
static inline void advectDensity(uint32_t chunk_mask, int N, float ** d, float ** d0, float ** ur, float ** vr, float ** wr, float dt){
|
||||
int i, j, k, i0, j0, k0, i1, j1, k1;
|
||||
int m,n,o;
|
||||
float x, y, z, s0, t0, s1, t1, u1, u0, dtx,dty,dtz;
|
||||
|
||||
@ -4,6 +4,11 @@
|
||||
#include "../includes/electrosphere_FluidSim.h"
|
||||
#include "../includes/mainFunctions.h"
|
||||
#include "../includes/chunk.h"
|
||||
#include "../includes/simulation.h"
|
||||
|
||||
#include "./chunkmask.c"
|
||||
#include "./velocitystep.c"
|
||||
#include "./densitystep.c"
|
||||
|
||||
|
||||
#define DIM 18
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
//local includes
|
||||
#include "../includes/chunk.h"
|
||||
#include "../includes/chunkmask.h"
|
||||
#include "../includes/mainFunctions.h"
|
||||
#include "../includes/utilities.h"
|
||||
#include "../includes/simulation.h"
|
||||
|
||||
|
||||
//defines
|
||||
|
||||
@ -16,14 +16,14 @@
|
||||
|
||||
#define LINEARSOLVERTIMES 20
|
||||
|
||||
void add_source(int N, float * x, float * s, float dt);
|
||||
void advect(uint32_t chunk_mask, int N, int b, float ** jrd, float ** jrd0, float * u, float * v, float * w, float dt);
|
||||
static inline void add_source(int N, float * x, float * s, float dt);
|
||||
static inline void advect(uint32_t chunk_mask, int N, int b, float ** jrd, float ** jrd0, float * u, float * v, float * w, float dt);
|
||||
|
||||
|
||||
/*
|
||||
* Adds force to all vectors
|
||||
*/
|
||||
void addSourceToVectors
|
||||
static inline void addSourceToVectors
|
||||
(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
@ -44,7 +44,7 @@ void addSourceToVectors
|
||||
/**
|
||||
* Adds from a source array to a destination array
|
||||
*/
|
||||
void add_source(int N, float * x, float * s, float dt){
|
||||
static inline void add_source(int N, float * x, float * s, float dt){
|
||||
int i;
|
||||
int size=N*N*N;
|
||||
for(i=0; i<size; i++){
|
||||
@ -55,7 +55,7 @@ void add_source(int N, float * x, float * s, float dt){
|
||||
/*
|
||||
* Solves vector diffusion along all axis
|
||||
*/
|
||||
void solveVectorDiffuse (
|
||||
static inline void solveVectorDiffuse (
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** jru,
|
||||
@ -163,7 +163,7 @@ void solveVectorDiffuse (
|
||||
/*
|
||||
* Sets up a projection system of equations
|
||||
*/
|
||||
void setupProjection(
|
||||
static inline void setupProjection(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** ur,
|
||||
@ -246,7 +246,7 @@ void setupProjection(
|
||||
/*
|
||||
* Solves a projection system of equations
|
||||
*/
|
||||
void solveProjection(
|
||||
static inline void solveProjection(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** jru,
|
||||
@ -297,7 +297,7 @@ void solveProjection(
|
||||
/*
|
||||
* Finalizes a projection (subtract curl, set bounds, etc)
|
||||
*/
|
||||
void finalizeProjection(
|
||||
static inline void finalizeProjection(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** jru,
|
||||
@ -381,7 +381,7 @@ void finalizeProjection(
|
||||
/*
|
||||
* Advects u, v, and w
|
||||
*/
|
||||
void advectVectors(
|
||||
static inline void advectVectors(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
float ** jru,
|
||||
@ -402,7 +402,7 @@ void advectVectors(
|
||||
/**
|
||||
* Actually performs the advection
|
||||
*/
|
||||
void advect(uint32_t chunk_mask, int N, int b, float ** jrd, float ** jrd0, float * u, float * v, float * w, float dt){
|
||||
static inline void advect(uint32_t chunk_mask, int N, int b, float ** jrd, float ** jrd0, float * u, float * v, float * w, float dt){
|
||||
int i, j, k, i0, j0, k0, i1, j1, k1;
|
||||
int m,n,o;
|
||||
float x, y, z, s0, t0, s1, t1, u1, u0, dtx,dty,dtz;
|
||||
@ -647,7 +647,7 @@ void advect(uint32_t chunk_mask, int N, int b, float ** jrd, float ** jrd0, floa
|
||||
/**
|
||||
* Sets the bounds of this cube to those of its neighbor
|
||||
*/
|
||||
void setBoundsToNeighborsRaw(
|
||||
static inline void setBoundsToNeighborsRaw(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
int vector_dir,
|
||||
@ -702,7 +702,7 @@ void setBoundsToNeighborsRaw(
|
||||
/**
|
||||
* This exclusively copies neighbors to make sure zeroing out stuff doesn't break sim
|
||||
*/
|
||||
void copyNeighborsRaw(
|
||||
static inline void copyNeighborsRaw(
|
||||
int N,
|
||||
int chunk_mask,
|
||||
int cx,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user