11 using namespace MoFEM;
24 static char help[] =
"...\n\n";
26 int main(
int argc,
char *argv[]) {
33 PetscBool flg_file = PETSC_FALSE;
34 CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Field to vertices options",
36 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
38 ierr = PetscOptionsEnd();
43 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
45 pcomm =
new ParallelComm(&moab, PETSC_COMM_WORLD);
53 if (flg_file != PETSC_TRUE) {
55 "*** ERROR -my_file (MESH FILE NEEDED)");
58 Range all_tets, topo_nodes, mid_nodes;
59 CHKERR moab.get_entities_by_type(0, MBTET, all_tets);
60 CHKERR moab.get_connectivity(all_tets, topo_nodes,
true);
61 CHKERR moab.get_connectivity(all_tets, mid_nodes,
false);
62 std::cout <<
"\n Mesh contains of " << mid_nodes.size()
63 <<
" nodes in total. ";
64 mid_nodes = subtract(mid_nodes, topo_nodes);
65 std::cout << mid_nodes.size() <<
" higher order nodes. \n";
67 for (
int dim : {1, 2, 3}) {
69 CHKERR moab.create_meshset(MESHSET_SET, sub_meshset);
71 CHKERR moab.get_entities_by_dimension(0, dim, edges,
false);
72 CHKERR moab.add_entities(sub_meshset, edges);
73 CHKERR moab.convert_entities(sub_meshset,
false,
false,
78 CHKERR moab.get_entities_by_type(0, MBVERTEX, new_nodes);
79 PetscPrintf(PETSC_COMM_WORLD,
"New number of nodes: %d. \n",
81 PetscPrintf(PETSC_COMM_WORLD,
"Saving file out.h5m... \n");
83 CHKERR moab.write_file(
"out.h5m");