src/bisection_tree/btfn.rs

branch
dev
changeset 86
d5b0e496b72f
parent 63
f7b87d84864d
--- a/src/bisection_tree/btfn.rs	Mon Dec 30 15:46:28 2024 -0500
+++ b/src/bisection_tree/btfn.rs	Mon Jan 06 20:29:25 2025 -0500
@@ -1,5 +1,6 @@
 
 use numeric_literals::replace_float_literals;
+use serde::{Serialize, Deserialize};
 use std::iter::Sum;
 use std::marker::PhantomData;
 use std::sync::Arc;
@@ -30,7 +31,7 @@
 /// Identifiers of the components ([`SupportGenerator::Id`], usually `usize`) are stored stored
 /// in a [bisection tree][BTImpl], when one is provided as `bt`. However `bt` may also be `()`
 /// for a [`PreBTFN`] that is only useful for vector space operations with a full [`BTFN`].
-#[derive(Clone,Debug)]
+#[derive(Clone,Debug,Serialize,Deserialize)]
 pub struct BTFN<
     F : Float,
     G : SupportGenerator<F, N>,
@@ -39,6 +40,7 @@
 > /*where G::SupportType : LocalAnalysis<F, A, N>*/ {
     bt : BT,
     generator : Arc<G>,
+    #[serde(skip)]
     _phantoms : PhantomData<F>,
 }
 
@@ -587,14 +589,17 @@
 }
 
 /// Helper type to use [`P2Refiner`] for maximisation.
+#[derive(Debug, Clone, Serialize, Deserialize)]
 struct RefineMax;
 
 /// Helper type to use [`P2Refiner`] for minimisation.
+#[derive(Debug, Clone, Serialize, Deserialize)]
 struct RefineMin;
 
 /// A bisection tree [`Refiner`] for maximising or minimising a [`BTFN`].
 ///
 /// The type parameter `T` should be either [`RefineMax`] or [`RefineMin`].
+#[derive(Debug, Clone, Serialize, Deserialize)]
 struct P2Refiner<F : Float, T> {
     /// The maximum / minimum should be above / below this threshold.
     /// If the threshold cannot be satisfied, the refiner will return `None`.
@@ -733,6 +738,7 @@
 /// The type parameter `T` should be either [`RefineMax`] for upper bound or [`RefineMin`]
 /// for lower bound.
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
 struct BoundRefiner<F : Float, T> {
     /// The upper/lower bound to check for
     bound : F,

mercurial