Go to the documentation of this file. 1
2 #include <iostream>
3 #include "moab/Core.hpp"
4 #include "moab/NestedRefine.hpp"
5
6 using namespace moab;
7
8 int main( int argc, char* argv[] )
9 {
10 Core mb;
11 Interface* mbImpl = &mb;
12 ErrorCode error;
13
14 if( argc == 1 )
15 {
16 std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl;
17 return 1;
18 }
19
20 const char* filename = argv[1];
21 error = mbImpl->load_file( filename );MB_CHK_ERR( error );
22
23 NestedRefine uref( &mb );
24
25
26
27
28 std::vector< int > level_degrees;
29 if( argc > 2 )
30 {
31 level_degrees.resize( argc - 2 );
32 for( int i = 2; i < argc; ++i )
33 level_degrees[i - 2] = atoi( argv[i] );
34 }
35 else
36 {
37 level_degrees.resize( 2 );
38 }
39 int num_levels = static_cast< int >( level_degrees.size() );
40
41 std::cout << "Starting hierarchy generation" << std::endl;
42 std::vector< EntityHandle > set;
43 error = uref.generate_mesh_hierarchy( num_levels, level_degrees.data(), set );MB_CHK_ERR( error );
44 std::cout << "Finished hierarchy generation" << std::endl;
45
46 std::stringstream file;
47 file << "mesh_hierarchy.h5m";
48 error = mbImpl->write_file( file.str().c_str() );MB_CHK_ERR( error );
49 return 0;
50 }