54 {
55
56 const char param_file[] = "param_file.petsc";
58
59 try {
60
61 PetscBool flg = PETSC_FALSE;
63 if (flg == PETSC_TRUE)
65
68 255, &flg);
69 moab::Core mb_instance;
70 moab::Interface &moab = mb_instance;
71
72
73 if (flg) {
74 const char *option;
75 option = "";
77 }
78
79
82
83 auto add_last_twenty = [&]() {
87 mask.set(ll);
89 ->addToDatabaseBitRefLevelByType(MBTET, mask,
BitRefLevel().set());
91 };
92
93 auto add_first_four = [&]() {
96 for (int ll = 0; ll != 5; ++ll)
97 mask.set(ll);
99 ->addToDatabaseBitRefLevelByType(MBTET, mask,
BitRefLevel().set());
101 };
102
105
108 ->writeEntitiesAllBitLevelsByType(
BitRefLevel().set(), MBTET,
109 "all_start.vtk", "VTK", "");
110
111
114
118 ents);
119 if (!ents.empty()) {
121 CHKERR moab.create_meshset(MESHSET_SET, meshset);
122 CHKERR moab.add_entities(meshset, ents);
123 CHKERR moab.write_file(
"ents_not_in_database_to_delete.vtk",
"VTK",
"",
124 &meshset, 1);
125 CHKERR moab.delete_entities(&meshset, 1);
126
128 CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets,
false);
129 for (
auto m : meshsets)
130 CHKERR moab.remove_entities(
m, ents);
131 CHKERR moab.delete_entities(ents);
132 }
134 cp.crackAccelerationFactor,
"cutting_surface.vtk",
QUIET,
136
139 } else {
140
143 CHKERR cp.getInterface<
CPMeshCut>()->copySurface(
"cutting_surface.vtk");
145 CHKERR moab.get_entities_by_type(0, MBTET, vol,
false);
148 }
149
152
153 CHKERR moab.write_mesh(
"cut_mesh_out.h5m");
154
156 cp.mapBitLevel[
"mesh_cut"],
BitRefLevel().set(), MBTET,
157 "out_level0.vtk", "VTK", "");
159 cp.mapBitLevel[
"spatial_domain"],
BitRefLevel().set(), MBTET,
160 "out_level1_tets.vtk", "VTK", "");
162 cp.mapBitLevel[
"spatial_domain"],
BitRefLevel().set(), MBPRISM,
163 "out_level1_prisms.vtk", "VTK", "");
164
165 }
167
169
170 return 0;
171}
#define CATCH_ERRORS
Catch errors.
#define BITREFLEVEL_SIZE
max number of refinements
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
FTensor::Index< 'm', 3 > m
const std::string & getCutSurfMeshName() const
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.