Personal tools
You are here: Home Forum Use Get connectivies of group's edges

Get connectivies of group's edges

Up to Use
  • Get connectivies of group's edges

    Posted by ZIBOUCHE Kamel at March 23. 2006
    Hello !!

    I am writing a python module in SALOME in order to plug a Solver. In my test program I create a 2D mesh which contains  1D  elements (2 nodes  elems) on boundaries and  2D  cells  (triangles)  inside the domain, then  I create a group of edges  (SMESH::SMESH_Group)  to  get  some  boundary  edges needed by the solver. The edges of this group have the global element indices.  In my Salome module, i load the mesh in a MEDMEM object. The problem occurs when getting connetivities by the methode "getConnectivity(in medModeSwitch typeSwitch,
                        in medConnectivity mode,
                        in medEntityMesh entity,
                        in medGeometryElement geomElement)
    using MED_EDGE as medEntityMesh and MED_SEG2 as medGeometryElement. The connectivity array returned by this method contains all edges of the mesh even the internal edges that belong to the triangles. It follows that the indices of EdgeGroup don't correspond with connectivity table.
    I'd like to know how can i get the group edge connectivities.

    Thanks .
    • Re: Get connectivies of group's edges

      Posted by Edward AGAPOV at March 23. 2006

      Even though indices of edges contained in the group may change, these indices refer to edges with the same nodal connectivity. You can obtain nodes of edges in the group like this (note that this is not universal code, it should be a bit different for a group of all edges (group.isOnAllElements()))

      entity = MED_EDGE
      nodalConnect = mesh.getConnectivity (MED_FULL_INTERLACE,
      nodalConnectIndex = mesh.getConnectivityIndex (MED_NODAL,entity)

      group = mesh.getGroup(entity,1)
      types = group.getTypes()

      for type in types:
          # edge indices
          number = group.getNumber(type)
          nbNodeByElem = type % 100
          for elem in number:
              index = nodalConnectIndex[ elem - 1 ] - 1
              print "element", elem, nodalConnect[ index:index + nbNodeByElem]

      • Re: Get connectivies of group's edges

        Posted by ZIBOUCHE Kamel at March 24. 2006
        It works.
        Thanks Edward.
Powered by Ploneboard
Document Actions