コード例 #1
0
ファイル: Program.cs プロジェクト: DenisFuryaev/3_course_HW
        static void Main(string[] args)
        {
            // ------------------------------

            try
            {
                Console.WriteLine("-------------- V2DataOnGrid red from text file --------------\n");
                V2DataOnGrid data_on_grid = new V2DataOnGrid("V2DataOnGrid.txt");
                Console.WriteLine(data_on_grid.ToLongString("N1"));
                Console.WriteLine("-------------------------------------------------------------\n");

                V2MainCollection main_collection = new V2MainCollection();
                main_collection.AddDefaults();
                Console.WriteLine(main_collection.ToLongString());

                foreach (Vector2 coord in main_collection.GetValue)
                {
                    Console.WriteLine(coord);
                }
                Console.WriteLine("\n");

                Console.WriteLine(main_collection.GetNearAverage.ToString("N2"));
            }
            catch (Exception e)
            {
                Console.WriteLine("--------<ERROR: " + e.Message + ">--------");
                return;
            }

            // ------------------------------
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // ------------------------------

            V2DataOnGrid data_grid = new V2DataOnGrid("data_grid_1", 10.0f, new Grid1D(1, 2), new Grid1D(2, 3));

            data_grid.InitRandom(-10.0, -5.0);
            Console.WriteLine(data_grid.ToLongString());

            V2DataCollection data_collection = (V2DataCollection)data_grid;

            Console.WriteLine(data_collection.ToLongString());

            V2MainCollection main_collection = new V2MainCollection();

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

            Complex[] array;
            Console.WriteLine(" NearAverage of all elements in main_collection object:\n");
            foreach (V2Data data in main_collection)
            {
                array = data.NearAverage(1.0f);

                for (int i = 0; i < array.Length; i++)
                {
                    Console.WriteLine(array[i]);
                }

                Array.Clear(array, 0, array.Length);

                Console.WriteLine("\n");
            }

            // ------------------------------


            // --- deleting element ---
            //main_collection.Remove("data_collection_1", 2.0f);
            //Console.WriteLine(main_collection.ToString());
        }