DEMutilities.postprocessing.analysistools. clip

Module to provide generic clipping functions and functors.

In general, all functions and functors provided have a strict interface: They require that an actual ‘call’ requires the return type to be a mask which is an np.ndarray with boolean members (dtype=bool).

This mask should be applicable on the main data fed into the function as a positive filter, retaining the elements that the clipping function promises.

Attention

Currently, these functions implement the functionality mostly themselves. In the future, most of the actual computations should be wrapped in Mpacts commands (wrapped again in concepts). These clipping tools can then be very thin wrappers that simply set data and execute a commandlist.

In order to be able to use this module import it like this:

import DEMutilities.postprocessing.analysistools.clip
#or assign it to a shorter name
import DEMutilities.postprocessing.analysistools.clip as cli

CrossingBordersCounterCommand

class DEMutilities.postprocessing.analysistools.clip.CrossingBordersCounterCommand(sim, rays, pred)

Bases: mpacts.core.command.PythonCommand

Internal PythonCommand used by PointsInMesh to count the numbers of face crossings each ray makes

CrossingBordersCounterCommand(name, parent, **kwargs)
execute()

ProcessRayCommand

class DEMutilities.postprocessing.analysistools.clip.ProcessRayCommand(sim, rays, ngons)

Bases: mpacts.core.command.PythonCommand

Internal PythonCommand used by PointsInMesh to ‘categorize’ face crossings that each ray makes. contact type = 1 is set for anti-aligned face crossings, contact type = 2 is set for aligned crossings, and contact type = 0 for no crossings. The list of last-encounted ngon indices that each ray keeps is updated and only its last 5 remaining values are kept.

This command should not be used directly, but only indirectly through PointsInMesh.

ProcessRayCommand(name, parent, **kwargs)
execute()
DEMutilities.postprocessing.analysistools.clip.in_beam(x, xmin, xmax)

Clip to an axis-aligned rectangular beam

Parameters:
  • x – array with points
  • xmin – a point with the minimal beam co-ordinates
  • xmax – a point with the maximal beam co-ordinates
DEMutilities.postprocessing.analysistools.clip.in_cylinder(x, pcyl1, pcyl2, rcyl)

Retain all points from x that are within a finite cylinder defined by two points pcyl1 and pcyl2, and a radius rcyl.

DEMutilities.postprocessing.analysistools.clip.in_infinite_cylinder(x, pcyl, vcyl, rcyl)

Retain all points from x that are within an infinite cylinder defined by a point on its axis pcyl, a direction vector (MUST be normalized) vcyl and a radius rcyl.

DEMutilities.postprocessing.analysistools.clip.in_sphere(x, xsphere, rsphere)

Retain all points in x that are within a given sphere at position xsphere and with radius rsphere.

DEMutilities.postprocessing.analysistools.clip.invert(mask)

Invert a boolean mask (every True becomes False and vice versa)

DEMutilities.postprocessing.analysistools.clip.proj_within_segment(x, pseg1, pseg2)

Retain all points from x that - when projected onto its axis - lie within a line segment defined by two points pseg1 and pseg2.