![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | N_FLUID |
| structure of a fluid More... | |
| struct | N_FLUID_THREAD_PARAMS |
| structure passed to a threaded fluid process More... | |
Macros | |
| #define | _z(__fluid, __component) ((__fluid->__component) > (__fluid->negative_float_tolerance) && (__fluid->__component) < (__fluid->positive_float_tolerance)) |
| test if component is near zero, according to fluid's precision | |
| #define | _zd(__fluid, __value) ((__value) > (__fluid->negative_float_tolerance) && (__value) < (__fluid->positive_float_tolerance)) |
| test if value is near zero, according to fluid's precision | |
Functions | |
| int | destroy_n_fluid (N_FLUID **fluid) |
| ddestroy a fluid structure | |
| int | n_fluid_advectSmoke (N_FLUID *fluid) |
| non threaded version of add smoke function | |
| int | n_fluid_advectVel (N_FLUID *fluid) |
| non threaded version of add velocities function | |
| double | n_fluid_avgU (N_FLUID *fluid, size_t i, size_t j) |
| compute the average U value at a fluid position using it's surrounding | |
| double | n_fluid_avgV (N_FLUID *fluid, size_t i, size_t j) |
| compute the average V value at a fluid position using it's surrounding | |
| int | n_fluid_draw (N_FLUID *fluid) |
| draw a N_FLUID on screen / targert bitmap | |
| int | n_fluid_extrapolate (N_FLUID *fluid) |
| non threaded extrapolation function | |
| ALLEGRO_COLOR | n_fluid_getSciColor (N_FLUID *fluid, double val, double minVal, double maxVal) |
| get fonky colors for the fluid | |
| int | n_fluid_integrate (N_FLUID *fluid) |
| non threaded version of integration function | |
| int | n_fluid_resetObstacles (N_FLUID *fluid) |
| reset the obstacles set in a N_FLUID | |
| double | n_fluid_sampleField (N_FLUID *fluid, double x, double y, uint32_t field) |
| compute a sample value at a field position | |
| int | n_fluid_setObstacle (N_FLUID *fluid, double x, double y, double vx, double vy, double r) |
| set an obstacle in the fluid grid | |
| int | n_fluid_simulate (N_FLUID *fluid) |
| non threaded version of N_FLUID global processing function | |
| int | n_fluid_simulate_threaded (N_FLUID *fluid, THREAD_POOL *thread_pool) |
| a threaded version of N_FLUID global processing function | |
| int | n_fluid_solveIncompressibility (N_FLUID *fluid) |
| non threaded version of incompressibility solving function | |
| N_FLUID * | new_n_fluid (double density, double gravity, size_t numIters, double dt, double overRelaxation, size_t sx, size_t sy) |
| return a newly allocated fluid | |
| struct N_FLUID |
structure of a fluid
Definition at line 51 of file n_fluids.h.
Collaboration diagram for N_FLUID:| Data Fields | ||
|---|---|---|
| LIST * | advectSmoke_chunk_list |
preprocessed list of threaded procs parameters, for n_fluid_advectSmoke |
| LIST * | advectVel_chunk_list | preprocessed list of threaded procs parameters, for n_fluid_advectVel |
| double | cScale | scale used to deduce cellX and cellY from screen/window width and height |
| double | density | density of the fluid (not working ?) |
| double | dt | time between frames |
| double | fluid_production_percentage | size of the produced fluid |
| double | gravity | gravity on Y |
| double | h | |
| LIST * | integrate_chunk_list |
preprocessed list of threaded procs parameters, for n_fluid_integrate |
| double * | m | holder for m arrays |
| double | negative_float_tolerance | fluid double negative precision setting |
| double * | newM | holder for newM arrays |
| double * | newU | holder for newU arrays |
| double * | newV | holder for newV arrays |
| size_t | numCells | total number of cells |
| size_t | numIters | number of fluid processing iterations for each frame |
| size_t | numX | number of cells in X |
| size_t | numY | number of cells in Y |
| size_t | numZ | number of cells in Z |
| double | overRelaxation | over relaxation |
| double * | p | holder for p arrays |
| double | positive_float_tolerance | fluid double positive precision setting |
| double * | s | holder for s arrays |
| bool | showPaint | activate a fonky palette, override smoke and pressure display |
| bool | showPressure | display fluids pressures as color variations, can be combined with showSmoke |
| bool | showSmoke | display fluid as a colored cloud instead of black and white, can be combined with showPressure |
| LIST * | solveIncompressibility_chunk_list |
preprocessed list of threaded procs parameters, for n_fluid_solveIncompressibility |
| double * | u | holder for u arrays |
| double * | v | holder for v arrays |
| struct N_FLUID_THREAD_PARAMS |
structure passed to a threaded fluid process
Definition at line 37 of file n_fluids.h.
Collaboration diagram for N_FLUID_THREAD_PARAMS:| Data Fields | ||
|---|---|---|
| void * | ptr | pointer to data which will be used in the proc |
| size_t | x_end | x end point |
| size_t | x_start | x start point |
| size_t | y_end | y end point |
| size_t | y_start | y start point |
| #define _z | ( | __fluid, | |
| __component | |||
| ) | ((__fluid->__component) > (__fluid->negative_float_tolerance) && (__fluid->__component) < (__fluid->positive_float_tolerance)) |
test if component is near zero, according to fluid's precision
Definition at line 28 of file n_fluids.h.
| #define _zd | ( | __fluid, | |
| __value | |||
| ) | ((__value) > (__fluid->negative_float_tolerance) && (__value) < (__fluid->positive_float_tolerance)) |
test if value is near zero, according to fluid's precision
Definition at line 33 of file n_fluids.h.
| int destroy_n_fluid | ( | N_FLUID ** | fluid | ) |
ddestroy a fluid structure
| fluid | pointer to the structure to destroy |
Definition at line 45 of file n_fluids.c.
References __n_assert, and FreeNoLog.
| int n_fluid_advectSmoke | ( | N_FLUID * | fluid | ) |
non threaded version of add smoke function
| fluid | a N_FLUID ptr |
Definition at line 530 of file n_fluids.c.
References __n_assert, _z, N_FLUID::dt, N_FLUID::h, N_FLUID::m, N_FLUID_S_FIELD, n_fluid_sampleField(), N_FLUID::newM, N_FLUID::numCells, N_FLUID::numX, N_FLUID::numY, N_FLUID::u, and N_FLUID::v.
Referenced by n_fluid_simulate().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_fluid_advectVel | ( | N_FLUID * | fluid | ) |
non threaded version of add velocities function
| fluid | a N_FLUID ptr |
Definition at line 450 of file n_fluids.c.
References __n_assert, _z, N_FLUID::dt, N_FLUID::h, n_fluid_avgU(), n_fluid_avgV(), n_fluid_sampleField(), N_FLUID_U_FIELD, N_FLUID_V_FIELD, N_FLUID::newU, N_FLUID::newV, N_FLUID::numCells, N_FLUID::numX, N_FLUID::numY, N_FLUID::u, and N_FLUID::v.
Referenced by n_fluid_simulate().
Here is the call graph for this function:
Here is the caller graph for this function:| double n_fluid_avgU | ( | N_FLUID * | fluid, |
| size_t | i, | ||
| size_t | j | ||
| ) |
compute the average U value at a fluid position using it's surrounding
| fluid | targeted N_FLUID |
| i | X position in the fluid grid |
| j | Y position in the fluid grid |
Definition at line 376 of file n_fluids.c.
References __n_assert, N_FLUID::numY, and N_FLUID::u.
Referenced by n_fluid_advectVel(), and n_fluid_advectVel_proc().
Here is the caller graph for this function:| double n_fluid_avgV | ( | N_FLUID * | fluid, |
| size_t | i, | ||
| size_t | j | ||
| ) |
compute the average V value at a fluid position using it's surrounding
| fluid | targeted N_FLUID |
| i | X position in the fluid grid |
| j | Y position in the fluid grid |
Definition at line 393 of file n_fluids.c.
References __n_assert, N_FLUID::numY, and N_FLUID::v.
Referenced by n_fluid_advectVel(), and n_fluid_advectVel_proc().
Here is the caller graph for this function:| int n_fluid_draw | ( | N_FLUID * | fluid | ) |
draw a N_FLUID on screen / targert bitmap
| fluid | the N_FLUID to draw |
Definition at line 782 of file n_fluids.c.
References __n_assert, N_FLUID::cScale, N_FLUID::m, n_fluid_getSciColor(), N_FLUID::numCells, N_FLUID::numX, N_FLUID::numY, N_FLUID::p, N_FLUID::showPaint, N_FLUID::showPressure, and N_FLUID::showSmoke.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_fluid_extrapolate | ( | N_FLUID * | fluid | ) |
non threaded extrapolation function
| fluid | a N_FLUID to extrapolate |
Definition at line 299 of file n_fluids.c.
References __n_assert, N_FLUID::numX, N_FLUID::numY, N_FLUID::u, and N_FLUID::v.
Referenced by n_fluid_simulate(), and n_fluid_simulate_threaded().
Here is the caller graph for this function:| ALLEGRO_COLOR n_fluid_getSciColor | ( | N_FLUID * | fluid, |
| double | val, | ||
| double | minVal, | ||
| double | maxVal | ||
| ) |
get fonky colors for the fluid
| fluid | targeted N_FLUID |
| val | value mixer |
| minVal | minimum output value |
| maxVal | maximum output value |
Definition at line 739 of file n_fluids.c.
References _zd.
Referenced by n_fluid_draw().
Here is the caller graph for this function:| int n_fluid_integrate | ( | N_FLUID * | fluid | ) |
non threaded version of integration function
| fluid | a N_FLUID to integrate_chunk_list |
Definition at line 206 of file n_fluids.c.
References __n_assert, _z, N_FLUID::dt, N_FLUID::gravity, N_FLUID::numX, N_FLUID::numY, and N_FLUID::v.
Referenced by n_fluid_simulate().
Here is the caller graph for this function:| int n_fluid_resetObstacles | ( | N_FLUID * | fluid | ) |
reset the obstacles set in a N_FLUID
| fluid | the targeted N_FLUID |
Definition at line 679 of file n_fluids.c.
References __n_assert, N_FLUID::numX, N_FLUID::numY, and N_FLUID::s.
Referenced by main().
Here is the caller graph for this function:| double n_fluid_sampleField | ( | N_FLUID * | fluid, |
| double | x, | ||
| double | y, | ||
| uint32_t | field | ||
| ) |
compute a sample value at a field position
| fluid | target N_FLUID |
| x | X position in the fluid grid |
| y | Y position in the fluid grid |
| field | type of field wanted, one of N_FLUID_U_FIELD, N_FLUID_V_FIELD, N_FLUID_S_FIELD |
Definition at line 321 of file n_fluids.c.
References __n_assert, N_FLUID::h, N_FLUID::m, N_FLUID_S_FIELD, N_FLUID_U_FIELD, N_FLUID_V_FIELD, N_FLUID::numX, N_FLUID::numY, N_FLUID::u, and N_FLUID::v.
Referenced by n_fluid_advectSmoke(), n_fluid_advectSmoke_proc(), n_fluid_advectVel(), and n_fluid_advectVel_proc().
Here is the caller graph for this function:| int n_fluid_setObstacle | ( | N_FLUID * | fluid, |
| double | x, | ||
| double | y, | ||
| double | vx, | ||
| double | vy, | ||
| double | r | ||
| ) |
set an obstacle in the fluid grid
| fluid | targeted N_FLUID |
| x | X position in fluid grid |
| y | y position in fluid grid |
| vx | X velocity for the point |
| vy | Y velocity for the point |
| r | radius |
Definition at line 652 of file n_fluids.c.
References __n_assert, N_FLUID::m, N_FLUID::numX, N_FLUID::numY, N_FLUID::s, N_FLUID::u, and N_FLUID::v.
Referenced by main().
Here is the caller graph for this function:| int n_fluid_simulate | ( | N_FLUID * | fluid | ) |
non threaded version of N_FLUID global processing function
| fluid | a N_FLUID ptr |
Definition at line 563 of file n_fluids.c.
References __n_assert, n_fluid_advectSmoke(), n_fluid_advectVel(), n_fluid_extrapolate(), n_fluid_integrate(), n_fluid_solveIncompressibility(), N_FLUID::numCells, and N_FLUID::p.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_fluid_simulate_threaded | ( | N_FLUID * | fluid, |
| THREAD_POOL * | thread_pool | ||
| ) |
a threaded version of N_FLUID global processing function
| fluid | a N_FLUID ptr |
| thread_pool | a THREAD_POOL pool to use |
Definition at line 580 of file n_fluids.c.
References __n_assert, add_threaded_process(), N_FLUID::advectSmoke_chunk_list, N_FLUID::advectVel_chunk_list, N_FLUID::integrate_chunk_list, list_foreach, N_FLUID::m, n_fluid_advectSmoke_proc(), n_fluid_advectVel_proc(), n_fluid_extrapolate(), n_fluid_integrate_proc(), n_fluid_solveIncompressibility_proc(), N_FLUID::newM, N_FLUID::newU, N_FLUID::newV, N_FLUID::numCells, N_FLUID::numIters, N_FLUID::p, refresh_thread_pool(), N_FLUID::solveIncompressibility_chunk_list, start_threaded_pool(), SYNCED_PROC, thread_pool, N_FLUID::u, N_FLUID::v, and wait_for_synced_threaded_pool().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_fluid_solveIncompressibility | ( | N_FLUID * | fluid | ) |
non threaded version of incompressibility solving function
| fluid | N_FLUID to solve |
Definition at line 261 of file n_fluids.c.
References __n_assert, _z, _zd, N_FLUID::density, N_FLUID::dt, N_FLUID::h, N_FLUID::numIters, N_FLUID::numX, N_FLUID::numY, N_FLUID::overRelaxation, N_FLUID::p, N_FLUID::s, N_FLUID::u, and N_FLUID::v.
Referenced by n_fluid_simulate().
Here is the caller graph for this function:| N_FLUID * new_n_fluid | ( | double | density, |
| double | gravity, | ||
| size_t | numIters, | ||
| double | dt, | ||
| double | overRelaxation, | ||
| size_t | sx, | ||
| size_t | sy | ||
| ) |
return a newly allocated fluid
| density | density of the fluid |
| gravity | gravity applied (Y axe) |
| numIters | predefined number of iterations for each frames |
| dt | preconfigured delta time |
| overRelaxation | over predefined over relaxation value |
| sx | number of cells on x axis |
| sy | number of cells on y axis |
Definition at line 72 of file n_fluids.c.
References __n_assert, N_FLUID::advectSmoke_chunk_list, N_FLUID::advectVel_chunk_list, N_FLUID::cScale, N_FLUID::density, N_FLUID::dt, LIST::end, N_FLUID::fluid_production_percentage, get_nb_cpu_cores(), N_FLUID::gravity, N_FLUID::h, N_FLUID::integrate_chunk_list, list_push(), N_FLUID::m, Malloc, MAX_LIST_ITEMS, n_memset(), N_FLUID::negative_float_tolerance, new_generic_list(), N_FLUID::newM, N_FLUID::newU, N_FLUID::newV, N_FLUID::numCells, N_FLUID::numIters, N_FLUID::numX, N_FLUID::numY, N_FLUID::numZ, N_FLUID::overRelaxation, N_FLUID::p, N_FLUID::positive_float_tolerance, N_FLUID_THREAD_PARAMS::ptr, LIST_NODE::ptr, N_FLUID::s, N_FLUID::showPaint, N_FLUID::showPressure, N_FLUID::showSmoke, N_FLUID::solveIncompressibility_chunk_list, N_FLUID::u, N_FLUID::v, N_FLUID_THREAD_PARAMS::x_end, N_FLUID_THREAD_PARAMS::x_start, N_FLUID_THREAD_PARAMS::y_end, and N_FLUID_THREAD_PARAMS::y_start.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function: