Classes | Typedefs | Functions

gmi.h File Reference

abstract Geometric Model Interface More...

Go to the source code of this file.

Classes

struct  gmi_set
 a set of model entities More...
struct  gmi_model_ops
 model interface definition More...
struct  gmi_model
 the basic structure for all GMI models More...

Typedefs

typedef struct gmi_model *(* gmi_creator )(const char *filename)
 model from file constructor, give to gmi_register

Functions

struct gmi_setgmi_make_set (int n)
 allocate a gmi_set with (n) elements
void gmi_free_set (struct gmi_set *s)
 free a gmi_set
struct gmi_iter * gmi_begin (struct gmi_model *m, int dim)
 begin an iterator over model entities of one dimension
struct gmi_ent * gmi_next (struct gmi_model *m, struct gmi_iter *i)
 dereference and then increment an interator
void gmi_end (struct gmi_model *m, struct gmi_iter *i)
 free an iterator
int gmi_dim (struct gmi_model *m, struct gmi_ent *e)
 get the dimension of a model entity
int gmi_tag (struct gmi_model *m, struct gmi_ent *e)
 get the tag of a model entity
struct gmi_ent * gmi_find (struct gmi_model *m, int dim, int tag)
 lookup a model entity by dimension and tag
struct gmi_setgmi_adjacent (struct gmi_model *m, struct gmi_ent *e, int dim)
 query model entity adjacencies
int gmi_can_eval (struct gmi_model *m)
 check whether the model implements gmi_eval
void gmi_eval (struct gmi_model *m, struct gmi_ent *e, double const p[2], double x[3])
 evaluate the parametric definition of a model boundary entity
void gmi_reparam (struct gmi_model *m, struct gmi_ent *from, double const from_p[2], struct gmi_ent *to, double to_p[2])
 re-parameterize from one model entity to another
int gmi_periodic (struct gmi_model *m, struct gmi_ent *e, int dim)
 return true iff the model entity is periodic around this dimension
void gmi_range (struct gmi_model *m, struct gmi_ent *e, int dim, double r[2])
 return the range of parametric coordinates along this dimension
void gmi_closest_point (struct gmi_model *m, struct gmi_ent *e, double const from[3], double to[3], double to_p[2])
 return closest point and its parameter
void gmi_normal (struct gmi_model *m, struct gmi_ent *e, double const p[2], double n[3])
 return normal vector at a parameter
void gmi_first_derivative (struct gmi_model *m, struct gmi_ent *e, double const p[2], double t0[3], double t1[3])
 return first derivative
void gmi_destroy (struct gmi_model *m)
 destroy a geometric model
void gmi_register (gmi_creator f, const char *ext)
 register a new geometric modeler
struct gmi_modelgmi_load (const char *filename)
 load a geometric model file
void gmi_write_dmg (struct gmi_model *m, const char *filename)
 write a dmg (meshmodel) file
void gmi_fail (const char *why) __attribute__((noreturn))
 print the message as a gmi failure and abort
void gmi_fscanf (FILE *f, int n, const char *format,...)
 fscanf wrapper that checks return values

Detailed Description

abstract Geometric Model Interface


Function Documentation

struct gmi_set* gmi_adjacent ( struct gmi_model m,
struct gmi_ent *  e,
int  dim 
) [read]

query model entity adjacencies

currently only one-level adjacencies are supported by most implementations

struct gmi_iter* gmi_begin ( struct gmi_model m,
int  dim 
) [read]

begin an iterator over model entities of one dimension

call gmi_end on this iterator afterwards

void gmi_eval ( struct gmi_model m,
struct gmi_ent *  e,
double const   p[2],
double  x[3] 
)

evaluate the parametric definition of a model boundary entity

Parameters:
p ignored for vertices. for edges, p[0] should be the edge parametric coordinate. for faces, p should contain the parametric u,v face coordinates
x the resulting point in space
void gmi_fail ( const char *  why  ) 

print the message as a gmi failure and abort

this is for GMI internal use, not public users

void gmi_fscanf ( FILE *  f,
int  n,
const char *  format,
  ... 
)

fscanf wrapper that checks return values

programmers often fail to check the return value of fscanf, and some compiler configurations will complain about that. this function calls fscanf(f,format,...) and then requires that the return value is equal to n.

struct gmi_model* gmi_load ( const char *  filename  )  [read]

load a geometric model file

see gmi_register. the filename is checked against all registered extensions. The first match triggers a gmi_creator to load the file. This function will fail and abort if there are no matches

struct gmi_ent* gmi_next ( struct gmi_model m,
struct gmi_iter *  i 
) [read]

dereference and then increment an interator

Returns:
0 if past the end, otherwise a valid entity
void gmi_register ( gmi_creator  f,
const char *  ext 
)

register a new geometric modeler

this function registers a geometric modeler in GMI's global list. the modeler declares that it is responsible for files with extension (ext). Subsequent calls to gmi_load will check for extension (ext), and if it matches then the gmi_creator (f) is called with the given filename and the resulting model is returned.

Parameters:
ext the model file extension, without the dot
void gmi_reparam ( struct gmi_model m,
struct gmi_ent *  from,
double const   from_p[2],
struct gmi_ent *  to,
double  to_p[2] 
)

re-parameterize from one model entity to another

Parameters:
from the model entity to start from
from_p the parametric coordinates on entity (from), see gmi_eval
to the model entity to reparameterize onto
to_p the resulting parametric coordinates, again in the form described by gmi_eval
void gmi_write_dmg ( struct gmi_model m,
const char *  filename 
)

write a dmg (meshmodel) file

the .dmg format is SCOREC's meshmodel format which contains only model entities and topology, and can be loaded by the gmi_mesh.h system as its own structure. GMI can write this file format from any gmi_model object that implements basic iteration and dim/tag queries.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines