<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi guys,<br>
<br>
I am trying to calculate the gradient of an unstructed data set
saved in vtk format with the function in the following:<br>
<br>
Somehow I am not able to access the PointData of the solution. The
error is always<br>
<br>
<br>
<b> Grad_DMDu = dataAdp.PointData['Grad_DMDu']</b><br>
obj._dataset.Set(dataset.VTKObject)<br>
TypeError: Set argument 1: method requires a VTK objec<br>
<br>
<br>
So what am I doing wrong here?<br>
<br>
Thanks in advance<br>
<br>
############################################<br>
def Cal_Dissp(DMDmodeFile,DMDmodeName, nu):<br>
"""<br>
Calculate the (Pseudo) dissipation with paraview vtk, and return
data<br>
""" <br>
print(' Calculate mode gradient ...')<br>
import paraview.simple as ps<br>
import vtk.numpy_interface.dataset_adapter as dsa<br>
ps.paraview.simple._DisableFirstRenderCameraReset()<br>
<br>
<br>
xmlUnstructerdGrReader =
ps.XMLUnstructuredGridReader(FileName=[DMDmodeFile])<br>
xmlUnstructerdGrReader.PointArrayStatus = [ DMDmodeName ]<br>
<br>
gradientOfUnstructuredDataSet1 =
ps.GradientOfUnstructuredDataSet(Input=xmlUnstructerdGrReader)<br>
gradientOfUnstructuredDataSet1.ScalarArray = ['POINTS',
DMDmodeName]<br>
gradientOfUnstructuredDataSet1.ResultArrayName = 'Grad_DMDu'<br>
<br>
gradientOfUnstructuredDataSet1.UpdatePipeline()<br>
<br>
rawData = ps.servermanager.Fetch(gradientOfUnstructuredDataSet1)<br>
rawData = rawData.Get<br>
dataAdp = dsa.WrapDataObject(rawData)<br>
<br>
<b> Grad_DMDu = dataAdp.PointData['Grad_DMDu'] - > Here comes
the error</b><br>
<br>
#release paraview ocupied memory<br>
del xmlUnstructerdGrReader<br>
ps.Disconnect()<br>
ps.Connect()<br>
<br>
print(' Calculate dissipation ...')<br>
D= ..........<br>
<br>
return D<br>
############################################
</body>
</html>