Back to index

salome-paravis  6.5.0
Public Member Functions | Public Attributes | Properties
paravisSM.ColorArrayProperty Class Reference
Inheritance diagram for paravisSM.ColorArrayProperty:
Inheritance graph
[legend]
Collaboration diagram for paravisSM.ColorArrayProperty:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def GetAvailable
def SetData
def ConvertValue
def __len__
def __iter__
def __setitem__
def GetElement
def __getitem__
def GetData
def Clear
def __repr__
def __call__
def __getattr__

Public Attributes

 SMProperty
 Proxy

Properties

 Available
 Name

Detailed Description

This subclass of VectorProperty handles setting of the array to
color by. It handles attribute type as well as well array name.

Definition at line 697 of file paravisSM.py.


Member Function Documentation

def paravisSM.Property.__call__ (   self) [inherited]
Forces a property update using InvokeCommand.

Definition at line 563 of file paravisSM.py.

00563 
00564     def __call__(self):
00565         """Forces a property update using InvokeCommand."""
00566         if type(self) is Property:
00567             self.Proxy.SMProxy.InvokeCommand(self._FindPropertyName())
00568         else:
00569             raise RuntimeError, "Cannot invoke this property"

Here is the call graph for this function:

def paravisSM.Property.__getattr__ (   self,
  name 
) [inherited]

Reimplemented in paravisSM.ProxyProperty.

Definition at line 585 of file paravisSM.py.

00585 
00586     def __getattr__(self, name):
00587         "Unknown attribute requests get forwarded to SMProperty."
00588         return getattr(self.SMProperty, name)

def paravisSM.VectorProperty.__getitem__ (   self,
  idx 
) [inherited]
Returns the range [min, max) of elements. Raises an IndexError
exception if an argument is out of bounds.

Reimplemented in paravisSM.ArrayListProperty, and paravisSM.ArraySelectionProperty.

Definition at line 648 of file paravisSM.py.

00648 
00649     def __getitem__(self, idx):
00650         """Returns the range [min, max) of elements. Raises an IndexError
00651         exception if an argument is out of bounds."""
00652         ls = len(self)
00653         if isinstance(idx, slice):
00654             indices = idx.indices(ls)
00655             retVal = []
00656             for i in range(*indices):
00657                retVal.append(self.GetElement(i))
00658             return retVal
00659         elif idx >= ls:
00660             raise IndexError
00661         elif idx < 0:
00662             idx = ls + idx
00663             if idx < 0:
00664                 raise IndexError
00665 
00666         return self.GetElement(idx)

Here is the call graph for this function:

def paravisSM.VectorProperty.__iter__ (   self) [inherited]
Implementation of the sequence API

Reimplemented in paravisSM.ArrayListProperty.

Definition at line 628 of file paravisSM.py.

00628 
00629     def __iter__(self):
00630         """Implementation of the sequence API"""
00631         return GenericIterator(self)

Here is the caller graph for this function:

def paravisSM.VectorProperty.__len__ (   self) [inherited]
Returns the number of elements.

Reimplemented in paravisSM.ArrayListProperty, and paravisSM.ArraySelectionProperty.

Definition at line 624 of file paravisSM.py.

00624 
00625     def __len__(self):
00626         """Returns the number of elements."""
00627         return self.SMProperty.GetNumberOfElements()

def paravisSM.Property.__repr__ (   self) [inherited]
Returns a string representation containing property name
and value

Definition at line 545 of file paravisSM.py.

00545 
00546     def __repr__(self):
00547         """Returns a string representation containing property name
00548         and value"""
00549         if not type(self) is Property:
00550             if self.GetData() is not None:
00551                 repr = self.GetData().__repr__()
00552             else:
00553                 repr = "None"
00554         else:
00555             repr = "Property name= "
00556             name = self.Proxy.GetPropertyName(self.SMProperty)
00557             if name:
00558                 repr += name
00559             else:
00560                 repr += "Unknown"
00561 
00562         return repr

Here is the call graph for this function:

def paravisSM.VectorProperty.__setitem__ (   self,
  idx,
  value 
) [inherited]
Given a list or tuple of values, sets a slice of values [min, max)

Reimplemented in paravisSM.ArrayListProperty, and paravisSM.ArraySelectionProperty.

Definition at line 632 of file paravisSM.py.

00632 
00633     def __setitem__(self, idx, value):
00634         """Given a list or tuple of values, sets a slice of values [min, max)"""
00635         if isinstance(idx, slice):
00636             indices = idx.indices(len(self))
00637             for i, j in zip(range(*indices), value):
00638                 self.SMProperty.SetElement(i, self.ConvertValue(j))
00639             self._UpdateProperty()
00640         elif idx >= len(self) or idx < 0:
00641             raise IndexError
00642         else:
00643             self.SMProperty.SetElement(idx, self.ConvertValue(value))
00644             self._UpdateProperty()

