[Paraview] Invalid array name
Berk Geveci
berk.geveci at kitware.com
Fri Jul 3 09:44:07 EDT 2009
Hi Michael,
Unfortunately, there are no filters that can append attributes when
inputs are multi-block datasets (which is what the pvd reader
produces). Fortunately, the Programmable Filter can easily do this. I
am attaching a script that should do what you want. I tested it in
serial and parallel. To use, load the two datasets, select them both,
apply the Programmable Filter, copy the script I am attaching and
apply. I tested this with the CVS version but it should work with 3.4
or 3.6. You should be able to create a custom filter from the
Programmable Filter that you created. If that doesn't work, please let
me know so that I can file a bug report.
Best,
-berk
def add_arrays(output, input):
ipd = input.GetPointData()
opd = output.GetPointData()
for i in range(ipd.GetNumberOfArrays()):
opd.AddArray(ipd.GetArray(i))
icd = input.GetCellData()
ocd = output.GetCellData()
for i in range(icd.GetNumberOfArrays()):
ocd.AddArray(icd.GetArray(i))
input1 = self.GetInputDataObject(0, 0)
input2 = self.GetInputDataObject(0, 1)
output = self.GetOutputDataObject(0)
output.CopyStructure(input1)
for i in range(input1.GetNumberOfBlocks()):
bl1 = input1.GetBlock(i)
bl2 = input2.GetBlock(i)
for j in range(bl1.GetNumberOfBlocks()):
ds1 = bl1.GetBlock(j)
ds2 = bl2.GetBlock(j)
if ds1 and ds2:
ob = ds1.NewInstance()
ob.ShallowCopy(ds1)
output.GetBlock(i).SetBlock(j, ob)
add_arrays(ob, ds2)
ob.UnRegister(None)
On Tue, Jun 30, 2009 at 6:05 PM, Michael
Zöllner<michael.zoellner at rwth-aachen.de> wrote:
> Hi all,
>
> I want to apply the calculator filter on the results of some 3D numerical
> simulation but keep getting the following error message (it appears about
> fourty times in the Ouput Messages window):
>
> ERROR: In
> /home/berk/Work/ReleaseBuilds/ParaView3/VTK/Graphics/vtkArrayCalculator.cxx,
> line 305
> vtkArrayCalculator (0x882fbf8): Invalid array name: VelSca0
>
> About the data: I have opened a file Conc_Anim.pvd with one float (Conc_0)
> and another file VelScalar_Anim.pvd with three floats (VelSca0, VelSca1, and
> VelSca2) for the velocities in x, y, and z direction. To be able to do some
> calculations with data from both files, I used Group Datasets. The
> calculation should be something like
>
> Conc_0*(VelSca0*iHat+VelSca1*jHat+VelSca2*kHat)
>
> though the error message appears whatever I enter as a formula.
>
> Does anybody have any idea what went wrong here?
>
> Thanks,
> Michael
>
> _______________________________________________
> 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
>
>
More information about the ParaView
mailing list