def __init__(self, subcase_id, labels, loads, colormap='jet', uname='Cart3dResult'): GuiResultCommon.__init__(self) self.uname = uname self.labels = labels self.n = 5 self.loads = loads self.data_formats = ['%.3g', '%.3g', '%.3g', '%.3g', '%.3g'] self.titles = ['rho', 'rhoU' 'rhoV', 'rhoW', 'rhoE'] self.labels = labels self.min_default = loads.min(axis=1).tolist() assert len(self.min_default) == 5, len(self.min_default) self.max_default = loads.max(axis=1).tolist() self.min_value = deepcopy(self.min_default) self.max_value = deepcopy(self.max_default) self.data_format_default = deepcopy(self.data_formats) ntitles = len(self.titles) self.nlabels = [None] * ntitles self.labelsize = [None] * ntitles self.ncolors = [None] * ntitles self.colormap = [colormap] * ntitles
def __init__(self, subcase_id, labels, nodes, elements, regions, area, cnormals, colormap='jet', uname='Cart3dGeometry'): GuiResultCommon.__init__(self) self.colormap_default = colormap self.uname = uname self.n = 2 self.nodes = nodes # 0 self.elements = elements # 1 self.regions = regions # 2 self.area = area self.centroid_normals = cnormals self.labels = labels self.data_formats = ['%i', '%i', '%i', '%.3f', '%.3f', '%.3f', '%.3f'] self.titles = ['NodeID', 'ElementID', 'Region', 'Area', 'NormalX', 'NormalY', 'NormalZ', ] self.result_types = ['NodeID', 'ElementID', 'Region', 'Area', 'NormalX', 'NormalY', 'NormalZ', ] self.subcase_id = subcase_id self.min_default = [ nodes.min(), elements.min(), regions.min(), area.min(), cnormals[:, 0].min(), cnormals[:, 1].min(), cnormals[:, 2].min()] self.max_default = [ nodes.max(), elements.max(), regions.max(), area.max(), cnormals[:, 0].max(), cnormals[:, 1].max(), cnormals[:, 2].max()] self.min_value = deepcopy(self.min_default) self.max_value = deepcopy(self.max_default) self.title_default = deepcopy(self.titles) self.data_format_default = deepcopy(self.data_formats) ntitles = len(self.titles) self.nlabels = [None] * ntitles self.labelsize = [None] * ntitles self.ncolors = [None] * ntitles self.colormap = [self.colormap_default] * ntitles
def __init__( self, subcase_id, location, titles, headers, dxyz, linked_scale_factor, #xyz, scalar, scales, data_formats=None, nlabels=None, labelsize=None, ncolors=None, colormap='jet', set_max_min=False, uname='NastranGeometry'): """ Defines a Displacement/Eigenvector result Parameters ---------- subcase_id : int the flag that points to self.subcases for a message headers : List[str] the sidebar word titles : List[str] the legend title #xyz : (nnodes, 3) #the nominal xyz locations #scalars : (nnodes,n) float ndarray ##the data to make a contour plot with #does nothing dxyz : (nnodes, 3) the delta xyz values linked_scale_factor : bool is the displacement scale factor linked displacements/loads steps should be force/eigenvectors should not be scales : List[float] the table (e.g., deflection, SPC Forces) scale factors nominally, this starts as an empty list and is filled later data_formats : List[str] the type of data result (e.g. '%i', '%.2f', '%.3f') ncolors : int; default=None sets the default for reverting the legend ncolors set_max_min : bool; default=False set default_mins and default_maxs Unused ------ #deflects : bool; default=True #seems to be an unused parameter... uname : str some unique name for ... """ GuiResultCommon.__init__(self) self.subcase_id = subcase_id self.location = location assert location in ['node', 'centroid'], 'location=%r' % location self.linked_scale_factor = linked_scale_factor #assert self.subcase_id > 0, self.subcase_id self.dxyz = dxyz self.dim = len(self.dxyz.shape) self.uname = uname #self.dxyz_norm = norm(dxyz, axis=1) #self.deflects = deflects self.titles = titles self.headers = headers self.scales = scales self.subcase_id = subcase_id self.data_type = self.dxyz.dtype.str # '<c8', '<f4' self.is_real = True if self.data_type in ['<f4', '<f8'] else False #print('self.data_type = %r' % self.data_type) self.is_complex = not self.is_real self.nlabels = nlabels self.labelsize = labelsize self.ncolors = ncolors self.colormap = colormap self.data_formats = data_formats self.titles_default = deepcopy(self.titles) self.headers_default = deepcopy(self.headers) self.scales_default = deepcopy(self.scales) self.data_formats_default = deepcopy(self.data_formats) if self.dim == 2: ntimes = 1 self.default_mins = zeros(1, dtype=self.dxyz.dtype) self.default_maxs = zeros(1, dtype=self.dxyz.dtype) normi = norm(self.dxyz, axis=1) self.default_mins[0] = normi.min().real self.default_maxs[0] = normi.max().real elif self.dim == 3: ntimes = self.dxyz.shape[0] self.default_mins = zeros(ntimes) self.default_maxs = zeros(ntimes) for itime in range(ntimes): normi = norm(self.dxyz[itime, :, :], axis=1) self.default_mins[itime] = normi.min().real self.default_maxs[itime] = normi.max().real if not self.is_real: #: stored in degrees self.phases = np.zeros(ntimes) else: raise NotImplementedError('dim=%s' % self.dim) if set_max_min: self.min_values = deepcopy(self.default_mins) self.max_values = deepcopy(self.default_maxs) else: self.max_values = None self.min_values = None