Пример #1
0
        public double[] solver(fPointer fptr, double t0, double y0,
                               double h, double t, int maxIter)
        {
            double[] yvalues = new double[maxIter];
            yvalues[0] = y0;

            for (int i = 1; i < maxIter; i++)
            {
                yvalues[i] = (yvalues[i - 1] + h * fptr(t0, yvalues[i - 1]));
                t0        += h;

                if (Math.Abs(t0 - t) < TOL)
                {
                    break;
                }
            }
            return(yvalues);
        }
        public async void loadApp()
        {
            fPointer        functionPointerDownload = new fPointer(TimTick);
            List <fPointer> functionPointerList     = new List <fPointer>();

            functionPointerList.Add(functionPointerDownload);
            while (true)
            {
                //if (timer2.Enabled == true)
                {
                    try
                    {
                        await functionPointerList[0](null);
                        System.Diagnostics.Debug.WriteLine("functionPointerList[0] functionPointerDownload");
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Exception + " + e.ToString());
                    }
                }
                Application.DoEvents(); // allow the picturebox to refresh itself before continuing
            }
        }
Пример #3
0
    private delegate void fPointer();     // point to every functions that it has void as return value and with no input parameter

    public void function1()
    {
        fPointer point = new fPointer(function2);

        point();
    }
 public void function1(fPointer ftr)
 {
     ftr();
 }