diff --git a/utils/api_demos/CMakeLists.txt b/utils/api_demos/CMakeLists.txt index e89693a20f7e28531b12d1005887094a198b810e..97db72d7ce346335df436bb87a86eb1c25a8d54a 100644 --- a/utils/api_demos/CMakeLists.txt +++ b/utils/api_demos/CMakeLists.txt @@ -24,6 +24,9 @@ else(APPLE) set(glut "glut") endif(APPLE) +add_executable(mainVertexArray mainVertexArray.cpp) +target_link_libraries(mainVertexArray shared) + add_executable(mainAntTweakBar mainAntTweakBar.cpp) target_link_libraries(mainAntTweakBar shared AntTweakBar ${glut}) diff --git a/utils/api_demos/mainVertexArray.cpp b/utils/api_demos/mainVertexArray.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6468974f20abefc8c54c5e7cbe205e0c11e23bf --- /dev/null +++ b/utils/api_demos/mainVertexArray.cpp @@ -0,0 +1,31 @@ +#include <stdio.h> +#include "Gmsh.h" +#include "GModel.h" +#include "MElement.h" +#include "VertexArray.h" + +int main(int argc, char **argv) +{ + GmshInitialize(argc, argv); + GmshSetOption("Mesh", "Algorithm", 5.); + GmshSetOption("General", "Terminal", 1.); + + GModel *m = new GModel(); + m->readMSH("bunny.msh"); + m->fillVertexArrays(); + + std::vector<GEntity*> entities; + m->getEntities(entities); + + for(unsigned int i = 0; i < entities.size(); i++){ + GEntity *ge = entities[i]; + printf("coucou entite %d (dimension %d)\n", ge->tag(), ge->dim()); + if(ge->va_triangles) + printf(" j'ai un va de triangles: %d vertex\n", ge->va_triangles->getNumVertices()); + if(ge->va_lines) + printf(" j'ai un va de lignes: %d vertex\n", ge->va_lines->getNumVertices()); + } + + delete m; + GmshFinalize(); +}