Back to index

salome-paravis  6.5.0
Classes | Functions | Variables
paravisSM Namespace Reference

Classes

class  Proxy
class  SourceProxy
class  ExodusIIReaderProxy
class  ViewLayoutProxy
class  Property
class  GenericIterator
class  VectorProperty
class  ColorArrayProperty
class  EnumerationProperty
class  FileNameProperty
class  ArraySelectionProperty
class  ArrayListProperty
class  ProxyProperty
class  InputProperty
class  DataInformation
class  ArrayInformation
class  FieldDataInformationIterator
class  FieldDataInformation
class  ProxyManager
class  PropertyIterator
class  ProxyDefinitionIterator
class  ProxyIterator
class  Connection
class  _ModuleLoader
class  PVModule
class  MissingRegistrationInformation
class  MissingProxy

Functions

def _wrap_property
def __getattr__
 if not c.HasObserver("ModifiedEvent"): self.ObserverTag =c.AddObserver("ModifiedEvent", _makeUpdateCameraMethod(weakref.ref(self))) self.Observed = c
def OutputPort
def _update_definitions
def close
 
   self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions)

CompoundProxyDefinitionsUpdated = 2001 self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions)

def __del__
def SaveState
def LoadState
def InitFromGUI
def Connect
def ReverseConnect
def Disconnect
def CreateProxy
def GetRenderView
def GetRenderViews
def GetContextViews
def CreateRenderView
def _create_view
def GetRepresentation
def CreateRepresentation
def LoadXML
def LoadPlugin
def Fetch
def AnimateReader
def GetProgressPrintingIsEnabled
def SetProgressPrintingEnabled
def ToggleProgressPrinting
def Finalize
def _getPyProxy
def _makeUpdateCameraMethod
def _createInitialize
def _createGetProperty
def _createSetProperty
def _findClassForProxy
def _printProgress
def updateModules
def _createModules
def _make_name_valid
def createModule
def __determineGroup
def __determineName
def __getName
def Register
def UnRegister
def demo1
def demo2
def demo3
def demo4
def demo5
def enableMultiServer
def switchActiveConnection
def __InitAfterConnect__
def __exposeActiveModules__
def GetConnectionFromId
 Connection(aParams[0]) ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5]) ToggleProgressPrinting() fromGUI = True.
def GetConnectionFromSession
def GetConnectionAt
def GetNumberOfConnections

Variables

dictionary __nameCounter = {}
dictionary ASSOCIATIONS = { 'POINTS' : 0, 'CELLS' : 1, 'VERTICES' : 4, 'EDGES' : 5, 'ROWS' : 6}
 ActiveConnection = None
 MultiServerConnections = None
 progressObserverTag = None
 currentAlgorithm = False
int currentProgress = 0
 fromGUI = False
dictionary _pyproxies = {}
tuple loader = _ModuleLoader()
 __LastAttrName
 Session
 Modules
 Alive

Class Documentation

class paravisSM::PVModule

Definition at line 2470 of file paravisSM.py.

class paravisSM::MissingRegistrationInformation
Exception for missing registration information. Raised when a name or group 
is not specified or when a group cannot be deduced.

Definition at line 2610 of file paravisSM.py.

class paravisSM::MissingProxy
Exception fired when the requested proxy is missing.

Definition at line 2615 of file paravisSM.py.


Function Documentation

def paravisSM.__del__ (   self)

Definition at line 1851 of file paravisSM.py.

01851 
01852     def __del__(self):
01853         if self.Alive:
01854            self.close()

def paravisSM.__determineGroup (   proxy) [private]
Internal method

Definition at line 2562 of file paravisSM.py.

02562 
02563 def __determineGroup(proxy):
02564     """Internal method"""
02565     if not proxy:
02566         return None
02567     xmlgroup = proxy.GetXMLGroup()
02568     xmlname = proxy.GetXMLName()
02569     if xmlgroup == "sources":
02570         if xmlname in ["BlockSelectionSource",
02571                        "FrustumSelectionSource",
02572                        "GlobalIDSelectionSource",
02573                        "PedigreeIDSelectionSource",
02574                        "IDSelectionSource",
02575                        "CompositeDataIDSelectionSource",
02576                        "HierarchicalDataIDSelectionSource",
02577                        "ThresholdSelectionSource",
02578                        "LocationSelectionSource"]:
02579             return "selection_sources"
02580         return "sources"
02581     elif xmlgroup == "filters":
02582         return "sources"
02583     elif xmlgroup == "representations":
02584         if xmlname == "ScalarBarWidgetRepresentation":
02585             return "scalar_bars"
02586         return "representations"
02587     elif xmlgroup == "animation_keyframes":
02588         return "animation"
02589     return xmlgroup

Here is the caller graph for this function:

def paravisSM.__determineName (   proxy,
  group 
) [private]

Definition at line 2591 of file paravisSM.py.

02591 
02592 def __determineName(proxy, group):
02593     global __nameCounter
02594     name = _make_name_valid(proxy.GetXMLLabel())
02595     if not name:
02596         return None
02597     if not __nameCounter.has_key(name):
02598         __nameCounter[name] = 1
02599         val = 1
02600     else:
02601         __nameCounter[name] += 1
02602         val = __nameCounter[name]
02603     return "%s%d" % (name, val)

Here is the call graph for this function:

Update servermanager submodules to point to the current
ActiveConnection.Modules.*

Definition at line 2965 of file paravisSM.py.

02965 
02966 def __exposeActiveModules__():
02967     """Update servermanager submodules to point to the current
02968     ActiveConnection.Modules.*"""
02969     # Expose all active module to the current servermanager module
02970     if ActiveConnection:
02971        for m in [mName for mName in dir(ActiveConnection.Modules) if mName[0] != '_' ]:
02972           exec "global %s;%s = ActiveConnection.Modules.%s" % (m,m,m)
02973 
02974 # Definitions for working in SALOME GUI mode
02975 #aParams = myParavis.GetConnectionParameters()
#ActiveConnection = Connect()

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.__getattr__ (   self,
  name 
)

if not c.HasObserver("ModifiedEvent"): self.ObserverTag =c.AddObserver("ModifiedEvent", _makeUpdateCameraMethod(weakref.ref(self))) self.Observed = c

With the exception of a few overloaded methods,
returns the SMProxy method

Definition at line 354 of file paravisSM.py.

00354 
00355     def __getattr__(self, name):
00356         """With the exception of a few overloaded methods,
00357         returns the SMProxy method"""
00358         if not self.SMProxy:
00359             raise AttributeError("class %s has no attribute %s" % ("None", name))
00360             return None
00361         # Handle GetActiveCamera specially.
00362         if name == "GetActiveCamera" and \
00363            hasattr(self.SMProxy, "GetActiveCamera"):
00364             return self.__GetActiveCamera
00365         if name == "SaveDefinition" and hasattr(self.SMProxy, "SaveDefinition"):
00366             return self.__SaveDefinition
00367         # If not a property, see if SMProxy has the method
00368         try:
00369             proxyAttr = getattr(self.SMProxy, name)
00370             self.__LastAttrName = name
00371             return self.__ConvertArgumentsAndCall
00372         except:
00373             pass
00374         return getattr(self.SMProxy, name)

def paravisSM.__getName (   proxy,
  group 
) [private]

Definition at line 2604 of file paravisSM.py.

02604 
02605 def __getName(proxy, group):
02606     pxm = ProxyManager(proxy.GetSession())
02607     if isinstance(proxy, Proxy):
02608         proxy = proxy.SMProxy
02609     return pxm.GetProxyName(group, proxy)

Here is the caller graph for this function:

def paravisSM.__InitAfterConnect__ (   connection)
This function is called everytime after a server connection is made.
Since the ProxyManager and all proxy definitions are changed every time a
new connection is made, we re-create all the modules

Definition at line 2949 of file paravisSM.py.

