Nilorea Library
C utilities for networking, threading, graphics
n_fluids.h File Reference

fluid management port from "How to write an Eulerian fluid simulator with 200 lines of code", by Ten Minute Physics ( https://www.youtube.com/watch?v=iKAVRgIrUOU ) More...

#include "allegro5/allegro.h"
#include <allegro5/allegro_primitives.h>
#include "nilorea/n_list.h"
#include "nilorea/n_thread_pool.h"
+ Include dependency graph for n_fluids.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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, __componant)   ( (__fluid->__componant) > (__fluid->negative_float_tolerance) && (__fluid->__componant) < (__fluid->positive_float_tolerance) )
 test if componant is near zero, according to fluid's precision More...
 
#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 More...
 

Functions

int destroy_n_fluid (N_FLUID **fluid)
 ddestroy a fluid structure More...
 
int n_fluid_advectSmoke (N_FLUID *fluid)
 non threaded version of add smoke function More...
 
int n_fluid_advectVel (N_FLUID *fluid)
 non threaded version of add velocities function More...
 
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 More...
 
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 More...
 
int n_fluid_draw (N_FLUID *fluid)
 draw a N_FLUID on screen / targert bitmap More...
 
int n_fluid_extrapolate (N_FLUID *fluid)
 non threaded extrapolation function More...
 
ALLEGRO_COLOR n_fluid_getSciColor (N_FLUID *fluid, double val, double minVal, double maxVal)
 get fonky colors for the fluid More...
 
int n_fluid_integrate (N_FLUID *fluid)
 non threaded version of integration function More...
 
int n_fluid_resetObstacles (N_FLUID *fluid)
 reset the obstacles set in a N_FLUID More...
 
double n_fluid_sampleField (N_FLUID *fluid, double x, double y, uint32_t field)
 compute a sample value at a field position More...
 
int n_fluid_setObstacle (N_FLUID *fluid, double x, double y, double vx, double vy, double r)
 set an obstacle in the fluid grid More...
 
int n_fluid_simulate (N_FLUID *fluid)
 non threaded version of N_FLUID global processing function More...
 
int n_fluid_simulate_threaded (N_FLUID *fluid, THREAD_POOL *thread_pool)
 a threaded version of N_FLUID global processing function More...
 
int n_fluid_solveIncompressibility (N_FLUID *fluid)
 non threaded version of incompressibility solving function More...
 
N_FLUIDnew_n_fluid (double density, double gravity, size_t numIters, double dt, double overRelaxation, size_t sx, size_t sy)
 ! More...
 

Detailed Description

fluid management port from "How to write an Eulerian fluid simulator with 200 lines of code", by Ten Minute Physics ( https://www.youtube.com/watch?v=iKAVRgIrUOU )

Author
Castagnier Mickaƫl aka Gull Ra Driel
Version
1.0
Date
31/12/2022

Definition in file n_fluids.h.