示例#1
0
    def _plot_max_Value( self ):
        X = self.X_hf[:, 0]
        Y = self.Y_hf[:, 0]
        Z = self.Z_hf[:, 0]


        plot_col = getattr( self, self.plot_column )[:, 0]
        scale = 1 / max( plot_col )
#        if self.plot_column == 'n_tex':
#            plot_col = where( plot_col < 0, 0, plot_col )

        mlab.figure( figure = "SFB532Demo",
                     bgcolor = ( 1.0, 1.0, 1.0 ),
                     fgcolor = ( 0.0, 0.0, 0.0 ) )

        mlab.points3d( X, Y, ( -1.0 ) * Z, plot_col,
#                       colormap = "gist_rainbow",
#                       colormap = "Reds",
                       colormap = "copper",
                       mode = "cube",
                       scale_factor = scale )
        mlab.outline()

        mlab.scalarbar( title = self.plot_column, orientation = 'vertical' )

        mlab.show
示例#2
0
    def _plot_fired(self):
        X = self.ls_table.X[:, 0]
        Y = self.ls_table.Y[:, 0]
        Z = self.ls_table.Z[:, 0]
        plot_col = getattr(self, self.plot_column)[:, 0]

        if self.plot_column == 'n_tex':
            plot_col = where(plot_col < 0, 0, plot_col)

        mlab.figure(figure="SFB532Demo",
                    bgcolor=(1.0, 1.0, 1.0),
                    fgcolor=(0.0, 0.0, 0.0))

        mlab.points3d(
            X,
            Y,
            (-1.0) * Z,
            plot_col,
            #                       colormap = "gist_rainbow",
            #                       colormap = "Reds",
            colormap="YlOrBr",
            mode="cube",
            scale_factor=0.15)

        mlab.scalarbar(title=self.plot_column, orientation='vertical')

        mlab.show
示例#3
0
    def _plot3d_points_flat_fired(self):
        '''Plot array of variable using colormap
        '''
        aramis_cdt = self.aramis_cdt

        m.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1) , size=(1600, 900))
        engine = m.get_engine()
        scene = engine.scenes[0]
        scene.scene.disable_render = True

        plot3d_var = getattr(aramis_cdt, self.plot3d_var_)

        mask = np.logical_or(np.isnan(aramis_cdt.x_arr),
                             aramis_cdt.data_array_undeformed_mask[0, :, :])
        mask = None
        m.points3d(aramis_cdt.x_arr[mask],
                   aramis_cdt.y_arr[mask],
                   aramis_cdt.z_arr[mask],
                   plot3d_var[mask],
                   mode='cube',
                   scale_mode='none', scale_factor=1)
        m.view(0, 0)
        scene.scene.parallel_projection = True
        scene.scene.disable_render = False

        if self.plot_title:
            m.title('step no. %d' % aramis_cdt.evaluated_step_idx, size=0.3)

        m.scalarbar(orientation='horizontal', title=self.plot3d_var_)

        # plot axes
        m.axes()

        m.show()
    def _plot_fired(self):

        plot_col = getattr(self, self.plot_column)[:, 0]

        mlab.figure(figure="SFB532Demo",
                     bgcolor=(1.0, 1.0, 1.0),
                     fgcolor=(0.0, 0.0, 0.0))

        gd = self.ls_table.geo_data
        sd = self.ls_table.state_data

        if self.plot_column == 'n_tex':
            plot_col = where(plot_col < 0, 0, plot_col)

        r = self.ls_table.reader
        r.plot_col(mlab, plot_col, gd, state_data=sd, warp_factor=self.warp_factor)

        mlab.scalarbar(title=self.plot_column, orientation='vertical')
        mlab.show
    def _plot_fired( self ):
        X = self.ls_table.X[:, 0]
        Y = self.ls_table.Y[:, 0]
        Z = self.ls_table.Z[:, 0]
        plot_col = getattr( self, self.plot_column )[:, 0]

        if self.plot_column == 'n_tex':
            plot_col = where( plot_col < 0, 0, plot_col )

        mlab.figure( figure = "SFB532Demo",
                     bgcolor = ( 1.0, 1.0, 1.0 ),
                     fgcolor = ( 0.0, 0.0, 0.0 ) )

        mlab.points3d( X, Y, ( -1.0 ) * Z, plot_col,
#                       colormap = "gist_rainbow",
#                       colormap = "Reds",
                       colormap = "YlOrBr",
                       mode = "cube",
                       scale_factor = 0.15 )

        mlab.scalarbar( title = self.plot_column, orientation = 'vertical' )

        mlab.show
