Plugins module

This module contains classes the Simphony plugins for the Mayavi2 application.

Classes

AddSourcePanel Standalone UI for adding datasets from a modeling engine to
AddEnginePanel A panel to add a new modeling engine by creating one from a factory function.
AddEngineSourceToMayavi This class provides the functions needed for loading a dataset from an engine and visualising it in Mayavi with the default visualisation pipeline.
EngineManager A basic container of Simphony Engine that comes with a GUI.
EngineManagerMayavi2 The Simphony panel in the Mayavi2 application
EngineManagerStandalone Standalone non-GUI manager for visualising datasets from a Simphony Modeling Engine, running the engine and animating the results.
EngineManagerStandaloneUI Standalone GUI for visualising datasets from a modeling engine,
RunAndAnimate Standalone non-GUI based controller for running a Simphony Modeling Engine and animating the CUDS dataset in Mayavi.
RunAndAnimatePanel GUI for running a Simphony Modeling Engine and animating
TabbedPanelCollection Collect a list of HasTraits instances and display each

Functions

add_source_and_modules_to_scene Add a data source to the current Mayavi scene

Descriptions

class simphony_mayavi.plugins.add_source_panel.AddSourcePanel[source]

Bases: traits.has_traits.HasTraits

Standalone UI for adding datasets from a modeling engine to a Mayavi scene

engine = ABCModelingEngine

Simphony Modeling Engine wrapper

engine_name = str

Name of the modeling engine

mayavi_engine = mayavi.api.Engine

the mayavi engine that manages the scenes

show_config()[source]

Show the GUI

class simphony_mayavi.plugins.add_engine_panel.AddEnginePanel[source]

Bases: traits.has_traits.HasTraits

A panel to add a new modeling engine by creating one from a factory function. Then send it to the EngineManager instance engine_manager

class simphony_mayavi.plugins.add_engine_source_to_mayavi.AddEngineSourceToMayavi(engine, mayavi_engine)[source]

Bases: object

This class provides the functions needed for loading a dataset from an engine and visualising it in Mayavi with the default visualisation pipeline.

Paramaters

engine : ABCModelingEngine
from which dataset is loaded
mayavi_engine : mayavi.api.Engine
the mayavi engine that manages the scenes
add_dataset_to_scene(name, **kwargs)[source]

Add a dataset from the engine to Mayavi

Parameters:name (str) – Name of the CUDS dataset to be loaded from the modeling engine
**kwargs :
Keyword arguments accepted by CUDSSource
class simphony_mayavi.plugins.engine_manager.EngineManager[source]

Bases: traits.has_traits.HasTraits

A basic container of Simphony Engine that comes with a GUI.

Additional panel can be added to support more operations related to the modeling engines

engines = dict

Mappings of Simphony Modeling Engines in this manager

engine_name = str

Name of the Simphony Modeling Engine

engine = ABCModelingEngine

Simphony Modeling Engine

add_engine(name, modeling_engine)[source]

Add a Simphony Engine to the manager

Parameters:
  • name (str) – Name to be associated with the modeling engine
  • modeling_engine (ABCModelingEngine) – Simphony Engine Wrapper
remove_engine(name)[source]

Remove a modeling engine from the manager. If modeling engine to be removed is currently selected, select the one of the remaining engines

Parameters:name (str) – Name associated with the engine to be removed
class simphony_mayavi.plugins.engine_manager_mayavi2.EngineManagerMayavi2[source]

Bases: simphony_mayavi.plugins.engine_manager.EngineManager

The Simphony panel in the Mayavi2 application

get_mayavi()[source]

Get the mayavi engine in Mayavi2

class simphony_mayavi.plugins.engine_manager_standalone.EngineManagerStandalone(engine, mayavi_engine=None)[source]

Bases: object

Standalone non-GUI manager for visualising datasets from a Simphony Modeling Engine, running the engine and animating the results.

Parameters:
  • engine (ABCModelingEngine) –
  • mayavi_engine (mayavi.api.Engine) – default to be mayavi.mlab.get_engine()
add_dataset_to_scene(*args, **kwargs)

Add a dataset from the engine to Mayavi

Parameters:name (str) – Name of the CUDS dataset to be loaded from the modeling engine
**kwargs :
Keyword arguments accepted by CUDSSource
animate(*args, **kwargs)

Run the modeling engine, and animate the scene. If there is no source in the scene or none of the sources belongs to the selected Engine engine, a RuntimeError is raised.

Parameters:
  • number_of_runs (int) – the number of times the engine.run() is called
  • delay (int) – delay between each run. If None, use previous setting or the Mayavi’s default (500)
  • ui (bool) – whether an UI is shown, default is False
  • update_all_scenes (bool) – whether all scenes are updated, default is False: i.e. only the current scene is updated
