def __init__(self, cell_type, mesh_dim, test): DataHandler.__init__(self) self.vertices, self.cells, self.functions = [], [], {} self.vertices_ended = self.cells_ended = self.closed = False self.__type, self.__dim = cell_type, mesh_dim self.__test = test test.assertEqual(self._state, self.State_Invalid) self.test_warnings = []
def start_vertices(self, num_vertices): DataHandler.start_vertices(self, num_vertices) self.vertices = [] for i in range(num_vertices): self.vertices.append(None)
def set_mesh_type(self, *args): DataHandler.set_mesh_type(self, *args) test = self.__test test.assertEqual(self._state, self.State_Init) test.assertEqual(self._cell_type, self.__type) test.assertEqual(self._dim, self.__dim)
def add_vertex(self, vertex, coords): DataHandler.add_vertex(self, vertex, coords) self.vertices[vertex] = tuple(coords)
def add_entity_meshfunction(self, index, value): DataHandler.add_entity_meshfunction(self, index, value) self.__curfunc[2][index] = value
def end_cells(self): DataHandler.end_cells(self) self.cells_ended = True
def start_cells(self, num_cells): DataHandler.start_cells(self, num_cells) for i in range(num_cells): self.cells.append(None)
def end_meshfunction(self): DataHandler.end_meshfunction(self) self.__curfunc[-1] = True
def start_meshfunction(self, name, dim, sz): DataHandler.start_meshfunction(self, name, dim, sz) entries = [] for i in range(sz): entries.append(None) self.__curfunc = self.functions[name] = [dim, sz, entries, False]
def add_cell(self, cell, nodes): DataHandler.add_cell(self, cell, nodes) self.cells[cell] = tuple(nodes)
def end_vertices(self): DataHandler.end_vertices(self) self.vertices_ended = True
def close(self): DataHandler.close(self) self.__test.assertEqual(self._state, self.State_Invalid) self.closed = True