예제 #1
0
        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));

        }
예제 #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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 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"));
 }
예제 #6
0
 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);
 }
예제 #7
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));
 }
예제 #8
0
 public void SpatialReference()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(new SpatialReference("no reference"), regularGrid.SpatialReference);
 }
예제 #9
0
 public void Version()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(0, regularGrid.Version);
 }
예제 #10
0
        public void ElementCount()
        {
            RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);

            Assert.AreEqual(12, regularGrid.ElementCount);
        }
예제 #11
0
 public void ElementType()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(global::OpenMI.Standard.ElementType.XYPolygon, regularGrid.ElementType);
 }
예제 #12
0
 public void GetFaceVertexIndices()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual(null, regularGrid.GetFaceVertexIndices(0, 0));
 }
예제 #13
0
 public void ID()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual("RegularGrid", regularGrid.ID);
 }
예제 #14
0
 public void Description()
 {
     RegularGrid regularGrid = new RegularGrid(100, 200, 10, 3, 4, 0.0);
     Assert.AreEqual("Regular Grid", regularGrid.Description);
 }
예제 #15
0
        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));

        }