Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
HelloMOAB.cpp File Reference
#include "moab/Core.hpp"
#include <iostream>
+ Include dependency graph for HelloMOAB.cpp:

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 17 of file HelloMOAB.cpp.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file HelloMOAB.cpp.

References ErrorCode, moab::Interface::get_entities_by_dimension(), moab::Interface::get_entities_by_type(), moab::Interface::load_mesh(), mb, MB_CHK_ERR, MBEDGE, MBVERTEX, moab::Range::size(), and test_file_name.

{
    // Get MOAB instance
    Interface* mb = new( std::nothrow ) Core;
    if( NULL == mb ) return 1;

    // 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 = mb->load_mesh( test_file_name.c_str() );MB_CHK_ERR( rval );

    // Get verts entities, by type
    Range verts;
    rval = mb->get_entities_by_type( 0, MBVERTEX, verts );MB_CHK_ERR( rval );

    // Get edge entities, by type
    Range edges;
    rval = mb->get_entities_by_type( 0, MBEDGE, edges );MB_CHK_ERR( rval );

    // Get faces, by dimension, so we stay generic to entity type
    Range faces;
    rval = mb->get_entities_by_dimension( 0, 2, faces );MB_CHK_ERR( rval );

    // Get regions, by dimension, so we stay generic to entity type
    Range elems;
    rval = mb->get_entities_by_dimension( 0, 3, elems );MB_CHK_ERR( rval );

    // 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 mb;

    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