Topological relationships

Name

Topological relationships -- 

Synopsis


#include <gfs.h>


#define     FTT_CELLS
#define     FTT_CELL_ID                     (c)
#define     FTT_OPPOSITE_DIRECTION          (d)
#define     FTT_ORTHOGONAL_COMPONENT        (c)

void        ftt_cell_children               (const FttCell *cell,
                                             FttCellChildren *children);
struct      FttCellChildren;
enum        FttDirection;
enum        FttComponent;
guint       ftt_cell_children_direction     (const FttCell *cell,
                                             FttDirection d,
                                             FttCellChildren *children);
FttCell*    ftt_cell_child_corner           (const FttCell *cell,
                                             FttDirectiond[FTT_DIMENSION]);
void        ftt_cell_neighbors              (const FttCell *cell,
                                             FttCellNeighbors *neighbors);
void        ftt_cell_neighbors_not_cached   (const FttCell *cell,
                                             FttCellNeighbors *neighbors);
struct      FttCellNeighbors;
FttCell*    ftt_cell_neighbor               (const FttCell *cell,
                                             FttDirection d);
FttCell*    ftt_cell_neighbor_not_cached    (const FttCell *cell,
                                             FttDirection d);
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);
gboolean    ftt_cell_neighbor_is_brother    (FttCell *cell,
                                             FttDirection d);

Description

Details

FTT_CELLS

#define     FTT_CELLS

Evaluates to the maximum number of children of a FttCell (4 in 2D, 8 in 3D).


FTT_CELL_ID()

#define  FTT_CELL_ID(c)           ((c)->flags & FTT_FLAG_ID)

Evaluates to the child index of c.

c :

a FttCell.


FTT_OPPOSITE_DIRECTION()

#define FTT_OPPOSITE_DIRECTION(d)     (ftt_opposite_direction[d])

d :


FTT_ORTHOGONAL_COMPONENT()

#define FTT_ORTHOGONAL_COMPONENT(c)   (((c) + 1) % FTT_DIMENSION)

c :


ftt_cell_children ()

void        ftt_cell_children               (const FttCell *cell,
                                             FttCellChildren *children);

Fills children with the children of cell.

This function fails if cell is a leaf.

cell :

a FttCell.

children :

a FttCellChildren.


struct FttCellChildren

struct FttCellChildren {

  FttCell * c[FTT_CELLS];
};


enum FttDirection

typedef enum
{
  FTT_RIGHT = 0,
  FTT_LEFT,
  FTT_TOP,
  FTT_BOTTOM,
#if (!FTT_2D)
  FTT_FRONT,
  FTT_BACK,
#endif /* FTT_3D || FTT_2D3 */
  FTT_NEIGHBORS
} FttDirection;


enum FttComponent

typedef enum
{
  FTT_X = 0,
  FTT_Y,
#if (!FTT_2D)
  FTT_Z,
#endif /* FTT_3D || FTT_2D3 */
  FTT_DIMENSION,
  FTT_XY,
#if FTT_2D
  FTT_XYZ = FTT_XY
#else  /* FTT_3D || FTT_2D3 */
  FTT_XYZ
#endif /* FTT_3D || FTT_2D3 */
} FttComponent;


ftt_cell_children_direction ()

guint       ftt_cell_children_direction     (const FttCell *cell,
                                             FttDirection d,
                                             FttCellChildren *children);

Fills children with the children (2 in 2D, 4 in 3D, 2 or 4 in 2D3) of cell in direction d.

This function fails if cell is a leaf.

cell :

a FttCell.

d :

a direction.

children :

a FttCellChildren.

Returns :

the number of children in direction d.


ftt_cell_child_corner ()

FttCell*    ftt_cell_child_corner           (const FttCell *cell,
                                             FttDirectiond[FTT_DIMENSION]);

This function fails if cell is a leaf.

cell :

a FttCell.

Param2 :

Returns :

the children of cell in the corner defined by directions d.


ftt_cell_neighbors ()

void        ftt_cell_neighbors              (const FttCell *cell,
                                             FttCellNeighbors *neighbors);

Fills neighbors with the neighbors of cell.

cell :

a FttCell.

neighbors :

a FttCellNeighbors.


ftt_cell_neighbors_not_cached ()

void        ftt_cell_neighbors_not_cached   (const FttCell *cell,
                                             FttCellNeighbors *neighbors);

Fills neighbors with the neighbors of cell (does not use saved values even if available).

cell :

a FttCell.

neighbors :

a FttCellNeighbors.


struct FttCellNeighbors

struct FttCellNeighbors {

  /* right, left, top, bottom, front, back */
  FttCell * c[FTT_NEIGHBORS];
};


ftt_cell_neighbor ()

FttCell*    ftt_cell_neighbor               (const FttCell *cell,
                                             FttDirection d);

cell :

a FttCell.

d :

a direction.

Returns :

the neighbor of cell in direction d or NULL if cell has no neighbor in this direction.


ftt_cell_neighbor_not_cached ()

FttCell*    ftt_cell_neighbor_not_cached    (const FttCell *cell,
                                             FttDirection d);

cell :

a FttCell.

d :

a direction.

Returns :

the neighbor of cell in direction d or NULL if cell has no neighbor in this direction (does not use saved values even if available).


ftt_cell_set_neighbor ()

void        ftt_cell_set_neighbor           (FttCell *root,
                                             FttCell *neighbor,
                                             FttDirection d,
                                             FttCellInitFunc init,
                                             gpointer init_data);

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.

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.


ftt_cell_set_neighbor_match ()

void        ftt_cell_set_neighbor_match     (FttCell *root,
                                             FttCell *neighbor,
                                             FttDirection d,
                                             FttCellInitFunc init,
                                             gpointer init_data);

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.

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.


ftt_cell_neighbor_is_brother ()

gboolean    ftt_cell_neighbor_is_brother    (FttCell *cell,
                                             FttDirection d);

cell :

a FttCell.

d :

a FttDirection.

Returns :

TRUE if a (potential) neighbor of cell in direction d and cell would have the same parent, FALSE otherwise.