This chapter introduces PHIGURE functions to deal with 2D meshes of the following type:
- rectangular mesh
- quadrangular mesh
- polar mesh
- sector mesh
- triangular mesh
- non-structured triangular mesh
- non-structured quadrangular mesh
- heterogeneous polygonal mesh
Each of these meshes is described giving its geometry (C structure Tmesh2D), its 2D scalar values (C structure Tscalar2D_data) and its 2D vector values (C structure Tvec2D_data). A PHIGURE function for 2D mesh representation has the following pattern:
txxxxx (struct_id, &mesh, &scal_data1, &scal_data2, ...)
where
txxxxx is the name of the PHIGURE function
struct_id : is the PHIGS structure identifier (to be included in the scene calling tscene function if to be visualized)
&mesh pointer to the structure describing mesh geometry
&scal_data1 pointer to the first set of data
&scal_data2 pointer to the second set of data ...
Description of the C structure mesh:
typedef struct {
Tmesh2D_type type;
union {
struct {
Pint num_x;
Pint num_y;
Pfloat *x;
Pfloat *y;
} rectangular;
struct {
Pint num_x;
Pint num_y;
Pfloat **x;
Pfloat **y;
} quadrangular;
struct {
Pint num_r;
Pint num_t;
Pfloat *r;
Pfloat *t;
} polar;
struct {
Pint num_r;
Pint num_t;
Pfloat *r;
Pfloat *t
} sector;
struct {
Pint num_triangles;
Pint num_edges;
Pint num_vertices;
Pint *triangle_edge[3];
Pint *edge_owner[2
Pint *edge_vertex[2];
Ppoint *vertex;
} triangular;
struct {
Pint num_triangles;
Pint num_nodes;
Ttriangle_ind *triangle_nodes;
Ppoint *nodes;
} ns_triangles;
struct {
Pint num_ quadrangles;
Pint num_nodes;
Ttriangle_ind *quadrangle_nodes;
Ppoint *nodes;
} ns_quadrangles;
struct {
Pint num_ elems;
Pint num_nodes;
Pint_list *elem_nodes;
Ppoint *nodes;
} ns_non_homo_2D;
}geometry;
}Tmesh2D
type stands for the geometry type of the mesh :
typedef enum {
TRECTANGULAR_MESH,
TQUADRANGULAR_MESH,
TPOLAR_MESH,
TTRIANGULAR_MESH,
TSECTOR_MESH,
TNS_OF_TRIANGLES,
TNS_OF_QUADRANGLES,
TNS_MESH_NON_HOMO_2D
} Tmesh2D_type;
vertex and nodes stand for mesh nodes :
typedef struct {
Pfloat x;
Pfloat y;
} Ppoint;
Triangle_ind
is a three integers array describing the three triangle node indices:typedef Pint Triangle_ind[3];
Tquadrangle_ind is a four integers array describing the four quadrangle node indices:
typedef Pint Tquadrangle_ind[4];
Description of the C structure scal_data:
typedef union {
struct {
Pfloat **s;
} rectangular;
struct {
Pfloat **s;
} quadrangular;
struct {
Pfloat **s;
Pfloat so;
} polar;
struct {
Ppoint *s;
} triangular;
struct {
Pfloat **s;
} sector;
struct {
Pfloat *s;
} ns_triangles;
struct {
Pfloat *s;
} ns_quadrangles;
struct {
Pfloat *s;
} ns_non_homo_2D;
} Tscalar2D_data;
Description
of the C structure vector_data:
typedef union {
struct {
Pvec **v;
} rectangular;
struct {
Pvec **v;
} quadrangular;
struct {
Pvec **v;
Pvec vo;
} polar;
struct {
Pvec *v;
} triangular;
struct {
Pvec **v;
} sector;
struct {
Pvec *v;
} ns_triangles;
struct {
Pvec *v;
} ns_quadrangles;
struct {
Pvec *v;
} ns_non_homo_2D;
} Tvec2D_data
where Pvec type is PHIGURE vector type:
typedef struct {
Pfloat delta_x;
Pfloat delta_y;
} Pvec;
Double
pointer structures fields (**s, **x, **y, or **v) may be
allocated calling utility functions talloc_float_matrix and
talloc_vec_matrix, and may be freed calling utility functions
tfree_float_matrix and tfree_vec_matrix.