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:- iMesh_DIR: the path to the iMesh implementation root. Mostly for defining other variables. This could be the only variable that configure needs to touch?
- iMesh_LIBS: everything you need to link to this iMesh implementation, including both -L and -l args to the linker. This should specifically include any backend or auxiliary libraries.
- iMesh_INCLUDES: path for iMesh include files (including any trailing /iMesh, if needed. iMesh_DEPS: key files that, if changed, should cause the app to re-link. This may be more of an implementation developer convenience than anything else.
include ../../iMesh-Defs.inc
HELLOiMesh: HELLOiMesh.o ${iMesh_DEPS}
$(CXX) $(CXXFLAGS) -o $@ HELLOiMesh.o ${iMesh_LIBS}
.cpp.o:
${CXX} -c ${CXXFLAGS} ${iMesh_INCLUDES} $<