static char help[] =
"...\n\n";
int main(
int argc,
char *argv[]) {
try {
PetscBool flg_file = PETSC_FALSE;
CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Field to vertices options",
"none");
CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
ierr = PetscOptionsEnd();
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
if (pcomm == NULL)
pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
const char *option;
option = "";
if (flg_file != PETSC_TRUE) {
"*** ERROR -my_file (MESH FILE NEEDED)");
}
Range all_tets, topo_nodes, mid_nodes;
CHKERR moab.get_entities_by_type(0, MBTET, all_tets);
CHKERR moab.get_connectivity(all_tets, topo_nodes,
true);
CHKERR moab.get_connectivity(all_tets, mid_nodes,
false);
std::cout << "\n Mesh contains of " << mid_nodes.size()
<< " nodes in total. ";
mid_nodes = subtract(mid_nodes, topo_nodes);
std::cout << mid_nodes.size() << " higher order nodes. \n";
for (
int dim : {1, 2, 3}) {
CHKERR moab.create_meshset(MESHSET_SET, sub_meshset);
CHKERR moab.get_entities_by_dimension(0,
dim, edges,
false);
CHKERR moab.add_entities(sub_meshset, edges);
CHKERR moab.convert_entities(sub_meshset,
false,
false,
false );
}
CHKERR moab.get_entities_by_type(0, MBVERTEX, new_nodes);
PetscPrintf(PETSC_COMM_WORLD, "New number of nodes: %d. \n",
new_nodes.size());
PetscPrintf(PETSC_COMM_WORLD, "Saving file out.h5m... \n");
CHKERR moab.write_file(
"out.h5m");
}
return 0;
}
static PetscErrorCode ierr
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define CHKERR
Inline error check.
implementation of Data Operators for Forces and Sources
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.