39 std::cout <<
"Usage: " << program_name <<
" filename [level1_degree level2_degree ...]\n"
40 <<
" filename - Path to the input mesh file\n"
41 <<
" levelN_degree - (Optional) Degree of refinement for each level\n"
43 <<
" levels with default degrees\n";
48 std::vector< int > level_degrees;
52 level_degrees.reserve( argc - 2 );
53 for(
int i = 2; i < argc; ++i )
57 int degree = std::stoi( argv[i] );
60 throw std::invalid_argument(
"Refinement degree must be at least 1" );
62 level_degrees.push_back( degree );
64 catch(
const std::exception& e )
66 throw std::runtime_error(
"Invalid refinement degree: " + std::string( e.what() ) );
80 int main(
int argc,
char* argv[] )
85 if( argc < 2 || std::string( argv[1] ) ==
"--help" || std::string( argv[1] ) ==
"-h" )
88 return argc < 2 ? 1 : 0;
93 const int num_levels =
static_cast< int >( level_degrees.size() );
95 std::cout <<
"Input file: " <<
input_file <<
"\n"
96 <<
"Refinement levels: " << num_levels <<
"\n"
99 for(
const auto& degree : level_degrees )
101 std::cout << degree <<
" ";
106 auto moab = std::make_unique< Core >();
109 throw std::runtime_error(
"Failed to create MOAB instance" );
118 std::vector< EntityHandle > mesh_sets;
119 std::cout <<
"Starting mesh hierarchy generation for " << num_levels <<
" levels...\n";
122 "Failed to generate mesh hierarchy" );
123 std::cout <<
"Successfully generated mesh hierarchy\n";
132 catch(
const std::exception& e )
134 std::cerr <<
"\nError: " << e.what() <<
"\n";
139 std::cerr <<
"\nError: Unknown exception occurred\n";