v0.14.0
Loading...
Searching...
No Matches
get_skin.cpp
Go to the documentation of this file.
1#include <MoFEM.hpp>
2
3using namespace MoFEM;
4
5static char help[] = "...\n\n";
6
7int main(int argc, char *argv[]) {
8 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
9
10 try {
11
12 moab::Core mb_instance;
13 moab::Interface &moab = mb_instance;
14 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
15 if (pcomm == NULL)
16 pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
17
18 // Create MoFEM database
19 MoFEM::Core core(moab);
20 MoFEM::Interface &m_field = core;
21
22 // global variables
23 char mesh_file_name[255] = "mesh.h5m";
24 char mesh_out_file[255] = "out.h5m";
25 int dim = 3;
26 PetscBool flg_file;
27
28 ierr = PetscOptionsBegin(PETSC_COMM_WORLD, "", "none", "none");
29 CHKERRQ(ierr);
30
31 CHKERR PetscOptionsString("-file_name", "mesh file name", "", "mesh.h5m",
32 mesh_file_name, 255, &flg_file);
33 CHKERR PetscOptionsString("-output_file", "output mesh file name", "",
34 mesh_out_file, mesh_out_file, 255, PETSC_NULL);
35 CHKERR PetscOptionsInt("-dim", "mesh dimension", "", dim, &dim, PETSC_NULL);
36
37
38 ierr = PetscOptionsEnd();
39 CHKERRQ(ierr);
40
41 if (flg_file != PETSC_TRUE)
42 SETERRQ(PETSC_COMM_SELF, 1,
43 "*** ERROR -my_file (-file_name) (MESH FILE NEEDED)");
44
45 MOFEM_LOG("WORLD", Sev::inform) << "In file " << mesh_file_name;
46 MOFEM_LOG("WORLD", Sev::inform) << "Out file " << mesh_out_file;
47 MOFEM_LOG("WORLD", Sev::inform) << "Mesh dimension " << dim;
48
49 const char *option;
50 option = "";
51 CHKERR moab.load_file(mesh_file_name, 0, option);
52
53 Range ents, skin;
54 CHKERR moab.get_entities_by_dimension(0, dim, ents);
55 MOFEM_LOG("WORLD", Sev::verbose) << "Ents:\n" << ents;
56
57 Skinner skinner(&moab);
58 CHKERR skinner.find_skin(0, ents, false, skin);
59 MOFEM_LOG("WORLD", Sev::verbose) << "Skin:\n" << skin;
60
61 EntityHandle set;
62 CHKERR moab.create_meshset(MESHSET_SET, set);
63 CHKERR moab.add_entities(set, skin);
64
65 CHKERR moab.write_file(mesh_out_file, "MOAB", "", &set, 1);
66 }
68
70
71 return 0;
72}
int main()
#define CATCH_ERRORS
Catch errors.
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHKERR
Inline error check.
static char help[]
Definition get_skin.cpp:5
#define MOFEM_LOG(channel, severity)
Log.
char mesh_file_name[255]
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
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:112
Deprecated interface functions.