Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
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.

Macros

#define MBI   mb_instance()
 

Functions

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

Macro Definition Documentation

◆ MBI

#define MBI   mb_instance()

Definition at line 8 of file quads_to_tris_driver.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file quads_to_tris_driver.cpp.

15 {
16 
17  if( 2 > argc )
18  {
19  std::cout << "Need name of input file with quads." << std::endl;
20  return 0;
21  }
22 
23  // load file from input argument
24  ErrorCode result;
25  std::string filename = argv[1];
26  result = MBI->load_file( filename.c_str() );
27  if( MB_SUCCESS != result )
28  {
29  std::cout << "Error reading file." << std::endl;
30  return 1;
31  }
32 
33  result = quads_to_tris( MBI, 0 );
34  if( MB_SUCCESS != result )
35  {
36  std::cout << "Error converting to tris." << std::endl;
37  return 1;
38  }
39 
40  // Write the file that has been converted from quads to tris.
41  // Cut off the .h5m
42  int len1 = filename.length();
43  filename.erase( len1 - 4 );
44  std::string filename_new = filename + "_tris.h5m";
45  result = MBI->write_mesh( filename_new.c_str() );
46  assert( MB_SUCCESS == result );
47 
48  return 0;
49 }

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

◆ mb_instance()

Interface * mb_instance ( )
static

Definition at line 50 of file quads_to_tris_driver.cpp.

51 {
52  static Core inst;
53  return &inst;
54 }