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

Go to the source code of this file.

Defines

#define MBI   mb_instance()

Functions

static Interfacemb_instance ()
int main (int argc, char **argv)

Define Documentation

#define MBI   mb_instance()

Definition at line 8 of file quads_to_tris_driver.cpp.

Referenced by main().


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file quads_to_tris_driver.cpp.

References ErrorCode, MB_SUCCESS, MBI, and quads_to_tris().

{

    if( 2 > argc )
    {
        std::cout << "Need name of input file with quads." << std::endl;
        return 0;
    }

    // load file from input argument
    ErrorCode result;
    std::string filename = argv[1];
    result               = MBI->load_file( filename.c_str() );
    if( MB_SUCCESS != result )
    {
        std::cout << "Error reading file." << std::endl;
        return 1;
    }

    result = quads_to_tris( MBI, 0 );
    if( MB_SUCCESS != result )
    {
        std::cout << "Error converting to tris." << std::endl;
        return 1;
    }

    // Write the file that has been converted from quads to tris.
    // Cut off the .h5m
    int len1 = filename.length();
    filename.erase( len1 - 4 );
    std::string filename_new = filename + "_tris.h5m";
    result                   = MBI->write_mesh( filename_new.c_str() );
    assert( MB_SUCCESS == result );

    return 0;
}
Interface * mb_instance ( ) [static]

Definition at line 50 of file quads_to_tris_driver.cpp.

{
    static Core inst;
    return &inst;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines