Hi guys,
I am trying to calculate the gradient of an unstructed data set saved in
vtk format with the function in the following:
Somehow I am not able to access the PointData of the solution. The error
is always
* Grad_DMDu = dataAdp.PointData['Grad_DMDu']*
obj._dataset.Set(dataset.VTKObject)
TypeError: Set argument 1: method requires a VTK objec
So what am I doing wrong here?
Thanks in advance
############################################
def Cal_Dissp(DMDmodeFile,DMDmodeName, nu):
"""
Calculate the (Pseudo) dissipation with paraview vtk, and return data
"""
print(' Calculate mode gradient ...')
import paraview.simple as ps
import vtk.numpy_interface.dataset_adapter as dsa
ps.paraview.simple._DisableFirstRenderCameraReset()
xmlUnstructerdGrReader =
ps.XMLUnstructuredGridReader(FileName=[DMDmodeFile])
xmlUnstructerdGrReader.PointArrayStatus = [ DMDmodeName ]
gradientOfUnstructuredDataSet1 =
ps.GradientOfUnstructuredDataSet(Input=xmlUnstructerdGrReader)
gradientOfUnstructuredDataSet1.ScalarArray = ['POINTS', DMDmodeName]
gradientOfUnstructuredDataSet1.ResultArrayName = 'Grad_DMDu'
gradientOfUnstructuredDataSet1.UpdatePipeline()
rawData = ps.servermanager.Fetch(gradientOfUnstructuredDataSet1)
rawData = rawData.Get
dataAdp = dsa.WrapDataObject(rawData)
* Grad_DMDu = dataAdp.PointData['Grad_DMDu'] - > Here comes the error*
#release paraview ocupied memory
del xmlUnstructerdGrReader
ps.Disconnect()
ps.Connect()
print(' Calculate dissipation ...')
D= ..........
return D
############################################
--- Begin Message ---
Hi guys,
I am trying to calculate the gradient of an unstructed data set saved in
vtk format with the function in the following:
Somehow I am not able to access the PointData of the solution. The error
is always
* Grad_DMDu = dataAdp.PointData['Grad_DMDu']*
obj._dataset.Set(dataset.VTKObject)
TypeError: Set argument 1: method requires a VTK objec
So what am I doing wrong here?
Thanks in advance
############################################
def Cal_Dissp(DMDmodeFile,DMDmodeName, nu):
"""
Calculate the (Pseudo) dissipation with paraview vtk, and return data
"""
print(' Calculate mode gradient ...')
import paraview.simple as ps
import vtk.numpy_interface.dataset_adapter as dsa
ps.paraview.simple._DisableFirstRenderCameraReset()
xmlUnstructerdGrReader =
ps.XMLUnstructuredGridReader(FileName=[DMDmodeFile])
xmlUnstructerdGrReader.PointArrayStatus = [ DMDmodeName ]
gradientOfUnstructuredDataSet1 =
ps.GradientOfUnstructuredDataSet(Input=xmlUnstructerdGrReader)
gradientOfUnstructuredDataSet1.ScalarArray = ['POINTS', DMDmodeName]
gradientOfUnstructuredDataSet1.ResultArrayName = 'Grad_DMDu'
gradientOfUnstructuredDataSet1.UpdatePipeline()
rawData = ps.servermanager.Fetch(gradientOfUnstructuredDataSet1)
rawData = rawData.Get
dataAdp = dsa.WrapDataObject(rawData)
* Grad_DMDu = dataAdp.PointData['Grad_DMDu'] - > Here comes the error*
#release paraview ocupied memory
del xmlUnstructerdGrReader
ps.Disconnect()
ps.Connect()
print(' Calculate dissipation ...')
D= ..........
return D
############################################
--- End Message ---
_______________________________________________
Powered by www.kitware.com
ParaView discussion is moving! Please visit https://discourse.paraview.org/ for
future posts.
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
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview