public void GetYCoordinate()
        {
            RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
            Assert.AreEqual(230.0, regularGrid.GetYCoordinate(0, 0));
            Assert.AreEqual(230.0, regularGrid.GetYCoordinate(0, 1));
            Assert.AreEqual(240.0, regularGrid.GetYCoordinate(0, 2));
            Assert.AreEqual(240.0, regularGrid.GetYCoordinate(0, 3));

            Assert.AreEqual(200.0, regularGrid.GetYCoordinate(11, 0));
            Assert.AreEqual(200.0, regularGrid.GetYCoordinate(11, 1));
            Assert.AreEqual(210.0, regularGrid.GetYCoordinate(11, 2));
            Assert.AreEqual(210.0, regularGrid.GetYCoordinate(11, 3));

        }
Example #2
0
        public void Initialize(System.Collections.Hashtable properties)
        {
            currentTimestep = 0;
            simulationStart = new DateTime(2001, 1, 1);
            dt               = 172800; //timestep length (2 days)
            nt               = 80;     // number of timesteps
            nx               = 2;      //number of grid cells in x-direction
            ny               = 2;      //number of grid cells in y-direction
            grid             = new RegularGrid(10, 10, 1000, nx, ny, 0);
            groundwaterHeads = new TimeSeriesGroup();
            infiltrations    = new TimeSeriesGroup();


            for (int i = 0; i < nx * ny; i++)
            {
                groundwaterHeads.Items.Add(new TimestampSeries("GwHead" + i.ToString(), simulationStart, nt, dt, TimestepUnit.Seconds, 4.9, new HydroNumerics.Core.Unit("meters", 1.0, 0.0)));
                infiltrations.Items.Add(new TimestampSeries("Infiltration" + i.ToString(), simulationStart, nt, dt, TimestepUnit.Seconds, -9999.9999, new HydroNumerics.Core.Unit("flow", 1.0, 0.0)));
            }

            Quantity infiltQuantity = new Quantity();

            infiltQuantity.Unit        = new HydroNumerics.OpenMI.Sdk.Backbone.Unit("level", 1.0, 0.0);
            infiltQuantity.ID          = "Infiltration";
            infiltQuantity.Description = "infiltration";
            infiltQuantity.ValueType   = global::OpenMI.Standard.ValueType.Scalar;
            InputExchangeItem infiltExItem = new InputExchangeItem();

            infiltExItem.Quantity   = infiltQuantity;
            infiltExItem.ElementSet = grid;
            inputExchangeItems      = new List <InputExchangeItem>();
            inputExchangeItems.Add(infiltExItem);

            Quantity headQuantity = new Quantity();

            headQuantity.Description = "Groundwater head";
            headQuantity.ID          = "Head";
            headQuantity.Unit        = new HydroNumerics.OpenMI.Sdk.Backbone.Unit("meters", 1, 0);
            headQuantity.ValueType   = global::OpenMI.Standard.ValueType.Scalar;
            OutputExchangeItem headOutItem = new OutputExchangeItem();

            headOutItem.Quantity   = headQuantity;
            headOutItem.ElementSet = grid;
            outputExchangeItems    = new List <OutputExchangeItem>();
            outputExchangeItems.Add(headOutItem);
        }
        public void Initialize(System.Collections.Hashtable properties)
        {
            currentTimestep = 0;
            simulationStart = new DateTime(2001,1,1);
            dt = 172800; //timestep length (2 days)
            nt = 80; // number of timesteps
            nx = 2; //number of grid cells in x-direction
            ny = 2; //number of grid cells in y-direction
            grid = new RegularGrid(10, 10, 1000, nx, ny, 0);
            groundwaterHeads = new TimeSeriesGroup();
            infiltrations = new TimeSeriesGroup();
            

            for (int i = 0; i < nx * ny; i++)
            {
                groundwaterHeads.Items.Add(new TimestampSeries("GwHead" + i.ToString(), simulationStart, nt, dt, TimestepUnit.Seconds, 4.9, new HydroNumerics.Core.Unit("meters",1.0,0.0)));
                infiltrations.Items.Add(new TimestampSeries("Infiltration" + i.ToString(), simulationStart, nt, dt, TimestepUnit.Seconds, -9999.9999, new HydroNumerics.Core.Unit("flow",1.0,0.0)));
            }

            Quantity infiltQuantity = new Quantity();
            infiltQuantity.Unit = new HydroNumerics.OpenMI.Sdk.Backbone.Unit("level", 1.0,0.0); 
            infiltQuantity.ID = "Infiltration";
            infiltQuantity.Description = "infiltration";
            infiltQuantity.ValueType = global::OpenMI.Standard.ValueType.Scalar;
            InputExchangeItem infiltExItem = new InputExchangeItem();
            infiltExItem.Quantity = infiltQuantity;
            infiltExItem.ElementSet = grid;
            inputExchangeItems = new List<InputExchangeItem>();
            inputExchangeItems.Add(infiltExItem);
           
            Quantity headQuantity = new Quantity();
            headQuantity.Description = "Groundwater head";
            headQuantity.ID = "Head";
            headQuantity.Unit = new HydroNumerics.OpenMI.Sdk.Backbone.Unit("meters",1,0);
            headQuantity.ValueType = global::OpenMI.Standard.ValueType.Scalar;
            OutputExchangeItem headOutItem = new OutputExchangeItem();
            headOutItem.Quantity = headQuantity;
            headOutItem.ElementSet = grid;
            outputExchangeItems = new List<OutputExchangeItem>();
            outputExchangeItems.Add(headOutItem);
        }
        public void GetZCoordinate()
        {
            RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
            bool exceptionWasThrown = false;
            try
            {
                regularGrid.GetZCoordinate(5, 0);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetType() == typeof(Exception));
                exceptionWasThrown = true;

            }
            Assert.IsTrue(exceptionWasThrown);
        }
 public void GetElementIndex()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(0, regularGrid.GetElementIndex("105_235"));
     Assert.AreEqual(11, regularGrid.GetElementIndex("125_205"));
 }
 public void CreateSmallElementSets()
 {
     RegularGrid regularGrid = new RegularGrid(10, 10, 20, 2, 2, 0);
     regularGrid = new RegularGrid(10, 10, 20, 1, 2, 0);
     regularGrid = new RegularGrid(10, 10, 20, 2, 1, 0);
     regularGrid = new RegularGrid(10, 10, 20, 1, 1, 0);
 }
 public void GetVertexCount()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(4, regularGrid.GetVertexCount(0));
     Assert.AreEqual(4, regularGrid.GetVertexCount(11));
 }
 public void SpatialReference()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(new SpatialReference("no reference"), regularGrid.SpatialReference);
 }
 public void Version()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(0, regularGrid.Version);
 }
        public void ElementCount()
        {
            RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);

            Assert.AreEqual(12, regularGrid.ElementCount);
        }
 public void ElementType()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(global::OpenMI.Standard.ElementType.XYPolygon, regularGrid.ElementType);
 }
 public void GetFaceVertexIndices()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(null, regularGrid.GetFaceVertexIndices(0, 0));
 }
 public void ID()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual("RegularGrid", regularGrid.ID);
 }
 public void Description()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual("Regular Grid", regularGrid.Description);
 }
        public void GetElementID()
        {
            RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
            Assert.AreEqual("105_235", regularGrid.GetElementID(0));
            Assert.AreEqual("125_205", regularGrid.GetElementID(11));

        }