Here is the call graph for this function:

def paravisSM.VectorProperty.Clear (   self) [inherited]

Definition at line 692 of file paravisSM.py.

00692 
00693     def Clear(self):
00694         "Removes all elements."
00695         self.SMProperty().SetNumberOfElements(0)
00696         self._UpdateProperty()

Here is the call graph for this function:

def paravisSM.VectorProperty.ConvertValue (   self,
  value 
) [inherited]

Reimplemented in paravisSM.EnumerationProperty.

Definition at line 621 of file paravisSM.py.

00621 
00622     def ConvertValue(self, value):
00623         return value

Here is the caller graph for this function:

Returns the list of available arrays as (attribute type, array name
tuples.

Definition at line 701 of file paravisSM.py.

00701 
00702     def GetAvailable(self):
00703         """Returns the list of available arrays as (attribute type, array name
00704         tuples."""
00705         arrays = []
00706         for a in self.Proxy.Input.PointData:
00707             arrays.append(('POINT_DATA', a.GetName()))
00708         for a in self.Proxy.Input.CellData:
00709             arrays.append(('CELL_DATA', a.GetName()))
00710         return arrays

def paravisSM.VectorProperty.GetData (   self) [inherited]

Reimplemented in paravisSM.ArrayListProperty.

Definition at line 667 of file paravisSM.py.

00667 
00668     def GetData(self):
00669         "Returns all elements as either a list or a single value."
00670         property = self.SMProperty
00671         if property.GetRepeatable() or \
00672            property.GetNumberOfElements() > 1:
00673             return self[0:len(self)]
00674         elif property.GetNumberOfElements() == 1:
00675             return self.GetElement(0)

Here is the call graph for this function:

Here is the caller graph for this function:

def paravisSM.VectorProperty.GetElement (   self,
  index 
) [inherited]

Reimplemented in paravisSM.EnumerationProperty.

Definition at line 645 of file paravisSM.py.

00645 
00646     def GetElement(self, index):
00647         return self.SMProperty.GetElement(index)

Here is the caller graph for this function:

def paravisSM.ColorArrayProperty.SetData (   self,
  value 
)
Overwritten to enable setting attribute type (the ColorAttributeType
property and the array name. The argument should be the array name
(in which case the first appropriate attribute type is picked) or
a tuple of attribute type and array name.

Reimplemented from paravisSM.VectorProperty.

Definition at line 711 of file paravisSM.py.

00711 
00712     def SetData(self, value):
00713         """Overwritten to enable setting attribute type (the ColorAttributeType
00714         property and the array name. The argument should be the array name
00715         (in which case the first appropriate attribute type is picked) or
00716         a tuple of attribute type and array name."""
00717         if isinstance(value, tuple) and len(value) == 2:
00718             att = value[0]
00719             arr = value[1]
00720         elif isinstance(value, str):
00721             att = None
00722             arr = value
00723         else:
00724             raise ValueError("Expected a tuple of 2 values or a string.")
00725 
00726         if not arr:
00727             self.SMProperty.SetElement(0, '')
00728             self._UpdateProperty()
00729             return
00730 
00731         found = False
00732         for a in self.Available:
00733             if a[1] == arr and (not att or att == a[0]):
00734                 att = a[0]
00735                 found = True
00736                 break
00737 
00738         if  not found:
00739             pvoptions = vtkProcessModule.GetProcessModule().GetOptions()
00740             # if this process is from a parallel batch run in symmetric mpi mode
00741             # then we may not have any points or cells on some processes in which
00742             # case we'll probably be missing the point and cell data too.  the
00743             # check below makes sure that we avoid this situation.
00744             if pvoptions.GetProcessType() != 0x40 or pvoptions.GetSymmetricMPIMode() == False \
00745                     or len(self.Available) != 0:
00746                 raise ValueError("Could not locate array %s in the input." % arr)
00747 
00748         catt = self.Proxy.GetProperty("ColorAttributeType")
00749         if att != None:
00750             catt.SetData(att)
00751         self.SMProperty.SetElement(0, arr)
00752         self._UpdateProperty()

Here is the call graph for this function:


Member Data Documentation

Definition at line 543 of file paravisSM.py.

Definition at line 542 of file paravisSM.py.


Property Documentation

Initial value:
property(GetAvailable, None, None, \
        "This read-only property returns the list of arrays that can be colored by.")

Definition at line 753 of file paravisSM.py.

paravisSM.Property.Name [static, inherited]
Initial value:
property(_FindPropertyName, None, None,
           "Returns the name for the property")

Definition at line 589 of file paravisSM.py.


The documentation for this class was generated from the following file: