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 
main(int argc,char ** argv)22 int main(int argc, char **argv)
23 {
24   if (argc > 1) {
25     // User has input a mesh file
26     test_file_name = argv[1];
27   }
28   if (argc > 2) {
29     // User has specified an output file
30     out_file = argv[2];
31   }
32 
33   // Instantiate & load a mesh from a file
34   Core* mb = new (std::nothrow) Core;
35   if (NULL == mb)
36     return 1;
37   ErrorCode rval = mb->load_mesh(test_file_name.c_str());MB_CHK_ERR(rval);
38 
39   Range edges;
40   rval = mb->get_entities_by_dimension(0, 1, edges);MB_CHK_ERR(rval);
41   rval = mb->delete_entities(edges); MB_CHK_ERR(rval);
42 
43   rval = mb->write_file(out_file.c_str()); MB_CHK_ERR(rval);
44   delete mb;
45 
46   return 0;
47 }
48