コード例 #1
0
 def elm_iter(self):
     """
     :return: Yield elements of the sub-mesh.
     :rtype: collections.Iterable(afem.smesh.entities.Element)
     """
     iter_ = self._ds.GetElements()
     while iter_.more():
         yield Element(iter_.next())
コード例 #2
0
 def faces_iter(self):
     """
     :return: Yield faces of the mesh.
     :rtype: collections.Iterable(afem.smesh.entities.Element)
     """
     iter_ = self._ds.facesIterator(True)
     while iter_.more():
         yield Element(iter_.next())
コード例 #3
0
    def get_element(self, id_):
        """
        Get an element.

        :param int id_: The id of the element in the shape.

        :return: The element.
        :rtype: afem.smesh.entities.Element
        """
        return Element(self._ds.GetElement(id_))
コード例 #4
0
ファイル: utils.py プロジェクト: gitter-badger/AFEM
    def add_edge(self, n1, n2, id_=0, force3d=True):
        """
        Add an edge.

        :param afem.smesh.entities.Node n1: The first node.
        :param afem.smesh.entities.Node n2: The second node.
        :param int id_: The edge ID. If zero then the ID will be assigned.
        :param force3d: Unknown option.

        :return: The created edge.
        :rtype: afem.smesh.entities.Element
        """
        smesh_elm = self._helper.AddEdge(n1.object, n2.object, id_, force3d)
        return Element(smesh_elm)
コード例 #5
0
ファイル: utils.py プロジェクト: gitter-badger/AFEM
    def add_face(self, n1, n2, n3, n4=None, id_=0, force3d=False):
        """
        Add a face.

        :param afem.smesh.entities.Node n1: The first node.
        :param afem.smesh.entities.Node n2: The second node.
        :param afem.smesh.entities.Node n3: The third node.
        :param afem.smesh.entities.Node n4: The fourth node. If provided then
            the face will be a quadrangle, if not provided then the face is
            a triangle.
        :param int id_: The face ID. If zero then the ID will be assigned.
        :param force3d: Unknown option.

        :return: The created face.
        :rtype: afem.smesh.entities.Element
        """
        if n4 is None:
            smesh_elm = self._helper.AddFace(n1.object, n2.object, n3.object,
                                             id_, force3d)
        else:
            smesh_elm = self._helper.AddFace(n1.object, n2.object, n3.object,
                                             n4.object, id_, force3d)
        return Element(smesh_elm)