Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
UniformRefinement.cpp
Go to the documentation of this file.
00001 /*This unit test is for the uniform refinement capability based on AHF datastructures*/
00002 #include <iostream>
00003 #include "moab/Core.hpp"
00004 #include "moab/NestedRefine.hpp"
00005 
00006 using namespace moab;
00007 
00008 int main( int argc, char* argv[] )
00009 {
00010     Core mb;
00011     Interface* mbImpl = &mb;
00012     ErrorCode error;
00013 
00014     if( argc == 1 )
00015     {
00016         std::cerr << "Usage: " << argv[0] << " [filename]" << std::endl;
00017         return 1;
00018     }
00019 
00020     const char* filename = argv[1];
00021     error                = mbImpl->load_file( filename );MB_CHK_ERR( error );
00022 
00023     NestedRefine uref( &mb );
00024 
00025     // Usage: The level degrees array controls number of refinemetns and
00026     // the degree of refinement at each level.
00027     // Example: int level_degrees[4] = {2,3,2,3};
00028     std::vector< int > level_degrees;
00029     if( argc > 2 )
00030     {
00031         level_degrees.resize( argc - 2 );
00032         for( int i = 2; i < argc; ++i )
00033             level_degrees[i - 2] = atoi( argv[i] );
00034     }
00035     else
00036     {
00037         level_degrees.resize( 2 );
00038     }
00039     int num_levels = static_cast< int >( level_degrees.size() );
00040 
00041     std::cout << "Starting hierarchy generation" << std::endl;
00042     std::vector< EntityHandle > set;
00043     error = uref.generate_mesh_hierarchy( num_levels, level_degrees.data(), set );MB_CHK_ERR( error );
00044     std::cout << "Finished hierarchy generation" << std::endl;
00045 
00046     std::stringstream file;
00047     file << "mesh_hierarchy.h5m";
00048     error = mbImpl->write_file( file.str().c_str() );MB_CHK_ERR( error );
00049     return 0;
00050 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines