26int main(
int argc, 
char *argv[]) {
 
   33    PetscBool flg_file = PETSC_FALSE;
 
   34    PetscOptionsBegin(PETSC_COMM_WORLD, 
"", 
"Field to vertices options",
 
   36    CHKERR PetscOptionsString(
"-my_file", 
"mesh file name", 
"", 
"mesh.h5m",
 
   40    moab::Core mb_instance;
 
   41    moab::Interface &moab = mb_instance;
 
   42    ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, 
MYPCOMM_INDEX);
 
   44      pcomm = 
new ParallelComm(&moab, PETSC_COMM_WORLD);
 
   52    if (flg_file != PETSC_TRUE) {
 
   54              "*** ERROR -my_file (MESH FILE NEEDED)");
 
   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";
 
   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,
 
   77    CHKERR moab.get_entities_by_type(0, MBVERTEX, new_nodes);
 
   78    PetscPrintf(PETSC_COMM_WORLD, 
"New number of nodes: %d. \n",
 
   80    PetscPrintf(PETSC_COMM_WORLD, 
"Saving file out.h5m... \n");
 
   82    CHKERR moab.write_file(
"out.h5m");
 
 
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.