![]() | ![]() | ![]() | Gerris Flow Solver Reference Manual | ![]() |
---|
#include <gfs.h> FttDirection ftt_direction_from_name (constgchar *name); FttCell* ftt_cell_locate (FttCell *root, FttVector target,gint max_depth); enum FttTraverseType; enum FttTraverseFlags;void (*FttCellTraverseFunc) (FttCell *cell,gpointer data);void ftt_cell_traverse (FttCell *root, FttTraverseType order, FttTraverseFlags flags,gint max_depth, FttCellTraverseFunc func,gpointer data);void ftt_cell_traverse_boundary (FttCell *root, FttDirection d, FttTraverseType order, FttTraverseFlags flags,gint max_depth, FttCellTraverseFunc func,gpointer data);void ftt_cell_traverse_box (FttCell *root,GtsBBox *box, FttTraverseType order, FttTraverseFlags flags,gint max_depth, FttCellTraverseFunc func,gpointer data); FttCellTraverse; FttCellTraverse* ftt_cell_traverse_new (FttCell *root, FttTraverseType order, FttTraverseFlags flags,gint max_depth); FttCell* ftt_cell_traverse_next (FttCellTraverse *t);void ftt_cell_traverse_rewind (FttCellTraverse *t);void ftt_cell_traverse_destroy (FttCellTraverse *t);void ftt_cell_write (const FttCell *root,gint max_depth,FILE *fp, FttCellWriteFunc write,gpointer data);void ftt_cell_write_binary (const FttCell *root,gint max_depth,FILE *fp, FttCellWriteFunc write,gpointer data);void (*FttCellWriteFunc) (const FttCell *cell,FILE *fp,gpointer data); FttCell* ftt_cell_read (GtsFile *fp, FttCellReadFunc read,gpointer data); FttCell* ftt_cell_read_binary (GtsFile *fp, FttCellReadFunc read,gpointer data);void (*FttCellReadFunc) (FttCell *cell,GtsFile *fp,gpointer data);void ftt_cell_draw (const FttCell *cell,FILE *fp);
FttDirection ftt_direction_from_name (constgchar *name);
name : | a direction name. |
Returns : | the index of the direction |
FttCell* ftt_cell_locate (FttCell *root, FttVector target,gint max_depth);
Locates the cell of the tree defined by root
containing
target
. This is done efficiently in log(n) operations by using the
topology of the tree.
root : | a FttCell. |
target : | position of the point to look for. |
max_depth : | maximum depth to consider (-1 means no restriction). |
Returns : | a FttCell of the tree defined by |
typedef enum { FTT_PRE_ORDER, FTT_POST_ORDER } FttTraverseType;
Controls the sequence in which the traversal is performed.
FTT_PRE_ORDER | Visits the parent cell and then its children. |
FTT_POST_ORDER | Visits each children and then their parent. |
typedef enum { FTT_TRAVERSE_LEAFS = 1 << 0, FTT_TRAVERSE_NON_LEAFS = 1 << 1, FTT_TRAVERSE_LEVEL = 1 << 2, FTT_TRAVERSE_BOUNDARY_FACES = 1 << 3, FTT_TRAVERSE_ALL = FTT_TRAVERSE_LEAFS | FTT_TRAVERSE_NON_LEAFS } FttTraverseFlags;
Controls the type of cell to visit.
FTT_TRAVERSE_LEAFS | Visits only the cells which are leaves of the cell tree. |
FTT_TRAVERSE_NON_LEAFS | Visits only the cells which are not leaves of the cell tree. |
FTT_TRAVERSE_LEVEL | If FTT_TRAVERSE_LEAFS is also set, visit the leafs of the cell tree and all the cells at level |
FTT_TRAVERSE_BOUNDARY_FACES | |
FTT_TRAVERSE_ALL | Visits all the cells of the cell tree. |
void (*FttCellTraverseFunc) (FttCell *cell,gpointer data);
This functions is called by ftt_cell_traverse()
for each of the visited cells.
cell : | a FttCell. |
data : | user-data passed to the function. |
void ftt_cell_traverse (FttCell *root, FttTraverseType order, FttTraverseFlags flags,gint max_depth, FttCellTraverseFunc func,gpointer data);
Traverses a cell tree starting at the given root FttCell. Calls the given function for each cell visited.
root : | the root FttCell of the tree to traverse. |
order : | the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER. |
flags : | which types of children are to be visited. |
max_depth : | the maximum depth of the traversal. Cells below this
depth will not be traversed. If |
func : | the function to call for each visited FttCell. |
data : | user data to pass to |
void ftt_cell_traverse_boundary (FttCell *root, FttDirection d, FttTraverseType order, FttTraverseFlags flags,gint max_depth, FttCellTraverseFunc func,gpointer data);
Traverses the boundary of a cell tree in direction d
starting at
the given root FttCell. Calls the given function for each node
visited.
root : | the root FttCell of the tree to traverse. |
d : | the direction of the boundary to traverse. |
order : | the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER. |
flags : | which types of children are to be visited. |
max_depth : | the maximum depth of the traversal. Cells below this
depth will not be traversed. If |
func : | the function to call for each visited FttCell. |
data : | user data to pass to |
void ftt_cell_traverse_box (FttCell *root,GtsBBox *box, FttTraverseType order, FttTraverseFlags flags,gint max_depth, FttCellTraverseFunc func,gpointer data);
Traverses a cell tree starting at the given root FttCell. Calls
the given function for each cell visited. Only the cells partly or
totally contained within box
are visited.
root : | the root FttCell of the tree to traverse. |
box : | a |
order : | the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER. |
flags : | which types of children are to be visited. |
max_depth : | the maximum depth of the traversal. Cells below this
depth will not be traversed. If |
func : | the function to call for each visited FttCell. |
data : | user data to pass to |
FttCellTraverse* ftt_cell_traverse_new (FttCell *root, FttTraverseType order, FttTraverseFlags flags,gint max_depth);
root : | the root FttCell of the tree to traverse. |
order : | the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER. |
flags : | which types of children are to be visited. |
max_depth : | the maximum depth of the traversal. Cells below this
depth will not be traversed. If |
Returns : | a new FttCellTraverse. |
FttCell* ftt_cell_traverse_next (FttCellTraverse *t);
t : | |
Returns : | the next cell to visit or NULL if all the cells have been visited. |
void ftt_cell_traverse_rewind (FttCellTraverse *t);
Sets t
at the begining of the traversal.
t : |
void ftt_cell_traverse_destroy (FttCellTraverse *t);
Frees all the memory associated with t
.
t : |
void ftt_cell_write (const FttCell *root,gint max_depth,FILE *fp, FttCellWriteFunc write,gpointer data);
Writes in the file pointed to by fp
a text representation of the
cell tree starting at root
. If not NULL, the user-defined
function write
is used to write the extra user data associated
with each cell.
root : | a FttCell. |
max_depth : | the maximum depth at which to stop writing (-1 means no limit). |
fp : | a file pointer. |
write : | a FttCellWriteFunc function or NULL. |
data : | user data to pass to |
void ftt_cell_write_binary (const FttCell *root,gint max_depth,FILE *fp, FttCellWriteFunc write,gpointer data);
Writes in the file pointed to by fp
a binary representation of the
cell tree starting at root
. If not NULL, the user-defined
function write
is used to write the extra user data associated
with each cell.
root : | a FttCell. |
max_depth : | the maximum depth at which to stop writing (-1 means no limit). |
fp : | a file pointer. |
write : | a FttCellWriteFunc function or NULL. |
data : | user data to pass to |
void (*FttCellWriteFunc) (const FttCell *cell,FILE *fp,gpointer data);
Writes in fp
any user data associated with cell
. It is important that this function does not output any newline caracter ('\n').
cell : | a FttCell. |
fp : | a file pointer. |
data : |
|
FttCell* ftt_cell_read (GtsFile *fp, FttCellReadFunc read,gpointer data);
If an error occurs (i.e. corrupted file or file format incorrect),
the error
field of fp
is set. A possibly incomplete tree is then
returned.
fp : | a |
read : | a FttCellReadFunc function or NULL. |
data : | user data to pass to |
Returns : | the root cell of the tree contained in the file pointed to
by |
FttCell* ftt_cell_read_binary (GtsFile *fp, FttCellReadFunc read,gpointer data);
If an error occurs (i.e. corrupted file or file format incorrect),
the error
field of fp
is set. A possibly incomplete tree is then
returned.
fp : | a |
read : | a FttCellReadFunc function or NULL. |
data : | user data to pass to |
Returns : | the root cell of the tree contained in the file pointed to
by |
void (*FttCellReadFunc) (FttCell *cell,GtsFile *fp,gpointer data);
Reads in any user data associated with cell
from file fp
and initializes the corresponding fields.
cell : | a FttCell. |
fp : | a file pointer. |
data : |
<<< Cell faces operations | Flow solver >>> |