02949 
02950 def __InitAfterConnect__(connection):
02951     """
02952     This function is called everytime after a server connection is made.
02953     Since the ProxyManager and all proxy definitions are changed every time a
02954     new connection is made, we re-create all the modules
02955     """
02956     _createModules(connection.Modules)
02957     ## VSV fromFilter is alwais False for SALOME because it can't be changed from ParaView code
02958     #if not paraview.fromFilter:
02959         # fromFilter is set when this module is imported from the programmable
02960         # filter
02961 #    global _defUpdater
02962 #    _defUpdater = __DefinitionUpdater()
02963     connection.AttachDefinitionUpdater()
02964     pass

Here is the call graph for this function:

def paravisSM._create_view (   view_xml_name,
  session = None,
  extraArgs 
) [private]
Creates a view on the particular session. If session
is not specified, then the active session is used, if available.
This method can also be used to initialize properties by passing
keyword arguments where the key is the name of the property.

Definition at line 2032 of file paravisSM.py.

02032 
02033 def _create_view(view_xml_name, session=None, **extraArgs):
02034     """Creates a view on the particular session. If session
02035     is not specified, then the active session is used, if available.
02036     This method can also be used to initialize properties by passing
02037     keyword arguments where the key is the name of the property."""
02038     if not session:
02039         session = ActiveConnection.Session
02040     if not session:
02041         raise RuntimeError, "Cannot create view without session."
02042     pxm = ProxyManager()
02043     view_module = None
02044     if view_xml_name:
02045         view_module = CreateProxy("views", view_xml_name, session)
02046     if not view_module:
02047         return None
02048     extraArgs['proxy'] = view_module
02049     python_proxy_name = _make_name_valid(view_module.GetXMLName())
02050     proxy = rendering.__dict__[python_proxy_name](**extraArgs)
02051     return proxy

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM._createGetProperty (   pName) [private]
Internal method to create a GetXXX() method where XXX == pName.

Definition at line 2354 of file paravisSM.py.

02354 
02355 def _createGetProperty(pName):
02356     """Internal method to create a GetXXX() method where XXX == pName."""
02357     propName = pName
02358     def getProperty(self):
02359         return self.GetPropertyValue(propName)
02360     return getProperty

Here is the caller graph for this function:

def paravisSM._createInitialize (   group,
  name 
) [private]
Internal method to create an Initialize() method for the sub-classes
of Proxy

Definition at line 2336 of file paravisSM.py.

02336 
02337 def _createInitialize(group, name):
02338     """Internal method to create an Initialize() method for the sub-classes
02339     of Proxy"""
02340     pgroup = group
02341     pname = name
02342     def aInitialize(self, connection=None, update=True):
02343         if not connection:
02344             connection = ActiveConnection
02345         if not connection:
02346             raise RuntimeError,\
02347                   'Cannot create a proxy without a session.'
02348         if not connection.Session.GetProxyDefinitionManager().HasDefinition(pgroup, pname):
02349             error_msg = "The connection does not provide any definition for %s." % pname
02350             raise RuntimeError, error_msg
02351         self.InitializeFromProxy(\
02352             CreateProxy(pgroup, pname, connection.Session), update)
02353     return aInitialize

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM._createModules (   m) [private]
Called when the module is loaded, this creates sub-
modules for all know proxy groups.

Definition at line 2450 of file paravisSM.py.

02450 
02451 def _createModules(m):
02452     """Called when the module is loaded, this creates sub-
02453     modules for all know proxy groups."""
02454 
02455     m.sources = createModule('sources')
02456     m.filters = createModule('filters')
02457     m.writers = createModule('writers')
02458     m.rendering = createModule('representations')
02459     createModule('views', m.rendering)
02460     createModule("lookup_tables", m.rendering)
02461     createModule("textures", m.rendering)
02462     createModule('cameramanipulators', m.rendering)
02463     m.animation = createModule('animation')
02464     createModule('animation_keyframes', m.animation)
02465     m.implicit_functions = createModule('implicit_functions')
02466     m.piecewise_functions = createModule('piecewise_functions')
02467     m.extended_sources = createModule("extended_sources")
02468     m.misc = createModule("misc")
02469     createModule("incremental_point_locators", m.misc)

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM._createSetProperty (   pName) [private]
Internal method to create a SetXXX() method where XXX == pName.

Definition at line 2361 of file paravisSM.py.

02361 
02362 def _createSetProperty(pName):
02363     """Internal method to create a SetXXX() method where XXX == pName."""
02364     propName = pName
02365     def setProperty(self, value):
02366         return self.SetPropertyWithName(propName, value)
02367     return setProperty

Here is the caller graph for this function:

def paravisSM._findClassForProxy (   xmlName,
  xmlGroup 
) [private]
Given the xmlName for a proxy, returns a Proxy class. Note
that if there are duplicates, the first one is returned.

Definition at line 2368 of file paravisSM.py.

02368 
02369 def _findClassForProxy(xmlName, xmlGroup):
02370     """Given the xmlName for a proxy, returns a Proxy class. Note
02371     that if there are duplicates, the first one is returned."""
02372     global sources, filters, writers, rendering, animation, implicit_functions,\
02373            piecewise_functions, extended_sources, misc
02374     if not xmlName:
02375         return None
02376     if xmlGroup == "sources":
02377         return sources.__dict__[xmlName]
02378     elif xmlGroup == "filters":
02379         return filters.__dict__[xmlName]
02380     elif xmlGroup == "implicit_functions":
02381         return implicit_functions.__dict__[xmlName]
02382     elif xmlGroup == "piecewise_functions":
02383         return piecewise_functions.__dict__[xmlName]
02384     elif xmlGroup == "writers":
02385         return writers.__dict__[xmlName]
02386     elif xmlGroup == "extended_sources":
02387         return extended_sources.__dict__[xmlName]
02388     elif xmlName in rendering.__dict__:
02389         return rendering.__dict__[xmlName]
02390     elif xmlName in animation.__dict__:
02391         return animation.__dict__[xmlName]
02392     elif xmlName in misc.__dict__:
02393         return misc.__dict__[xmlName]
02394     else:
02395         return None

Here is the caller graph for this function:

def paravisSM._getPyProxy (   smproxy,
  outputPort = 0 
) [private]
Returns a python wrapper for a server manager proxy. This method
first checks if there is already such an object by looking in the
_pyproxies group and returns it if found. Otherwise, it creates a
new one. Proxies register themselves in _pyproxies upon creation.

Definition at line 2303 of file paravisSM.py.

02303 
02304 def _getPyProxy(smproxy, outputPort=0):
02305     """Returns a python wrapper for a server manager proxy. This method
02306     first checks if there is already such an object by looking in the
02307     _pyproxies group and returns it if found. Otherwise, it creates a
02308     new one. Proxies register themselves in _pyproxies upon creation."""
02309     if not smproxy:
02310         return None
02311     if (smproxy, outputPort) in _pyproxies:
02312         return _pyproxies[(smproxy, outputPort)]()
02313 
02314     xmlName = smproxy.GetXMLName()
02315     if smproxy.GetXMLLabel():
02316         xmlName = smproxy.GetXMLLabel()
02317     classForProxy = _findClassForProxy(_make_name_valid(xmlName), smproxy.GetXMLGroup())
02318     if classForProxy:
02319         retVal = classForProxy(proxy=smproxy, port=outputPort)
02320     else:
02321         retVal = Proxy(proxy=smproxy, port=outputPort)
02322     return retVal

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM._make_name_valid (   name) [private]
Make a string into a valid Python variable name.

Definition at line 2473 of file paravisSM.py.

02473 
02474 def _make_name_valid(name):
02475     """Make a string into a valid Python variable name."""
02476     if not name:
02477         return None
02478     import string
02479     valid_chars = "_%s%s" % (string.ascii_letters, string.digits)
02480     name = str().join([c for c in name if c in valid_chars])
02481     if not name[0].isalpha():
02482         name = 'a' + name
02483     return name

Here is the caller graph for this function:

def paravisSM._makeUpdateCameraMethod (   rv) [private]
This internal method is used to create observer methods 

Definition at line 2323 of file paravisSM.py.

02323 
02324 def _makeUpdateCameraMethod(rv):
02325     """ This internal method is used to create observer methods """
02326     if not hasattr(rv(), "BlockUpdateCamera"):
02327         rv().add_attribute("BlockUpdateCamera", False)
02328     def UpdateCamera(obj, string):
02329         if not rv().BlockUpdateCamera:
02330           # used to avoid some nasty recursion that occurs when interacting in
02331           # the GUI.
02332           rv().BlockUpdateCamera = True
02333           rv().SynchronizeCameraProperties()
02334           rv().BlockUpdateCamera = False
02335     return UpdateCamera

def paravisSM._printProgress (   caller,
  event 
) [private]
The default event handler for progress. Prints algorithm
name and 1 '.' per 10% progress.

Definition at line 2396 of file paravisSM.py.

02396 
02397 def _printProgress(caller, event):
02398     """The default event handler for progress. Prints algorithm
02399     name and 1 '.' per 10% progress."""
02400     global currentAlgorithm, currentProgress
02401 
02402     pm = vtkProcessModule.GetProcessModule()
02403     progress = pm.GetLastProgress() / 10
02404     # If we got a 100% as the first thing, ignore
02405     # This is to get around the fact that some vtk
02406     # algorithms report 100% more than once (which is
02407     # a bug)
02408     if not currentAlgorithm and progress == 10:
02409         return
02410     alg = pm.GetLastProgressName()
02411     if alg != currentAlgorithm and alg:
02412         if currentAlgorithm:
02413             while currentProgress <= 10:
02414                 import sys
02415                 sys.stdout.write(".")
02416                 currentProgress += 1
02417             print "]"
02418             currentProgress = 0
02419         print alg, ": [ ",
02420         currentAlgorithm = alg
02421     while currentProgress <= progress:
02422         import sys
02423         sys.stdout.write(".")
02424         #sys.stdout.write("%d " % pm.GetLastProgress())
02425         currentProgress += 1
02426     if progress == 10:
02427         print "]"
02428         currentAlgorithm = None
02429         currentProgress = 0

def paravisSM._update_definitions (   caller,
  event 
) [private]

Definition at line 1784 of file paravisSM.py.

01784 
01785 def _update_definitions(caller, event):
01786     updateModules(ActiveConnection.Modules)

Here is the call graph for this function:

def paravisSM._wrap_property (   proxy,
  smproperty 
) [private]
Internal function.
Given a server manager property and its domains, returns the
appropriate python object.

Definition at line 56 of file paravisSM.py.

00056 
00057 def _wrap_property(proxy, smproperty):
00058     """ Internal function.
00059     Given a server manager property and its domains, returns the
00060     appropriate python object.
00061     """
00062     property = None
00063     if smproperty.IsA("vtkSMStringVectorProperty"):
00064         al = smproperty.GetDomain("array_list")
00065         if  al and al.IsA("vtkSMArraySelectionDomain") and \
00066             smproperty.GetRepeatable():
00067             property = ArrayListProperty(proxy, smproperty)
00068         elif al and al.IsA("vtkSMArrayListDomain") and smproperty.GetNumberOfElements() == 5:
00069             property = ArraySelectionProperty(proxy, smproperty)
00070         else:
00071             iter = smproperty.NewDomainIterator()
00072             isFileName = False
00073             while not iter.IsAtEnd():
00074                 # Refer to BUG #9710 to see why optional domains need to be
00075                 # ignored.
00076                 if iter.GetDomain().IsA("vtkSMFileListDomain") and \
00077                   iter.GetDomain().GetIsOptional() == 0 :
00078                     isFileName = True
00079                     break
00080                 iter.Next()
00081             iter.UnRegister(None)
00082             if isFileName:
00083                 property = FileNameProperty(proxy, smproperty)
00084             elif _make_name_valid(smproperty.GetXMLLabel()) == 'ColorArrayName':
00085                 property = ColorArrayProperty(proxy, smproperty)
00086             else:
00087                 property = VectorProperty(proxy, smproperty)
00088     elif smproperty.IsA("vtkSMVectorProperty"):
00089         if smproperty.IsA("vtkSMIntVectorProperty") and \
00090           smproperty.GetDomain("enum"):
00091             property = EnumerationProperty(proxy, smproperty)
00092         else:
00093             property = VectorProperty(proxy, smproperty)
00094     elif smproperty.IsA("vtkSMInputProperty"):
00095         property = InputProperty(proxy, smproperty)
00096     elif smproperty.IsA("vtkSMProxyProperty"):
00097         property = ProxyProperty(proxy, smproperty)
00098     else:
00099         property = Property(proxy, smproperty)
00100     return property

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.AnimateReader (   reader,
  view,
  filename = None 
)
This is a utility function that, given a reader and a view
animates over all time steps of the reader. If the optional
filename is provided, a movie is created (type depends on the
extension of the filename.

Definition at line 2225 of file paravisSM.py.

02225 
02226 def AnimateReader(reader, view, filename=None):
02227     """This is a utility function that, given a reader and a view
02228     animates over all time steps of the reader. If the optional
02229     filename is provided, a movie is created (type depends on the
02230     extension of the filename."""
02231     if not reader:
02232         raise RuntimeError, "No reader was specified, cannot animate."
02233     if not view:
02234         raise RuntimeError, "No view was specified, cannot animate."
02235     # Create an animation scene
02236     scene = animation.AnimationScene()
02237 
02238     # We need to have the reader and the view registered with
02239     # the time keeper. This is how the scene gets its time values.
02240     try:
02241         tk = ProxyManager().GetProxiesInGroup("timekeeper").values()[0]
02242         scene.TimeKeeper = tk
02243     except IndexError:
02244         tk = misc.TimeKeeper()
02245         scene.TimeKeeper = tk
02246 
02247     if not reader in tk.TimeSources:
02248         tk.TimeSources.append(reader)
02249     if not view in tk.Views:
02250         tk.Views.append(view)
02251 
02252 
02253     # with 1 view
02254     scene.ViewModules = [view]
02255     # Update the reader to get the time information
02256     reader.UpdatePipelineInformation()
02257     # Animate from 1st time step to last
02258     scene.StartTime = reader.TimestepValues.GetData()[0]
02259     scene.EndTime = reader.TimestepValues.GetData()[-1]
02260 
02261     # Each frame will correspond to a time step
02262     scene.PlayMode = 2 #Snap To Timesteps
02263 
02264     # Create a special animation cue for time.
02265     cue = animation.TimeAnimationCue()
02266     cue.AnimatedProxy = view
02267     cue.AnimatedPropertyName = "ViewTime"
02268     scene.Cues = [cue]
02269 
02270     if filename:
02271         writer = vtkSMAnimationSceneImageWriter()
02272         writer.SetFileName(filename)
02273         writer.SetFrameRate(1)
02274         writer.SetAnimationScene(scene.SMProxy)
02275 
02276         # Now save the animation.
02277         if not writer.Save():
02278             raise RuntimeError, "Saving of animation failed!"
02279     else:
02280         scene.Play()
02281     return scene

Here is the caller graph for this function:

def paravisSM.close (   self)

   self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions)

CompoundProxyDefinitionsUpdated = 2001 self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions)

Definition at line 1843 of file paravisSM.py.

01843 
01844     def close(self):
01845         if self.DefinitionObserverTag:
01846             self.Session.GetProxyDefinitionManager().RemoveObserver(self.DefinitionObserverTag)
01847             self.Session.GetProxyDefinitionManager().RemoveObserver(self.CustomDefinitionObserverTag)
01848         self.Session = None
01849         self.Modules = None
01850         self.Alive = False

def paravisSM.Connect (   ds_host = None,
  ds_port = 11111,
  rs_host = None,
  rs_port = 22221 
)
Use this function call to create a new session. On success,
it returns a vtkSMSession object that abstracts the connection.
Otherwise, it returns None.
There are several ways in which this function can be called:
* When called with no arguments, it creates a new session
 to the built-in server on the client itself.
* When called with ds_host and ds_port arguments, it
  attempts to connect to a server(data and render server on the same server)
  on the indicated host:port.
* When called with ds_host, ds_port, rs_host, rs_port, it
  creates a new connection to the data server on ds_host:ds_port and to the
  render server on rs_host: rs_port.

Definition at line 1903 of file paravisSM.py.

01903 
01904 def Connect(ds_host=None, ds_port=11111, rs_host=None, rs_port=22221):
01905     """
01906     Use this function call to create a new session. On success,
01907     it returns a vtkSMSession object that abstracts the connection.
01908     Otherwise, it returns None.
01909     There are several ways in which this function can be called:
01910     * When called with no arguments, it creates a new session
01911      to the built-in server on the client itself.
01912     * When called with ds_host and ds_port arguments, it
01913       attempts to connect to a server(data and render server on the same server)
01914       on the indicated host:port.
01915     * When called with ds_host, ds_port, rs_host, rs_port, it
01916       creates a new connection to the data server on ds_host:ds_port and to the
01917       render server on rs_host: rs_port.
01918     """
01919     global fromGUI
01920     if fromGUI:
01921         raise RuntimeError, "Cannot create a session through python. Use the GUI to setup the connection."
01922     if ds_host == None:
01923         session = vtkSMSession()
01924     elif rs_host == None:
01925         session = vtkSMSessionClient()
01926         session.Connect("cs://%s:%d" % (ds_host, ds_port))
01927     else:
01928         session = vtkSMSessionClient()
01929         session.Connect("cdsrs://%s:%d/%s:%d" % (ds_host, ds_port, rs_host, rs_port))
01930     id = vtkProcessModule.GetProcessModule().RegisterSession(session)
01931     connection = Connection(id, session)
01932     return connection

Here is the caller graph for this function:

def paravisSM.createModule (   groupName,
  mdl = None 
)
Populates a module with proxy classes defined in the given group.
If mdl is not specified, it also creates the module

Definition at line 2484 of file paravisSM.py.

02484 
02485 def createModule(groupName, mdl=None):
02486     """Populates a module with proxy classes defined in the given group.
02487     If mdl is not specified, it also creates the module"""
02488     global ActiveConnection
02489 
02490     if not ActiveConnection:
02491       raise RuntimeError, "Please connect to a server using \"Connect\""
02492 
02493     pxm = ProxyManager()
02494     # Use prototypes to find all proxy types.
02495     pxm.InstantiateGroupPrototypes(groupName)
02496 
02497     debug = False
02498     if not mdl:
02499         debug = True
02500         mdl = PVModule()
02501     definitionIter = pxm.NewDefinitionIterator(groupName)
02502     for i in definitionIter:
02503         proxyName = i['key']
02504         proto = pxm.GetPrototypeProxy(groupName, proxyName)
02505         if not proto:
02506            print "Error while loading %s/%s %s"%(groupName, i['group'], proxyName)
02507            continue
02508         pname = proxyName
02509         if proto.GetXMLLabel():
02510             pname = proto.GetXMLLabel()
02511         pname = _make_name_valid(pname)
02512         if not pname:
02513             continue
02514         if pname in mdl.__dict__:
02515             if debug:
02516                 print "Warning: %s is being overwritten. This may point to an issue in the ParaView configuration files" % pname
02517         cdict = {}
02518         # Create an Initialize() method for this sub-class.
02519         cdict['Initialize'] = _createInitialize(groupName, proxyName)
02520         iter = PropertyIterator(proto)
02521         # Add all properties as python properties.
02522         for prop in iter:
02523             propName = iter.GetKey()
02524             if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
02525                    or prop.GetIsInternal():
02526                 continue
02527             names = [propName]
02528             names = [iter.PropertyLabel]
02529                 
02530             propDoc = None
02531             if prop.GetDocumentation():
02532                 propDoc = prop.GetDocumentation().GetDescription()
02533             for name in names:
02534                 name = _make_name_valid(name)
02535                 if name:
02536                     cdict[name] = property(_createGetProperty(propName),
02537                                            _createSetProperty(propName),
02538                                            None,
02539                                            propDoc)
02540         # Add the documentation as the class __doc__
02541         if proto.GetDocumentation() and \
02542            proto.GetDocumentation().GetDescription():
02543             doc = proto.GetDocumentation().GetDescription()
02544         else:
02545             doc = Proxy.__doc__
02546         cdict['__doc__'] = doc
02547         # Create the new type
02548         if proto.GetXMLName() == "ExodusIIReader":
02549             superclasses = (ExodusIIReaderProxy,)
02550         elif proto.IsA("vtkSMSourceProxy"):
02551             superclasses = (SourceProxy,)
02552         elif proto.IsA("vtkSMViewLayoutProxy"):
02553             superclasses = (ViewLayoutProxy,)
02554         else:
02555             superclasses = (Proxy,)
02556 
02557         cobj = type(pname, superclasses, cdict)
02558         # Add it to the modules dictionary
02559         mdl.__dict__[pname] = cobj
02560     return mdl
02561 

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.CreateProxy (   xml_group,
  xml_name,
  session = None 
)
Creates a proxy. If session is set, the proxy's session is
set accordingly. If session is None, the current Session is used, if
present. You should not have to use method normally. Instantiate the
appropriate class from the appropriate module, for example:
sph = servermanager.sources.SphereSource()

Definition at line 1980 of file paravisSM.py.

01980 
01981 def CreateProxy(xml_group, xml_name, session=None):
01982     """Creates a proxy. If session is set, the proxy's session is
01983     set accordingly. If session is None, the current Session is used, if
01984     present. You should not have to use method normally. Instantiate the
01985     appropriate class from the appropriate module, for example:
01986     sph = servermanager.sources.SphereSource()"""
01987     global ActiveConnection
01988     if not session:
01989         session = ActiveConnection.Session
01990     if not session:
01991         raise RuntimeError, "Cannot create objects without a session."
01992     pxm = ProxyManager(session)
01993     return pxm.NewProxy(xml_group, xml_name)

Here is the caller graph for this function:

def paravisSM.CreateRenderView (   session = None,
  extraArgs 
)
Creates a render window on the particular session. If session
is not specified, then the active session is used, if available.

This method can also be used to initialize properties by passing
keyword arguments where the key is the name of the property. In addition
registrationGroup and registrationName (optional) can be specified (as
keyword arguments) to automatically register the proxy with the proxy
manager.

Definition at line 2021 of file paravisSM.py.

02021 
02022 def CreateRenderView(session=None, **extraArgs):
02023     """Creates a render window on the particular session. If session
02024     is not specified, then the active session is used, if available.
02025 
02026     This method can also be used to initialize properties by passing
02027     keyword arguments where the key is the name of the property. In addition
02028     registrationGroup and registrationName (optional) can be specified (as
02029     keyword arguments) to automatically register the proxy with the proxy
02030     manager."""
02031     return _create_view("RenderView", session, **extraArgs)

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.CreateRepresentation (   aProxy,
  view,
  extraArgs 
)
Creates a representation for the proxy and adds it to the render
module.

This method can also be used to initialize properties by passing
keyword arguments where the key is the name of the property.In addition
registrationGroup and registrationName (optional) can be specified (as
keyword arguments) to automatically register the proxy with the proxy
manager.

This method tries to create the best possible representation for the given
proxy in the given view. Additionally, the user can specify proxyName
(optional) to create a representation of a particular type.

Definition at line 2060 of file paravisSM.py.

02060 
02061 def CreateRepresentation(aProxy, view, **extraArgs):
02062     """Creates a representation for the proxy and adds it to the render
02063     module.
02064 
02065     This method can also be used to initialize properties by passing
02066     keyword arguments where the key is the name of the property.In addition
02067     registrationGroup and registrationName (optional) can be specified (as
02068     keyword arguments) to automatically register the proxy with the proxy
02069     manager.
02070 
02071     This method tries to create the best possible representation for the given
02072     proxy in the given view. Additionally, the user can specify proxyName
02073     (optional) to create a representation of a particular type."""
02074 
02075     global rendering
02076     if not aProxy:
02077         raise RuntimeError, "proxy argument cannot be None."
02078     if not view:
02079         raise RuntimeError, "view argument cannot be None."
02080     if "proxyName" in extraArgs:
02081       display = CreateProxy("representations", extraArgs['proxyName'], None)
02082       del extraArgs['proxyName']
02083     else:
02084       display = view.SMProxy.CreateDefaultRepresentation(aProxy.SMProxy, 0)
02085       if display:
02086         display.UnRegister(None)
02087     if not display:
02088         return None
02089     extraArgs['proxy'] = display
02090     proxy = rendering.__dict__[display.GetXMLName()](**extraArgs)
02091     proxy.Input = aProxy
02092     proxy.UpdateVTKObjects()
02093     view.Representations.append(proxy)
02094     return proxy

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.demo1 ( )
This simple demonstration creates a sphere, renders it and delivers
it to the client using Fetch. It returns a tuple of (data, render
view)

Definition at line 2660 of file paravisSM.py.

02660 
02661 def demo1():
02662     """This simple demonstration creates a sphere, renders it and delivers
02663     it to the client using Fetch. It returns a tuple of (data, render
02664     view)"""
02665     if not ActiveConnection:
02666         Connect()
02667     ss = sources.Sphere(Radius=2, ThetaResolution=32)
02668     shr = filters.Shrink(Input=OutputPort(ss,0))
02669     cs = sources.Cone()
02670     app = filters.AppendDatasets()
02671     app.Input = [shr, cs]
02672     rv = CreateRenderView()
02673     rep = CreateRepresentation(app, rv)
02674     rv.ResetCamera()
02675     rv.StillRender()
02676     data = Fetch(ss)
02677 
02678     return (data, rv)

Here is the call graph for this function:

def paravisSM.demo2 (   fname = "/Users/berk/Work/ParaViewData/Data/disk_out_ref.ex2")
This method demonstrates the user of a reader, representation and
view. It also demonstrates how meta-data can be obtained using proxies.
Make sure to pass the full path to an exodus file. Also note that certain
parameters are hard-coded for disk_out_ref.ex2 which can be found
in ParaViewData. This method returns the render view.

Definition at line 2679 of file paravisSM.py.

02679 
02680 def demo2(fname="/Users/berk/Work/ParaViewData/Data/disk_out_ref.ex2"):
02681     """This method demonstrates the user of a reader, representation and
02682     view. It also demonstrates how meta-data can be obtained using proxies.
02683     Make sure to pass the full path to an exodus file. Also note that certain
02684     parameters are hard-coded for disk_out_ref.ex2 which can be found
02685     in ParaViewData. This method returns the render view."""
02686     if not ActiveConnection:
02687         Connect()
02688     # Create the exodus reader and specify a file name
02689     reader = sources.ExodusIIReader(FileName=fname)
02690     # Get the list of point arrays.
02691     arraySelection = reader.PointVariables
02692     print arraySelection.Available
02693     # Select all arrays
02694     arraySelection.SetData(arraySelection.Available)
02695 
02696     # Next create a default render view appropriate for the session type.
02697     rv = CreateRenderView()
02698     # Create the matching representation
02699     rep = CreateRepresentation(reader, rv)
02700     rep.Representation = 1 # Wireframe
02701     # Black background is not pretty
02702     rv.Background = [0.4, 0.4, 0.6]
02703     rv.StillRender()
02704     # Reset the camera to include the whole thing
02705     rv.ResetCamera()
02706     rv.StillRender()
02707     # Change the elevation of the camera. See VTK documentation of vtkCamera
02708     # for camera parameters.
02709     c = rv.GetActiveCamera()
02710     c.Elevation(45)
02711     rv.StillRender()
02712     # Now that the reader execute, let's get some information about it's
02713     # output.
02714     pdi = reader[0].PointData
02715     # This prints a list of all read point data arrays as well as their
02716     # value ranges.
02717     print 'Number of point arrays:', len(pdi)
02718     for i in range(len(pdi)):
02719         ai = pdi[i]
02720         print "----------------"
02721         print "Array:", i, ai.Name, ":"
02722         numComps = ai.GetNumberOfComponents()
02723         print "Number of components:", numComps
02724         for j in range(numComps):
02725             print "Range:", ai.GetRange(j)
02726     # White is boring. Let's color the geometry using a variable.
02727     # First create a lookup table. This object controls how scalar
02728     # values are mapped to colors. See VTK documentation for
02729     # details.
02730     lt = rendering.PVLookupTable()
02731     # Assign it to the representation
02732     rep.LookupTable = lt
02733     # Color by point array called Pres
02734     rep.ColorAttributeType = 0 # point data
02735     rep.ColorArrayName = "Pres"
02736     # Add to RGB points. These are tuples of 4 values. First one is
02737     # the scalar values, the other 3 the RGB values. This list has
02738     # 2 points: Pres: 0.00678, color: blue, Pres: 0.0288, color: red
02739     lt.RGBPoints = [0.00678, 0, 0, 1, 0.0288, 1, 0, 0]
02740     lt.ColorSpace = 1 # HSV
02741     rv.StillRender()
02742     return rv

Here is the call graph for this function:

def paravisSM.demo3 ( )
This method demonstrates the use of servermanager with numpy as
well as pylab for plotting. It creates an artificial data sources,
probes it with a line, delivers the result to the client using Fetch
and plots it using pylab. This demo requires numpy and pylab installed.
It returns a tuple of (data, render view).

Definition at line 2743 of file paravisSM.py.

02743 
02744 def demo3():
02745     """This method demonstrates the use of servermanager with numpy as
02746     well as pylab for plotting. It creates an artificial data sources,
02747     probes it with a line, delivers the result to the client using Fetch
02748     and plots it using pylab. This demo requires numpy and pylab installed.
02749     It returns a tuple of (data, render view)."""
02750     import paraview.numpy_support
02751     import pylab
02752 
02753     if not ActiveConnection:
02754         Connect()
02755     # Create a synthetic data source
02756     source = sources.Wavelet()
02757     # Let's get some information about the data. First, for the
02758     # source to execute
02759     source.UpdatePipeline()
02760 
02761     di = source.GetDataInformation()
02762     print "Data type:", di.GetPrettyDataTypeString()
02763     print "Extent:", di.GetExtent()
02764     print "Array name:", \
02765           source[0].PointData[0].Name
02766 
02767     rv = CreateRenderView()
02768 
02769     rep1 = CreateRepresentation(source, rv)
02770     rep1.Representation = 3 # outline
02771 
02772     # Let's apply a contour filter
02773     cf = filters.Contour(Input=source, ContourValues=[200])
02774 
02775     # Select the array to contour by
02776     #cf.SelectInputScalars = 'RTData'
02777 
02778     rep2 = CreateRepresentation(cf, rv)
02779 
02780     rv.Background = (0.4, 0.4, 0.6)
02781     # Reset the camera to include the whole thing
02782     rv.StillRender()
02783     rv.ResetCamera()
02784     rv.StillRender()
02785 
02786     # Now, let's probe the data
02787     probe = filters.ResampleWithDataset(Input=source)
02788     # with a line
02789     line = sources.Line(Resolution=60)
02790     # that spans the dataset
02791     bounds = di.GetBounds()
02792     print "Bounds: ", bounds
02793     line.Point1 = bounds[0:6:2]
02794     line.Point2 = bounds[1:6:2]
02795 
02796     probe.Source = line
02797 
02798     # Render with the line
02799     rep3 = CreateRepresentation(line, rv)
02800     rv.StillRender()
02801 
02802     # Now deliver it to the client. Remember, this is for small data.
02803     data = Fetch(probe)
02804     # Convert it to a numpy array
02805     data = paraview.numpy_support.vtk_to_numpy(
02806       data.GetPointData().GetArray("RTData"))
02807     # Plot it using matplotlib
02808     pylab.plot(data)
02809     pylab.show()
02810 
02811     return (data, rv, probe)

Here is the call graph for this function:

def paravisSM.demo4 (   fname = "/Users/berk/Work/ParaViewData/Data/can.ex2")
This method demonstrates the user of AnimateReader for
creating animations.

Definition at line 2812 of file paravisSM.py.

02812 
02813 def demo4(fname="/Users/berk/Work/ParaViewData/Data/can.ex2"):
02814     """This method demonstrates the user of AnimateReader for
02815     creating animations."""
02816     if not ActiveConnection:
02817         Connect()
02818     reader = sources.ExodusIIReader(FileName=fname)
02819     view = CreateRenderView()
02820     repr = CreateRepresentation(reader, view)
02821     view.StillRender()
02822     view.ResetCamera()
02823     view.StillRender()
02824     c = view.GetActiveCamera()
02825     c.Elevation(95)
02826     return AnimateReader(reader, view)
02827 

Here is the call graph for this function:

def paravisSM.demo5 ( )
Simple sphere animation

Definition at line 2828 of file paravisSM.py.

02828 
02829 def demo5():
02830     """ Simple sphere animation"""
02831     if not ActiveConnection:
02832         Connect()
02833     sphere = sources.Sphere()
02834     view = CreateRenderView()
02835     repr = CreateRepresentation(sphere, view)
02836 
02837     view.StillRender()
02838     view.ResetCamera()
02839     view.StillRender()
02840 
02841     # Create an animation scene
02842     scene = animation.AnimationScene()
02843     # Add 1 view
02844     scene.ViewModules = [view]
02845 
02846     # Create a cue to animate the StartTheta property
02847     cue = animation.KeyFrameAnimationCue()
02848     cue.AnimatedProxy = sphere
02849     cue.AnimatedPropertyName = "StartTheta"
02850     # Add it to the scene's cues
02851     scene.Cues = [cue]
02852 
02853     # Create 2 keyframes for the StartTheta track
02854     keyf0 = animation.CompositeKeyFrame()
02855     keyf0.Type = 2 # Set keyframe interpolation type to Ramp.
02856     # At time = 0, value = 0
02857     keyf0.KeyTime = 0
02858     keyf0.KeyValues= [0]
02859 
02860     keyf1 = animation.CompositeKeyFrame()
02861     # At time = 1.0, value = 200
02862     keyf1.KeyTime = 1.0
02863     keyf1.KeyValues= [200]
02864 
02865     # Add keyframes.
02866     cue.KeyFrames = [keyf0, keyf1]
02867 
02868     scene.Play()
02869     return scene

Here is the call graph for this function:

def paravisSM.Disconnect (   session = None)
Disconnects the connection. Make sure to clear the proxy manager
first.

Definition at line 1953 of file paravisSM.py.

01953 
01954 def Disconnect(session=None):
01955     """Disconnects the connection. Make sure to clear the proxy manager
01956     first."""
01957     global ActiveConnection
01958     global MultiServerConnections
01959     global fromGUI
01960     if fromGUI:
01961         raise RuntimeError, "Cannot disconnect through python. Use the GUI to disconnect."
01962     if ActiveConnection and (not session or session == ActiveConnection.Session):
01963         session = ActiveConnection.Session
01964         if MultiServerConnections:
01965            MultiServerConnections.remove(ActiveConnection)
01966            ActiveConnection.close()
01967            ActiveConnection = None
01968            switchActiveConnection()
01969         else:
01970            ActiveConnection.close()
01971            ActiveConnection = None
01972     elif MultiServerConnections:
01973         for connection in MultiServerConnections:
01974           if connection.Session == session:
01975             connection.close()
01976             MultiServerConnections.remove(connection)
01977     if session:
01978       vtkProcessModule.GetProcessModule().UnRegisterSession(session)
01979     return

Here is the call graph for this function:

def paravisSM.enableMultiServer (   multiServer = True)
This method enable the current servermanager to support several
connections. Once we enable the multi-server support, the user can create
as many connection as he want and switch from one to another in order to
create and manage proxy.

Definition at line 2881 of file paravisSM.py.

02881 
02882 def enableMultiServer(multiServer=True):
02883   """This method enable the current servermanager to support several
02884   connections. Once we enable the multi-server support, the user can create
02885   as many connection as he want and switch from one to another in order to
02886   create and manage proxy."""
02887   global MultiServerConnections, ActiveConnection
02888   if not multiServer and MultiServerConnections:
02889       raise RuntimeError, "Once we enable Multi-Server support we can not get back"
02890   MultiServerConnections = []
02891   if ActiveConnection:
02892     MultiServerConnections.append(ActiveConnection)

Here is the caller graph for this function:

def paravisSM.Fetch (   input,
  arg1 = None,
  arg2 = None,
  idx = 0 
)
A convenience method that moves data from the server to the client,
optionally performing some operation on the data as it moves.
The input argument is the name of the (proxy for a) source or filter
whose output is needed on the client.

You can use Fetch to do three things:

If arg1 is None (the default) then all of the data is brought to the client.
In parallel runs an appropriate append Filter merges the
data on each processor into one data object. The filter chosen will be
vtkAppendPolyData for vtkPolyData, vtkAppendRectilinearGrid for
vtkRectilinearGrid, vtkMultiBlockDataGroupFilter for vtkCompositeData,
and vtkAppendFilter for anything else.

If arg1 is an integer then one particular processor's output is brought to
the client. In serial runs the arg is ignored. If you have a filter that
computes results in parallel and brings them to the root node, then set
arg to be 0.

If arg1 and arg2 are a algorithms, for example vtkMinMax, the algorithm
will be applied to the data to obtain some result. Here arg1 will be
applied pre-gather and arg2 will be applied post-gather. In parallel
runs the algorithm will be run on each processor to make intermediate
results and then again on the root processor over all of the
intermediate results to create a global result.

Optional argument idx is used to specify the output port number to fetch the
data from. Default is port 0.

Definition at line 2144 of file paravisSM.py.

02144 
02145 def Fetch(input, arg1=None, arg2=None, idx=0):
02146     """
02147     A convenience method that moves data from the server to the client,
02148     optionally performing some operation on the data as it moves.
02149     The input argument is the name of the (proxy for a) source or filter
02150     whose output is needed on the client.
02151 
02152     You can use Fetch to do three things:
02153 
02154     If arg1 is None (the default) then all of the data is brought to the client.
02155     In parallel runs an appropriate append Filter merges the
02156     data on each processor into one data object. The filter chosen will be
02157     vtkAppendPolyData for vtkPolyData, vtkAppendRectilinearGrid for
02158     vtkRectilinearGrid, vtkMultiBlockDataGroupFilter for vtkCompositeData,
02159     and vtkAppendFilter for anything else.
02160 
02161     If arg1 is an integer then one particular processor's output is brought to
02162     the client. In serial runs the arg is ignored. If you have a filter that
02163     computes results in parallel and brings them to the root node, then set
02164     arg to be 0.
02165 
02166     If arg1 and arg2 are a algorithms, for example vtkMinMax, the algorithm
02167     will be applied to the data to obtain some result. Here arg1 will be
02168     applied pre-gather and arg2 will be applied post-gather. In parallel
02169     runs the algorithm will be run on each processor to make intermediate
02170     results and then again on the root processor over all of the
02171     intermediate results to create a global result.
02172 
02173     Optional argument idx is used to specify the output port number to fetch the
02174     data from. Default is port 0.
02175     """
02176 
02177     import types
02178 
02179     reducer = filters.ReductionFilter(Input=OutputPort(input,idx))
02180 
02181     #create the pipeline that reduces and transmits the data
02182     if arg1 == None:
02183         cdinfo = input.GetDataInformation(idx).GetCompositeDataInformation()
02184         if cdinfo.GetDataIsComposite():
02185             print "use composite data append"
02186             reducer.PostGatherHelperName = "vtkMultiBlockDataGroupFilter"
02187 
02188         elif input.GetDataInformation(idx).GetDataClassName() == "vtkPolyData":
02189             print "use append poly data filter"
02190             reducer.PostGatherHelperName = "vtkAppendPolyData"
02191 
02192         elif input.GetDataInformation(idx).GetDataClassName() == "vtkRectilinearGrid":
02193             print "use append rectilinear grid filter"
02194             reducer.PostGatherHelperName = "vtkAppendRectilinearGrid"
02195 
02196         elif input.GetDataInformation(idx).IsA("vtkDataSet"):
02197             print "use unstructured append filter"
02198             reducer.PostGatherHelperName = "vtkAppendFilter"
02199 
02200     elif type(arg1) is types.IntType:
02201         reducer.PassThrough = arg1
02202 
02203     else:
02204         reducer.PreGatherHelper = arg1
02205         reducer.PostGatherHelper = arg2
02206 
02207     # reduce
02208     reducer.UpdatePipeline()
02209     dataInfo = reducer.GetDataInformation(0)
02210     dataType = dataInfo.GetDataSetType()
02211     if dataInfo.GetCompositeDataSetType() > 0:
02212       dataType = dataInfo.GetCompositeDataSetType()
02213 
02214     fetcher = filters.ClientServerMoveData(Input=reducer)
02215     fetcher.OutputDataType = dataType
02216     fetcher.WholeExtent = dataInfo.GetExtent()[:]
02217     #fetch
02218     fetcher.UpdatePipeline()
02219 
02220     op = fetcher.GetClientSideObject().GetOutputDataObject(0)
02221     opc = op.NewInstance()
02222     opc.ShallowCopy(op)
02223     opc.UnRegister(None)
02224     return opc

Here is the call graph for this function:

Here is the caller graph for this function:

Although not required, this can be called at exit to cleanup.

Definition at line 2293 of file paravisSM.py.

02293 
02294 def Finalize():
02295     """Although not required, this can be called at exit to cleanup."""
02296     global progressObserverTag
02297     # Make sure to remove the observer
02298     if progressObserverTag:
02299         ToggleProgressPrinting()
02300     vtkInitializationHelper.Finalize()
02301 
02302 # Internal methods

Here is the call graph for this function:

def paravisSM.GetConnectionAt (   index)

Definition at line 2999 of file paravisSM.py.

02999 
03000 def GetConnectionAt(index):
03001    return MultiServerConnections[index]

Connection(aParams[0]) ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5]) ToggleProgressPrinting() fromGUI = True.

Definition at line 2987 of file paravisSM.py.

02987 
02988 def GetConnectionFromId(id):
02989    for connection in MultiServerConnections:
02990       if connection.ID == id:
02991          return connection
02992    return None

Definition at line 2993 of file paravisSM.py.

02993 
02994 def GetConnectionFromSession(session):
02995    for connection in MultiServerConnections:
02996       if connection.Session == session:
02997          return connection
02998    return None

def paravisSM.GetContextViews (   connection = None)
Returns the set of all context views.

Definition at line 2013 of file paravisSM.py.

02013 
02014 def GetContextViews(connection=None):
02015     """Returns the set of all context views."""
02016     context_modules = []
02017     for aProxy in ProxyManager():
02018         if aProxy.IsA("vtkSMContextViewProxy"):
02019             context_modules.append(aProxy)
02020     return context_modules

Definition at line 3002 of file paravisSM.py.

03002 
03003 def GetNumberOfConnections():
03004    return len(MultiServerConnections)

Definition at line 2282 of file paravisSM.py.

02282 
02283 def GetProgressPrintingIsEnabled():
02284     return progressObserverTag is not None

def paravisSM.GetRenderView (   connection = None)
Return the render view in use.  If more than one render view is in
use, return the first one.

Definition at line 1994 of file paravisSM.py.

01994 
01995 def GetRenderView(connection=None):
01996     """Return the render view in use.  If more than one render view is in
01997     use, return the first one."""
01998 
01999     render_module = None
02000     for aProxy in ProxyManager():
02001         if aProxy.IsA("vtkSMRenderViewProxy"):
02002             render_module = aProxy
02003             break
02004     return render_module

Here is the caller graph for this function:

def paravisSM.GetRenderViews (   connection = None)
Returns the set of all render views.

Definition at line 2005 of file paravisSM.py.

02005 
02006 def GetRenderViews(connection=None):
02007     """Returns the set of all render views."""
02008     render_modules = []
02009     for aProxy in ProxyManager():
02010         if aProxy.IsA("vtkSMRenderViewProxy"):
02011             render_modules.append(aProxy)
02012     return render_modules

Here is the caller graph for this function:

def paravisSM.GetRepresentation (   aProxy,
  view 
)

Definition at line 2052 of file paravisSM.py.

02052 
02053 def GetRepresentation(aProxy, view):
02054     for rep in view.Representations:
02055         #VSV: ==
02056         try: isRep = rep.Input.IsSame(aProxy)
02057         except: isRep = False
02058         if isRep: return rep
02059     return None

Here is the caller graph for this function:

Method used to initialize the Python Shell from the ParaView GUI.

Definition at line 1879 of file paravisSM.py.

01879 
01880 def InitFromGUI():
01881     """
01882     Method used to initialize the Python Shell from the ParaView GUI.
01883     """
01884     global fromGUI, ActiveConnection
01885     if not fromGUI:
01886        print "from paraview.simple import *"
01887     fromGUI = True
01888     # ToggleProgressPrinting() ### FIXME COLLABORATION
01889     enableMultiServer(vtkProcessModule.GetProcessModule().GetMultipleSessionsSupport())
01890     iter = vtkProcessModule.GetProcessModule().NewSessionIterator();
01891     iter.InitTraversal()
01892     ActiveConnection = None
01893     activeSession = vtkSMProxyManager.GetProxyManager().GetActiveSession()
01894     tmpActiveConnection = None
01895     while not iter.IsDoneWithTraversal():
01896        c = Connection(iter.GetCurrentSessionId(), iter.GetCurrentSession())
01897        if c.Session == activeSession:
01898           tmpActiveConnection = c
01899        iter.GoToNextItem()
01900     iter.UnRegister(None)
01901     if tmpActiveConnection:
01902        ActiveConnection = tmpActiveConnection

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.LoadPlugin (   filename,
  remote = True,
  connection = None 
)
Given a filename and a session (optional, otherwise uses
ActiveConnection), loads a plugin. It then updates the sources,
filters and rendering modules.

Definition at line 2120 of file paravisSM.py.

02120 
02121 def LoadPlugin(filename,  remote=True, connection=None):
02122     """ Given a filename and a session (optional, otherwise uses
02123     ActiveConnection), loads a plugin. It then updates the sources,
02124     filters and rendering modules."""
02125 
02126     if not connection:
02127         connection = ActiveConnection
02128     if not connection:
02129         raise RuntimeError, "Cannot load a plugin without a connection."
02130     plm = vtkSMProxyManager.GetProxyManager().GetPluginManager()
02131 
02132     if remote:
02133         status = plm.LoadRemotePlugin(filename, connection.Session)
02134     else:
02135         status = plm.LoadLocalPlugin(filename)
02136 
02137     # shouldn't the extension check happend before attempting to load the plugin?
02138     if not status:
02139         raise RuntimeError, "Problem loading plugin %s" % (filename)
02140     else:
02141         # we should never have to call this. The modules should update automatically.
02142         updateModules(connection.Modules)
02143 

Here is the call graph for this function:

def paravisSM.LoadState (   filename,
  connection = None 
)
Given a state filename and an optional connection, loads the server
manager state.

Definition at line 1861 of file paravisSM.py.

01861 
01862 def LoadState(filename, connection=None):
01863     """Given a state filename and an optional connection, loads the server
01864     manager state."""
01865     if not connection:
01866         connection = ActiveConnection
01867     if not connection:
01868         raise RuntimeError, "Cannot load state without a connection"
01869     pm = ProxyManager()
01870     pm.LoadState(filename, None)
01871     views = GetRenderViews()
01872     for view in views:
01873         # Make sure that the client window size matches the
01874         # ViewSize property. In paraview, the GUI takes care
01875         # of this.
01876         if view.GetClassName() == "vtkSMIceTDesktopRenderViewProxy":
01877             view.GetRenderWindow().SetSize(view.ViewSize[0], \
01878                                            view.ViewSize[1])

Here is the call graph for this function:

def paravisSM.LoadXML (   xmlstring)
DEPRECATED. Given a server manager XML as a string, parse and process it.

Definition at line 2115 of file paravisSM.py.

02115 
02116 def LoadXML(xmlstring):
02117     """DEPRECATED. Given a server manager XML as a string, parse and process it."""
02118     raise RuntimeError, "Deprecated. Use LoadPlugin(...) instead."
02119 

def paravisSM.OutputPort (   proxy,
  outputPort = 0 
)

Definition at line 1460 of file paravisSM.py.

