
-- FumeFX Simulation Script Template     --
-- File is located in AfterWorks/FumeFX/ --

-- SIMULATION CONTROL
---------------------
-- Uncomment this if you want to skip certain FumeFX simulation phases completely.
-- Not recommended unless you know what you are doing!
--skipForces = true
--skipAdvectFields = true
--skipAdvectVels = true
--skipPressure = true
--skipBurn = true


-- GLOBAL VARIBLES
------------------
-- declare here...


-- FUNCTIONS
------------
-- before first step has started, but after snapshots have been loaded etc...
fn PreSim = (
)

-- after the last step has ended, the simulation results are still in memory.
fn PostSim = (
)

-- called in each step ...

-- after the sources and objects have been applied. initialise grid in any way you like.
fn PostObjects = (
)

-- only function where you can use AddVort function
fn Vorticity = (
)

-- after the forces have been applied. apply custom forces like radial gravity etc.
fn PostForces = (
)

-- after fields have been advected. If you disabled Fume's advection you can write your own here.
fn PostAdvectFields = (
)

-- after velocitieshave been advected. If you disabled Fume's advection you can write your own here.
fn PostAdvectVels = (
)

-- after velocity has been pressure corrected. you can make further adjustments to the velocity,
-- and also you can prepare other values - temp, smoke... - which will be moved next
fn PostPressure = (
)

-- this is a place to start the fire by setting temperature, do some fuel processing, etc...
fn PostDiffuse = (
)

-- after the whole simulation step, after the fuel has been burned and diffusion and dissipation applied.
-- if you have disabled burn, here you can burn fuel in your way, or have any other kind of influence between channels.
fn PostStep = (
)



-- QUICK REFERENCE
--------------------------------------------------------
/*
Here are the functions and variables you can use...


Exported by FumeFX node (accessed by $FumeFX01.function)
--------------------------------------------------------
width, length, height, GridSpacing - calculate total grid dimensions with those
--nxmax = ffx.width / ffx.GridSpacing


Called independent of FumeFX node (but they operate on it)
----------------------------------------------------------

CHANNEL SET / SET FUNCTIONS
bool SetSmoke        i j k value - in grid coordinates
bool SetSmokeByIndex index value - index = (i*ny + j)*nz + k
bool SetSmokeWorld   worldPoint (FumeFX transform matrix) value
bool SetSmokeLocal   localPoint value
bool FillSmoke value - fills the entire smoke volume with the given value
... analogous are SetFuel, SetTemp, SetVelocity.
... and also the GetChannel() functions, which return float or point3, depending on channel

AddVort i j k strength
AddVortByIndex index strength

AddTurb i j k strength
AddTurbByIndex index strength

Coordinate converters
----------------------------------------------------------
Point3	IndexToVoxel int
Point3	IndexToLocal int
Point3	IndexToWorld int

int	VoxelPtToIndex Point3
Point3	VoxelPtToLocal Point3
Point3	VoxelPtToWorld Point3

int	LocalPtToIndex Point3
Point3	LocalPtToVoxel Point3
Point3	LocalPtToWorld Point3

int	WorldPtToIndex Point3
Point3	WorldPtToVoxel Point3
Point3	WorldPtToLocal Point3

Misc. functions
---------------
bool ffxPrintToStatus message
bool ffxStopSimulation()
bool ffxCancelSimulation()
bool ffxHoldWindowOnce()


Global Variables
----------------
node	ffx 		- current FumeFX node
int	ffxSimStep	- simulation frame
int	ffxSimSubStep	- simulation substep (if there are more than 1)
int	nx, ny, nz	- dimensions of the adaptive area (in voxels)
int 	nyz		- +-nyz means next voxel over x axis, +-nz over y axis, +-1 over z axis
int	voxels		- total number of voxels

*/