MCPcopy Create free account
hub / github.com/Kitware/VTK / ExecuteDot

Function ExecuteDot

Filters/Programmable/Testing/Python/MultidimensionalSolution.py:88–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86pressureGradient.SetInputConnection(probe_gradient.GetOutputPort())
87pressureGradient.SetScaleFactor(0.00002)
88def ExecuteDot():
89 # proc for ProgrammableAttributeDataFilter.
90 inputs = dotProduct.GetInputList()
91 input0 = inputs.GetDataSet(0)
92 input1 = inputs.GetDataSet(1)
93 numPts = input0.GetNumberOfPoints()
94 vectors0 = input0.GetPointData().GetVectors()
95 vectors1 = input1.GetPointData().GetVectors()
96 scalars = vtkFloatArray()
97 for i in range(numPts):
98 v0x,v0y,v0z = vectors0.GetTuple3(i)
99 v1x,v1y,v1z = vectors1.GetTuple3(i)
100 l0 = math.sqrt(v0x*v0x + v0y*v0y + v0z*v0z)
101 l1 = math.sqrt(v1x*v1x + v1y*v1y + v1z*v1z)
102 if l0 > 0.0 and l1 > 0.0:
103 d = (v0x*v1x + v0y*v1y + v0z*v1z)/(l0*l1)
104 else:
105 d = 0.0
106 scalars.InsertValue(i,d)
107
108 dotProduct.GetOutput().GetPointData().SetScalars(scalars)
109
110#
111# We use the ProgrammableAttributeDataFilter to compute the cosine

Callers

nothing calls this directly

Calls 12

GetTuple3Method · 0.80
sqrtMethod · 0.80
SetScalarsMethod · 0.80
vtkFloatArrayClass · 0.50
rangeClass · 0.50
GetInputListMethod · 0.45
GetDataSetMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetVectorsMethod · 0.45
GetPointDataMethod · 0.45
InsertValueMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected