示例#1
0
def snapshot(cuds, filename):
    """ Save a snapshot of the cuds object using the default visualisation.

     Parameters
     ----------
     cuds :
         A top level cuds object (e.g. a mesh). The method will detect
         the type of object and create the appropriate visualisation.

     filename : string
         The filename to use for the output file.

    """
    # adapt to CUDSSource
    if isinstance(cuds, (ABCMesh, ABCParticles, ABCLattice)):
        source = CUDSSource(cuds=cuds)
    else:
        msg = 'Provided object {} is not of any known cuds type'
        raise TypeError(msg.format(type(cuds)))

    # set image size
    size = 800, 600

    with get_figure(size=size):
        # add source
        mlab.pipeline.add_dataset(source)

        modules = default_module(source)

        # add default modules
        for module in modules:
            source.add_module(module)

        mlab.savefig(filename, size=size)
def view():
    from mayavi.modules.surface import Surface
    from simphony_mayavi.sources.api import CUDSSource

    mayavi.new_scene()  # noqa
    src = CUDSSource(cuds=mesh_inside_wrapper)
    mayavi.add_source(src)  # noqa
    s = Surface()
    mayavi.add_module(s)  # noqa
def view(dataset):
    from mayavi.modules.surface import Surface
    from simphony_mayavi.sources.api import CUDSSource

    mayavi.new_scene()  # noqa
    src = CUDSSource(cuds=dataset)
    mayavi.add_source(src)  # noqa
    s = Surface()
    mayavi.add_module(s)  # noqa
示例#4
0
 def _sources_default(self):
     return CUDSSource(), CUDSSource(), CUDSSource()
示例#5
0
def dataset2cudssource(dataset):
    return CUDSSource(cuds=dataset)