cminject.boundaries package¶
Implementations of cminject.base.Boundary.
Submodules¶
cminject.boundaries.field_based module¶
Boundaries based on (existing) grids, for instance defined by a RegularGridInterpolationField.
- class cminject.boundaries.field_based.GridFieldBasedBoundary(field: cminject.fields.regular_grid_interpolation.RegularGridInterpolationField)¶
Bases:
cminject.base.BoundaryA Boundary defined in terms of a
RegularGridInterpolationField. Fully delegates the implementation ofis_particle_inside()to the methodRegularGridInterpolationField.is_particle_inside(), as well as the definition ofz_boundary().- is_particle_inside(position: numpy.array, time: float) bool¶
Tells whether the given position is inside this boundary at the given time.
- Parameters
position – A spatial position to tell this for.
time – The time to tell this for.
- Returns
True if the particle is definitely inside this Boundary, False if it is not inside this Boundary (or if this is unknown).
- property z_boundary: Tuple[float, float]¶
Returns the Z boundary of this Z-bounded object.
- Returns
A tuple of floats, the first entry being z_min, the second being z_max.
cminject.boundaries.simple module¶
A collection of simple implementations of cminject.base.Boundary.
- class cminject.boundaries.simple.CuboidBoundary(intervals: List[Tuple[float, float]])¶
Bases:
cminject.boundaries.simple.SimpleZBoundary,cminject.utils.global_config.ConfigSubscriberAn n-dimensional cuboid (line/rectangle/3D cuboid…) that encloses a region of space.
- config_change(key: cminject.utils.global_config.ConfigKey, value: Any)¶
Will be called whenever the value of any subscribed key changes. Will be called once at the time of subscribing, IF the value for the subscribed key(s) is not None.
- Parameters
key – The ConfigKey that the change occurred for.
value – The new value of the configuration value stored for the key
key.
- Returns
Nothing (unused).
- is_particle_inside(position: numpy.array, time: float) bool¶
True if the particle’s position is inside the defined cuboid region.
- Parameters
position – The particle’s position.
time – The current time (ignored)
- class cminject.boundaries.simple.InfiniteBoundary¶
Bases:
cminject.base.BoundaryAn infinite boundary, enclosing all of space.
- is_particle_inside(position: float, time: float) bool¶
Tells whether the given position is inside this boundary at the given time.
- Parameters
position – A spatial position to tell this for.
time – The time to tell this for.
- Returns
True if the particle is definitely inside this Boundary, False if it is not inside this Boundary (or if this is unknown).
- property z_boundary: Tuple[float, float]¶
Returns the Z boundary of this Z-bounded object.
- Returns
A tuple of floats, the first entry being z_min, the second being z_max.
- class cminject.boundaries.simple.SimpleZBoundary(z_minmax: Tuple[float, float])¶
Bases:
cminject.base.BoundaryA boundary defined in terms of an interval in the Z dimension (the last spatial dimension). This type of boundary should be considered infinite with respect to all other spatial dimensions.
- is_particle_inside(position: numpy.array, time: float)¶
True if the particle’s position is inside the defined interval in the Z dimension (the last spatial dimension). All other coordinates are ignored, so this boundary should be considered infinite with respect to those.
- Parameters
position – The particle’s position (ignored apart from the last component
time – The current time (ignored)
- property z_boundary: Tuple[float, float]¶
Returns the Z boundary of this Z-bounded object.
- Returns
A tuple of floats, the first entry being z_min, the second being z_max.