pub struct Channel { /* private fields */ }Expand description
A named reaction graph whose edges are particles and whose vertices are production or decay processes.
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn edge(&mut self, name: impl Into<String>) -> EdgeHandle<'_>
pub fn edge(&mut self, name: impl Into<String>) -> EdgeHandle<'_>
Create or edit a named particle edge.
§Panics
Panics only if the internal edge map fails to return an entry that was just inserted.
Sourcepub fn vertex(&mut self, name: impl Into<String>) -> VertexHandle<'_>
pub fn vertex(&mut self, name: impl Into<String>) -> VertexHandle<'_>
Create or edit a named interaction vertex.
Sourcepub fn get_vertex(&self, name: &str) -> LadduPhysicsResult<VertexView<'_>>
pub fn get_vertex(&self, name: &str) -> LadduPhysicsResult<VertexView<'_>>
Retrieve a vertex view which evaluates quantities in that vertex’s rest frame.
§Errors
Returns LadduPhysicsError when name does not identify a vertex in
this channel.
Sourcepub fn edges(&self) -> impl Iterator<Item = &Edge>
pub fn edges(&self) -> impl Iterator<Item = &Edge>
Iterate over particle edges in insertion order.
Sourcepub fn vertices(&self) -> impl Iterator<Item = &Vertex>
pub fn vertices(&self) -> impl Iterator<Item = &Vertex>
Iterate over interaction vertices in insertion order.
Sourcepub fn initial_edges(&self) -> impl Iterator<Item = &Edge>
pub fn initial_edges(&self) -> impl Iterator<Item = &Edge>
Iterate over edges consumed by the graph but not produced by any vertex.
Sourcepub fn validate(&self) -> LadduPhysicsResult<()>
pub fn validate(&self) -> LadduPhysicsResult<()>
Validate all channel vertices.
Consumers such as event generators call this automatically.
§Errors
Returns LadduPhysicsError when a vertex references missing or
duplicate edges, the reaction graph is inconsistent, or an initial edge
lacks a valid momentum source.
Sourcepub fn properties(
&self,
edge: &str,
) -> LadduPhysicsResult<Option<&ParticleProperties>>
pub fn properties( &self, edge: &str, ) -> LadduPhysicsResult<Option<&ParticleProperties>>
Return the optional particle properties attached to an edge.
§Errors
Returns LadduPhysicsError when edge is not in this channel.
Sourcepub fn particle(&self, edge: &str) -> LadduPhysicsResult<&ParticleProperties>
pub fn particle(&self, edge: &str) -> LadduPhysicsResult<&ParticleProperties>
Return the particle definition attached to an edge.
§Errors
Returns LadduPhysicsError when edge is unknown or has no particle
properties.
Sourcepub fn p4(&self, edge: &str) -> LadduPhysicsResult<Vec4>
pub fn p4(&self, edge: &str) -> LadduPhysicsResult<Vec4>
Construct the symbolic four-momentum of an edge.
When no explicit expression is attached, momentum conservation is used to infer a uniquely missing momentum at a connected vertex.
§Errors
Returns LadduPhysicsError when the edge is unknown or its momentum
cannot be uniquely resolved from the channel.
Sourcepub fn vec3(&self, edge: &str) -> LadduPhysicsResult<Vec3>
pub fn vec3(&self, edge: &str) -> LadduPhysicsResult<Vec3>
Construct the symbolic three-momentum of an edge.
§Errors
Returns LadduPhysicsError when the edge’s four-momentum cannot be
resolved.
Sourcepub fn mass(&self, edge: &str) -> LadduPhysicsResult<Expr>
pub fn mass(&self, edge: &str) -> LadduPhysicsResult<Expr>
Construct the invariant-mass expression for an edge.
§Errors
Returns LadduPhysicsError when the edge’s four-momentum cannot be
resolved.
Sourcepub fn s(&self, edge: &str) -> LadduPhysicsResult<Expr>
pub fn s(&self, edge: &str) -> LadduPhysicsResult<Expr>
Construct the invariant mass squared of an edge.
§Errors
Returns LadduPhysicsError when the edge’s four-momentum cannot be
resolved.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Channel
impl<'de> Deserialize<'de> for Channel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.