public void SplitAtPositions() { var positions = new[] { 3.0, 8, 5, 4 }; var grid = new Grid1d(10); grid.SplitAtPositions(positions); Assert.Equal(5, grid.Cells.Count); Assert.Equal(1, grid[1].Domain.Length); grid.SplitAtPosition(8); // should do nothing but not throw an error Assert.Equal(5, grid.Cells.Count); }
public void TryToSplitButAlreadySplitAtLowerLevel() { //var grid = new Grid1d(100); //grid.DivideByCount(2); //now split at 50 //grid[1].SplitAtParameter(0.5); // splitting child cell at halfway mark = 75 on the parent //grid.SplitAtPosition(75); // should silently do nothing. //Assert.Equal(3, grid.GetCells().Count); var grid2 = new Grid1d(256); grid2.DivideByCount(2); //split at 128 grid2[0].DivideByCount(2); // split at 64 grid2[0][0].DivideByCount(2); // split at 32 grid2[0][0][0].DivideByCount(2); // split at 16 grid2.SplitAtPosition(32); Assert.Equal(5, grid2.GetCells().Count); Assert.Equal(3, grid2.Cells.Count); Assert.Single(grid2[0].Cells); Assert.Equal(2, grid2[1].Cells.Count); Assert.Single(grid2[0][0].Cells); Assert.Equal(2, grid2[0][0][0].Cells.Count); }