Пример #1
0
        static void Main(string[] args)
        {
            //1
            Grid1D       x         = new Grid1D(1, 3);
            Grid1D       y         = new Grid1D(1, 3);
            V2DataOnGrid Mag_Field = new V2DataOnGrid("Mag_Field", 100, x, y);

            Mag_Field.initRandom(0, 100);
            Console.WriteLine(Mag_Field.ToLongString());
            //1.1
            V2DataCollection collection = (V2DataCollection)Mag_Field;

            Console.WriteLine(collection.ToLongString());
            //2
            V2MainCollection mainCollection = new V2MainCollection();

            mainCollection.AddDefaults();
            Console.WriteLine(mainCollection.ToString());
            //3
            Complex[] e;
            int       eps   = 10;
            int       count = 1;

            foreach (V2Data item in mainCollection)
            {
                Console.WriteLine("item " + count++.ToString());
                item.ToLongString();
                e = item.NearAverage(eps);
                Console.WriteLine($"average eps = { ++eps }");
                for (int i = 0; i < e.Length; i++)
                {
                    Console.WriteLine(e[i].ToString());
                }
            }
            Console.WriteLine("=====\n");
            mainCollection.Remove("Data", 123);
            Console.WriteLine(mainCollection.ToString());
        }
Пример #2
0
        public void AddDefaults()
        {
            Grid1D Ox = new Grid1D(1, 3);
            Grid1D Oy = new Grid1D(1, 3);

            v2Datas = new List <V2Data>();
            V2DataOnGrid[]     mag         = new V2DataOnGrid[3];
            V2DataCollection[] collections = new V2DataCollection[3];
            for (int i = 0; i < 3; i++)
            {
                mag[i]         = new V2DataOnGrid("Data", 123, Ox, Oy);
                collections[i] = new V2DataCollection("Data", 123);
                //mag[i] = new V2DataOnGrid("Data " + i.ToString(), i, Ox, Oy);
                //collections[i] = new V2DataCollection("Collection number:  " + i.ToString(), i);
            }
            for (int i = 0; i < 3; i++)
            {
                mag[i].initRandom(0, 100);
                collections[i].initRandom(4, 10, 10, 0, 100);
                v2Datas.Add(mag[i]);
                v2Datas.Add(collections[i]);
            }
        }