def __init__(self, fig, dmp, options): # Connect handler to self DofMapHandler.__init__(self, dmp, options) fig.canvas.mpl_connect('key_press_event', self) mesh = self.mesh self.gdim = mesh.geometry().dim() self.tdim = mesh.topology().dim() # Make sure we have global indicies for all mesh entities for tdim in range(self.tdim+1): dmt_number_entities(mesh, tdim) # Get axes based on 2d or 3d self.fig = fig self.axes = fig.gca(projection='3d') if self.gdim > 2 else fig.gca() # Labels and plotting flags for mesh entities of topological # dimension 0, 1, 2, 3 self.mesh_entity_labels = {i: {} for i in range(4)} self.showing_all_mesh_entities = {i: False for i in range(4)} # Color for plotting enties cmap = get_cmap(options['colors']['mesh_entities']) N = cmap.N self.mesh_entity_colors = {i: cmap(i**2*N/10) for i in range(4)}
def __init__(self, fig, dmp, options): # Connect handler to self DofMapHandler.__init__(self, dmp, options) fig.canvas.mpl_connect('key_press_event', self) mesh = self.mesh self.gdim = mesh.geometry().dim() self.tdim = mesh.topology().dim() # Make sure we have global indicies for all mesh entities for tdim in range(self.tdim + 1): dmt_number_entities(mesh, tdim) # Get axes based on 2d or 3d self.fig = fig self.axes = fig.gca(projection='3d') if self.gdim > 2 else fig.gca() # Labels and plotting flags for mesh entities of topological # dimension 0, 1, 2, 3 self.mesh_entity_labels = {i: {} for i in range(4)} self.showing_all_mesh_entities = {i: False for i in range(4)} # Color for plotting enties cmap = get_cmap(options['colors']['mesh_entities']) N = cmap.N self.mesh_entity_colors = {i: cmap(i**2 * N / 10) for i in range(4)}
def __init__(self, fig, dmp, options): # Connect figure to self DofMapHandler.__init__(self, dmp, options) fig.canvas.mpl_connect('key_press_event', self) # Get axes based on 2d or 3d gdim = self.mesh.geometry().dim() ax = fig.gca(projection='3d') if gdim > 2 else fig.gca() self.axes = ax self.fig = fig # Get the markersize self.markersize = options['markersize'] if not options['xkcd'] else 0 # See which dofmaps will be plotted and which subspaces are used self.component = options['component'] self.dofmaps = dmp.dofmaps self.elements = dmp.elements self.bounds = dmp.bounds # Get ownership range. To be used with global ordering scheme self.first_dof = self.dofmaps[0].ownership_range()[0] # Get indices of subspaces to which component belongs self.subspace_index = subspace_index(self.component, self.bounds) # Unique subspaces self.subspaces = set(self.subspace_index) # Plot of dofs is a scatter for node/dof position # and text for label. self.showing_all_dofs = False self.scatter_objects = {} self.text_objects = {} # Scatter objects require position self.positions = {} # Taxt objects require numbering of dofs and position self.labels = {} # Notify in terminal and set the window title self.printer('Plotting dofmaps ' + str(self.component), 'blue') title = 'Figure %d : Dofs of %s' % (self.fig_num, str(self.component)) if self.mpi_size > 1: title = ' '.join([title, 'on process %d' % self.mpi_rank]) fig.canvas.set_window_title(title)