Not sure what you mean by that last statement -- do you mean transfer an array
to pointdata? I tried to do this:
input = self.GetInput()
output = self.GetOuput()
output = vtk.vtkStructuredGrid()
output.ShallowCopy(input.GetBlock(0))
// create UVW array (3-component velocity array)
output.GetPointData().AddArray(UVWArray)
When I print output, I do see the added array in the point data section with
the correct component and tuple count. However, the bounds of the grid are
suspect (like -0.1 to 0.3 for x; -0.1 to 2.6e-18 for y) and the grid extent is
0, -1, 0, -1, 0, -1.
I also tried:
p, li { white-space: pre-wrap; }output.GetPointData().SetVectors(UVWArray)
Didn't work either. Something is still not right here...
Sohail
--- On Wed, 3/2/11, Berk Geveci <[email protected]> wrote:
From: Berk Geveci <[email protected]>
Subject: Re: [Paraview] Using streamtracer/gradient filters on "multi-block"
data set
To: "Sohail Shafii" <[email protected]>
Cc: [email protected]
Date: Wednesday, March 2, 2011, 3:40 AM
I looks like you to apply cell data to point data.
On Tue, Mar 1, 2011 at 9:06 PM, Sohail Shafii <[email protected]> wrote:
Hi,
Let me correct myself; the block contained inside is a vtkStructuredGrid. I
did a printout what is in the pipeline (self.GetInput()):
vtkMultiBlockDataSet (0x3a7c1d0)
Debug: Off
Modified Time: 164250
Reference Count: 2
Registered Events: (none)
Source: (none)
Information: 0x3a7c230
Data Released: False
Global Release Data: Off
UpdateTime: 164282
Release Data: Off
UpdateExtent: Initialized
Update Number Of Pieces: 1
Update Piece: 0
Update Ghost Level: 0
MaximumNumberOfPieces: -1
ExtentTranslator: (0x3a7df30)
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 155460
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Children: 1
Child 0: vtkUnstructuredGrid
Debug: Off
Modified Time: 164208
Reference Count: 3
Registered Events: (none)
Source: (none)
Information: 0x4920790
Data Released: False
Global Release Data: Off
UpdateTime: 0
Release Data: Off
UpdateExtent: Not Initialized
MaximumNumberOfPieces: 1
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 164167
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 34943
Number Of Cells: 31488
Cell Data:
Debug: Off
Modified Time: 164206
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 24
Array 0 name = PRESSURE
Array 1 name = X_VELOCITY
Array 2 name = X_VELOCITY_M1
Array 3 name = X_VELOCITY_M2
Array 4 name = Y_VELOCITY
Array 5 name = Y_VELOCITY_M1
Array 6 name = Y_VELOCITY_M2
Array 7 name = Z_VELOCITY
Array 8 name = Z_VELOCITY_M1
Array 9 name = Z_VELOCITY_M2
Array 10 name = TEMPERATURE
Array 11 name = ENTHALPY
Array 12 name = ENERGY_M1
Array 13 name = ENERGY_M2
Array 14 name = NUT
Array 15 name = NUT_M1
Array 16 name = NUT_M2
Array 17 name = DENSITY
Array 18 name = DENSITY_M1
Array 19 name = DENSITY_M2
Array 20 name = MU_LAM
Array 21 name = MU_TURB
Array 22 name = WALL_DIST
Array 23 name = BODY_FORCES
Number Of Components: 26
Number Of Tuples: 31488
Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 )
Pass Through Flags: ( 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
Point Data:
Debug: Off
Modified Time: 164208
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 )
Pass Through Flags: ( 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
Bounds:
Xmin,Xmax: (-0.1, 0.3)
Ymin,Ymax: (-0.100002, 2.60209e-18)
Zmin,Zmax: (-0.100002, 2.60209e-18)
Compute Time: 379083
Number Of Points: 34943
Point Coordinates: 0x4aa82b0
Locator: 0
Number Of Pieces: 1
Piece: -1
Ghost Level: 0Maybe it's because the point data fields, like the scalars
and vectors you mentioned, are empty? I could probably fill in the gaps.
Sohail
--- On Tue, 3/1/11, Berk Geveci <[email protected]> wrote:
From: Berk Geveci <[email protected]>
Subject: Re: [Paraview] Using streamtracer/gradient filters on "multi-block"
data set
To: "Sohail Shafii" <[email protected]>
Cc: [email protected]
Date: Tuesday, March 1, 2011, 5:07 PM
By any chance, does this multi-block dataset contain a block that does not have
arrays (scalars and/or vectors)? That's probably why those filters are
disabled. You can always use
Extract Blocks to extract the block you are interested in and then apply the
filter. As for the Programmable Filter, if you set the output type to
vtkUnstructuredGrid, you should be able to do:
self.GetOutput().ShallowCopy(self.GetInput().GetBlock(0))
assuming that block 0 is a uns. grid.
-berk
On Tue, Mar 1, 2011 at 5:29 PM, Sohail Shafii <[email protected]> wrote:
Hi,
I've read in a CAS file, which Paraview read in a Multi-block dataset, which
contains within it a unstructured grid.
Initially I had a problem where all of the data items were one-tuple arrays.
So I created a UVW (3-tuple velocity) array and added it to the pipeline this
way using a Python programmable filter:
input = self.GetInput()
output = self.GetOutput()
output.ShallowCopy(input)
****create array here***
output.GetBlock(0).GetCellData().AddArray(UVWArray)
Note that "GetBlock(0)" gives me access to the grid object. For some reason
the gradients and streamtracer filters were greyed out and unavailable. So I
decided to make the output variable a vtkUnstructuredGrid instead and
transferred the UVW array to it this way:
output.GetPointData().AddArray(UVWArray)
Nope...didn't work. Any thoughts how I can modify the pipeline so that the
streamtracer and gradients of unstructured data sets array can become usable?
I'm guessing there is something in those classes which tells Paraview that they
require certain input types. I've seen references to stuff like
FillInputPortInformation.
Thanks,
Sohail
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview