Пример #1
0
 def add_faces(self):
     if utils.element_dimensions(self.interp) == 2:
         self.mesh.add_face(self.id, 0, self.node_ids)
     elif utils.element_dimensions(self.interp) == 3:
         face_nodes = core.element_face_nodes(self.interp, self.node_ids)
         for face_index in range(6):
             self.mesh.add_face(self.id, face_index, face_nodes[face_index])
Пример #2
0
 def add_face(self, element, face_index=0, nodes=None):
     '''
     Adds a face to the mesh, typically used to store element faces
     for graphics
     - basis: the intepolation functions in each dimension
         e.g., ['L2', 'H3']
     - nodes: the node indices for the face
     - face index: the face position on a cube, range [0:7]
     '''
     if nodes == None:
         nodes = core.element_face_nodes(elem.interp, elem.node_ids)[face_index]
     sorted_nodes = [n for n in nodes]
     sorted_nodes.sort()
     face_id = '_' + '_'.join([str(i) for i in sorted_nodes])
     if face_id not in self.faces:
         face = Face(self, face_id)
         self.faces.add(face)
     else:
         face = self.faces[face_id]
     face.add_element(element, face_index)
     return face