示例#6
0
        offset_arr = np.array([xyoffset, xyoffset, zoffset]) 
        pts = pts + offset_arr

        return pts


if __name__ == '__main__':

    from numpy import mgrid, c_, hstack, vstack, shape
    from etsproxy.mayavi import mlab

    geo_supprt = GeoSUPPRT()

    shape_xy = 2
    shape_z = 1

    grid = mgrid[0:1:complex(0, shape_xy + 1),
                 0:1:complex(0, shape_xy + 1 ),
                 0:1:complex(0, shape_z + 1)]

    X, Y, Z = grid

    gpoints = c_[ X.flatten(), Y.flatten(), Z.flatten() ]
    
    mlab.figure(bgcolor=(1.,1.,1.,))
    fp1 = geo_supprt(gpoints)
    mlab.points3d(fp1[:, 0], fp1[:, 1], fp1[:, 2],
                   scale_factor = 0.003 ,
                   resolution = 8)
    mlab.axes()
    mlab.show()
示例#7
0
        offset_arr = np.array([xyoffset, xyoffset, zoffset]) 
        pts = pts + offset_arr

        return pts


if __name__ == '__main__':

    from numpy import mgrid, c_, hstack, vstack, shape
    from etsproxy.mayavi import mlab

    geo_supprt = GeoSUPPRT()

    shape_xy = 2
    shape_z = 1

    grid = mgrid[0:1:complex(0, shape_xy + 1),
                 0:1:complex(0, shape_xy + 1 ),
                 0:1:complex(0, shape_z + 1)]

    X, Y, Z = grid

    gpoints = c_[ X.flatten(), Y.flatten(), Z.flatten() ]
    
    mlab.figure(bgcolor=(1.,1.,1.,))
    fp1 = geo_supprt(gpoints)
    mlab.points3d(fp1[:, 0], fp1[:, 1], fp1[:, 2],
                   scale_factor = 0.003 ,
                   resolution = 8)
    mlab.axes()
    mlab.show()
示例#8
0
 
 e_arr = make_ogrid(s.evar_lst)
 n_e_arr = [ e / np.max(np.fabs(e)) for e in e_arr ]
 
 max_mu_q = np.max(np.fabs(s.mu_q_arr))
 n_mu_q_arr = s.mu_q_arr / max_mu_q
 n_std_q_arr = np.sqrt(s.var_q_arr) / max_mu_q
 
 #===========================================================================
 # Prepare plotting 
 #===========================================================================
 tdir = tempfile.mkdtemp()
 n_img = n_mu_q_arr.shape[0]
 fnames = [os.path.join(tdir, 'x%02d.jpg' % i) for i in range(n_img) ]
 
 f = m.figure(1, size = (1000, 500), fgcolor = (0, 0, 0),
              bgcolor = (1., 1., 1.))
 
 s = m.surf(n_e_arr[1], n_e_arr[2], n_mu_q_arr[0, :, :])
 ms = s.mlab_source
 
 m.axes(s, color = (.7, .7, .7),
        extent = (-1, 1, 0, 1, 0, 1),
        ranges = (-0.21, 0.21, 0.1, 20, 0, max_mu_q),
        xlabel = 'x[mm]', ylabel = 'Lr[mm]',
        zlabel = 'f[N]',)
 m.view(-60.0, 70.0, focalpoint = [0., 0.45, 0.45])
 
 m.savefig(fnames[0])
 
 for i, fname in enumerate(fnames[1:]):
     ms.scalars = n_mu_q_arr[i, :, :]
