Exemplo n.º 1
0
    def plot_stiffness( self, editor, object ):
        '''This method gets the input data from the current tstepper
        which is the root of the tree. Sets up the context and 
        gets the stiffness matrix.
        '''
        K = self._get_stiffness( editor, object )
        K_dense = DenseMtx( assemb = K )

        # prepare plotting of the matrix in Mayavi
        #
        z_data = K_dense.mtx.flatten()
        z_max = max( z_data )
        n_dofs = K.n_dofs

        spoints = tvtk.StructuredPoints( origin = ( 0, 0, 0 ),
                                        spacing = ( 1, -1, 1 ),
                                        dimensions = ( n_dofs, n_dofs, 1 ) )
        spoints.point_data.scalars = z_data
        spoints.point_data.scalars.name = 'Stiffness'

        e = get_engine()
        src = VTKDataSource( data = spoints )
        e.add_source( src )
        scale_factor = .1 / float( z_max ) * n_dofs
        ws = WarpScalar()
        ws.filter.scale_factor = scale_factor
        e.add_filter( ws )
        e.add_filter( PolyDataNormals() )
        s = Surface()
        e.add_module( s )
Exemplo n.º 2
0
    def plot_stiffness(self, editor, object):
        '''This method gets the input data from the current tstepper
        which is the root of the tree. Sets up the context and 
        gets the stiffness matrix.
        '''
        K = self._get_stiffness(editor, object)
        K_dense = DenseMtx(assemb=K)

        # prepare plotting of the matrix in Mayavi
        #
        z_data = K_dense.mtx.flatten()
        z_max = max(z_data)
        n_dofs = K.n_dofs

        spoints = tvtk.StructuredPoints(origin=(0, 0, 0),
                                        spacing=(1, -1, 1),
                                        dimensions=(n_dofs, n_dofs, 1))
        spoints.point_data.scalars = z_data
        spoints.point_data.scalars.name = 'Stiffness'

        e = get_engine()
        src = VTKDataSource(data=spoints)
        e.add_source(src)
        scale_factor = .1 / float(z_max) * n_dofs
        ws = WarpScalar()
        ws.filter.scale_factor = scale_factor
        e.add_filter(ws)
        e.add_filter(PolyDataNormals())
        s = Surface()
        e.add_module(s)
Exemplo n.º 3
0
    def __init__(self,**kw):

        e = get_engine()

        super( MVPMeshGridLabels, self ).__init__(**kw)
        from etsproxy.mayavi.modules.api import Outline, Surface, Labels

        self.src = VTKDataSource( name = self.name, data = self.pd )
        e.add_source(self.src)
        
        self.labels = Labels( name = 'Node numbers', object = self.src, 
                         label_format = '%g',
                         number_of_labels = 100 )
        e.add_module(self.labels)
Exemplo n.º 4
0
    def __init__(self,**kw):

        e = get_engine()

        super( MVPMeshGridGeo, self ).__init__(**kw)
        from etsproxy.mayavi.modules.api import Outline, Surface, Labels

        self.src = VTKDataSource( name = self.name, data = self.pd )
        e.add_source(self.src)
        
        o = Outline()
        e.add_module(o)
        s = Surface()
        e.add_module(s)
Exemplo n.º 5
0
    def __init__(self, **kw):

        e = get_engine()

        super(MVPMeshGridGeo, self).__init__(**kw)
        from etsproxy.mayavi.modules.api import Outline, Surface, Labels

        self.src = VTKDataSource(name=self.name, data=self.pd)
        e.add_source(self.src)

        o = Outline()
        e.add_module(o)
        s = Surface()
        e.add_module(s)
Exemplo n.º 6
0
    def __init__(self, **kw):

        e = get_engine()

        super(MVPMeshGridLabels, self).__init__(**kw)
        from etsproxy.mayavi.modules.api import Outline, Surface, Labels

        self.src = VTKDataSource(name=self.name, data=self.pd)
        e.add_source(self.src)

        self.labels = Labels(name='Node numbers',
                             object=self.src,
                             label_format='%g',
                             number_of_labels=100)
        e.add_module(self.labels)
Exemplo n.º 7
0
    def __init__(self,**kw):

        super( MVPStructuredGrid, self ).__init__(**kw)
        e = get_engine()

        from etsproxy.mayavi.modules.api import \
        Outline, Surface, StructuredGridOutline, GridPlane

        self.src = VTKDataSource( name = self.name, data = self.pd )
        e.add_source(self.src)
        
        o = StructuredGridOutline()
        e.add_module(o)
        
        for axis in ['x','y','z']:
            g = GridPlane( name = '%s - grid plane' % axis )
            g.grid_plane.axis = axis
            e.add_module(g)
Exemplo n.º 8
0
    def __init__(self, **kw):

        super(MVPStructuredGrid, self).__init__(**kw)
        e = get_engine()

        from etsproxy.mayavi.modules.api import \
        Outline, Surface, StructuredGridOutline, GridPlane

        self.src = VTKDataSource(name=self.name, data=self.pd)
        e.add_source(self.src)

        o = StructuredGridOutline()
        e.add_module(o)

        for axis in ['x', 'y', 'z']:
            g = GridPlane(name='%s - grid plane' % axis)
            g.grid_plane.axis = axis
            e.add_module(g)
Exemplo n.º 9
0
    def __init__(self, **kw):

        super(MVStructuredGrid, self).__init__(**kw)
        e = get_engine()

        from mayavi.modules.api import \
            StructuredGridOutline, GridPlane

        self.src = VTKDataSource(name=self.name, data=self.pd)
        e.add_source(self.src)

        o = StructuredGridOutline()
        e.add_module(o)

        for axis in ['x', 'y', 'z']:
            g = GridPlane(name='%s - grid plane' % axis)
            g.grid_plane.axis = axis
            e.add_module(g)

        if self.scalars or self.vectors or self.tensors:
            s = Surface()
            e.add_module(s)
Exemplo n.º 10
0
    def __init__(self, **kw):

        super(MVStructuredGrid, self).__init__(**kw)
        e = get_engine()

        from mayavi.modules.api import \
            StructuredGridOutline, GridPlane

        self.src = VTKDataSource(name=self.name, data=self.pd)
        e.add_source(self.src)

        o = StructuredGridOutline()
        e.add_module(o)

        for axis in ['x', 'y', 'z']:
            g = GridPlane(name='%s - grid plane' % axis)
            g.grid_plane.axis = axis
            e.add_module(g)

        if self.scalars or self.vectors or self.tensors:
            s = Surface()
            e.add_module(s)
Exemplo n.º 11
0
"""
Created on Apr 7, 2009

@author: jakub
"""

from ibvpy.plugins.mayavi_engine import get_engine

e = get_engine()
Exemplo n.º 12
0
 def _engine_default(self):
     return get_engine()
Exemplo n.º 13
0
 def _engine_default(self):
     return get_engine()