Exemple #1
0
        public void AddDefaults()
        {
            V2Datas = new List <V2Data>();

            Grid1D       x1 = new Grid1D(1, 3);
            V2DataOnGrid d1 = new V2DataOnGrid(x1, x1, "Grid", 2);

            d1.InitRandom(1, 5);
            Add(d1);

            V2DataCollection d2 = new V2DataCollection("Collection", 1.5);

            d2.InitRandom(3, 5, 5, 4.5, 6.9);
            Add(d2);

            Grid1D       x2 = new Grid1D(1, 3);
            V2DataOnGrid d3 = new V2DataOnGrid(x2, x2, "Grid 2", 0.5);

            d3.InitRandom(1, 4);
            Add(d3);
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            /*Console.WriteLine("Task 1\n");
             * Grid1D x1 = new Grid1D((float)1.5, 3);
             * V2DataOnGrid d1 = new V2DataOnGrid(x1, x1, "6", 2);
             * d1.InitRandom(1, 5);
             * Console.WriteLine(d1.ToLongString());
             * V2DataCollection d2 = (V2DataCollection)d1;
             * Console.WriteLine(d2.ToLongString());
             *
             * Console.WriteLine("Task 2\n");
             * V2MainCollection coll = new V2MainCollection();
             *
             * coll.AddDefaults();
             * foreach (V2Data item in coll)
             * {
             *  Console.WriteLine(item.ToLongString() + "\n");
             * }
             *
             * Console.WriteLine("Task 3\n");
             * Complex[] ans;
             * foreach (V2Data item in coll)
             * {
             *  ans = item.NearAverage((float)0.5);
             *  for (int i = 0; i < ans.Length; i++)
             *  {
             *      Console.WriteLine(ans[i].ToString());
             *  }
             *  Console.WriteLine("\n");
             * }*/

            try
            {
                //Console.WriteLine("--------initializing V2DataOnGrid from text file--------\n");
                V2DataOnGrid DOG = new V2DataOnGrid("filename.txt");
                Console.WriteLine(DOG.ToLongString("N1"));
                //Console.WriteLine("--------------------------------------------------------\n");

                V2MainCollection MC = new V2MainCollection();
                MC.DataChanged += CatchCalls;
                MC.AddDefaults();         //Add
                MC.Remove("Grid 2", 0.5); //Remove
                MC[0].period = 0.3;       //ItemChanged
                MC[0]        = DOG;       //Replace

                /*Console.WriteLine(MC.ToLongString());
                 *
                 * foreach (Vector2 coord in MC.GetValue)
                 * {
                 *  Console.WriteLine(coord);
                 * }
                 * Console.WriteLine("\n");
                 *
                 * Console.WriteLine(MC.GetNearAverage.ToString("N2"));*/
            }
            catch (Exception e)
            {
                Console.WriteLine("--------<ERROR: " + e.Message + ">--------");
                return;
            }
        }