[Paraview] calculator gives incorrect results for multiblock datasets

Edwards, Paul Paul.Edwards3 at Rolls-Royce.com
Mon Feb 13 09:34:20 EST 2012


Hi,

 

The calculator gives incorrect results for multiblock unless the
variables have the same index internally.  This can be reproduced with
the steps below:

 

1.       Create a python source that outputs vtkUnstructuredGrid with
the following script:

def add_scalar(ds, val):

                arr = vtk.vtkDoubleArray()

                arr.SetName("Scalar"+str(val))

                arr.SetNumberOfComponents(1)

                arr.SetNumberOfTuples(8)

                for i in range(8):

                                arr.SetTuple1(i, float(val))

                output.GetPointData().AddArray(arr)

 

output = self.GetOutput()

npts = 8

pts = vtk.vtkPoints()

pts.InsertNextPoint(-3.0, -1.0, -1.0)

pts.InsertNextPoint(-1.0, -1.0, -1.0)

pts.InsertNextPoint(-1.0,  1.0, -1.0)

pts.InsertNextPoint(-3.0,  1.0, -1.0)

pts.InsertNextPoint(-3.0, -1.0,  1.0)

pts.InsertNextPoint(-1.0, -1.0,  1.0)

pts.InsertNextPoint(-1.0,  1.0,  1.0)

pts.InsertNextPoint(-3.0,  1.0,  1.0)

output.SetPoints(pts)

output.Allocate(1,1)

ids = vtk.vtkIdList()

for i in range(npts):

    ids.InsertId(i,i)

add_scalar(output, 1)

add_scalar(output, 2)

output.InsertNextCell(vtk.VTK_HEXAHEDRON, ids)

2.       Create a second python source that outputs vtkUnstructuredGrid
with the following script (notice the change in order when adding the
scalars):

def add_scalar(ds, val):

                arr = vtk.vtkDoubleArray()

                arr.SetName("Scalar"+str(val))

                arr.SetNumberOfComponents(1)

                arr.SetNumberOfTuples(8)

                for i in range(8):

                                arr.SetTuple1(i, float(val))

                output.GetPointData().AddArray(arr)

 

output = self.GetOutput()

npts = 8

pts = vtk.vtkPoints()

pts.InsertNextPoint(-3.0, -1.0, -1.0)

pts.InsertNextPoint(-1.0, -1.0, -1.0)

pts.InsertNextPoint(-1.0,  1.0, -1.0)

pts.InsertNextPoint(-3.0,  1.0, -1.0)

pts.InsertNextPoint(-3.0, -1.0,  1.0)

pts.InsertNextPoint(-1.0, -1.0,  1.0)

pts.InsertNextPoint(-1.0,  1.0,  1.0)

pts.InsertNextPoint(-3.0,  1.0,  1.0)

output.SetPoints(pts)

output.Allocate(1,1)

ids = vtk.vtkIdList()

for i in range(npts):

    ids.InsertId(i,i) 

add_scalar(output, 2)

add_scalar(output, 1)

output.InsertNextCell(vtk.VTK_HEXAHEDRON, ids)

3.       Group the two python sources together

4.       Use the Calculator filter to pass through Scalar1

 

See output below:

 

 

 

Regards,

Paul


The data contained in, or attached to, this e-mail, may contain confidential information. If you have received it in error you should notify the sender immediately by reply e-mail, delete the message from your system and contact +44 (0) 1332 242424 (the Rolls-Royce IT Security Director) if you need assistance. Please do not copy it for any purpose, or disclose its contents to any other person.

An e-mail response to this address may be subject to interception or monitoring for operational reasons or for lawful business practices.

(c) 2012 Rolls-Royce plc

Registered office: 65 Buckingham Gate, London SW1E 6AT Company number: 1003142. Registered in England. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120213/fbb755f8/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 29544 bytes
Desc: image001.png
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120213/fbb755f8/attachment-0001.png>


More information about the ParaView mailing list