Skip to content
Snippets Groups Projects
node_reference.rs 536 B
Newer Older
use crate::optic_node::{OpticNode, Optical};

/// A virtual component referring to another existing component. This node type is necessary in order to model resonators (loops) or double-pass systems.
pub struct NodeReference<'a> {
    reference: &'a Box<dyn Optical>,
}

impl<'a> NodeReference<'a> {
    pub fn new(node: &'a Box<dyn Optical>) -> Self {
        Self { reference: node }
    }
}

impl<'a> Optical for NodeReference<'a> {
    /// Returns "dummy" as node type.
    fn node_type(&self) -> &str {
        "reference"
    }
}