Exemplo n.º 1
0
        /// <summary>
        /// Исследование создания одномерных сеток
        /// </summary>
        private static void GenerateGridTests()
        {
            Grid3D grid = new Grid3D(10m, 1m, 0.5m, 10, 5, 5);

            Console.WriteLine($"Проверка корректности сетки: {grid.GridValidity()}");

            var result = grid.InsertLayerX(10m);

            result = grid.InsertLayerX(0.3m);
            result = grid.InsertLayerX(0.2m);
            result = grid.InsertLayerX(0.1m);
            result = grid.InsertLayerX(9.0m);
            result = grid.InsertLayerX(1.5m);
            result = grid.InsertLayerX(4.3m);
            result = grid.InsertLayerX(9.7m);
            result = grid.InsertLayerX(9.75m);

            result = grid.InsertLayerY(0.5m);

            result = grid.InsertLayerZ(0.43m);

            Console.WriteLine($"Проверка корректности сетки после вставки слоёв: {grid.GridValidity()}");

            /////////////////////////
            XmlSerializer formatter = new XmlSerializer(typeof(Grid3D));

            using (FileStream fs = new FileStream("grid1D.xml", FileMode.Create))
            {
                formatter.Serialize(fs, grid);

                Console.WriteLine("Объект сериализован");
            }
        }