Raises:
RuntimeError
if nothing in scene(s) belongs to engine
class simphony_mayavi.plugins.engine_manager_standalone_ui.EngineManagerStandaloneUI(engine_name='', engine=None, mayavi_engine=None)[source]

Bases: simphony_mayavi.plugins.engine_manager.EngineManager

Standalone GUI for visualising datasets from a modeling engine, running the engine and animating the results

Parameters:
  • engine_name (str) – Name of the Simphony Modeling Engine wrapper
  • engine (ABCModelingEngine) – Simphony Modeling Engine wrapper
  • mayavi_engine (mayavi.api.engine) – Default to be mayavi.mlab.get_engine()
show_config()[source]

Show the GUI with all the panels

class simphony_mayavi.plugins.run_and_animate.RunAndAnimate(engine, mayavi_engine)[source]

Bases: object

Standalone non-GUI based controller for running a Simphony Modeling Engine and animating the CUDS dataset in Mayavi.

Precondition: The required CUDS datasets are already visible in the Mayavi scene(s)

Parameters:
  • engine (ABCModelingEngine) – Simphony Modeling Engine
  • mayavi_engine (mayavi.api.Engine) – for retrieving scenes and visible datasets
animate(number_of_runs, delay=None, ui=False, update_all_scenes=False)[source]

Run the modeling engine, and animate the scene. If there is no source in the scene or none of the sources belongs to the selected Engine engine, a RuntimeError is raised.

Parameters:
  • number_of_runs (int) – the number of times the engine.run() is called
  • delay (int) – delay between each run. If None, use previous setting or the Mayavi’s default (500)
  • ui (bool) – whether an UI is shown, default is False
  • update_all_scenes (bool) – whether all scenes are updated, default is False: i.e. only the current scene is updated
Raises:
RuntimeError
if nothing in scene(s) belongs to engine
class simphony_mayavi.plugins.run_and_animate_panel.RunAndAnimatePanel[source]

Bases: traits.has_traits.HasTraits

GUI for running a Simphony Modeling Engine and animating the result in an existing scene

engine = ABCModelingEngine

Simphony Engine

mayavi_engine = mayavi.api.Engine

The mayavi engine that manages the scenes

time_step = float

CUBA.TIME_STEP of the Simphony Engine

number_of_time_steps = float

CUBA.NUMBER_OF_TIME_STEPS of the Simphony Engine

show_config()[source]

Show the GUI

class simphony_mayavi.plugins.tabbed_panel_collection.TabbedPanelCollection[source]

Bases: traits.has_traits.HasTraits

Collect a list of HasTraits instances and display each of them as a tab in a tabbed notebook using ListEditor

panels = list

Instances of HasTraits to be displayed in tabs

selected_panel = HasTraits

Currectly selected (visible) instance

classmethod create(**kwargs)[source]

Create a TabbedPanelCollection containing the given HasTraits instances.

**kwargs
The values are the HasTraits instances to be collected. The keys in the keyword arguments are used to define attributes of the TabbedPanelCollection so that the HasTraits instances can be retrieved easily. As with any keyword arguments, the order of the keys is lost.
Raises:
AttributeError
If the given key is a pre-defined attribute/method

Examples

>>> all_panels = TabbedPanelCollection(panel_a=PanelA(),
                                       panel_b=PanelB())
>>> all_panels.panel_a
<PanelA at 0x7fdc974febd0>
>>> all_panels.configure_traits()  # should display a notebook
simphony_mayavi.plugins.add_engine_source_to_mayavi.add_source_and_modules_to_scene(mayavi_engine, source)[source]

Add a data source to the current Mayavi scene in a given Mayavi engine and add the modules appropriate for the data

Parameters:
  • mayavi_engine (mayavi.api.Engine) –
  • source (VTKDataSource) – Examples are CUDSSource, CUDSFileSource, EngineSource, which are subclasses of VTKDataSource

Engine_wrapper module

class simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory[source]

Bases: traits.has_traits.ABCHasStrictTraits

create()[source]

Return a new engine wrapper instance

class simphony_mayavi.plugins.engine_wrappers.jyulb.JyulbFileIOEngineFactory[source]

Bases: simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory

class simphony_mayavi.plugins.engine_wrappers.jyulb.JyulbInternalEngineFactory[source]

Bases: simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory

class simphony_mayavi.plugins.engine_wrappers.kratos.KratosEngineFactory[source]

Bases: simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory

class simphony_mayavi.plugins.engine_wrappers.lammps_md.LammpsEngineFactory[source]

Bases: simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory

class simphony_mayavi.plugins.engine_wrappers.openfoam.OpenFoamFileIOEngineFactory[source]

Bases: simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory

class simphony_mayavi.plugins.engine_wrappers.openfoam.OpenFoamInternalEngineFactory[source]

Bases: simphony_mayavi.plugins.engine_wrappers.abc_engine_factory.ABCEngineFactory