Esempio n. 1
0
        public Integrator(double h, double maxTime, AWP awp = null)
        {
            _editPause = new ManualResetEvent (true);
            _h = h;
            _stepper = new RungeKuttaStepper (_h);
            //_stepper = new EulerStepper(_h);
            _calculating = false;

            _maxTime = maxTime;
            int capacity = (int)(maxTime / h) + 5;
            _list = new TimeList<Complex[]> (ChooseClosest.Distant, capacity);
            _triggerRange = 10;

            if (awp != null) {
                _awp = awp.Clone ();
            } else {
                Complex[] y0 = new Complex[100];

                for (int i = 0; i < y0.Length; i++) {
                    //y0 [i] = new Complex(1, rnd.NextDouble() * 2 - 1);
                    //y0 [i] = new Complex (1, i < y0.Length / 2 ? -1 : 1);
                    y0 [i] = Complex.FromPolarCoordinates(1, _rnd.NextDouble() * 2 * Math.PI);
                    //y0 [i] = Complex.FromPolarCoordinates(1, i < y0.Length / 2 ? Math.PI / 2 : Math.PI * 3 / 2);
                }
                _awp = new AWP (100, 4, 1, 2, 14, 0, y0);
            }
            _awp.Changed+= delegate(object sender, EventArgs e) {
                _changed = true;
                Recalc ();
            };
            _changed = true;
            Recalc ();
        }
 public static void Save(string path, AWP awp)
 {
     Save (path, awp.N, awp.P, awp.Lambda, awp.Omega, awp.K, awp.Beta, awp.Y);
 }
Esempio n. 3
0
 public void Use(AWP awp)
 {
     this._N = awp._N;
     this._P = awp._P;
     this._lambda = awp._lambda;
     this._omega = awp._omega;
     this._K = awp._K;
     this._beta = awp._beta;
     this._y0 = (Complex[])awp._y0.Clone ();
     if(Changed != null) {
         Changed (this, EventArgs.Empty);
     }
 }