SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 More...
 
struct gmi_ent * gmi_next (struct gmi_model *m, struct gmi_iter *i)
 dereference and then increment an interator More...
 
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 More...
 
int gmi_can_eval (struct gmi_model *m)
 check whether the model implements gmi_eval
 
int gmi_can_get_closest_point (struct gmi_model *m)
 check whether the model gmi_closest_point
 
int gmi_has_normal (struct gmi_model *m)
 check whether the model implements gmi_normal
 
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 More...
 
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 More...
 
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
 
int gmi_is_point_in_region (struct gmi_model *m, struct gmi_ent *e, double point[3])
 check if point is in region
 
int gmi_is_in_closure_of (struct gmi_model *m, struct gmi_ent *e, struct gmi_ent *et)
 check if e is in the closure of et
 
void gmi_bbox (struct gmi_model *m, struct gmi_ent *e, double bmin[3], double bmax[3])
 get the bounding box of model entity e
 
int gmi_is_discrete_ent (struct gmi_model *m, struct gmi_ent *e)
 check if e is a discrete entity
 
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 More...
 
struct gmi_modelgmi_load (const char *filename)
 load a geometric model file More...
 
void gmi_write_dmg (struct gmi_model *m, const char *filename)
 write a dmg (meshmodel) file More...
 
void gmi_fail (const char *why) __attribute__((noreturn))
 print the message as a gmi failure and abort More...
 
void gmi_fscanf (FILE *f, int n, const char *format,...)
 fscanf wrapper that checks return values More...
 

Detailed Description

abstract Geometric Model Interface

Definition in file gmi.h.

Function Documentation

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

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 
)

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
pignored for vertices. for edges, p[0] should be the edge parametric coordinate. for faces, p should contain the parametric u,v face coordinates
xthe 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)

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 
)

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
extthe 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
fromthe model entity to start from
from_pthe parametric coordinates on entity (from), see gmi_eval
tothe model entity to reparameterize onto
to_pthe 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.