static char help[] =
"mesh cutting\n\n";
int main(
int argc,
char *argv[]) {
try {
int surface_side_set = 200;
PetscBool flg_vol_block_set;
int vol_block_set = 1;
PetscBool flg_shift;
double shift[] = {0, 0, 0};
int nmax = 3;
int fraction_level = 2;
PetscBool squash_bits = PETSC_TRUE;
PetscBool set_coords = PETSC_TRUE;
int create_surface_side_set = 201;
PetscBool flg_create_surface_side_set;
int nb_ref_cut = 0;
int nb_ref_trim = 0;
PetscBool flg_tol;
double tol[] = {1e-2, 2e-1, 2e-1};
int nmax_tol = 3;
PetscBool
debug = PETSC_FALSE;
CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Mesh cut options",
"none");
CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
CHKERR PetscOptionsInt(
"-surface_side_set",
"surface side set",
"",
surface_side_set, &surface_side_set, PETSC_NULL);
CHKERR PetscOptionsInt(
"-vol_block_set",
"volume side set",
"",
vol_block_set, &vol_block_set, &flg_vol_block_set);
CHKERR PetscOptionsInt(
"-edges_block_set",
"edges block set",
"",
CHKERR PetscOptionsInt(
"-vertex_block_set",
"vertex block set",
"",
CHKERR PetscOptionsRealArray(
"-shift",
"shift surface by vector",
"", shift,
&nmax, &flg_shift);
CHKERR PetscOptionsInt(
"-fraction_level",
"fraction of merges merged",
"",
fraction_level, &fraction_level, PETSC_NULL);
CHKERR PetscOptionsBool(
"-squash_bits",
"true to squash bits at the end",
"", squash_bits, &squash_bits, PETSC_NULL);
CHKERR PetscOptionsBool(
"-set_coords",
"true to set coords at the end",
"",
set_coords, &set_coords, PETSC_NULL);
CHKERR PetscOptionsBool(
"-output_vtk",
"if true outout vtk file",
"",
CHKERR PetscOptionsInt(
"-create_side_set",
"crete side set",
"",
create_surface_side_set, &create_surface_side_set,
&flg_create_surface_side_set);
CHKERR PetscOptionsInt(
"-nb_ref_cut",
"nb refinements befor cut",
"",
nb_ref_cut, &nb_ref_cut, PETSC_NULL);
CHKERR PetscOptionsInt(
"-nb_ref_trim",
"nb refinements befor trim",
"",
nb_ref_trim, &nb_ref_trim, PETSC_NULL);
"-tol", "tolerances tolCut, tolCutClose, tolTrim, tolTrimClose", "",
tol, &nmax_tol, &flg_tol);
CHKERR PetscOptionsBool(
"-debug",
"debug (produces many VTK files)",
"",
ierr = PetscOptionsEnd();
"*** ERROR -my_file (MESH FILE NEEDED)");
}
if (flg_shift && nmax != 3) {
}
if (flg_tol && nmax_tol != 3)
ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
if (pcomm == NULL)
pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
const char *option;
option = "";
cout << *it << endl;
}
else
"Side set not found %d", surface_side_set);
Range fixed_edges, corner_nodes;
1, fixed_edges, true);
1, fixed_edges, true);
if (flg_vol_block_set) {
3, tets, true);
else
"Block set %d not found", vol_block_set);
} else
CHKERR moab.get_entities_by_dimension(0, 3, tets,
false);
auto shift_after_ref = [&]() {
mask.set(0);
for (int ll = 1; ll != nb_ref_cut + nb_ref_trim + 1; ++ll)
mask.set(ll);
nb_ref_cut + nb_ref_trim, mask,
VERBOSE);
};
double def_position[] = {0, 0, 0};
CHKERR moab.tag_get_handle(
"POSITION", 3, MB_TYPE_DOUBLE,
th,
MB_TAG_CREAT | MB_TAG_SPARSE, def_position);
int first_bit = 1;
tol[1],
tol[2], fixed_edges, corner_nodes,
true, false);
if (set_coords)
if (flg_vol_block_set) {
}
if (squash_bits) {
for (int ll = 0; ll != first_bit; ++ll)
shift_mask.set(ll);
first_bit - 1, shift_mask,
VERBOSE);
}
moab::Interface::UNION);
CHKERR moab.delete_entities(surface_edges);
CHKERR moab.delete_entities(surface_verts);
if (flg_create_surface_side_set) {
else
"Warring >>> sideset %d is on the mesh",
create_surface_side_set);
}
CHKERR moab.write_file(
"out.h5m");
CHKERR moab.create_meshset(MESHSET_SET, meshset);
if (flg_vol_block_set) {
ents, true);
CHKERR moab.add_entities(meshset, ents);
} else {
}
CHKERR moab.write_file(
"out.vtk",
"VTK",
"", &meshset, 1);
CHKERR moab.delete_entities(&meshset, 1);
}
}
return 0;
}