Plugins module

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

Classes

simphony_mayavi.plugins.add_source_panel.AddSourcePanel
AddEnginePanel A panel to add a new modeling engine by creating one from a factory function.
simphony_mayavi.plugins.add_engine_source_to_mayavi.AddEngineSourceToMayavi
EngineManager A basic container of Simphony Engine that comes with a GUI.
EngineManagerMayavi2 The Simphony panel in the Mayavi2 application
simphony_mayavi.plugins.engine_manager_standalone.EngineManagerStandalone
simphony_mayavi.plugins.engine_manager_standalone_ui.EngineManagerStandaloneUI
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

simphony_mayavi.plugins.add_engine_source_to_mayavi.add_source_and_modules_to_scene

Descriptions

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.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.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

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