moab
HelloMOAB.cpp File Reference
#include "moab/Core.hpp"
#include <iostream>
#include <assert.h>

Go to the source code of this file.

Defines

#define MESH_DIR   "."

Functions

int main (int argc, char **argv)

Variables

string test_file_name = string(MESH_DIR) + string("/3k-tri-sphere.vtk")

Define Documentation

#define MESH_DIR   "."

Definition at line 18 of file HelloMOAB.cpp.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file HelloMOAB.cpp.

{
  Interface *iface = new Core;

    // need option handling here for input filename
  if (argc > 1){
    //user has input a mesh file
    test_file_name = argv[1];
  }  
    //load the mesh from vtk file
  ErrorCode rval = iface->load_mesh( test_file_name.c_str() );
  assert(rval == MB_SUCCESS);

    // get verts entities, by type
  Range verts;
  rval = iface->get_entities_by_type(0, MBVERTEX, verts);
  assert(rval == MB_SUCCESS);
    //get edge entities, by type
  Range edges;
  rval = iface->get_entities_by_type(0, MBEDGE, edges);
  assert(rval == MB_SUCCESS);

    // get faces, by dimension, so we stay generic to entity type
  Range faces;
  rval = iface->get_entities_by_dimension(0, 2, faces);
  assert(rval == MB_SUCCESS);

    //get regions, by dimension, so we stay generic to entity type
  Range elems;
  rval = iface->get_entities_by_dimension(0, 3, elems);
  assert(rval == MB_SUCCESS);

   //output the number of entities
  cout << "Number of vertices is " << verts.size() <<  endl;
  cout << "Number of edges is " << edges.size() <<  endl;
  cout << "Number of faces is " << faces.size() <<  endl;
  cout << "Number of elements is " << elems.size() <<  endl;

  delete iface;

  return 0;
}

Variable Documentation

string test_file_name = string(MESH_DIR) + string("/3k-tri-sphere.vtk")

Definition at line 21 of file HelloMOAB.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines