Example #1
0
        public void DivideFromPosition()
        {
            var grid = new Grid1d(new Domain1d(-8, 8));

            Assert.Throws <ArgumentException>(() => grid.DivideByFixedLengthFromPosition(1, 10));
            grid.DivideByFixedLengthFromPosition(4, 0);
            Assert.Equal(4, grid.Cells.Count);
        }
Example #2
0
        public void DivideFromPosition()
        {
            var grid = new Grid1d(new Domain1d(-8, 8));

            grid.DivideByFixedLengthFromPosition(20, 10);
            Assert.Null(grid.Cells); // this should have been left undivided
            grid.DivideByFixedLengthFromPosition(4, 0);
            Assert.Equal(4, grid.Cells.Count);
        }
Example #3
0
        public void DivideGridFromOrigin()
        {
            var grid1 = new Grid1d(10);

            grid1.DivideByFixedLengthFromPosition(3, 5);
            var cellGeo = grid1.GetCells().Select(c => c.GetCellGeometry());

            Assert.Equal(4, cellGeo.Count());
            Assert.Equal(2, cellGeo.Last().Length());
            Assert.Equal(3, cellGeo.ToArray()[1].Length());
        }