Skip to main content

Module filter

Module filter 

Source
Expand description

Event filtering using bitmask matching.

This module provides filtering capabilities for event chains, allowing selection of events based on bitpattern matching.

§Filtering Scheme

Events are filtered using bit masks to match specific fields:

  • Pipeline mask matches pipeline type (bits 24-27)
  • SuperType mask matches MCRT category (bits 22-23)
  • SubType mask matches specific event type (bits 16-21)
  • SourceID mask matches material/surface ID (bits 0-15)

§Usage

use aetherus_events::filter::{BitsMatch, BitsProperty};

// Match all Material events from Mat(ID=1)
let matcher = BitsProperty::Match(BitsMatch::new(0x00FF0001, 0x03800001));
let matches = matcher.matches(0x03800001); // true

See module-level docs for more examples. Defines a filtering scheme that can be composed by concatenation of various fields in the event bitfield description.

§Examples - Pseudocode

The following is not supported syntax, but it was the driving force to develop an external DSL!
  1. We could filter for all Scattering Events coming from a specific material with MatId as such filter_seq!(MCRT|Material|{Inelastic, Elastic}|*|*|MatId)

  2. Filter for all interactions with objects that have SurfId(x) or MatId(x) described by MatSurfId(x) filter_seq!(MCRT|*|*|MatSurfId)

  3. Filter for events that have N number of interactions described by

use aetherus_events::filter_mcrt_seq;
filter_mcrt_seq!([MCRT|Interface|Refraction|SurfId, MCRT|Material|{Inelastic, Elastic}|*|*|MatId, ... ]);
  1. Filter for permutations of events
use aetherus_events::filter_mcrt_seq;
filter_mcrt_seq!(perm![ MCRT|Interface|*|SurfId,
                   MCRT|Material|{Elastic, Inelastic}|*|*|MatId,
                   ... ])

§Building patterns for filtering

As an internal DSL we would like to construct patterns as follows, but this was superseeded by the external DSL Eldritch-Trace

Macro to create a filter specification using pipe-delimited syntax Single event filter:

use aetherus_events::filter_mcrt_seq;
filter_mcrt_seq!(MCRT|Material|{Inelastic, Elastic}|*|*|MatId)

Sequence of events:

filter_mcrt_seq!([MCRT|Interface|*|SurfId, MCRT|Material|{Inelastic, Elastic}|*|*|MatId])

Permutation (any order):

filter_perm![MCRT|Interface|*|SurfId, MCRT|Material|{Inelastic, Elastic}|*|*|MatId]

Structs§

BitsMatch
Bitmask matcher for event filtering.

Enums§

BitsProperty

Functions§

find_dangling_uids
find_forward_uid_seq