v0.15.0
Loading...
Searching...
No Matches
add_meshsets.cpp
Go to the documentation of this file.
1/** \file add_meshsets.cpp
2
3 \brief Add meshsets
4
5*/
6
7#include <MoFEM.hpp>
8using namespace MoFEM;
9
10static char help[] = "...\n\n";
11
12int main(int argc, char *argv[]) {
13 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
14
15 try {
16
17 moab::Core mb_instance;
18 moab::Interface &moab = mb_instance;
19
20 char mesh_file_name[255];
21 char mesh_out_file[255] = "out.h5m";
22 PetscBool flg_file = PETSC_FALSE;
23 PetscOptionsBegin(PETSC_COMM_WORLD, "", "none", "none");
24 CHKERR PetscOptionsString("-my_file", "mesh file name", "", "mesh.h5m",
25 mesh_file_name, 255, &flg_file);
26 CHKERR PetscOptionsString("-file_name", "mesh file name", "", "mesh.h5m",
27 mesh_file_name, 255, &flg_file);
28 CHKERR PetscOptionsString("-output_file", "output mesh file name", "",
29 "out.h5m", mesh_out_file, 255, PETSC_NULLPTR);
30 PetscOptionsEnd();
31
32 const char *option;
33 option = "";
34 CHKERR moab.load_file(mesh_file_name, 0, option);
35
36 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
37 if (pcomm == NULL)
38 pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
39
40 // Create MoFEM database
41 MoFEM::Core core(moab);
42 MoFEM::Interface &m_field = core;
43
44 CHKERR m_field.getInterface<MeshsetsManager>()->setMeshsetFromFile();
45
46 CHKERR moab.write_file(mesh_out_file);
47 }
49
51
52 return 0;
53}
static char help[]
int main()
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERR
Inline error check.
char mesh_file_name[255]
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
Core (interface) class.
Definition Core.hpp:82
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:72
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:118
Deprecated interface functions.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.