11 using namespace MoFEM;
13 static char help[] =
"teting interface inserting algorithm\n\n";
17 int main(
int argc,
char *argv[]) {
23 PetscBool flg = PETSC_TRUE;
25 #if PETSC_VERSION_GE(3, 6, 4)
32 if (flg != PETSC_TRUE) {
34 "*** ERROR -my_file (MESH FILE NEEDED)");
51 std::vector<BitRefLevel> bit_levels;
56 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"Insert Interface %d\n",
62 CHKERR moab.create_meshset(MESHSET_SET, ref_level_meshset);
64 ->getEntitiesByTypeAndRefLevel(bit_levels.back(),
68 ->getEntitiesByTypeAndRefLevel(bit_levels.back(),
72 CHKERR moab.get_entities_by_handle(ref_level_meshset, ref_level_tets,
75 CHKERR interface->
getSides(cubit_meshset, bit_levels.back(),
true, 0);
80 cubit_meshset,
true,
true, 0);
82 CHKERR moab.delete_entities(&ref_level_meshset, 1);
88 ->updateMeshsetByEntitiesChildren(cubit_meshset, bit_levels.back(),
89 cubit_meshset, MBMAXTYPE,
true);
129 for (
int lll = ll - 2; lll < ll; lll++) {
130 std::stringstream problem_name;
131 problem_name <<
"PROBLEM_SCALAR_" << lll;
141 for (
int lll = ll - 2; lll < ll; lll++) {
142 std::stringstream problem_name;
143 problem_name <<
"PROBLEM_SCALAR_" << lll;
144 std::stringstream message;
145 message <<
"set problem problem < " << problem_name.str()
146 <<
" > bit level " << bit_levels[lll] << std::endl;
147 CHKERR PetscPrintf(PETSC_COMM_WORLD, message.str().c_str());
162 Range tets_back_bit_level;
164 bit_levels.back(),
BitRefLevel().set(), tets_back_bit_level);
171 CHKERR cit->getAttributeDataStructure(mydata);
172 std::cout << mydata << std::endl;
175 CHKERR moab.get_entities_by_type(cubit_meshset, MBTET, tets,
true);
176 tets = intersect(tets_back_bit_level, tets);
178 CHKERR moab.get_connectivity(tets, nodes,
true);
180 for (Range::iterator nit = nodes.begin(); nit != nodes.end(); nit++) {
182 CHKERR moab.get_coords(&*nit, 1, coords);
183 coords[0] += mydata.
data.User1;
184 coords[1] += mydata.
data.User2;
185 coords[2] += mydata.
data.User3;
186 CHKERR moab.set_coords(&*nit, 1, coords);
194 for (
int lll = ll - 2; lll < ll; lll++) {
196 std::stringstream problem_name;
197 problem_name <<
"PROBLEM_SCALAR_" << lll;
204 std::ofstream myfile;
208 CHKERR moab.create_meshset(MESHSET_SET, out_meshset_tet);
211 bit_levels.back(),
BitRefLevel().set(), MBTET, out_meshset_tet);
213 CHKERR moab.get_entities_by_handle(out_meshset_tet, tets,
true);
214 for (Range::iterator tit = tets.begin(); tit != tets.end(); tit++) {
217 CHKERR moab.get_connectivity(*tit, conn, num_nodes,
true);
219 for (
int nn = 0; nn < num_nodes; nn++) {
220 std::cout << conn[nn] <<
" ";
221 myfile << conn[nn] <<
" ";
223 std::cout << std::endl;
227 CHKERR moab.create_meshset(MESHSET_SET, out_meshset_prism);
229 bit_levels.back(),
BitRefLevel().set(), MBPRISM, out_meshset_prism);
231 CHKERR moab.get_entities_by_handle(out_meshset_prism, prisms);
232 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
235 CHKERR moab.get_connectivity(*pit, conn, num_nodes,
true);
237 for (
int nn = 0; nn < num_nodes; nn++) {
238 std::cout << conn[nn] <<
" ";
239 myfile << conn[nn] <<
" ";
241 std::cout << std::endl;
247 CHKERR moab.write_file(
"out_tet.vtk",
"VTK",
"", &out_meshset_tet, 1);
248 CHKERR moab.write_file(
"out_prism.vtk",
"VTK",
"", &out_meshset_prism, 1);
251 CHKERR moab.create_meshset(MESHSET_SET, out_meshset_tets_and_prism);
252 CHKERR moab.add_entities(out_meshset_tets_and_prism, tets);
253 CHKERR moab.add_entities(out_meshset_tets_and_prism, prisms);
254 CHKERR moab.write_file(
"out_tets_and_prisms.vtk",
"VTK",
"",
255 &out_meshset_tets_and_prism, 1);
258 CHKERR moab.create_meshset(MESHSET_SET, out_meshset_tris);
260 CHKERR moab.get_adjacencies(prisms, 2,
false, tris,
261 moab::Interface::UNION);
262 std::cerr << tris.size() <<
" : " << prisms.size() << std::endl;
263 CHKERR moab.add_entities(out_meshset_tris, tris);
264 CHKERR moab.write_file(
"out_tris.vtk",
"VTK",
"", &out_meshset_tris, 1);