src/bisection_tree/refine.rs

branch
dev
changeset 81
d2acaaddd9af
parent 9
f40dfaf2166d
--- a/src/bisection_tree/refine.rs	Sun Nov 10 09:02:57 2024 -0500
+++ b/src/bisection_tree/refine.rs	Tue Dec 31 09:12:43 2024 -0500
@@ -92,10 +92,9 @@
 /// The `Refiner` is used to determine whether an [`Aggregator`] `A` stored in the [`BT`] is
 /// sufficiently refined within a [`Cube`], and in such a case, produce a desired result (e.g.
 /// a maximum value of a function).
-pub trait Refiner<F : Float, A, G, const N : usize> : Sync + Send + 'static
-where F : Num,
-      A : Aggregator,
-      G : SupportGenerator<F, N> {
+pub trait Refiner<A, G, const N : usize> : Sync + Send + 'static
+where A : Aggregator,
+      G : SupportGenerator<N> {
 
     /// The result type of the refiner
     type Result : std::fmt::Debug + Sync + Send + 'static;
@@ -125,7 +124,7 @@
     fn refine(
         &self,
         aggregator : &A,
-        domain : &Cube<F, N>,
+        domain : &Cube<G::Field, N>,
         data : &[G::Id],
         generator : &G,
         step : usize,
@@ -323,9 +322,9 @@
         container_arc : &'c Arc<Mutex<HeapContainer<'a, F, D, A, R::Sorting, R::Result, N, P>>>,
         step : usize
     ) -> Result<R::Result, MutexGuard<'c, HeapContainer<'a, F, D, A, R::Sorting, R::Result, N, P>>>
-    where R : Refiner<F, A, G, N>,
-          G : SupportGenerator<F, N, Id=D>,
-          G::SupportType : LocalAnalysis<F, A, N> {
+    where R : Refiner<A, G, N>,
+          G : SupportGenerator<N, Id=D, RealField = F>,
+          G::SupportType : LocalAnalysis<A, Cube<F, N>> {
 
         //drop(container);
 
@@ -435,9 +434,9 @@
         refiner : R,
         generator : &Arc<G>,
     ) -> Option<R::Result>
-    where R : Refiner<F, Self::Agg, G, N> + Sync + Send + 'static,
-          G : SupportGenerator<F, N, Id=Self::Data> + Sync + Send + 'static,
-          G::SupportType : LocalAnalysis<F, Self::Agg, N>;
+    where R : Refiner<Self::Agg, G, N> + Sync + Send + 'static,
+          G : SupportGenerator<N, Id=Self::Data, RealField = F> + Sync + Send + 'static,
+          G::SupportType : LocalAnalysis<Self::Agg, Cube<F, N>>;
 }
 
 fn refinement_loop<F : Float, D, A, R, G, const N : usize, const P : usize> (
@@ -446,9 +445,9 @@
     generator_arc : &Arc<G>,
     container_arc : &Arc<Mutex<HeapContainer<F, D, A, R::Sorting, R::Result, N, P>>>,
 ) where A : Aggregator,
-        R : Refiner<F, A, G, N>,
-        G : SupportGenerator<F, N, Id=D>,
-        G::SupportType : LocalAnalysis<F, A, N>,
+        R : Refiner<A, G, N>,
+        G : SupportGenerator<N, Id=D, RealField = F>,
+        G::SupportType : LocalAnalysis<A, Cube<F, N>>,
         Const<P> : BranchCount<N>,
         D : 'static + Copy + Sync + Send + std::fmt::Debug {
 
@@ -565,9 +564,9 @@
                 refiner : R,
                 generator : &Arc<G>,
             ) -> Option<R::Result>
-            where R : Refiner<F, A, G, $n>,
-                  G : SupportGenerator<F, $n, Id=D>,
-                  G::SupportType : LocalAnalysis<F, A, $n> {
+            where R : Refiner<A, G, $n>,
+                  G : SupportGenerator<$n, Id=D, RealField = F>,
+                  G::SupportType : LocalAnalysis<A, Cube<F, $n>> {
                 let mut init_container = HeapContainer {
                     heap : BinaryHeap::new(),
                     glb : R::Sorting::bottom(),

mercurial