Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
DeleteEdges.cpp
Go to the documentation of this file.
1 /** @example GetEntities.cpp
2  * Description: Get entities and report non-vertex entity connectivity and vertex adjacencies.\n
3  * then delete edges, and write result
4  * To run: ./DeleteEdges [meshfile] [outfile]\n
5  */
6 
7 #include "moab/Core.hpp"
8 #include "moab/Range.hpp"
9 #include "moab/CN.hpp"
10 #include <iostream>
11 
12 using namespace moab;
13 using namespace std;
14 
15 #ifndef MESH_DIR
16 #define MESH_DIR "."
17 #endif
18 
19 string test_file_name = string( MESH_DIR ) + string( "/hex01.vtk" );
20 string out_file = string( "outFile.h5m" );
21 
22 int main( int argc, char** argv )
23 {
24  if( argc > 1 )
25  {
26  // User has input a mesh file
27  test_file_name = argv[1];
28  }
29  if( argc > 2 )
30  {
31  // User has specified an output file
32  out_file = argv[2];
33  }
34 
35  // Instantiate & load a mesh from a file
36  Core* mb = new( std::nothrow ) Core;
37  if( NULL == mb ) return 1;
38  ErrorCode rval = mb->load_mesh( test_file_name.c_str() );MB_CHK_ERR( rval );
39 
40  Range edges;
41  rval = mb->get_entities_by_dimension( 0, 1, edges );MB_CHK_ERR( rval );
42  rval = mb->delete_entities( edges );MB_CHK_ERR( rval );
43 
44  rval = mb->write_file( out_file.c_str() );MB_CHK_ERR( rval );
45  delete mb;
46 
47  return 0;
48 }