26                                 {
   28 
   29  try {
   30 
   31    
   33    PetscBool flg_file = PETSC_FALSE;
   34    PetscOptionsBegin(PETSC_COMM_WORLD, "", "Field to vertices options",
   35                             "none");
   36    CHKERR PetscOptionsString(
"-my_file", 
"mesh file name", 
"", 
"mesh.h5m",
 
   38    PetscOptionsEnd();
   39 
   40    moab::Core mb_instance;
   41    moab::Interface &moab = mb_instance;
   42    ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, 
MYPCOMM_INDEX);
 
   43    if (pcomm == NULL)
   44      pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
   45    const char *option;
   46    option = "";
   48 
   49    
   51 
   52    if (flg_file != PETSC_TRUE) {
   54              "*** ERROR -my_file (MESH FILE NEEDED)");
   55    }
   56 
   57    Range all_tets, topo_nodes, mid_nodes;
 
   58    CHKERR moab.get_entities_by_type(0, MBTET, all_tets);
 
   59    CHKERR moab.get_connectivity(all_tets, topo_nodes, 
true);
 
   60    CHKERR moab.get_connectivity(all_tets, mid_nodes, 
false);
 
   61    std::cout << "\n Mesh contains of " << mid_nodes.size()
   62              << " nodes in total. ";
   63    mid_nodes = subtract(mid_nodes, topo_nodes);
   64    std::cout << mid_nodes.size() << " higher order nodes. \n";
   65 
   66    for (int dim : {1, 2, 3}) {
   68      CHKERR moab.create_meshset(MESHSET_SET, sub_meshset);
 
   70      CHKERR moab.get_entities_by_dimension(0, dim, edges, 
false);
 
   71      CHKERR moab.add_entities(sub_meshset, edges);
 
   72      CHKERR moab.convert_entities(sub_meshset, 
false, 
false,
 
   73                                   false );
   74    }
   75 
   77    CHKERR moab.get_entities_by_type(0, MBVERTEX, new_nodes);
 
   78    PetscPrintf(PETSC_COMM_WORLD, "New number of nodes: %d. \n",
   79                new_nodes.size());
   80    PetscPrintf(PETSC_COMM_WORLD, "Saving file out.h5m... \n");
   81 
   82    CHKERR moab.write_file(
"out.h5m");
 
   83  }
   85 
   87 
   88  return 0;
   89}
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERR
Inline error check.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.