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. 

<<image001.png>>

_______________________________________________
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

Reply via email to