From c5d5ac90b16ccfbb275509573e4636f30adb5c3a Mon Sep 17 00:00:00 2001
From: Anton Kudryashov <qubabox@mail.ru>
Date: Mon, 21 Nov 2016 14:16:51 +0300
Subject: [PATCH] generic matrix created.

---
 WindStressPRM/Matrix.cs        | 74 ++++++++++++++++++++++++++++++++++
 WindStressPRM/WindStressPRM.cs | 37 -----------------
 2 files changed, 74 insertions(+), 37 deletions(-)
 create mode 100644 WindStressPRM/Matrix.cs

diff --git a/WindStressPRM/Matrix.cs b/WindStressPRM/Matrix.cs
new file mode 100644
index 0000000..158561f
--- /dev/null
+++ b/WindStressPRM/Matrix.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+
+namespace WindStressPRM
+{
+    /// <summary>
+    /// Generic Matrix of type T
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class Matrix<T>
+    {
+        /// <summary>
+        /// Size of cell. In meters
+        /// </summary>
+        public CellSize Size { get; set; }
+        /// <summary>
+        /// Cells Container
+        /// </summary>
+        public T[,] Cells { get; set; }
+        /// <summary>
+        /// Number of rows in matrix
+        /// </summary>
+        /// <returns></returns>
+        public int RowsCount()
+        {
+            return Cells.Rank > 0 ? Cells.GetLength(0) : 0;
+        }
+        /// <summary>
+        /// Number of columns 
+        /// </summary>
+        /// <returns></returns>
+        public int ColumnCount()
+        {
+            return Cells.Rank > 1 ? Cells.GetLength(1) : 0;
+        }
+    }
+    /// <summary>
+    /// Cell Sizes
+    /// Параметры ячейки (регулярной сетки)
+    /// </summary>
+    public class CellSize
+    {
+        /// <summary>
+        /// ширина ячейки (расстояние между соседними по широте центрами ячеек)
+        /// </summary>
+        public double Width { get; set; }
+        /// <summary>
+        /// высота ячейки (расстояние между соседними по долготе центрами ячеек)
+        /// </summary>
+        public double Height { get; set; }
+        /// <summary>
+        /// designated constructor
+        /// </summary>
+        /// <param name="wdh">Cell Width</param>
+        /// <param name="hgh">Cell Height</param>
+        public CellSize(double wdh, double hgh)
+        {
+            this.Width = wdh;
+            this.Height = hgh;
+            if (!(this.CheckValue()))
+            {
+                throw new System.ArgumentException("Cell width or height values are incorrect!");
+            }
+        }
+        /// <summary>
+        /// Проверка валидности полей
+        /// </summary>
+        /// <returns></returns>
+        public bool CheckValue()
+        {
+            return Width > 0 && Height > 0;
+        }
+    }
+}
diff --git a/WindStressPRM/WindStressPRM.cs b/WindStressPRM/WindStressPRM.cs
index ecbd4ce..8c52ee5 100644
--- a/WindStressPRM/WindStressPRM.cs
+++ b/WindStressPRM/WindStressPRM.cs
@@ -198,43 +198,6 @@ namespace WindStressPRM
         }
     }
     /// <summary>
-    /// Cell Size parameters
-    /// Параметры ячейки (регулярной сетки)
-    /// </summary>
-    public class CellSize
-    {
-        /// <summary>
-        /// ширина ячейки (расстояние между соседними по широте центрами ячеек)
-        /// </summary>
-        public double Width { get; set; }
-        /// <summary>
-        /// высота ячейки (расстояние между соседними по долготе центрами ячеек)
-        /// </summary>
-        public double Height { get; set; }
-        /// <summary>
-        /// designated constructor
-        /// </summary>
-        /// <param name="wdh">Cell Width</param>
-        /// <param name="hgh">Cell Height</param>
-        public CellSize(double wdh, double hgh)
-        {
-            this.Width = wdh;
-            this.Height = hgh;
-            if (!(this.CheckValue()))
-            {
-                throw new System.ArgumentException("Cell width or height values are incorrect!");
-            }
-        }
-        /// <summary>
-        /// Проверка валидности полей
-        /// </summary>
-        /// <returns></returns>
-        public bool CheckValue()
-        {
-            return Width > 0 && Height > 0;
-        }
-    }
-    /// <summary>
     /// power line object
     /// объект - ЛЭП
     /// </summary>
-- 
GitLab