コード例 #1
0
def create_flux_surface(bfield, surf_seeds):
    """
    Create a flux surface from an array of seeds and a tvtk vector field.

    Parameters
    ----------
    bfield: tvtk.ImageData
        The vector field to use for streamline traceing

    surf_seeds: numpy.ndarray
        The array of seed points to start the fieldline tracing from

    Returns
    -------
    surf_field_lines: tvtk.StreamTracer instance
        The fieldline tracer with the fieldlines stored inside it.

    surface: tvtk.RuledSurfaceFilter instance
        The surface built from the StreamTracer instance
    """
    #Make a streamline instance with the bfield
    surf_field_lines = tvtk.StreamTracer()
#    surf_field_lines.input_connection = bfield
    tvtk_common.configure_input(surf_field_lines, bfield)

    tvtk_common.configure_source_data(surf_field_lines, surf_seeds)
#    surf_field_lines.source = surf_seeds
    surf_field_lines.integrator = tvtk.RungeKutta4()
    surf_field_lines.maximum_propagation = 1000
    surf_field_lines.integration_direction = 'backward'
    surf_field_lines.update()

    #Create surface from 'parallel' lines
    surface = tvtk.RuledSurfaceFilter()
    tvtk_common.configure_connection(surface, surf_field_lines)
#    surface.input = surf_field_lines.output
    surface.close_surface = True
    surface.pass_lines = True
    surface.offset = 0
    surface.distance_factor = 30
    surface.ruled_mode = 'point_walk'
#    surface.ruled_mode = 'resample'
#    surface.resolution = (10,1)
    surface.update()

    return surf_field_lines, surface
コード例 #2
0
ファイル: pipeline_base.py プロジェクト: bergtholdt/mayavi
 def configure_connection(self, obj, inp):
     """ Configure topology for vtk pipeline obj."""
     tvtk_common.configure_connection(obj, inp)
コード例 #3
0
 def configure_connection(self, obj, inp):
     """ Configure topology for vtk pipeline obj."""
     tvtk_common.configure_connection(obj, inp)