01460 
01461 def OutputPort(proxy, outputPort=0):
01462     if not Proxy:
01463         return None
01464     if isinstance(outputPort, str):
01465         outputPort = proxy.GetOutputPortIndex(outputPort)
01466     if outputPort >= proxy.GetNumberOfOutputPorts():
01467         return None
01468     if proxy.Port == outputPort:
01469         return proxy
01470     newinstance = _getPyProxy(proxy.SMProxy, outputPort)
01471     newinstance.Port = outputPort
01472     newinstance._Proxy__Properties = proxy._Proxy__Properties
01473     return newinstance

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.Register (   proxy,
  extraArgs 
)
Registers a proxy with the proxy manager. If no 'registrationGroup' is
specified, then the group is inferred from the type of the proxy.
'registrationName' may be specified to register with a particular name
otherwise a default name will be created.

Definition at line 2619 of file paravisSM.py.

02619 
02620 def Register(proxy, **extraArgs):
02621     """Registers a proxy with the proxy manager. If no 'registrationGroup' is
02622     specified, then the group is inferred from the type of the proxy.
02623     'registrationName' may be specified to register with a particular name
02624     otherwise a default name will be created."""
02625     # TODO: handle duplicate registration
02626     if "registrationGroup" in extraArgs:
02627         registrationGroup = extraArgs["registrationGroup"]
02628     else:
02629         registrationGroup = __determineGroup(proxy)
02630 
02631     if "registrationName" in extraArgs:
02632         registrationName = extraArgs["registrationName"]
02633     else:
02634         registrationName = __determineName(proxy, registrationGroup)
02635     if registrationGroup and registrationName:
02636         pxm = ProxyManager()
02637         pxm.RegisterProxy(registrationGroup, registrationName, proxy)
02638     else:
02639         raise MissingRegistrationInformation, "Registration error %s %s." % (registrationGroup, registrationName)
02640     return (registrationGroup, registrationName)

Here is the call graph for this function:

def paravisSM.ReverseConnect (   port = 11111)
Use this function call to create a new session. On success,
it returns a Session object that abstracts the connection.
Otherwise, it returns None.
In reverse connection mode, the client waits for a connection
from the server (client has to be started first). The server
then connects to the client (run pvserver with -rc and -ch
option).
The optional port specified the port to listen to.

Definition at line 1933 of file paravisSM.py.

01933 
01934 def ReverseConnect(port=11111):
01935     """
01936     Use this function call to create a new session. On success,
01937     it returns a Session object that abstracts the connection.
01938     Otherwise, it returns None.
01939     In reverse connection mode, the client waits for a connection
01940     from the server (client has to be started first). The server
01941     then connects to the client (run pvserver with -rc and -ch
01942     option).
01943     The optional port specified the port to listen to.
01944     """
01945     global fromGUI
01946     if fromGUI:
01947         raise RuntimeError, "Cannot create a connection through python. Use the GUI to setup the connection."
01948     session = vtkSMSessionClient()
01949     session.Connect("csrc://hostname:" + port)
01950     id = vtkProcessModule.GetProcessModule().RegisterSession(session)
01951     connection = Connection(id, session)
01952     return connection

def paravisSM.SaveState (   filename)
Given a state filename, saves the state of objects registered
with the proxy manager.

Definition at line 1855 of file paravisSM.py.

01855 
01856 def SaveState(filename):
01857     """Given a state filename, saves the state of objects registered
01858     with the proxy manager."""
01859     pm = ProxyManager()
01860     pm.SaveState(filename)

Is not supported because of not supported observers

Definition at line 2285 of file paravisSM.py.

02285 
02286 def SetProgressPrintingEnabled(value):
02287     """Is not supported because of not supported observers"""
02288     pass

def paravisSM.switchActiveConnection (   newActiveConnection = None)
Switch active connection to be the provided one or if none just pick the
other one

Definition at line 2893 of file paravisSM.py.

02893 
02894 def switchActiveConnection(newActiveConnection=None):
02895   """Switch active connection to be the provided one or if none just pick the
02896   other one"""
02897   global MultiServerConnections, ActiveConnection
02898   if MultiServerConnections == None:
02899     raise RuntimeError, "enableMultiServer() must be called before"
02900 
02901   # Manage the case when no connection is provided
02902   if newActiveConnection:
02903     ActiveConnection = newActiveConnection
02904     __exposeActiveModules__()
02905     # Update active session for ParaView
02906     if vtkSMProxyManager.GetProxyManager().GetActiveSession() != ActiveConnection.Session:
02907        vtkSMProxyManager.GetProxyManager().SetActiveSession(ActiveConnection.Session)
02908     return ActiveConnection
02909   else:
02910     for connection in MultiServerConnections:
02911       if connection != ActiveConnection:
02912          ActiveConnection = connection
02913          __exposeActiveModules__()
02914          # Update active session for ParaView
02915          if vtkSMProxyManager.GetProxyManager().GetActiveSession() != ActiveConnection.Session:
02916             vtkSMProxyManager.GetProxyManager().SetActiveSession(ActiveConnection.Session)
02917          return ActiveConnection
02918   return None
02919 
02920 # Needs to be called when paraview module is loaded from python instead
# of pvpython, pvbatch or GUI.

Here is the call graph for this function:

Here is the caller graph for this function:

Turn on/off printing of progress.  See SetProgressPrintingEnabled.

Definition at line 2289 of file paravisSM.py.

02289 
02290 def ToggleProgressPrinting():
02291     """Turn on/off printing of progress.  See SetProgressPrintingEnabled."""
02292     SetProgressPrintingEnabled(not GetProgressPrintingIsEnabled())

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.UnRegister (   proxy,
  extraArgs 
)
UnRegisters proxies registered using Register().

Definition at line 2641 of file paravisSM.py.

02641 
02642 def UnRegister(proxy, **extraArgs):
02643     """UnRegisters proxies registered using Register()."""
02644     if "registrationGroup" in extraArgs:
02645         registrationGroup = extraArgs["registrationGroup"]
02646     else:
02647         registrationGroup = __determineGroup(proxy)
02648 
02649     if "registrationName" in extraArgs:
02650         registrationName = extraArgs["registrationName"]
02651     else:
02652         registrationName = __getName(proxy, registrationGroup)
02653 
02654     if registrationGroup and registrationName:
02655         pxm = ProxyManager()
02656         pxm.UnRegisterProxy(registrationGroup, registrationName, proxy)
02657     else:
02658         raise RuntimeError, "UnRegistration error."
02659     return (registrationGroup, registrationName)

Here is the call graph for this function:

Called when a plugin is loaded, this method updates
the proxy class object in all known modules.

Definition at line 2430 of file paravisSM.py.

02430 
02431 def updateModules(m):
02432     """Called when a plugin is loaded, this method updates
02433     the proxy class object in all known modules."""
02434 
02435     createModule("sources", m.sources)
02436     createModule("filters", m.filters)
02437     createModule("writers", m.writers)
02438     createModule("representations", m.rendering)
02439     createModule("views", m.rendering)
02440     createModule("lookup_tables", m.rendering)
02441     createModule("textures", m.rendering)
02442     createModule('cameramanipulators', m.rendering)
02443     createModule("animation", m.animation)
02444     createModule("misc", m.misc)
02445     createModule('animation_keyframes', m.animation)
02446     createModule('implicit_functions', m.implicit_functions)
02447     createModule('piecewise_functions', m.piecewise_functions)
02448     createModule("extended_sources", m.extended_sources)
02449     createModule("incremental_point_locators", m.misc)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 369 of file paravisSM.py.

dictionary paravisSM.__nameCounter = {}

Definition at line 2590 of file paravisSM.py.

dictionary paravisSM._pyproxies = {}

Definition at line 2939 of file paravisSM.py.

Definition at line 2875 of file paravisSM.py.

Definition at line 1849 of file paravisSM.py.

dictionary paravisSM.ASSOCIATIONS = { 'POINTS' : 0, 'CELLS' : 1, 'VERTICES' : 4, 'EDGES' : 5, 'ROWS' : 6}

Definition at line 2870 of file paravisSM.py.

Definition at line 2934 of file paravisSM.py.

Definition at line 2935 of file paravisSM.py.

Definition at line 2936 of file paravisSM.py.

Definition at line 2946 of file paravisSM.py.

Definition at line 1848 of file paravisSM.py.

Definition at line 2878 of file paravisSM.py.

Definition at line 2933 of file paravisSM.py.

Definition at line 1847 of file paravisSM.py.