Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
DeleteEdges.cpp File Reference
#include "moab/Core.hpp"
#include "moab/Range.hpp"
#include "moab/CN.hpp"
#include <iostream>
#include <memory>
+ Include dependency graph for DeleteEdges.cpp:

Go to the source code of this file.

Macros

#define MESH_DIR   "."
 

Functions

int main (int argc, char **argv)
 

Variables

string test_file_name = string( MESH_DIR ) + string( "/hex01.vtk" )
 
string out_file = string( "outFile.h5m" )
 

Macro Definition Documentation

◆ MESH_DIR

#define MESH_DIR   "."
Examples
DeleteEdges.cpp.

Definition at line 25 of file DeleteEdges.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)
Examples
DeleteEdges.cpp.

Definition at line 31 of file DeleteEdges.cpp.

32 {
33  if( argc == 1 )
34  {
35  std::cout << "Usage: " << argv[0] << " [meshfile] [outfile]\n";
36  return 0;
37  }
38  std::string mesh_file = ( argc > 1 ) ? argv[1] : std::string( MESH_DIR ) + "/hex01.vtk";
39  std::string out_file = ( argc > 2 ) ? argv[2] : "outFile.h5m";
40 
41  auto mb = std::make_unique< Core >();
42  if( !mb )
43  {
44  std::cerr << "Error: Could not allocate MOAB Core instance.\n";
45  return 1;
46  }
47  if( MB_SUCCESS != mb->load_mesh( mesh_file.c_str() ) )
48  {
49  std::cerr << "Error: Could not load mesh file '" << mesh_file << "'\n";
50  return 1;
51  }
52 
53  Range edges;
54  MB_CHK_ERR( mb->get_entities_by_dimension( 0, 1, edges ) );
55  MB_CHK_ERR( mb->delete_entities( edges ) );
56 
57  MB_CHK_SET_ERR( mb->write_file( out_file.c_str() ), "Error: Could not write output mesh file '" + out_file + "'" );
58  std::cout << "Deleted " << edges.size() << " edges. Output written to '" << out_file << "'.\n";
59  return 0;
60 }

References moab::Core::delete_entities(), moab::Core::get_entities_by_dimension(), moab::Core::load_mesh(), mb, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, MESH_DIR, out_file, moab::Range::size(), and moab::Core::write_file().

Variable Documentation

◆ out_file

string out_file = string( "outFile.h5m" )
Examples
DeleteEdges.cpp, and ReadPartFile.cpp.

Definition at line 29 of file DeleteEdges.cpp.

Referenced by main().

◆ test_file_name

string test_file_name = string( MESH_DIR ) + string( "/hex01.vtk" )
Examples
DeleteEdges.cpp.

Definition at line 28 of file DeleteEdges.cpp.