use crate::{continuation::ContinuationMode, panoc::*};
#[derive(Debug)]
pub struct HomotopyCache {
pub(crate) panoc_cache: PANOCCache,
pub(crate) idx: Vec<usize>,
pub(crate) from: Vec<f64>,
pub(crate) to: Vec<f64>,
pub(crate) transition_mode: Vec<ContinuationMode>,
}
impl HomotopyCache {
pub fn new(panoc_cache: PANOCCache) -> Self {
HomotopyCache {
panoc_cache,
idx: Vec::new(),
from: Vec::new(),
to: Vec::new(),
transition_mode: Vec::new(),
}
}
pub fn add_continuation(
&mut self,
idx: usize,
from: f64,
to: f64,
transition: ContinuationMode,
) {
self.idx.push(idx);
self.from.push(from);
self.to.push(to);
self.transition_mode.push(transition);
}
pub fn add_continuations(
&mut self,
idx: &[usize],
from: &[f64],
to: &[f64],
transition: &[ContinuationMode],
) {
self.idx.extend(idx);
self.from.extend(from);
self.to.extend(to);
self.transition_mode.extend(transition);
}
}