SequentialSubModel

Trait SequentialSubModel 

Source
pub trait SequentialSubModel {
    // Required methods
    fn gaps(&self) -> &[Gap];
    fn is_obj_at_inf(&self) -> bool;
    fn try_iter<'a>(
        &'a self,
        surfaces: &'a [Surface],
    ) -> Result<SequentialSubModelIter<'a>>;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn len(&self) -> usize { ... }
    fn slice(&self, idx: Range<usize>) -> SequentialSubModelSlice<'_> { ... }
}
Expand description

A submodel of a sequential optical system.

A sequential submodel is the primary unit of computation in a sequential optical system. It is a collection of N + 1 surfaces and N gaps from which an iterator can be created to trace rays through the system.

Each submodel represents a sequence of surfaces and gaps for a given set of system parameters, such as wavelength and transverse axis. The set of all submodels spans the entire set of parameters of interest.

The iterator over a submodel yields a series of steps, each of which is a tuple of the form (Gap, Surface, Option<Gap>). The first element of a step is the gap before the surface, the second element is the surface itself, and the third element is the gap after the surface. The last Gap is optional because no gap exists after the image plane surface.

Given a system of N + 1 surfaces and N gaps, the first surface S0 is always an object plane and the last surface S(N) is always an image plane. The length of the iterator is N.

A forward iterator for such a system looks like the following:

S0   S1    S2    S3        S(N-1)    S(N)
 \  /  \  /  \  /  \   ... /    \    /  \
  G0    G1    G2    G3          G(N-1)   None
  --------    --------          -------------
   Step 0      Step 2             Step(N-1)
        --------
         Step 1

Step 0 is the tuple (G0, S1, G1), Step 1 is (G1, S2, G2), and so on.

A reverse iterator for the same system looks like the following:

   S(N)   S(N-1)  S(N-2)  S(N-3)            S1    S0
  /    \  /    \  /    \  /    \      ...  /  \  /
None  G(N-1)  G(N-2)  G(N-3)    G(N-4)    G1    G0
      --------------  ----------------    ---------
          Step 0           Step 2         Step(N-2)
              --------------
                  Step 1

In the reverse iteration, we never iterate from the image plane surface. For this reason, the number of steps in the reverse iterator is N - 1.

If i is the index of a surface in the forward iterator and j the index of the surface in the reverse iterator, then the two indexes are related by the equation j = N - i as shown above.

Strictly speaking, the last gap need not be None. Additionally, the first and last surfaces need not be object and image planes, repectively. These constraints are guaranteed at the level of the SequentialModel. However, since a SequentialSubModel is always created by a SequentialModel, we can assume that these constraints are always met. This would not be the case for user-supplied implementations of this trait, where care should be taken to ensure that the implementation conforms to these constraints.

With all of these constraints, the problem of sequential optical modeling is reduced to the problem of iterating over the surfaces and gaps in a submodel and determining what happens at each step. The same iterator can be used for different modeling approaches, e.g. paraxial ray tracing, 3D ray tracing, paraxial Gaussian beam propagation, etc. without changing the representation of the underlying system.

Required Methods§

Source

fn gaps(&self) -> &[Gap]

Source

fn is_obj_at_inf(&self) -> bool

Source

fn try_iter<'a>( &'a self, surfaces: &'a [Surface], ) -> Result<SequentialSubModelIter<'a>>

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn len(&self) -> usize

Source

fn slice(&self, idx: Range<usize>) -> SequentialSubModelSlice<'_>

Implementors§