Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 /** @example GetEntities.cpp 00002 * Description: Get entities and report non-vertex entity connectivity and vertex adjacencies.\n 00003 * then delete edges, and write result 00004 * To run: ./DeleteEdges [meshfile] [outfile]\n 00005 */ 00006 00007 #include "moab/Core.hpp" 00008 #include "moab/Range.hpp" 00009 #include "moab/CN.hpp" 00010 #include <iostream> 00011 00012 using namespace moab; 00013 using namespace std; 00014 00015 #ifndef MESH_DIR 00016 #define MESH_DIR "." 00017 #endif 00018 00019 string test_file_name = string( MESH_DIR ) + string( "/hex01.vtk" ); 00020 string out_file = string( "outFile.h5m" ); 00021 00022 int main( int argc, char** argv ) 00023 { 00024 if( argc > 1 ) 00025 { 00026 // User has input a mesh file 00027 test_file_name = argv[1]; 00028 } 00029 if( argc > 2 ) 00030 { 00031 // User has specified an output file 00032 out_file = argv[2]; 00033 } 00034 00035 // Instantiate & load a mesh from a file 00036 Core* mb = new( std::nothrow ) Core; 00037 if( NULL == mb ) return 1; 00038 ErrorCode rval = mb->load_mesh( test_file_name.c_str() );MB_CHK_ERR( rval ); 00039 00040 Range edges; 00041 rval = mb->get_entities_by_dimension( 0, 1, edges );MB_CHK_ERR( rval ); 00042 rval = mb->delete_entities( edges );MB_CHK_ERR( rval ); 00043 00044 rval = mb->write_file( out_file.c_str() );MB_CHK_ERR( rval ); 00045 delete mb; 00046 00047 return 0; 00048 }