示例#9
0
    # 2 shells: 
    # new geometry with new loading cases plus waterfilling
    #---------------------------------------------

    data_dir = os.path.join(simdb.simdb_dir,
                            'simdata',
                            'input_data_barrelshell',
                            '2cm'
#                            '3cm'
#                            '3-4cm'
                            )

    r = LCCReaderInfoCADRxyz(data_dir = data_dir)

    mlab.figure(figure = "SFB532Demo",
                bgcolor = (1.0, 1.0, 1.0),
                fgcolor = (0.0, 0.0, 0.0))

    # get 'geo_data' and 'state_data'
    #
#    gd = r.read_geo_data('')
    sd = r.read_state_data('LC1.txt')

    # plot the undeformed geometry (as mesh)
    #
#    r.plot_mesh(mlab, gd)

    # plot the deformed geometry (as mesh)
    #
#    r.plot_deformed_mesh(mlab, gd, sd, warp_factor = 1000.)
示例#10
0
    e_arr = make_ogrid(s.evar_lst)
    n_e_arr = [e / np.max(np.fabs(e)) for e in e_arr]

    max_mu_q = np.max(np.fabs(s.mu_q_arr))
    n_mu_q_arr = s.mu_q_arr / max_mu_q
    n_std_q_arr = np.sqrt(s.var_q_arr) / max_mu_q

    #===========================================================================
    # Prepare plotting
    #===========================================================================
    tdir = tempfile.mkdtemp()
    n_img = n_mu_q_arr.shape[0]
    fnames = [os.path.join(tdir, 'x%02d.jpg' % i) for i in range(n_img)]

    f = m.figure(1, size=(1000, 500), fgcolor=(0, 0, 0), bgcolor=(1., 1., 1.))

    s = m.surf(n_e_arr[1], n_e_arr[2], n_mu_q_arr[0, :, :])
    ms = s.mlab_source

    m.axes(
        s,
        color=(.7, .7, .7),
        extent=(-1, 1, 0, 1, 0, 1),
        ranges=(-0.21, 0.21, 0.1, 20, 0, max_mu_q),
        xlabel='x[mm]',
        ylabel='Lr[mm]',
        zlabel='f[N]',
    )
    m.view(-60.0, 70.0, focalpoint=[0., 0.45, 0.45])
示例#11
0
    def plot_assess_value(self, title = None, add_assess_values_from_file = None, save_assess_values_to_file = None):
        '''plot the assess value for all loading case combinations
        '''
        #----------------------------------------
        # script to get the maximum values of 'assess_value' 
        # at all given coordinate points for all possible loading
        # case combinations:
        #----------------------------------------

        # get the list of all loading case combinations:
        #
        lcc_list = self.lcc_list

        #----------------------------------------------
        # run trough all loading case combinations:
        #----------------------------------------------

        assess_value_list = []
        for lcc in lcc_list:

            # get the ls_table object and retrieve its 'ls_class'
            # (= LSTable_ULS-object)
            #
            ls_class = lcc.ls_table.ls_class
 
            # get 'assess_name'-column array 
            #
            assess_name = ls_class.assess_name
            if assess_name == 'max_eta_nm_tot':
                assess_value = getattr(ls_class, 'eta_nm_tot')
            if assess_name == 'max_n_tex':
                assess_value = getattr(ls_class, 'n_tex')
            if assess_name == 'max_eta_tot':
                assess_value = getattr(ls_class, 'eta_tot')
            
#            n_tex = ls_class.n_tex_up
#            n_tex = ls_class.n_tex_lo
            assess_value_list.append(assess_value)

        # stack the list to an array in order to use ndmax-function
        #
        assess_value_arr = hstack(assess_value_list)
        print 'assess_value_arr.shape', assess_value_arr.shape

        #----------------------------------------------
        # get the overall maximum values:
        #----------------------------------------------

        assess_value_max = ndmax(assess_value_arr, axis = 1)[:, None]

        #----------------------------------------------
        # plot
        #----------------------------------------------
        #
        X = lcc_list[0].ls_table.X[:, 0]
        Y = lcc_list[0].ls_table.Y[:, 0]
        Z = lcc_list[0].ls_table.Z[:, 0]
        if self.reader_type == 'RFEM':
            Z *= -1.0 
        plot_col = assess_value_max[:, 0]
        
        # save assess values to file in order to superpose them later
        #
        if save_assess_values_to_file != None:
            print 'assess_values saved to file %s' %( save_assess_values_to_file )
            assess_value_arr = plot_col
            np.savetxt( save_assess_values_to_file, assess_value_arr )

        # add read in saved assess values to be superposed with currently read in assess values
        #
        if add_assess_values_from_file != None:
            print 'superpose assess_value_arr with values read in from file %s' %( add_assess_values_from_file )
            assess_value_arr = np.loadtxt( add_assess_values_from_file )
            plot_col += assess_value_arr

#        # if n_tex is negative plot 0 instead:
#        #
#        plot_col = where(plot_col < 0, 0, plot_col)

        mlab.figure(figure = title,
                     bgcolor = (1.0, 1.0, 1.0),
                     fgcolor = (0.0, 0.0, 0.0))

        mlab.points3d(X, Y, Z, plot_col,
                       colormap = "YlOrBr",
                       mode = "cube",
                       scale_mode = 'none',
                       scale_factor = 0.10)

        mlab.scalarbar(title = assess_name + ' (all LCs)', orientation = 'vertical')

        mlab.show()
    #
    xi , yi , z_middle , t = get_mid_surface_and_thickness( hp, c_[X, Y], perpendicular_t = False )
    print "thickness at corner must evaluate to 60 mm (almost no slope): ", t[ argmax( z_middle ) ]
    print "minimum thickness must evaluate to about 60 mm (check if option 'perpendicular_t' is necessary)", min( t )

    # 3) export thickness to file
    #
    ouput_data_thickness = 'RFEM_file_export/output_data_thickness_' + n_shells_str + '_' + scalefactor_delta_h_str + '02.csv'
    export_thickness_data( elem_no, X, Y, t, ouput_data_thickness )

    # 4) plot midsurface and thickness in mayavi
    #
    print '*** plotting data - thickness***'

    mlab.figure( figure = "elem_coords and thickness",
             bgcolor = ( 1.0, 1.0, 1.0 ),
             fgcolor = ( 0.0, 0.0, 0.0 ) )

    mlab.points3d( X, Y, z_middle, t,
                   colormap = "YlOrBr",
                   mode = "cube",
                   scale_factor = 0.50 )
    mlab.scalarbar( title = 'elem_coords and thickness', orientation = 'vertical' )
    mlab.axes()
    mlab.show()


    #------------------------------------------------------------------
    # MIDSURFACE
    # get a csv file with the nodal coords of the shell elements
    # in the order of the supplied csv coordinates (x,y) 
示例#13
0
    print "thickness at corner must evaluate to 60 mm (almost no slope): ", t[
        argmax(z_middle)]
    print "minimum thickness must evaluate to about 60 mm (check if option 'perpendicular_t' is necessary)", min(
        t)

    # 3) export thickness to file
    #
    ouput_data_thickness = 'RFEM_file_export/output_data_thickness_' + n_shells_str + '_' + scalefactor_delta_h_str + '02.csv'
    export_thickness_data(elem_no, X, Y, t, ouput_data_thickness)

    # 4) plot midsurface and thickness in mayavi
    #
    print '*** plotting data - thickness***'

    mlab.figure(figure="elem_coords and thickness",
                bgcolor=(1.0, 1.0, 1.0),
                fgcolor=(0.0, 0.0, 0.0))

    mlab.points3d(X,
                  Y,
                  z_middle,
                  t,
                  colormap="YlOrBr",
                  mode="cube",
                  scale_factor=0.50)
    mlab.scalarbar(title='elem_coords and thickness', orientation='vertical')
    mlab.axes()
    mlab.show()

    #------------------------------------------------------------------
    # MIDSURFACE
