Hi,

I'm trying to read in GMSH files using the API. I'm unable to figure out how to 
access the mesh data from GMSH class structures.

#include <iostream>
#include <cstdio>

#include "GModel.h"

using namespace std;

int main(int argc, char **argv){
        unsigned int i=0, ele=0, nodes=0;
        GModel *m = new GModel();
        m->readMSH("cv.msh");

        /*
        Is this necessary? As in, won't node numbers be always continuous? (no 
missing indices)
        */
        m->indexMeshVertices(true, 0, true);

        nodes = m->getNumMeshVertices();
        printf("No. of vertices \t%d\n", nodes);
        ele = m->getNumMeshElements();
        printf("No. of elements \t%d\n", ele); // this works.  prints the exact 
sum of all the elements

        m->writeMSH("test.msh");

        for(i=0; i<nodes; i++){
                printf("node loop to get coordinates");
        }

        for(i=0; i<ele; i++){
                printf("element loop to access all the elements and tag_ids");
        }

        delete m;
}


Many thanks

_______________________________________________
gmsh mailing list
[email protected]
http://onelab.info/mailman/listinfo/gmsh

Reply via email to