Hi Paraviewers,

Is it possible to add or append a newly created vtkFloatArray to an
existing set of arrays?
Please find below my attempt to append/add an array 'p2' to the existing
arrays 'U','U_0' and 'p'

#~~~~~~~~~~~~~~~~
from paraview import vtk
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

OpenFOAM = OpenFOAMReader( FileName='C:\\Users\\Public\\30x30x1.OpenFOAM' )
OpenFOAM.CellArrays = ['U', 'U_0', 'p']
OpenFOAM.MeshRegions = ['internalMesh']
MergeBlocks1 = MergeBlocks()

parray=servermanager.Fetch(MergeBlocks1).GetPointData().GetArray('p')
npts=parray.GetNumberOfTuples()
p2array = vtk.vtkFloatArray()
p2array.SetName('p2')
p2array.SetNumberOfComponents(1)
p2array.SetNumberOfTuples(npts)

for i in range(npts):
     p2array.SetValue(i, 999.9)

# Is it possible to add or append the p2array to the 'U','U_0' and 'p'
arrays?
# Maybe something like: MergeBlocks1.GetCellData().AddArray(p2array)
#~~~~~~~~~~~~~~~
Any help will be greatly appreciated.

Best regards,
George

_______________________________________________
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