Gerris
|
Quad/Octrees. More...
Functions | |
FttCell * | ftt_cell_new (FttCellInitFunc init, gpointer data) |
gboolean | ftt_cell_check (const FttCell *cell) |
void | ftt_cell_refine_single (FttCell *cell, FttCellInitFunc init, gpointer init_data) |
void | ftt_cell_refine (FttCell *root, FttCellRefineFunc refine, gpointer refine_data, FttCellInitFunc init, gpointer init_data) |
void | ftt_cell_draw (const FttCell *cell, FILE *fp) |
void | ftt_face_draw (const FttCellFace *face, FILE *fp) |
void | ftt_cell_relative_pos (const FttCell *cell, FttVector *pos) |
void | ftt_cell_pos (const FttCell *cell, FttVector *pos) |
void | ftt_corner_relative_pos (const FttCell *cell, FttDirection d[FTT_DIMENSION], FttVector *pos) |
void | ftt_corner_pos (const FttCell *cell, FttDirection d[FTT_DIMENSION], FttVector *pos) |
void | ftt_face_pos (const FttCellFace *face, FttVector *pos) |
void | ftt_cell_set_pos (FttCell *root, const FttVector *pos) |
void | ftt_cell_set_level (FttCell *root, guint level) |
void | ftt_cell_set_neighbor (FttCell *root, FttCell *neighbor, FttDirection d, FttCellInitFunc init, gpointer init_data) |
void | ftt_cell_set_neighbor_match (FttCell *root, FttCell *neighbor, FttDirection d, FttCellInitFunc init, gpointer init_data) |
void | ftt_cell_traverse (FttCell *root, FttTraverseType order, FttTraverseFlags flags, gint max_depth, FttCellTraverseFunc func, gpointer data) |
void | ftt_cell_traverse_condition (FttCell *root, FttTraverseType order, FttTraverseFlags flags, gint max_depth, FttCellTraverseFunc func, gpointer data, gboolean(*condition)(FttCell *, gpointer), gpointer cdata) |
void | ftt_cell_bbox (const FttCell *cell, GtsBBox *bb) |
void | ftt_cell_traverse_box (FttCell *root, GtsBBox *box, 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_destroy (FttCell *cell, FttCellCleanupFunc cleanup, gpointer data) |
void | ftt_cell_destroy_root (FttCell *root, FttCellChildren *children, FttCellCleanupFunc cleanup, gpointer data) |
void | ftt_cell_flatten (FttCell *root, FttDirection d, FttCellCleanupFunc cleanup, gpointer data) |
FttCell * | ftt_cell_locate (FttCell *root, FttVector target, gint max_depth) |
gdouble | ftt_cell_point_distance2_min (FttCell *cell, GtsPoint *p) |
gdouble | ftt_cell_point_distance2 (FttCell *root, GtsPoint *p, gdouble(*distance2)(FttCell *, GtsPoint *, gpointer), gpointer data, FttCell **closest) |
guint | ftt_cell_depth (const FttCell *root) |
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) |
FttCell * | ftt_cell_read (GtsFile *fp, FttCellReadFunc read, gpointer data) |
FttCell * | ftt_cell_read_binary (GtsFile *fp, FttCellReadFunc read, gpointer data) |
gboolean | ftt_refine_corner (const FttCell *cell) |
FttCell * | ftt_cell_copy (const FttCell *root, FttCellCopyFunc copy, gpointer data) |
void | ftt_face_traverse (FttCell *root, FttComponent c, FttTraverseType order, FttTraverseFlags flags, gint max_depth, FttFaceTraverseFunc func, gpointer data) |
void | ftt_face_traverse_boundary (FttCell *root, FttDirection d, FttTraverseType order, FttTraverseFlags flags, gint max_depth, FttFaceTraverseFunc func, gpointer data) |
gboolean | ftt_cell_coarsen (FttCell *root, FttCellCoarsenFunc coarsen, gpointer coarsen_data, FttCellCleanupFunc cleanup, gpointer cleanup_data) |
FttDirection | ftt_direction_from_name (const gchar *name) |
FttCellTraverse * | ftt_cell_traverse_new (FttCell *root, FttTraverseType order, FttTraverseFlags flags, gint max_depth) |
void | ftt_cell_traverse_rewind (FttCellTraverse *t) |
void | ftt_cell_traverse_destroy (FttCellTraverse *t) |
Quad/Octrees.
void ftt_cell_bbox | ( | const FttCell * | cell, |
GtsBBox * | bb | ||
) |
cell | a #FttCell. |
bb | a #GtsBBox. |
Fills bb with the bounding box of cell.
gboolean ftt_cell_check | ( | const FttCell * | cell | ) |
cell | a #FttCell. |
gboolean ftt_cell_coarsen | ( | FttCell * | root, |
FttCellCoarsenFunc | coarsen, | ||
gpointer | coarsen_data, | ||
FttCellCleanupFunc | cleanup, | ||
gpointer | cleanup_data | ||
) |
root | a #FttCell root of a cell tree to coarsen. |
coarsen | a #FttCellCoarsenFunc. |
coarsen_data | user data to pass to coarsen. |
cleanup | a #FttCellCleanupFunc to call before destroying a cell or NULL. |
cleanup_data | user data to pass to cleanup. |
Coarsens the cell tree defined by root according to coarsen.
FttCell* ftt_cell_copy | ( | const FttCell * | root, |
FttCellCopyFunc | copy, | ||
gpointer | data | ||
) |
root | the root of the cell tree to copy. |
copy | a #FttCellCopyFunc or NULL. |
data | user data to pass to copy. |
guint ftt_cell_depth | ( | const FttCell * | root | ) |
root | a #FttCell. |
void ftt_cell_destroy | ( | FttCell * | cell, |
FttCellCleanupFunc | cleanup, | ||
gpointer | data | ||
) |
cell | a #FttCell. |
cleanup | a #FttCellCleanupFunc to call before destroying cell or NULL. |
data | user data to pass to cleanup. |
Frees all memory allocated for cell and its descendants.
The user-defined function cleanup is called prior to freeing memory.
void ftt_cell_destroy_root | ( | FttCell * | root, |
FttCellChildren * | children, | ||
FttCellCleanupFunc | cleanup, | ||
gpointer | data | ||
) |
root | the root cell of a cell tree. |
children | a #FttCellChildren. |
cleanup | a #FttCellCleanupFunc to call before destroying a cell. |
data | user data to pass to cleanup. |
Destroys the root cell of a cell tree but not its children. Each child becomes the root cell of a new cell tree. The new (orphaned) children are returned in children.
Note that the function will fail if root is also a leaf cell.
void ftt_cell_draw | ( | const FttCell * | cell, |
FILE * | fp | ||
) |
cell | a #FttCell. |
fp | a file pointer. |
Outputs in fp an OOGL (geomview) representation of cell.
void ftt_cell_flatten | ( | FttCell * | root, |
FttDirection | d, | ||
FttCellCleanupFunc | cleanup, | ||
gpointer | data | ||
) |
root | the root of the cell tree to flatten. |
d | the direction in which to flatten. |
cleanup | a #FttCellCleanupFunc to call before destroying a cell. |
data | user data to pass to cleanup. |
Recursively destroys all the cells of the tree defined by root which do not form the boundary in direction d. The resulting cell tree is in effect a domain "flattened" in direction d.
The resulting domain is always one-cell thick in direction d.
FttCell* ftt_cell_locate | ( | FttCell * | root, |
FttVector | target, | ||
gint | max_depth | ||
) |
root | a #FttCell. |
target | position of the point to look for. |
max_depth | maximum depth to consider (-1 means no restriction, see below for -2). |
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.
If max_depth is set to -2, the finest cell containing target is returned. This cell is not necessarily a leaf-cell in contrast to the case where max_depth is set to -1.
FttCell* ftt_cell_new | ( | FttCellInitFunc | init, |
gpointer | data | ||
) |
init | a #FttCellInitFunc or NULL. |
data | user data to pass to init. |
gdouble ftt_cell_point_distance2 | ( | FttCell * | root, |
GtsPoint * | p, | ||
gdouble(*)(FttCell *, GtsPoint *, gpointer) | distance2, | ||
gpointer | data, | ||
FttCell ** | closest | ||
) |
root | a #FttCell. |
p | a #GtsPoint. |
distance2 | the squared distance function. |
data | user data to pass to distance2. |
closest | where to return the closest cell or NULL. |
For non-leafs cells distance2 must return a lower-bound for the minimum distance (using for example ftt_cell_point_distance2_min()).
gdouble ftt_cell_point_distance2_min | ( | FttCell * | cell, |
GtsPoint * | p | ||
) |
cell | a #FttCell. |
p | a #GtsPoint. |
void ftt_cell_pos | ( | const FttCell * | cell, |
FttVector * | pos | ||
) |
cell | a #FttCell. |
pos | a #FttVector. |
Fills pos with the coordinates of the center of cell.
FttCell* ftt_cell_read | ( | GtsFile * | fp, |
FttCellReadFunc | read, | ||
gpointer | data | ||
) |
fp | a #GtsFile. |
read | a #FttCellReadFunc function or NULL. |
data | user data to pass to read. |
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.
FttCell* ftt_cell_read_binary | ( | GtsFile * | fp, |
FttCellReadFunc | read, | ||
gpointer | data | ||
) |
fp | a #GtsFile. |
read | a #FttCellReadFunc function or NULL. |
data | user data to pass to read. |
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.
void ftt_cell_refine | ( | FttCell * | root, |
FttCellRefineFunc | refine, | ||
gpointer | refine_data, | ||
FttCellInitFunc | init, | ||
gpointer | init_data | ||
) |
root | a #FttCell. |
refine | a #FttCellRefineFunc. |
refine_data | user data to pass to refine. |
init | a #FttCellInitFunc or NULL. |
init_data | user data to pass to init. |
Recursively refines the tree starting from root. Each leaf of the tree is tested for refinement using the refine function. The new refined cells created are initialized using init (if not NULL) and are themselves recursively refined.
void ftt_cell_refine_single | ( | FttCell * | cell, |
FttCellInitFunc | init, | ||
gpointer | init_data | ||
) |
cell | a #FttCell. |
init | a #FttCellInitFunc or NULL. |
init_data | user data to pass to init. |
Refines cell and eventually its neighbors to ensure that the neighborhood properties are preserved. The new refined cells created are initialized using init (if not NULL).
void ftt_cell_relative_pos | ( | const FttCell * | cell, |
FttVector * | pos | ||
) |
cell | a #FttCell (not a root cell). |
pos | a #FttVector. |
Fills pos with the coordinates of the center of cell relative to the center of its parent cell. The length unit is the size of the parent cell.
void ftt_cell_set_level | ( | FttCell * | root, |
guint | level | ||
) |
root | a #FttCell, root of a cell tree. |
level | the new level. |
Sets the level of the root cell of a cell tree to level. Updates the levels of its children recursively.
void ftt_cell_set_neighbor | ( | FttCell * | root, |
FttCell * | neighbor, | ||
FttDirection | d, | ||
FttCellInitFunc | init, | ||
gpointer | init_data | ||
) |
root | a #FttCell, root of a cell tree. |
neighbor | a #FttCell, root of a cell tree. |
d | a direction. |
init | a #FttCellInitFunc or NULL. |
init_data | user data to pass to init. |
Sets the cell tree defined by neighbor as the neighbor in direction d of the cell tree defined by root.
Any new cell created during the process is initialized using the user-defined function init.
Both root and neighbor must be the roots of their respective cell trees.
void ftt_cell_set_neighbor_match | ( | FttCell * | root, |
FttCell * | neighbor, | ||
FttDirection | d, | ||
FttCellInitFunc | init, | ||
gpointer | init_data | ||
) |
root | a #FttCell, root of a cell tree. |
neighbor | a #FttCell, root of a cell tree. |
d | a direction. |
init | a #FttCellInitFunc or NULL. |
init_data | user data to pass to init. |
Sets the cell tree defined by neighbor as the neighbor in direction d of the cell tree defined by root.
The boundary between both trees is matched i.e. the type of the face between any pair of cells belonging to each tree is always FTT_FINE_FINE. Any new cell created during the process is initialized using the user-defined function init.
Both root and neighbor must be the roots of their respective cell trees.
void ftt_cell_set_pos | ( | FttCell * | root, |
const FttVector * | pos | ||
) |
root | a #FttCell, root of a cell tree. |
pos | a #FttVector. |
Sets the position of the center of the root cell of a cell tree to pos. Updates the positions of its children recursively.
void ftt_cell_traverse | ( | FttCell * | root, |
FttTraverseType | order, | ||
FttTraverseFlags | flags, | ||
gint | max_depth, | ||
FttCellTraverseFunc | func, | ||
gpointer | data | ||
) |
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 max_depth is -1 all cells in the tree are visited. |
func | the function to call for each visited #FttCell. |
data | user data to pass to func. |
Traverses a cell tree starting at the given root #FttCell. Calls the given function for each cell visited.
void ftt_cell_traverse_boundary | ( | FttCell * | root, |
FttDirection | d, | ||
FttTraverseType | order, | ||
FttTraverseFlags | flags, | ||
gint | max_depth, | ||
FttCellTraverseFunc | func, | ||
gpointer | data | ||
) |
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 max_depth is -1 all cells in the tree are visited. |
func | the function to call for each visited #FttCell. |
data | user data to pass to func. |
Traverses the boundary of a cell tree in direction d starting at the given root #FttCell. Calls the given function for each node visited.
void ftt_cell_traverse_box | ( | FttCell * | root, |
GtsBBox * | box, | ||
FttTraverseType | order, | ||
FttTraverseFlags | flags, | ||
gint | max_depth, | ||
FttCellTraverseFunc | func, | ||
gpointer | data | ||
) |
root | the root #FttCell of the tree to traverse. |
box | a #GtsBBox. |
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 max_depth is -1 all cells in the tree are visited. |
func | the function to call for each visited #FttCell. |
data | user data to pass to func. |
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.
void ftt_cell_traverse_condition | ( | FttCell * | root, |
FttTraverseType | order, | ||
FttTraverseFlags | flags, | ||
gint | max_depth, | ||
FttCellTraverseFunc | func, | ||
gpointer | data, | ||
gboolean(*)(FttCell *, gpointer) | condition, | ||
gpointer | cdata | ||
) |
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 max_depth is -1 all cells in the tree are visited. |
func | the function to call for each visited #FttCell. |
data | user data to pass to func. |
condition | the condition. |
cdata | user data to pass to condition. |
Traverses a cell tree starting at the given root #FttCell. Calls the given function for each cell visited.
Traversal of any branch of the tree is stopped whenever condition is not verified.
void ftt_cell_traverse_destroy | ( | FttCellTraverse * | t | ) |
t | a #FttCellTraverse. |
Frees all the memory associated with t.
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 max_depth is -1 all cells in the tree are visited. |
void ftt_cell_traverse_rewind | ( | FttCellTraverse * | t | ) |
t | a #FttCellTraverse. |
Sets t at the begining of the traversal.
void ftt_cell_write | ( | const FttCell * | root, |
gint | max_depth, | ||
FILE * | fp, | ||
FttCellWriteFunc | write, | ||
gpointer | data | ||
) |
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 write. |
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.
void ftt_cell_write_binary | ( | const FttCell * | root, |
gint | max_depth, | ||
FILE * | fp, | ||
FttCellWriteFunc | write, | ||
gpointer | data | ||
) |
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 write. |
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.
void ftt_corner_pos | ( | const FttCell * | cell, |
FttDirection | d[FTT_DIMENSION], | ||
FttVector * | pos | ||
) |
cell | a #FttCell. |
d | a set of perpendicular directions. |
pos | a #FttVector. |
Fills pos with the coordinates of the corner of cell defined by d.
void ftt_corner_relative_pos | ( | const FttCell * | cell, |
FttDirection | d[FTT_DIMENSION], | ||
FttVector * | pos | ||
) |
cell | a #FttCell. |
d | a set of perpendicular directions. |
pos | a #FttVector. |
Fills pos with the coordinates (normalised by the size of cell) of the corner of cell defined by d relative to the position of the center of cell.
FttDirection ftt_direction_from_name | ( | const gchar * | name | ) |
name | a direction name. |
void ftt_face_draw | ( | const FttCellFace * | face, |
FILE * | fp | ||
) |
face | a #FttCellFace. |
fp | a file pointer. |
Outputs in fp an OOGL (geomview) representation of face.
void ftt_face_pos | ( | const FttCellFace * | face, |
FttVector * | pos | ||
) |
face | a #FttCellFace. |
pos | a #FttVector. |
Fills pos with the coordinates of the center of face.
void ftt_face_traverse | ( | FttCell * | root, |
FttComponent | c, | ||
FttTraverseType | order, | ||
FttTraverseFlags | flags, | ||
gint | max_depth, | ||
FttFaceTraverseFunc | func, | ||
gpointer | data | ||
) |
root | the root #FttCell of the tree to traverse. |
c | only the faces orthogonal to this component will be traversed - one of FTT_X, FTT_Y, (FTT_Z), FTT_XYZ. |
order | the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER. |
flags | which types of children and faces are to be visited. |
max_depth | the maximum depth of the traversal. Cells below this depth will not be traversed. If max_depth is -1 all cells in the tree are visited. |
func | the function to call for each visited #FttCellFace. |
data | user data to pass to func. |
Traverses a cell tree starting at the given root #FttCell. Calls the given function for each face of the cells of the tree.
If FTT_TRAVERSE_BOUNDARY_FACES is not set in flags, only "double-sided" faces are traversed i.e. the neighbor field of the face is never NULL.
void ftt_face_traverse_boundary | ( | FttCell * | root, |
FttDirection | d, | ||
FttTraverseType | order, | ||
FttTraverseFlags | flags, | ||
gint | max_depth, | ||
FttFaceTraverseFunc | func, | ||
gpointer | data | ||
) |
root | the root #FttCell of the tree to traverse. |
d | the direction of the boundary to visit. |
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 max_depth is -1 all cells in the tree are visited. |
func | the function to call for each visited #FttCellFace. |
data | user data to pass to func. |
Traverses a cell tree starting at the given root #FttCell. Calls the given function for each face of the cell tree forming the boundary of the domain in direction d.
gboolean ftt_refine_corner | ( | const FttCell * | cell | ) |
cell | a #FttCell. |