コード例 #1
0
        private void initObs(Sph2D calc)
        {
            pr = calc;
            v0 = pr.Rebuild(pr.TimeSynch);
            //var dt = 0.0000001;
            var dt = 5 * 10E-6;

            sol = Ode.RK45(pr.TimeSynch, v0, pr.f, dt).WithStepRx(dt * 10, out controller);//.StartWith(new SolPoint(pr.TimeSynch,v0));
            controller.Pause();

            sol.ObserveOnDispatcher().Subscribe(sp => {
                vm.SolPointList.Update(sp);
                slider.Maximum = (double)(vm.SolPointList.Value.Count > 0 ? vm.SolPointList.Value.Count : 0);
            });
        }
コード例 #2
0
        private void initObs(Sph2D calc)
        {
            pr = calc;
            v0 = pr.Rebuild(pr.TimeSynch);
            //var dt = 0.0000001;
            var dt = 1000 * 1E-6;

            SPH2D_Ver3.dt = dt;
            sol           = Ode.RK45(pr.TimeSynch, v0, pr.f, dt).WithStepRx(dt * 10, out controller).StartWith(new SolPoint(pr.TimeSynch, v0));
            //sol = SPH2D_Ver3.CoolIntegration(calc as Sph2D_improoveIntegr).WithStepRx(dt * 100,out controller).StartWith(new SolPoint(pr.TimeSynch,v0));
            controller.Pause();

            sol.ObserveOnDispatcher().Subscribe(sp => {
                vm.SolPointList.Update(sp);
                slider.Maximum = (double)(vm.SolPointList.Value.Count > 0 ? vm.SolPointList.Value.Count : 0);
            });
        }
コード例 #3
0
        public MainWindow()
        {
            pr = GetTest();
            vm = new ViewModel(pr);
            vm.Model1Rx.Value.PlotType = OxyPlot.PlotType.Cartesian;
            DataContext = vm;
            InitializeComponent();



            //(0.001875+0.0075) * 0.5
            initObs(pr);
            vm.DrawState = 1;
            vm.Model1Rx.Update(new SolPoint(pr.TimeSynch, pr.Rebuild()));

            var trackbarch = Observable.FromEventPattern <RoutedPropertyChangedEventArgs <double> >(slider, "ValueChanged").Select(i => (int)i.EventArgs.NewValue);
            var rb0        = Observable.FromEventPattern <RoutedEventArgs>(radioButton, "Checked").Select(e => 0);
            var rb1        = Observable.FromEventPattern <RoutedEventArgs>(radioButton_Copy, "Checked").Select(e => 1);
            var grType     = rb0.Merge(rb1).StartWith(0);


            var rb10      = Observable.FromEventPattern <RoutedEventArgs>(radioButton_Copy1, "Checked").Select(e => 0);
            var rb11      = Observable.FromEventPattern <RoutedEventArgs>(radioButton_Copy2, "Checked").Select(e => 1);
            var rb12      = Observable.FromEventPattern <RoutedEventArgs>(radioButton_Copy3, "Checked").Select(e => 2);
            var rb13      = Observable.FromEventPattern <RoutedEventArgs>(radioButton_Copy4, "Checked").Select(e => 3);
            var wichGraph = rb10.Merge(rb11).Merge(rb12).Merge(rb13).StartWith(0);

            var all = trackbarch.CombineLatest(grType, wichGraph, (i, gT, wG) => new Tuple <int, int, int>(i, gT, wG));

            all.
            Subscribe(t => {
                vm.DrawState = t.Item2;
                vm.WichGraph = t.Item3;

                redrawVm(t.Item1);
            });
        }
コード例 #4
0
ファイル: ViewModel.cs プロジェクト: Poehavshiy/Interpolator
        public ViewModel(Sph2D curr)
        {
            _curr4Draw = MainWindow.GetTest();
            _curr4Draw.Rebuild();

            Fill0s(curr);

            Model1Rx = new VMPropRx <PlotModel, SolPoint>(
                () => {
                var Model1 = GetNewModel("params", "X", "p,Ro,V");
                P          = new ScatterSeries()
                {
                    Title      = "P",
                    MarkerType = MarkerType.Triangle,
                    MarkerSize = 2,
                    //ColorAxisKey = colorAxis.Key,
                };
                Model1.Series.Add(P);

                Ro = new ScatterSeries()
                {
                    Title      = "Ro",
                    MarkerType = MarkerType.Diamond,
                    MarkerSize = 2,
                    //ColorAxisKey = colorAxis.Key
                };
                Model1.Series.Add(Ro);

                V = new ScatterSeries()
                {
                    Title      = "V",
                    MarkerType = MarkerType.Circle,
                    MarkerSize = 2,
                    // ColorAxisKey = colorAxis.Key
                };
                Model1.Series.Add(V);

                E = new ScatterSeries()
                {
                    Title      = "E",
                    MarkerType = MarkerType.Circle,
                    MarkerSize = 2,
                    // ColorAxisKey = colorAxis.Key
                };
                Model1.Series.Add(E);

                colorSer2D = new ScatterSeries()
                {
                    Title        = "Color",
                    MarkerType   = MarkerType.Circle,
                    MarkerSize   = 2,
                    ColorAxisKey = colorAxis.Key
                };
                Model1.Series.Add(colorSer2D);

                return(Model1);
            },
                (sp, pm) => {
                _curr4Draw.SynchMeTo(sp);
                switch (DrawState)
                {
                case 1: {
                    Draw2D(sp.T, pm, WichGraph);
                    break;
                }

                default:
                    Draw(sp.T, pm);
                    break;
                }

                return(pm);
            });

            SolPointList = new VMPropRx <List <SolPoint>, SolPoint>(
                () => new List <SolPoint>(),
                (sp, lst) => {
                lst.Add(sp);
                return(lst);
            });
        }
コード例 #5
0
ファイル: ViewModel.cs プロジェクト: Poehavshiy/Interpolator
 public void Fill0s(Sph2D curr)
 {
     Ro0 = curr.AllParticles.Cast <IGasParticleVer3>().Max(p => p.Ro);
     P0  = curr.AllParticles.Cast <IGasParticleVer3>().Max(p => p.P);
     E0  = curr.AllParticles.Cast <IGasParticleVer3>().Max(p => p.E);
 }