Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
UniformRefinement.cpp File Reference
#include <iostream>
#include "moab/Core.hpp"
#include "moab/NestedRefine.hpp"
+ Include dependency graph for UniformRefinement.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 8 of file UniformRefinement.cpp.

9 {
10  Core mb;
11  Interface* mbImpl = &mb;
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  // Usage: The level degrees array controls number of refinemetns and
26  // the degree of refinement at each level.
27  // Example: int level_degrees[4] = {2,3,2,3};
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 }

References moab::error(), ErrorCode, moab::NestedRefine::generate_mesh_hierarchy(), moab::Interface::load_file(), mb, MB_CHK_ERR, and moab::Interface::write_file().