Dear Umut, First, I think the pages 11/12 of the "Short User Documentation" will give you some useful functions to deal with mesh_regions. You may also want to take a look at the mesh class reference:
http://download.gna.org/getfem/doc/getfem_reference/classgetfem_1_1mesh.html As you will see, one mesh_region can carry two kinds of entities: convex numbers and/or convex faces. In the case of hexa meshes they are respectively the hexahedrons themselves and the quad faces, as you described. I think one way to create some mesh_region more or less the way you want would be (adapted from the stokes.cc example): Consider an unitary cubic domain aligned with x, y and z axis. Then lets define three regions: mesh_region 0 : all the hexahedrons. mesh_region 1 : faces with external normal aligned with the x axis pointing to the positive sense. mesh_region 2 : all other faces. 1) Make sure mesh_region=0,1,2 are free to be used: if(mymesh.has_region(0)) mymesh.sup_region(0); if(mymesh.has_region(1)) mymesh.sup_region(1); if(mymesh.has_region(2)) mymesh.sup_region(2); 2) Loop over all mesh convex (hexahedrons) and add each one to the mesh_region 0: for(dal::bv_visitor i(mymesh.convex_index()); !i.finished(); ++i){ mymesh.region(0).add(i); } 3) Create a dummy mesh_region and load it with all outer faces getfem::mesh_region border_faces; getfem::outer_faces_of_mesh(mymesh, border_faces); 4) Loop over all faces of the dummy mesh_region (border_faces) check the direction and sign of their normal vectors and add each one to the respective mes_region (1 or 2). for(getfem::mr_visitor it(border_faces); !it.finished(); ++it){ assert(it.is_face()); // just checking base_node un = mymesh.normal_of_face_of_convex(it.cv(), it.f()); un/= gmm::vect_norm2(un); if(gmm::abs(un[0] - 1.0)<1.0E-7){ // will be true if the normal is close enough to the x axis positive versor (î) mymesh.region(1).add(it.cv(), it.f()); } else{ mymesh.region(2).add(it.cv(), it.f()); } } Well, It is not tested and may have some mistakes... (I would be glad if other guys could take a look) Regards, Iago C. Barbeiro University of São Paulo - Brazil On Wed, Jul 15, 2009 at 12:31 PM, Umut Tabak <[email protected]> wrote: > Dear all, > > As a new, fresh user of getfem, I was looking for a way to be able to > identify different elements in a mesh(imported from Gmsh), and put these > elements in different mesh regions for boundary condition application. > Say, I am importing a simple mesh of a box structure and I would like to > put some specific elements in different regions, for instance the quad > elements on once of the faces of the volume will be in one region and > the hexahedral elements of the whole mesh will be in another region. I > guess I can put all the valid elements in my mesh in a vector defined by > using mymesh.convex_index(), by how to separate them depending on convex > types, is there a direct way to do this separation in getFem++. > > Thanks in advance. > > Umut > > _______________________________________________ > Getfem-users mailing list > [email protected] > https://mail.gna.org/listinfo/getfem-users >
_______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users
