Go to the documentation of this file. 1 #include <iostream>
2 #include <cassert>
3 #include "moab/Core.hpp"
4 #include "quads_to_tris.hpp"
5
6 using namespace moab;
7
8 #define MBI mb_instance()
9 static Interface* mb_instance();
10
11
12
13
14 int main( int argc, char** argv )
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
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
41
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 }
50 Interface* mb_instance()
51 {
52 static Core inst;
53 return &inst;
54 }