MCPcopy Create free account
hub / github.com/Kitware/ParaView / test0

Function test0

Remoting/Application/Testing/Python/PythonFilters.py:50–175  ·  view source on GitHub ↗
(query, types=[], noperands=1, associations=[], debug=1, testComposite=False)

Source from the content-addressed store, hash-verified

48# 2 - output 1 and a brief display of the result array
49# 3 - output 2 and a complete display of the result array
50def test0 (query, types=[], noperands=1, associations=[], debug=1, testComposite=False) :
51 if debug :
52 print ''
53 print query, associations, types, "Composite=%s"%testComposite
54 sys.stdout.flush()
55
56 # Validity checks
57 if '' == query : return
58
59 if 0 == len(types) : return
60 for any in types :
61 if any not in ['scalar', 'vector', 'tensor'] : return
62
63 if 1 != noperands and 2 != noperands: return
64
65 if 0 == len(associations) : return
66 for any in associations :
67 if any not in ['point', 'cell'] : return
68
69 compositeOptions = [ False ]
70 if testComposite:
71 compositeOptions.append(True)
72
73 # Python Calculator test
74 for association in associations :
75 for type in types :
76 if 'scalar' == type : operand = 'Normals[:,0]'
77 elif 'vector' == type : operand = 'Normals'
78 elif 'tensor' == type : operand = 'VectorGradient'
79 else : continue # Ideally, we should never come to here
80
81 if 2 == noperands : operand = operand + ', ' + operand
82
83 # Actual expression of the query
84 expr = "%s(%s)" % (query, operand)
85 if debug :
86 sys.stdout.flush()
87
88 datasource = Sphere()
89 if 'tensor' == type :
90 datasource = ComputeDerivatives()
91 datasource.Vectors = ['Normals']
92
93 if 'cell' == association :
94 datasource = PointDatatoCellData()
95 else:
96 datasource = CellDatatoPointData()
97
98 for composite in compositeOptions:
99 if debug :
100 print ' PC', association.capitalize()[0], type.capitalize()[0], "Composite" if composite else "Sphere", expr
101 sys.stdout.flush()
102 if composite:
103 otherSphere = Sphere()
104 if 'tensor' == type :
105 otherSphere = ComputeDerivatives()
106 if 'cell' == association :
107 otherSphere = PointDatatoCellData()

Callers 1

mainFunction · 0.85

Calls 5

SetActiveSourceFunction · 0.85
print_arrayFunction · 0.85
appendMethod · 0.45
UpdatePipelineMethod · 0.45
GetArrayMethod · 0.45

Tested by

no test coverage detected