示例#14
0
    def plot_n_tex(self, title = None):
        '''plot number of textile reinforcement 'n_tex' for all loading case combinations
        '''
        #----------------------------------------
        # script to get the maximum number of reinforcement ('n_tex')
        # at all given coordinate points for all possible loading
        # case combinations:
        #----------------------------------------
        # set option to "True" for surrounding 
        # evaluation of necessary layers "n_tex"
        # needed for all loading cases

        # get the list of all loading case combinations:
        #
        lcc_list = self.lcc_list

        #----------------------------------------------
        # run trough all loading case combinations:
        #----------------------------------------------

        n_tex_list = []
        for lcc in lcc_list:

            # get the ls_table object and retrieve its 'ls_class'
            # (= LSTable_ULS-object)
            #
            ls_class = lcc.ls_table.ls_class

            # get 'n_tex'-column array 
            #
            n_tex = ls_class.n_tex
#            n_tex = ls_class.n_tex_up
#            n_tex = ls_class.n_tex_lo
            n_tex_list.append(n_tex)

        # stack the list to an array in order to use ndmax-function
        #
        n_tex_arr = hstack(n_tex_list)

        #----------------------------------------------
        # get the overall maximum values:
        #----------------------------------------------

        n_tex_max = ndmax(n_tex_arr, axis = 1)[:, None]

        #----------------------------------------------
        # plot
        #----------------------------------------------
        #
        X = lcc_list[0].ls_table.X[:, 0]
        Y = lcc_list[0].ls_table.Y[:, 0]
        Z = lcc_list[0].ls_table.Z[:, 0]
        plot_col = n_tex_max[:, 0]

        # if n_tex is negative plot 0 instead:
        #
        plot_col = where(plot_col < 0, 0, plot_col)

        mlab.figure(figure = title,
                     bgcolor = (1.0, 1.0, 1.0),
                     fgcolor = (0.0, 0.0, 0.0))

        mlab.points3d(X, Y, (-1.0) * Z, plot_col,
                       colormap = "YlOrBr",
                       mode = "cube",
                       scale_mode = 'none',
                       scale_factor = 0.10)

        mlab.scalarbar(title = 'n_tex (all LCs)', orientation = 'vertical')

        mlab.show()
示例#15
0
    def _plot3d_points_fired(self):
        '''Plot arrays of variables in 3d relief
        '''
        aramis_cdt = self.aramis_cdt
        m.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1), size=(900, 600))

        engine = m.get_engine()
        scene = engine.scenes[0]
        scene.scene.disable_render = True

        #-----------------------------------
        # plot crack width ('crack_field_w')
        #-----------------------------------

        z_arr = np.zeros_like(aramis_cdt.z_arr)

        plot3d_var = getattr(aramis_cdt, self.plot3d_var_)
        m.points3d(z_arr, aramis_cdt.x_arr, aramis_cdt.y_arr, plot3d_var,
                   mode='cube', colormap="blue-red", scale_mode='scalar', vmax=.2)

        # scale glyphs
        #
        glyph = engine.scenes[0].children[0].children[0].children[0]
        glyph.glyph.glyph_source.glyph_position = 'tail'
        glyph.glyph.glyph_source.glyph_source.x_length = self.glyph_x_length_cr
        glyph.glyph.glyph_source.glyph_source.y_length = self.glyph_y_length_cr
        glyph.glyph.glyph_source.glyph_source.z_length = self.glyph_z_length_cr

        #-----------------------------------
        # plot displacement jumps ('d_ux_w')
        #-----------------------------------

        plot3d_var = getattr(aramis_cdt, self.plot3d_var_)
        m.points3d(z_arr, aramis_cdt.x_arr, aramis_cdt.y_arr, plot3d_var, mode='cube',
                   colormap="blue-red", scale_mode='none')

        glyph1 = engine.scenes[0].children[1].children[0].children[0]
#       # switch order of the scale_factor corresponding to the order of the
        glyph1.glyph.glyph_source.glyph_source.x_length = self.glyph_z_length
        glyph1.glyph.glyph_source.glyph_source.y_length = self.glyph_x_length
        glyph1.glyph.glyph_source.glyph_source.z_length = self.glyph_y_length

        # rotate scene
        #
        scene = engine.scenes[0]
        scene.scene.parallel_projection = True
        m.view(0, 90)

        glyph.glyph.glyph_source.glyph_position = 'head'
        glyph.glyph.glyph_source.glyph_position = 'tail'

        module_manager = engine.scenes[0].children[0].children[0]
        module_manager.scalar_lut_manager.scalar_bar_representation.minimum_size = np.array([1, 1])
        module_manager.scalar_lut_manager.scalar_bar_representation.position2 = np.array([ 0.20603604, 0.16827586])
        module_manager.scalar_lut_manager.scalar_bar_representation.moving = 0
        module_manager.scalar_lut_manager.scalar_bar_representation.position = np.array([ 0.53971972, 0.19931035])
        module_manager.scalar_lut_manager.scalar_bar_representation.maximum_size = np.array([100000, 100000])
        scene.scene.disable_render = False

        if self.plot_title:
            m.title('step no. %d' % aramis_cdt.evaluated_step_idx, size=0.3)

        m.scalarbar(orientation='horizontal', title=self.plot3d_var_)

        # plot axes
        #
        m.axes()

        m.show()
示例#16
0
    def plot3d_surf(self):

        # set background color to white and forground color to black
        #
        m.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1), size=(1600, 900))

        #----------------------------------------------------
        # plot 'plot_var' as 3d-surface plot
        #----------------------------------------------------
        # @todo: is this comment still relavant? "why is moved in the y direction?"

        if self.use_mask == 'true':
            mask_arr = self.grid_mask_w
        else:
            mask_arr = None

        plot3d_var = getattr(self, self.plot3d_var_[0])
        vmax = self.plot3d_var_[1]

#        m.surf(self.x_arr, self.y_arr, plot3d_var, vmax = vmax, mask = mask_arr, warp_scale = warp_scale)
        m.surf(self.x_arr_avg, self.y_arr_avg, plot3d_var, vmax=vmax, mask=mask_arr, warp_scale=warp_scale)

        # use average coordinate values (1D-arrays)
        #
#        m.surf(self.x_arr_avg, self.y_arr_avg, plot3d_var, vmax = vmax, mask = mask_arr, warp_scale = warp_scale)


        # plot scalarbar
        #
        m.scalarbar(orientation='horizontal', title=self.plot3d_var)

        # plot axes
        #
#        m.axes()

        # figure title
        # uses directory path by default
        #
        if plot_title == 'true':
            m.title(os.path.join(self.data_dir, self.basename))

        # get mayavi engine
        #
        engine = m.get_engine()

        # rotate scene
        #
        scene = engine.scenes[0]
        scene.scene.parallel_projection = True
        if self.warp_scale == 1:
            scene.scene.z_plus_view()
        else:
            scene.scene.isometric_view()
            scene.scene.camera.position = [-319.07443227647047, -469.29101319337502, 434.40818470843612]
            scene.scene.camera.focal_point = [-66.983721840860625, -79.447548413824947, 1.1328650920308507]
            scene.scene.camera.view_angle = 30.0
            scene.scene.camera.view_up = [0.49290441759866288, 0.48449293877207339, 0.72271144130401255]
            scene.scene.camera.clipping_range = [325.28180250321782, 995.97136098229157]
            scene.scene.camera.compute_view_plane_normal()
            scene.scene.render()

        # predefine the position of the scalarbar
        #
        module_manager = engine.scenes[0].children[0].children[0].children[0].children[0]
        module_manager.scalar_lut_manager.scalar_bar_representation.minimum_size = np.array([1, 1])
        module_manager.scalar_lut_manager.scalar_bar_representation.position2 = np.array([ 0.27780226, 0.11638842])
        module_manager.scalar_lut_manager.scalar_bar_representation.position = np.array([ 0.59707606, 0.16105125])
        module_manager.scalar_lut_manager.scalar_bar_representation.maximum_size = np.array([100000, 100000])
        m.show()
示例#17
0
    def plot3d_cracks(self):
        # set background color to white and forground color to black
        #
        m.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1), size=(900, 600))

        # get mayavi engine
        #
        engine = m.get_engine()
        scene = engine.scenes[0]
        scene.scene.disable_render = True

        #-----------------------------------
        # plot crack width ('crack_field_w')
        #-----------------------------------

        # flatten z_arr
        # @todo: use instead: extent = [xmin, xmax, ymin, ymax, zmin, zmax],
        #
        z_arr = np.zeros_like(self.z_arr)
        # NOTE: coordinate order is switched in order to display glyphs at their tail instead of their center
        # (only possible in mayavis's x-direction)
        #
        plot3d_var = getattr(self, self.plot3d_var_[0])
#        plot3d_var = getattr(self, 'crack_field_w')
        vmax = self.plot3d_var_[1]
        m.points3d(z_arr, self.x_arr, self.y_arr, plot3d_var, mode='cube', colormap="blue-red", scale_mode='scalar', vmax=vmax)

        # plot scalarbar
        #
        m.scalarbar(orientation='horizontal', title=self.plot3d_var)

        # figure title
        # uses directory path by default
        #
        if plot_title == 'true':
            m.title(os.path.join(self.data_dir, self.basename))

        # scale glyphs
        #
        glyph = engine.scenes[0].children[0].children[0].children[0]
        glyph.glyph.glyph_source.glyph_position = 'tail'
        glyph.glyph.glyph_source.glyph_source.x_length = self.glyph_x_length_cr
        glyph.glyph.glyph_source.glyph_source.y_length = self.glyph_y_length_cr
        glyph.glyph.glyph_source.glyph_source.z_length = self.glyph_z_length_cr

        #-----------------------------------
        # plot displacement jumps ('d_ux_w')
        #-----------------------------------

#        plot3d_var = getattr(self, 'd_ux_w')
        plot3d_var = getattr(self, 'crack_field_w')
        m.points3d(z_arr, self.x_arr, self.y_arr, plot3d_var, mode='cube', colormap="blue-red", scale_mode='none', vmax=vmax)
        # m.surf(z_arr, self.x_arr, self.y_arr, colormap="blue-red")
        glyph1 = engine.scenes[0].children[1].children[0].children[0]
#         # switch order of the scale_factor corresponding to the order of the
        glyph1.glyph.glyph_source.glyph_source.x_length = self.glyph_z_length
        glyph1.glyph.glyph_source.glyph_source.y_length = self.glyph_x_length
        glyph1.glyph.glyph_source.glyph_source.z_length = self.glyph_y_length

        # rotate scene
        #
        scene = engine.scenes[0]
        scene.scene.parallel_projection = True
        m.view(0, 90)
#         scene.scene.camera.position = [616.49832063929375, 638.29074243238438, 514.06081220962164]
#         scene.scene.camera.focal_point = [11.259753942489624, 11.990119934082031, 9.7502956390380859]
#         scene.scene.camera.view_angle = 30.0
#         scene.scene.camera.view_up = [0.79246046934594205, -0.54446721176015089, -0.27488517574095594]
#         scene.scene.camera.clipping_range = [595.49259262137014, 1526.1362976999562]
#         scene.scene.camera.compute_view_plane_normal()

        glyph.glyph.glyph_source.glyph_position = 'head'
        glyph.glyph.glyph_source.glyph_position = 'tail'

        module_manager = engine.scenes[0].children[0].children[0]
        module_manager.scalar_lut_manager.scalar_bar_representation.minimum_size = np.array([1, 1])
        module_manager.scalar_lut_manager.scalar_bar_representation.position2 = np.array([ 0.20603604, 0.16827586])
        module_manager.scalar_lut_manager.scalar_bar_representation.moving = 0
        module_manager.scalar_lut_manager.scalar_bar_representation.position = np.array([ 0.53971972, 0.19931035])
        module_manager.scalar_lut_manager.scalar_bar_representation.maximum_size = np.array([100000, 100000])
        scene.scene.disable_render = False
        # plot axes
        #
        m.axes()

        m.show()
示例#18
0
    def plot3d_points(self):

        # set background color to white and forground color to black
        #
        m.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1), size=(900, 600))

        # NOTE: the missing facettes have all the coordinate position (0,0,0);
        # the missing facettes therefore are displayed in points3d as missing elements (gaps)

        plot3d_var = getattr(self, self.plot3d_var_[0])
        vmax = self.plot3d_var_[1]

#        m.points3d(self.x_arr, self.y_arr, self.z_arr, plot3d_var, mode = 'cube', colormap = "blue-red", scale_mode ='none', vmax = vmax)
#        m.points3d(self.x_arr_avg, self.y_arr_avg, self.z_arr, plot3d_var, mode = 'cube', colormap = "blue-red", scale_mode ='none', vmax = vmax)
        m.points3d(self.x_arr, self.y_arr, self.z_arr, plot3d_var, mode='cube', colormap="blue-red", scale_mode='none', vmax=vmax)

        # switch coordinate order to display glyphs at their head/tail insted of their center
#        m.points3d(self.z_arr, self.x_arr, self.y_arr, plot3d_var, mode = 'cube', colormap = "blue-red", scale_mode ='none', vmax = vmax)

        # plot scalarbar
        #
        m.scalarbar(orientation='horizontal', title=self.plot3d_var)
        # @todo: predefine scalarbar position
#        m.scalarbar().position = [0., 0.]

        # plot axes
        #
        m.axes()

        # figure title
        # uses directory path by default
        #
        if plot_title == 'true':
            m.title(os.path.join(self.data_dir, self.basename))

        # get mayavi engine
        #
        engine = m.get_engine()

        # scale glyphs
        #
        glyph = engine.scenes[0].children[0].children[0].children[0]
        glyph.glyph.glyph_source.glyph_source.x_length = self.glyph_x_length
        glyph.glyph.glyph_source.glyph_source.y_length = self.glyph_y_length
        glyph.glyph.glyph_source.glyph_source.z_length = self.glyph_z_length
        glyph.glyph.glyph_source.glyph_position = 'tail'

        # rotate scene
        #
        scene = engine.scenes[0]
        scene.scene.parallel_projection = True
        scene.scene.z_plus_view()

        # preset position of scalarbar
        #
        module_manager = engine.scenes[0].children[0].children[0]
        module_manager.scalar_lut_manager.scalar_bar_representation.maximum_size = np.array([100000, 100000])
        module_manager.scalar_lut_manager.scalar_bar_representation.minimum_size = np.array([1, 1])
        module_manager.scalar_lut_manager.scalar_bar_representation.position2 = np.array([ 0.20603604, 0.16827586])
        module_manager.scalar_lut_manager.scalar_bar_representation.moving = 0
        module_manager.scalar_lut_manager.scalar_bar_representation.position = np.array([ 0.40858859, 0.09310345])
        module_manager.scalar_lut_manager.scalar_bar_representation.maximum_size = np.array([100000, 100000])

#        # @todo: use mlab-functionality instead
#        view = mlab.view()
#        roll = mlab.roll()
#        # Reposition the camera
#        mlab.view(*view)
#        mlab.roll(roll)
#
#        f = mlab.gcf()
#        camera = f.scene.camera
#        cam.parallel_scale = 9

        m.show()
示例#19
0
    #---------------------------------------------
    # 2 shells:
    # new geometry with new loading cases plus waterfilling
    #---------------------------------------------

    data_dir = os.path.join(
        simdb.simdb_dir, 'simdata', 'input_data_barrelshell', '2cm'
        #                            '3cm'
        #                            '3-4cm'
    )

    r = LCCReaderInfoCADRxyz(data_dir=data_dir)

    mlab.figure(figure="SFB532Demo",
                bgcolor=(1.0, 1.0, 1.0),
                fgcolor=(0.0, 0.0, 0.0))

    # get 'geo_data' and 'state_data'
    #
    #    gd = r.read_geo_data('')
    sd = r.read_state_data('LC1.txt')

    # plot the undeformed geometry (as mesh)
    #
#    r.plot_mesh(mlab, gd)

# plot the deformed geometry (as mesh)
#
#    r.plot_deformed_mesh(mlab, gd, sd, warp_factor = 1000.)