12 |
from outline import Outline |
from outline import Outline |
13 |
from probe import Probe |
from probe import Probe |
14 |
from point import StructuredPoints |
from point import StructuredPoints |
15 |
|
from average import CellDataToPointData |
16 |
|
|
17 |
# NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, StructuredPoints and |
# NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, StructuredPoints and |
18 |
# Probe were inherited to allow access to their public methods from the driver. |
# Probe were inherited to allow access to their public methods from the driver. |
31 |
# If no lut is specified, the color scheme will be used. |
# If no lut is specified, the color scheme will be used. |
32 |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
def __init__(self, scene, data_collector, viewport = Viewport.SOUTH_WEST, |
33 |
color_mode = ColorMode.VECTOR, arrow = Arrow.TWO_D, |
color_mode = ColorMode.VECTOR, arrow = Arrow.TWO_D, |
34 |
lut = Lut.COLOR, outline = True): |
lut = Lut.COLOR, cell_to_point = False, outline = True): |
35 |
""" |
""" |
36 |
@type scene: L{Scene <scene.Scene>} object |
@type scene: L{Scene <scene.Scene>} object |
37 |
@param scene: Scene in which objects are to be rendered on |
@param scene: Scene in which objects are to be rendered on |
46 |
@param arrow: Type of arrow (two dimensional or three dimensional) |
@param arrow: Type of arrow (two dimensional or three dimensional) |
47 |
@type lut : L{Lut <constant.Lut>} constant |
@type lut : L{Lut <constant.Lut>} constant |
48 |
@param lut: Lookup table color scheme |
@param lut: Lookup table color scheme |
49 |
|
@type cell_to_point: Boolean |
50 |
|
@param cell_to_point: Converts cell data to point data (by averaging) |
51 |
@type outline: Boolean |
@type outline: Boolean |
52 |
@param outline: Places an outline around the domain surface |
@param outline: Places an outline around the domain surface |
53 |
""" |
""" |
87 |
lookup_table = LookupTable() |
lookup_table = LookupTable() |
88 |
lookup_table._setLookupTableToGreyScale() |
lookup_table._setLookupTableToGreyScale() |
89 |
|
|
90 |
|
""" |
91 |
|
if(cell_to_point == True): # Converts cell data to point data. |
92 |
|
print "YES..." |
93 |
|
c2p = CellDataToPointData(data_collector._getOutput()) |
94 |
|
StructuredPoints.__init__(self, c2p._getOutput()) |
95 |
|
Probe.__init__(self, c2p._getOutput(), |
96 |
|
StructuredPoints._getStructuredPoints(self)) |
97 |
|
elif(cell_to_point == False): # No conversion happens. |
98 |
|
print "NO..." |
99 |
|
StructuredPoints.__init__(self, data_collector._getOutput()) |
100 |
|
Probe.__init__(self, data_collector._getOutput(), |
101 |
|
StructuredPoints._getStructuredPoints(self)) |
102 |
|
""" |
103 |
StructuredPoints.__init__(self, data_collector._getOutput()) |
StructuredPoints.__init__(self, data_collector._getOutput()) |
104 |
Probe.__init__(self, data_collector._getOutput(), |
Probe.__init__(self, data_collector._getOutput(), |
105 |
StructuredPoints._getStructuredPoints(self)) |
StructuredPoints._getStructuredPoints(self)) |
110 |
Arrow2D._getOutput(self)) |
Arrow2D._getOutput(self)) |
111 |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
elif(arrow == Arrow.THREE_D): # Use 3D arrows. |
112 |
Arrow3D.__init__(self) |
Arrow3D.__init__(self) |
113 |
|
#Glyph3D.__init__(self, data_collector._getOutput(), |
114 |
Glyph3D.__init__(self, Probe._getOutput(self), |
Glyph3D.__init__(self, Probe._getOutput(self), |
115 |
Arrow3D._getOutput(self)) |
Arrow3D._getOutput(self)) |
116 |
|
|
117 |
|
|
118 |
|
#c2p = CellDataToPointData(Glyph3D._getOutput(self)) |
119 |
|
#DataSetMapper.__init__(self, c2p._getOutput(), |
120 |
|
# lookup_table._getLookupTable()) |
121 |
|
|
122 |
DataSetMapper.__init__(self, Glyph3D._getOutput(self), |
DataSetMapper.__init__(self, Glyph3D._getOutput(self), |
123 |
lookup_table._getLookupTable()) |
lookup_table._getLookupTable()) |
124 |
|
|
247 |
Glyph3D._setRange(self, data_collector._getVectorRange()) |
Glyph3D._setRange(self, data_collector._getVectorRange()) |
248 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
249 |
data_collector._getVectorRange()) |
data_collector._getVectorRange()) |
250 |
|
data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY, |
251 |
|
ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self), |
252 |
|
Glyph3D._getGlyph3D(self)) |
253 |
|
|
254 |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
255 |
Glyph3D._setColorModeByScalar(self) |
Glyph3D._setColorModeByScalar(self) |
256 |
Glyph3D._setRange(self, data_collector._getVectorRange()) |
Glyph3D._setRange(self, data_collector._getScalarRange()) |
257 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
258 |
data_collector._getScalarRange()) |
data_collector._getScalarRange()) |
259 |
|
data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY, |
260 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self), |
261 |
|
Glyph3D._getGlyph3D(self)) |
262 |
|
|
263 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
264 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
370 |
Glyph3D._setRange(self, data_collector._getVectorRange()) |
Glyph3D._setRange(self, data_collector._getVectorRange()) |
371 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
372 |
data_collector._getVectorRange()) |
data_collector._getVectorRange()) |
373 |
|
data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY, |
374 |
|
ColorMode.VECTOR, DataSetMapper._getDataSetMapper(self), |
375 |
|
Glyph3D._getGlyph3D(self)) |
376 |
|
|
377 |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar. |
378 |
Glyph3D._setColorModeByScalar(self) |
Glyph3D._setColorModeByScalar(self) |
379 |
Glyph3D._setRange(self, data_collector._getVectorRange()) |
Glyph3D._setRange(self, data_collector._getScalarRange()) |
380 |
DataSetMapper._setScalarRange(self, |
DataSetMapper._setScalarRange(self, |
381 |
data_collector._getScalarRange()) |
data_collector._getScalarRange()) |
382 |
|
data_collector._paramForUpdatingMultipleSources(VizType.VELOCITY, |
383 |
|
ColorMode.SCALAR, DataSetMapper._getDataSetMapper(self), |
384 |
|
Glyph3D._getGlyph3D(self)) |
385 |
|
|
386 |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self)) |
387 |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |
scene._addActor3D(viewport, Actor3D._getActor3D(self)) |