Nilorea Library
C utilities for networking, threading, graphics
All Data Structures Files Functions Variables Typedefs Enumerations Macros Modules Pages
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, __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_FLUIDnew_n_fluid (double density, double gravity, size_t numIters, double dt, double overRelaxation, size_t sx, size_t sy)
 !
 

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.