[vtkusers] vtkVector_vtkScalar?

Karshi karshi.hasanov at utoronto.ca
Tue Feb 19 13:04:49 EST 2002


Hi all,

 I get errors when I run the following code in VTK4.0:
-----------------------------------------------------------------------
xspace=0.004
yspace=0.004
zspace=0.004

data = vtkStructuredPoints()
data.SetDimensions(Nx,Ny,Nz)
data.SetSpacing(xspace, yspace, zspace)
vectors =vtkVectors()

for z in range(Nz):
    for y in range(Ny):
        for x in range(Nx):
            dum = vectors.InsertNextVector(Jx[x,y,z],Jy[x,y,z],Jz[x,y,z])
data.GetPointData().SetVectors(vectors)

writer = vtkStructuredPointsWriter()
writer.SetInput(data)

J_mag = sqrt(pow(Jx,2)+pow(Jy,2)+pow(Jz,2))

scalars = vtkScalars()

for z in range(Nz):
    for y in range(Ny):
        for x in range(Nx):
            dum = scalars.InsertNextScalar(J_mag[x,y,z])
data.GetPointData().SetScalars(scalars)


writer = vtkStructuredPointsWriter()
writer.SetInput(data)
writer.SetFileName("Anisotropic_Case_Jmag_Jvec.vtk")
writer.Write()
----------------------------------------------------------------------------
It was working fine in vtk3.2.
What need to be replaced? 
Thanks



More information about the vtkusers mailing list