Simple Example (C specification)

Hello Mesh

#include
#include "iMesh.h"


int main( int argc, char *argv[] )
{
/* create the Mesh instance */
char *options = NULL;
iMesh_Instance mesh;
int ierr, options_len = 0;
iMesh_newMesh(options, &mesh, &ierr,
options_len);


/* load the mesh */
iMesh_load(mesh, argv[1], options, &ierr,
strlen(argv[1]), options_len);


/* report the number of elements of each dimension */
for (int dim = iBase_VERTEX; dim <= iBase_REGION; dim++) {
int numd;
iMesh_getNumOfType(mesh, 0, dim, &numd, &ierr);
std::cout << "Number of " << dim << "d elements = "
<< numd << std::endl;
}
return true;}


The Makefile

Applications will have a file called iMesh-Defs.inc which can be included in a makfile and which provides the following variables: For example:

include ../../iMesh-Defs.inc

HELLOiMesh: HELLOiMesh.o ${iMesh_DEPS}
$(CXX) $(CXXFLAGS) -o $@ HELLOiMesh.o ${iMesh_LIBS}

.cpp.o:
${CXX} -c ${CXXFLAGS} ${iMesh_INCLUDES} $<