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

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.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file quads_to_tris_driver.cpp.

                                {

  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 47 of file quads_to_tris_driver.cpp.

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