@@ -27,7 +27,7 @@ use rayon::iter::IndexedParallelIterator;
2727use rayon:: iter:: IntoParallelIterator ;
2828#[ cfg( feature = "rayon" ) ]
2929use rayon:: iter:: ParallelIterator ;
30- use rupl:: types:: { Bound , Complex , Graph , GraphType , Prec } ;
30+ use rupl:: types:: { Bound , Complex , Graph , GraphData , Prec } ;
3131#[ cfg( feature = "bincode" ) ]
3232use serde:: { Deserialize , Serialize } ;
3333#[ cfg( not( feature = "kalc-lib" ) ) ]
@@ -202,7 +202,7 @@ impl Data {
202202 } )
203203 . next ( ) ;
204204 let apply_names =
205- |data : & [ GraphType ] , complex : bool , plot : & mut Graph , k : Option < usize > | {
205+ |data : & [ GraphData ] , complex : bool , plot : & mut Graph , k : Option < usize > | {
206206 if let Some ( names) = names {
207207 let names = get_names ( data, names) ;
208208 if let Some ( k) = k {
@@ -376,12 +376,12 @@ impl Data {
376376 lenx : usize ,
377377 leny : usize ,
378378 n : Option < usize > ,
379- buffer : & mut Vec < GraphType > ,
379+ buffer : & mut Vec < GraphData > ,
380380 ) -> bool {
381381 let len = if n. is_some ( ) { 1 } else { self . data . len ( ) } ;
382382 if len > buffer. len ( ) {
383383 for _ in 0 ..len - buffer. len ( ) {
384- buffer. push ( GraphType :: None )
384+ buffer. push ( GraphData :: None )
385385 }
386386 }
387387 buffer. into_par_iter ( ) . enumerate ( ) . any ( |( mut i, b) | {
@@ -418,16 +418,22 @@ impl Data {
418418 endy : f64 ,
419419 lenx : usize ,
420420 leny : usize ,
421- buffer : & mut GraphType ,
421+ buffer : & mut GraphData ,
422422 ) -> Option < bool > {
423423 let dx = ( endx - startx) / lenx as f64 ;
424424 let dy = ( endy - starty) / leny as f64 ;
425425 Some ( match & data. graph_type . val {
426426 Val :: Num ( n) => {
427427 if let Some ( c) = n {
428- * buffer = GraphType :: Constant ( * c, data. graph_type . inv ( ) ) ;
428+ * buffer = GraphData :: Constant ( * c, data. graph_type . inv ( ) ) ;
429429 matches ! ( c, Complex :: Complex ( _, _) | Complex :: Imag ( _) )
430430 } else {
431+ /*TODO
432+ buffer.set_type(GraphType::Width3D, (leny+1)*(lenx+1));
433+ let GraphData::Width3D(v, sx,sy,ex,ey) = buffer else {
434+ unreachable!()
435+ };
436+ */
431437 let data = ( 0 ..=leny)
432438 . into_par_iter ( )
433439 . flat_map ( |j| {
@@ -469,14 +475,14 @@ impl Data {
469475 let ( a, b) = compact ( data) ;
470476 #[ cfg( not( feature = "kalc-lib" ) ) ]
471477 let ( a, b) = ( data, is_complex ( ) ) ;
472- * buffer = GraphType :: Width3D ( a, startx, starty, endx, endy) ;
478+ * buffer = GraphData :: Width3D ( a, startx, starty, endx, endy) ;
473479 b
474480 }
475481 }
476482 #[ cfg( feature = "kalc-lib" ) ]
477483 Val :: Vector ( v) => {
478484 if let Some ( v) = v {
479- * buffer = GraphType :: Point ( * v) ;
485+ * buffer = GraphData :: Point ( * v) ;
480486 false
481487 } else {
482488 let data = ( 0 ..=leny)
@@ -517,7 +523,7 @@ impl Data {
517523 } )
518524 . collect :: < Vec < ( f64 , Complex ) > > ( ) ;
519525 let ( a, b) = compact_coord ( data) ;
520- * buffer = GraphType :: Coord ( a) ;
526+ * buffer = GraphData :: Coord ( a) ;
521527 b
522528 }
523529 }
@@ -562,7 +568,7 @@ impl Data {
562568 } )
563569 . collect :: < Vec < ( f64 , f64 , Complex ) > > ( ) ;
564570 let ( a, b) = compact_coord3d ( data) ;
565- * buffer = GraphType :: Coord3D ( a) ;
571+ * buffer = GraphData :: Coord3D ( a) ;
566572 b
567573 }
568574 #[ cfg( feature = "kalc-lib" ) ]
@@ -609,13 +615,13 @@ impl Data {
609615 }
610616 }
611617 let mut b = false ;
612- * buffer = GraphType :: List (
618+ * buffer = GraphData :: List (
613619 ndata
614620 . into_iter ( )
615621 . map ( |data| {
616622 let ( a, c) = compact_coord3d ( data) ;
617623 b |= c;
618- GraphType :: Coord3D ( a)
624+ GraphData :: Coord3D ( a)
619625 } )
620626 . collect ( ) ,
621627 ) ;
@@ -624,7 +630,7 @@ impl Data {
624630 #[ cfg( feature = "kalc-lib" ) ]
625631 Val :: Matrix ( m) => {
626632 if let Mat :: D3 ( m) = m {
627- * buffer = GraphType :: Coord3D (
633+ * buffer = GraphData :: Coord3D (
628634 m. iter ( ) . map ( |m| ( m. x , m. y , Complex :: Real ( m. z ) ) ) . collect ( ) ,
629635 ) ;
630636 false
@@ -646,12 +652,12 @@ impl Data {
646652 slice : isize ,
647653 view_x : bool ,
648654 n : Option < usize > ,
649- buffer : & mut Vec < GraphType > ,
655+ buffer : & mut Vec < GraphData > ,
650656 ) -> bool {
651657 let len = if n. is_some ( ) { 1 } else { self . data . len ( ) } ;
652658 if len > buffer. len ( ) {
653659 for _ in 0 ..len - buffer. len ( ) {
654- buffer. push ( GraphType :: None )
660+ buffer. push ( GraphData :: None )
655661 }
656662 }
657663 self . get_2d_slice (
@@ -670,7 +676,7 @@ impl Data {
670676 mut leny : usize ,
671677 view_x : bool ,
672678 n : Option < usize > ,
673- buffer : & mut Vec < GraphType > ,
679+ buffer : & mut Vec < GraphData > ,
674680 ) -> bool {
675681 #[ cfg( feature = "kalc-lib" ) ]
676682 let ( xstr, ystr, startx, starty, endx, endy) = if view_x {
@@ -702,7 +708,7 @@ impl Data {
702708 return false ;
703709 } ;
704710 if let Val :: Num ( Some ( c) ) = data. graph_type . val {
705- * buf = GraphType :: Constant ( c, data. graph_type . inv ( ) ) ;
711+ * buf = GraphData :: Constant ( c, data. graph_type . inv ( ) ) ;
706712 matches ! ( c, Complex :: Complex ( _, _) | Complex :: Imag ( _) )
707713 } else {
708714 #[ cfg( feature = "kalc-lib" ) ]
@@ -740,17 +746,17 @@ impl Data {
740746 let ( a, b) = compact ( data) ;
741747 #[ cfg( not( feature = "kalc-lib" ) ) ]
742748 let ( a, b) = ( data, is_complex ( ) ) ;
743- * buf = GraphType :: Width3D ( a, starx, stary, enx, eny) ;
749+ * buf = GraphData :: Width3D ( a, starx, stary, enx, eny) ;
744750 b
745751 }
746752 #[ cfg( feature = "kalc-lib" ) ]
747753 Val :: Vector ( _) => {
748- * buf = GraphType :: None ;
754+ * buf = GraphData :: None ;
749755 false
750756 }
751757 #[ cfg( feature = "kalc-lib" ) ]
752758 Val :: Vector3D => {
753- * buf = GraphType :: None ;
759+ * buf = GraphData :: None ;
754760 false
755761 }
756762 #[ cfg( feature = "kalc-lib" ) ]
@@ -789,13 +795,13 @@ impl Data {
789795 }
790796 }
791797 let mut b = false ;
792- * buf = GraphType :: List (
798+ * buf = GraphData :: List (
793799 ndata
794800 . into_iter ( )
795801 . map ( |data| {
796802 let ( a, c) = compact_coord3d ( data) ;
797803 b |= c;
798- GraphType :: Coord3D ( a)
804+ GraphData :: Coord3D ( a)
799805 } )
800806 . collect ( ) ,
801807 ) ;
@@ -804,12 +810,12 @@ impl Data {
804810 #[ cfg( feature = "kalc-lib" ) ]
805811 Val :: Matrix ( m) => {
806812 if let Mat :: D2 ( m) = m {
807- * buf = GraphType :: Coord (
813+ * buf = GraphData :: Coord (
808814 m. iter ( ) . map ( |m| ( m. x , Complex :: Real ( m. y ) ) ) . collect ( ) ,
809815 ) ;
810816 false
811817 } else {
812- * buf = GraphType :: None ;
818+ * buf = GraphData :: None ;
813819 false
814820 }
815821 }
@@ -823,12 +829,12 @@ impl Data {
823829 end : f64 ,
824830 len : usize ,
825831 n : Option < usize > ,
826- buffer : & mut Vec < GraphType > ,
832+ buffer : & mut Vec < GraphData > ,
827833 ) -> bool {
828834 let l = if n. is_some ( ) { 1 } else { self . data . len ( ) } ;
829835 if l > buffer. len ( ) {
830836 for _ in 0 ..l - buffer. len ( ) {
831- buffer. push ( GraphType :: None )
837+ buffer. push ( GraphData :: None )
832838 }
833839 }
834840 buffer. into_par_iter ( ) . enumerate ( ) . any ( |( mut i, b) | {
@@ -865,13 +871,13 @@ impl Data {
865871 start : f64 ,
866872 end : f64 ,
867873 len : usize ,
868- buffer : & mut GraphType ,
874+ buffer : & mut GraphData ,
869875 ) -> Option < bool > {
870876 let dx = ( end - start) / len as f64 ;
871877 Some ( match & data. graph_type . val {
872878 Val :: Num ( n) => {
873879 if let Some ( c) = n {
874- * buffer = GraphType :: Constant ( * c, data. graph_type . inv ( ) ) ;
880+ * buffer = GraphData :: Constant ( * c, data. graph_type . inv ( ) ) ;
875881 matches ! ( c, Complex :: Complex ( _, _) | Complex :: Imag ( _) )
876882 } else if data. graph_type . inv ( ) {
877883 let data = ( 0 ..=len)
@@ -898,7 +904,7 @@ impl Data {
898904 let ( a, b) = compact_coord ( data) ;
899905 #[ cfg( not( feature = "kalc-lib" ) ) ]
900906 let ( a, b) = ( data, is_complex ( ) ) ;
901- * buffer = GraphType :: Coord ( a) ;
907+ * buffer = GraphData :: Coord ( a) ;
902908 b
903909 } else {
904910 let data = ( 0 ..=len)
@@ -925,14 +931,14 @@ impl Data {
925931 let ( a, b) = compact ( data) ;
926932 #[ cfg( not( feature = "kalc-lib" ) ) ]
927933 let ( a, b) = ( data, is_complex ( ) ) ;
928- * buffer = GraphType :: Width ( a, start, end) ;
934+ * buffer = GraphData :: Width ( a, start, end) ;
929935 b
930936 }
931937 }
932938 #[ cfg( feature = "kalc-lib" ) ]
933939 Val :: Vector ( v) => {
934940 if let Some ( v) = v {
935- * buffer = GraphType :: Point ( * v) ;
941+ * buffer = GraphData :: Point ( * v) ;
936942 false
937943 } else {
938944 let data = ( 0 ..=len)
@@ -962,7 +968,7 @@ impl Data {
962968 } )
963969 . collect :: < Vec < ( f64 , Complex ) > > ( ) ;
964970 let ( a, b) = compact_coord ( data) ;
965- * buffer = GraphType :: Coord ( a) ;
971+ * buffer = GraphData :: Coord ( a) ;
966972 b
967973 }
968974 }
@@ -996,7 +1002,7 @@ impl Data {
9961002 } )
9971003 . collect :: < Vec < ( f64 , f64 , Complex ) > > ( ) ;
9981004 let ( a, b) = compact_coord3d ( data) ;
999- * buffer = GraphType :: Coord3D ( a) ;
1005+ * buffer = GraphData :: Coord3D ( a) ;
10001006 b
10011007 }
10021008 #[ cfg( feature = "kalc-lib" ) ]
@@ -1022,7 +1028,7 @@ impl Data {
10221028 }
10231029 }
10241030 }
1025- * buffer = GraphType :: List ( ndata. into_iter ( ) . map ( GraphType :: Coord ) . collect ( ) ) ;
1031+ * buffer = GraphData :: List ( ndata. into_iter ( ) . map ( GraphData :: Coord ) . collect ( ) ) ;
10261032 false
10271033 } else {
10281034 let mut ndata: Vec < Vec < ( f64 , Complex ) > > = Vec :: new ( ) ;
@@ -1054,13 +1060,13 @@ impl Data {
10541060 }
10551061 }
10561062 let mut b = false ;
1057- * buffer = GraphType :: List (
1063+ * buffer = GraphData :: List (
10581064 ndata
10591065 . into_iter ( )
10601066 . map ( |data| {
10611067 let ( a, c) = compact_coord ( data) ;
10621068 b |= c;
1063- GraphType :: Coord ( a)
1069+ GraphData :: Coord ( a)
10641070 } )
10651071 . collect ( ) ,
10661072 ) ;
@@ -1071,7 +1077,7 @@ impl Data {
10711077 Val :: Matrix ( m) => {
10721078 if let Mat :: D2 ( m) = m {
10731079 * buffer =
1074- GraphType :: Coord ( m. iter ( ) . map ( |m| ( m. x , Complex :: Real ( m. y ) ) ) . collect ( ) ) ;
1080+ GraphData :: Coord ( m. iter ( ) . map ( |m| ( m. x , Complex :: Real ( m. y ) ) ) . collect ( ) ) ;
10751081 false
10761082 } else {
10771083 return None ;
0 commit comments