Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
anonymous_namespace{UniformRefinement.cpp} Namespace Reference

Functions

void print_usage (const char *program_name)
 
std::vector< int > parse_refinement_levels (int argc, char *argv[])
 

Variables

constexpr const char * DEFAULT_OUTPUT_FILE = "mesh_hierarchy.h5m"
 
constexpr int DEFAULT_REFINEMENT_LEVELS = 2
 

Function Documentation

◆ parse_refinement_levels()

std::vector< int > anonymous_namespace{UniformRefinement.cpp}::parse_refinement_levels ( int  argc,
char *  argv[] 
)
Examples
UniformRefinement.cpp.

Definition at line 46 of file UniformRefinement.cpp.

47 {
48  std::vector< int > level_degrees;
49 
50  if( argc > 2 )
51  {
52  level_degrees.reserve( argc - 2 );
53  for( int i = 2; i < argc; ++i )
54  {
55  try
56  {
57  int degree = std::stoi( argv[i] );
58  if( degree < 1 )
59  {
60  throw std::invalid_argument( "Refinement degree must be at least 1" );
61  }
62  level_degrees.push_back( degree );
63  }
64  catch( const std::exception& e )
65  {
66  throw std::runtime_error( "Invalid refinement degree: " + std::string( e.what() ) );
67  }
68  }
69  }
70  else
71  {
72  // Default: two levels with default degrees
73  level_degrees.resize( DEFAULT_REFINEMENT_LEVELS );
74  }
75 
76  return level_degrees;
77 }

References DEFAULT_REFINEMENT_LEVELS.

Referenced by main().

◆ print_usage()

void anonymous_namespace{UniformRefinement.cpp}::print_usage ( const char *  program_name)
Examples
UniformRefinement.cpp.

Definition at line 37 of file UniformRefinement.cpp.

38 {
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"
42  << " If not specified, uses " << DEFAULT_REFINEMENT_LEVELS
43  << " levels with default degrees\n";
44 }

References DEFAULT_REFINEMENT_LEVELS.

Referenced by main().

Variable Documentation

◆ DEFAULT_OUTPUT_FILE

constexpr const char* anonymous_namespace{UniformRefinement.cpp}::DEFAULT_OUTPUT_FILE = "mesh_hierarchy.h5m"
constexpr
Examples
UniformRefinement.cpp.

Definition at line 34 of file UniformRefinement.cpp.

Referenced by main().

◆ DEFAULT_REFINEMENT_LEVELS

constexpr int anonymous_namespace{UniformRefinement.cpp}::DEFAULT_REFINEMENT_LEVELS = 2
constexpr
Examples
UniformRefinement.cpp.

Definition at line 35 of file UniformRefinement.cpp.

Referenced by parse_refinement_levels(), and print_usage().