23 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
26 PetscBool flg = PETSC_TRUE;
28 #if PETSC_VERSION_GE(3, 6, 4)
35 if (flg != PETSC_TRUE) {
36 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
54 CHKERR moab.get_entities_by_type(0, MBVERTEX, nodes,
false);
55 CHKERR moab.get_entities_by_type(0, MBTET, tets,
false);
59 std::map<EntityHandle, unsigned long> moab_tetgen_map;
60 std::map<unsigned long, EntityHandle> tetgen_moab_map;
67 CHKERR tetgen_iface->
inData(nodes, in, moab_tetgen_map, tetgen_moab_map);
68 std::map<int, Range> types_ents;
69 types_ents[TetGenInterface::RIDGEVERTEX].merge(nodes);
79 CHKERR tetgen_iface->
outData(in, out, moab_tetgen_map, tetgen_moab_map,
80 bit_level1,
false,
true);
84 CHKERR moab.create_meshset(MESHSET_SET, meshset_level1);
86 bit_level1,
BitRefLevel().set(), MBTET, meshset_level1);
88 CHKERR moab.write_file(
"level1.vtk",
"VTK",
"", &meshset_level1, 1);
98 moab_tetgen_map.clear();
99 tetgen_moab_map.clear();
103 Range outer_surface_skin;
104 CHKERR skin.find_skin(0, tets,
false, outer_surface_skin);
107 CHKERR tetgen_iface->
inData(nodes, in, moab_tetgen_map, tetgen_moab_map);
109 Range side_set_faces;
112 CHKERR moab.get_entities_by_type(sit->meshset, MBTRI, faces,
true);
113 side_set_faces.merge(faces);
116 outer_surface_skin = subtract(outer_surface_skin, side_set_faces);
117 std::vector<std::vector<Range>> sorted_outer_surface_skin;
118 int nb_ents = outer_surface_skin.size();
121 sorted_outer_surface_skin, 1e-10);
123 std::cout <<
" number of triangle entities " << nb_ents
124 <<
" number of faces disjoint regions "
125 << sorted_outer_surface_skin.size() << std::endl;
126 for (
unsigned int vv = 0; vv < sorted_outer_surface_skin.size(); vv++) {
127 std::cout <<
"\tnb of disjoint region " << vv
128 <<
" nb of no-planar subregions "
129 << sorted_outer_surface_skin[vv].size() << std::endl;
130 for (
unsigned int vvv = 0; vvv < sorted_outer_surface_skin[vv].size();
132 std::cout <<
"\t\tnb. of subregion " << vvv
133 <<
" nb. elements in subregion "
134 << sorted_outer_surface_skin[vv][vvv].size() << std::endl;
139 std::vector<std::pair<Range, int>>
141 std::vector<std::vector<Range>>::iterator vit =
142 sorted_outer_surface_skin.begin();
143 for (; vit != sorted_outer_surface_skin.end(); vit++) {
144 std::vector<Range>::iterator viit = vit->begin();
145 for (; viit != vit->end(); viit++) {
149 CHKERR moab.get_connectivity(*viit, aa,
true);
151 CHKERR m_field.
get_moab().get_adjacencies(*viit, 1,
false, viit_edges,
152 moab::Interface::UNION);
155 CHKERR moab.get_entities_by_type(sit->meshset, MBTRI, faces,
true);
158 faces, 1,
false, faces_edges, moab::Interface::UNION);
159 aa.merge(intersect(faces_edges, viit_edges));
161 markers.push_back(std::pair<Range, int>(unite(polygons, aa), -1));
168 int id = sit->getMeshsetId();
170 CHKERR moab.get_entities_by_type(sit->meshset, MBTRI, faces,
true);
171 markers.push_back(std::pair<Range, int>(faces,
id));
179 std::vector<std::pair<EntityHandle, int>> regions;
181 int id =
bit->getMeshsetId();
183 CHKERR moab.get_entities_by_type(
bit->meshset, MBTET, tets,
true);
184 regions.push_back(std::pair<EntityHandle, int>(*tets.begin(), -
id));
191 char tetgen_in_file_name[] =
"in";
192 in.save_nodes(tetgen_in_file_name);
193 in.save_elements(tetgen_in_file_name);
194 in.save_faces(tetgen_in_file_name);
195 in.save_edges(tetgen_in_file_name);
196 in.save_poly(tetgen_in_file_name);
200 char switches2[] =
"pYA";
206 CHKERR tetgen_iface->
outData(in, out, moab_tetgen_map, tetgen_moab_map,
207 bit_level2,
false,
true);
218 CHKERR moab.create_meshset(MESHSET_SET, meshset_level2);
220 bit_level2,
BitRefLevel().set(), MBTET, meshset_level2);
222 CHKERR moab.write_file(
"level2.vtk",
"VTK",
"", &meshset_level2, 1);
224 CHKERR moab.create_meshset(MESHSET_SET, meshset_skin_level2);
226 bit_level2,
BitRefLevel().set(), MBTRI, meshset_skin_level2);
228 CHKERR moab.write_file(
"level_skin2.vtk",
"VTK",
"", &meshset_skin_level2,