14 {
16
17 try {
18
19
20 char mesh_file_name[255];
21 PetscBool flg_file = PETSC_FALSE;
22 char field_name_param[255] = "RHO";
23 PetscOptionsBegin(PETSC_COMM_WORLD, "", "Field to vertices options",
24 "none");
25 CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
26 mesh_file_name, 255, &flg_file);
27 CHKERR PetscOptionsString(
"-my_field",
"field name",
"",
"FIELD",
28 field_name_param, 255, PETSC_NULLPTR);
29 PetscOptionsEnd();
30
32
33 moab::Core mb_instance;
34 moab::Interface &moab = mb_instance;
35 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
36 if (pcomm == NULL)
37 pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
38 const char *option;
39 option = "";
40 CHKERR moab.load_file(mesh_file_name, 0, option);
41
42
45
46 if (flg_file != PETSC_TRUE) {
48 "*** ERROR -my_file (MESH FILE NEEDED)");
49 }
51 bit_level0.set(0);
53 0, 3, bit_level0);
55
56 bool field_flg = false;
58 for (auto field : (*fields_ptr)) {
59 bool check_space = field->getSpace() ==
H1;
60 if (field->getName() ==
field_name && check_space)
61 field_flg = true;
62 }
63 if (!field_flg) {
65 "*** ERROR -my_field (FIELD (in H1 space) is NOT FOUND)");
66 }
67
70
72 PetscPrintf(PETSC_COMM_WORLD, "\nDone. Saving files... \n");
73
74
76 bit_level0,
BitRefLevel().set(), MBTET,
"out_mesh.vtk",
"VTK",
"");
77 CHKERR moab.write_file(
"out.h5m");
78 }
80
82
83 return 0;
84}
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERR
Inline error check.
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
constexpr auto field_name
Save field DOFS on vertices/tags.
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.
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.