Created
October 29, 2015 14:39
-
-
Save pwolfram/b7250ec5d3bb7f00e246 to your computer and use it in GitHub Desktop.
Add missing numpy import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<CustomFilterDefinitions> | |
<CustomProxyDefinition name="Remove Periodic Sides" group="filters"> | |
<CompoundSourceProxy id="5150" servers="1"> | |
<Proxy group="filters" type="ProgrammableFilter" id="4476" servers="1" compound_name="ProgrammableFilter1"> | |
<Property name="CopyArrays" id="4476.CopyArrays" number_of_elements="1"> | |
<Element index="0" value="0"/> | |
<Domain name="bool" id="4476.CopyArrays.bool"/> | |
</Property> | |
<Property name="InformationScript" id="4476.InformationScript" number_of_elements="1"> | |
<Element index="0" value=""/> | |
</Property> | |
<Property name="Input" id="4476.Input" number_of_elements="1"> | |
<Domain name="groups" id="4476.Input.groups"/> | |
<Domain name="input_type" id="4476.Input.input_type"/> | |
</Property> | |
<Property name="OutputDataSetType" id="4476.OutputDataSetType" number_of_elements="1"> | |
<Element index="0" value="8"/> | |
<Domain name="enum" id="4476.OutputDataSetType.enum"> | |
<Entry value="8" text="Same as Input"/> | |
<Entry value="0" text="vtkPolyData"/> | |
<Entry value="2" text="vtkStructuredGrid"/> | |
<Entry value="3" text="vtkRectilinearGrid"/> | |
<Entry value="4" text="vtkUnstructuredGrid"/> | |
<Entry value="6" text="vtkImageData"/> | |
<Entry value="10" text="vtkUniformGrid"/> | |
<Entry value="13" text="vtkMultiblockDataSet"/> | |
<Entry value="15" text="vtkHierarchicalBoxDataSet"/> | |
<Entry value="19" text="vtkTable"/> | |
</Domain> | |
</Property> | |
<Property name="PythonPath" id="4476.PythonPath" number_of_elements="1"> | |
<Element index="0" value=""/> | |
</Property> | |
<Property name="Script" id="4476.Script" number_of_elements="1"> | |
<Element index="0" value="import numpy;ncells = inputs[0].GetNumberOfCells()

ids = vtk.vtkIdList()
pts = inputs[0].GetPoints()
minx = min(pts[1:,0].flatten())
maxx = max(pts[1:,0].flatten())

ids2 = zeros(3, dtype=numpy.int64)
mask = zeros(inputs[0].GetNumberOfCells(), dtype=numpy.int8)
for i in xrange(ncells):
 inputs[0].GetCellPoints(i, ids)
 for j in range(3):
 ids2[j] = ids.GetId(j)
 xs = pts[ids2, 0]
 lminx = min(xs.flatten())
 lmaxx = max(xs.flatten())
 # print xs,lminx, lmaxx
 if lminx > 0.9*minx and lminx < 1.1*minx and lmaxx > 0.9*maxx and lmaxx < 1.1*maxx:
 mask[i] = 0
 else:
 mask[i] = 1

output.CellData.append(mask, "mask")
output.PointData.PassData(inputs[0].PointData.VTKObject)
"/> | |
</Property> | |
<Property name="UpdateExtentScript" id="4476.UpdateExtentScript" number_of_elements="1"> | |
<Element index="0" value=""/> | |
</Property> | |
</Proxy> | |
<Proxy group="filters" type="Threshold" id="4789" servers="1" compound_name="Threshold1"> | |
<Property name="AllScalars" id="4789.AllScalars" number_of_elements="1"> | |
<Element index="0" value="1"/> | |
<Domain name="bool" id="4789.AllScalars.bool"/> | |
</Property> | |
<Property name="Input" id="4789.Input" number_of_elements="1"> | |
<Proxy value="4476" output_port="0"/> | |
<Domain name="groups" id="4789.Input.groups"/> | |
<Domain name="input_array" id="4789.Input.input_array"> | |
<InputArray attribute_type="any" number_of_components="1"/> | |
</Domain> | |
<Domain name="input_type" id="4789.Input.input_type"/> | |
</Property> | |
<Property name="SelectInputScalars" id="4789.SelectInputScalars" number_of_elements="5"> | |
<Element index="0" value=""/> | |
<Element index="1" value=""/> | |
<Element index="2" value=""/> | |
<Element index="3" value="1"/> | |
<Element index="4" value="mask"/> | |
<Domain name="array_list" id="4789.SelectInputScalars.array_list"> | |
<String text="density"/> | |
<String text="layerThickness"/> | |
<String text="salinity"/> | |
<String text="seaSurfacePressure"/> | |
<String text="temperature"/> | |
<String text="mask"/> | |
</Domain> | |
<Domain name="field_list" id="4789.SelectInputScalars.field_list"> | |
<Entry value="0" text="Point Data"/> | |
<Entry value="1" text="Cell Data"/> | |
</Domain> | |
</Property> | |
<Property name="ThresholdBetween" id="4789.ThresholdBetween" number_of_elements="2"> | |
<Element index="0" value="0.05"/> | |
<Element index="1" value="1"/> | |
<Domain name="range" id="4789.ThresholdBetween.range"/> | |
</Property> | |
<Property name="UseContinuousCellRange" id="4789.UseContinuousCellRange" number_of_elements="1"> | |
<Element index="0" value="0"/> | |
<Domain name="bool" id="4789.UseContinuousCellRange.bool"/> | |
</Property> | |
</Proxy> | |
<ExposedProperties> | |
<Property name="Input" proxy_name="ProgrammableFilter1" exposed_name="Input"/> | |
</ExposedProperties> | |
<OutputPort name="Output" proxy="Threshold1" port_index="0"/> | |
<Hints> | |
<ShowInMenu/> | |
</Hints> | |
</CompoundSourceProxy> | |
</CustomProxyDefinition> | |
</CustomFilterDefinitions> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment