示例#1
0
        public override string ToLongString()
        {
            string ret = "";

            for (int i = 0; i < Grids[0].Num; i++)
            {
                for (int j = 0; j < Grids[1].Num; j++)
                {
                    ret = ret + (" (" + (Grids[0].Step * (i + 1)).ToString() + ", " + (Grids[1].Step * (j + 1)).ToString()
                                 + ") Value: " + Node[i, j].ToString());
                }
                ret = ret + "\n";
            }

            return("Type: 2DataOnGrid Base: Info: " + Info + " Freq: " + Freq.ToString()
                   + " Ox: " + Grids[0].ToString() + " Oy: " + Grids[1].ToString() + "\n" + ret);
        }
示例#2
0
        static void Main(string[] args)
        {
            /* 1 */
            Grid1D       x    = new Grid1D(10, 3);
            Grid1D       y    = new Grid1D(10, 3);
            V2DataOnGrid test = new V2DataOnGrid("test", 100, x, y);

            test.initRandom(0, 100);
            Console.WriteLine(test.ToLongString());

            //Console.WriteLine("\n\n ========== OPERATOR ========== \n\n");

            V2DataCollection collection = (V2DataCollection)test;

            Console.WriteLine(collection.ToLongString());

            /* 2 */
            V2MainCollection mainCollection = new V2MainCollection();

            mainCollection.AddDefaults();
            Console.WriteLine(mainCollection.ToString());

            /* 3 */
            Complex[] c;
            int       count = 1;

            foreach (V2Data item in mainCollection)
            {
                Console.WriteLine("item " + count.ToString());
                item.ToLongString();

                c = item.NearAverage(10);
                Console.WriteLine("average eps = 10");
                for (int i = 0; i < c.Length; i++)
                {
                    Console.WriteLine(c[i].ToString());
                }
                count++;
            }

            /* test remove */
            mainCollection.Remove("data info2", 2);
            Console.WriteLine(mainCollection.ToString());
        }
示例#3
0
        public void AddDefaults()
        {
            Grid1D Ox = new Grid1D(10, 3);
            Grid1D Oy = new Grid1D(10, 3);

            v2Datas = new List <V2Data>();
            V2DataOnGrid[]     grid        = new V2DataOnGrid[3];
            V2DataCollection[] collections = new V2DataCollection[3];

            for (int i = 0; i < 3; i++)
            {
                grid[i]        = new V2DataOnGrid("data info2" /*+ i.ToString()*/, 2, Ox, Oy); // test i = 2
                collections[i] = new V2DataCollection("collection info" + i.ToString(), i);
            }

            for (int i = 0; i < 3; i++)
            {
                grid[i].initRandom(0, 100);
                collections[i].initRandom(4, 100, 100, 0, 100);
                v2Datas.Add(grid[i]);
                v2Datas.Add(collections[i]);
            }
        }