mymesh.mesh.mesh.Threshold#
- mesh.Threshold(scalars, threshold, mode=None, scalar_preference='elements', all_nodes=True, InPlace=False, cleanup=False)[source]#
Threshold the mesh by scalar values at either nodes or elements.
- Parameters:
scalars (str or array_like) – Values to be used for thresholding, either a string indicating an entry in NodeData or ElemData, or an array_like of values.
threshold (int, float, or tuple) – Thresholding value(s) to use. If provided as a two element tuple, they’re taken to be lower and upper bounds.
mode (str, optional) –
Thresholding condition to determine which elements to keep in the mesh.
- Single threshold options:
’>=’ - Keeping condition is value >= threshold, default.
’>’ - Keeping condition is value > threshold.
’<’ - Keeping condition is value < threshold.
’<=’ - Keeping condition is value <= threshold.
’==’ - Keeping condition is value == threshold.
- Double threshold options:
’in’ - Inside bounds, inclusive of thresholds, default.
’xin’ - Inside bounds, exclusive of thresholds.
’out’ - Outside bounds, inclusive of thresholds.
’xout’ - Outside bounds, exclusive of threhsolds.
’<=<=’ - Keeping condition is lower <= value <= upper, equivalent to ‘in’.
’<<’ - Keeping condition is lower < value < upper, equivalent to ‘xin’.
’>=>=’ - Keeping condition is (lower >= value) | (value >= upper), equivalent to ‘out’.
’>>’ - Keeping condition is (lower > value) | (value > upper), equivalent to ‘xout’
scalar_preference (str, optional) – If scalars is provided as a string and that string exists as an entry in both NodeData and ElemData, this determines which will be used. Must be either ‘nodes’ or ‘elements’, by default ‘elements’.
all_nodes (bool, optional) – If node data is being used, this determines whether to keep an element if all nodes pass the thresholding condition or if any nodes pass the condition, by default True
InPlace (bool, optional) – If true, this mesh will be modified, otherwise a copy of the mesh will be created and modified, by default False.
cleanup (bool, optional) – Option to run
mesh.cleanup()
, removing nodes that are no longer in the cropped mesh, by default False.