private ProgressiveVolumesCalculationsAggregator BuildFilterToFilterAggregatorWithOneAggregation(float baseLevel, float topLevel) { var subGrids = new[] { new[] { ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes) } }; if (!(subGrids[0][0] is ClientProgressiveHeightsLeafSubGrid progressiveSubGrid)) { throw new ArgumentException("Sub grid not a ClientProgressiveHeightsLeafSubGrid"); } progressiveSubGrid.NumberOfHeightLayers = 2; TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => progressiveSubGrid.Heights[0][x, y] = baseLevel); TRex.SubGridTrees.Core.Utilities.SubGridUtilities.SubGridDimensionalIterator((x, y) => progressiveSubGrid.Heights[1][x, y] = topLevel); var aggr = new ProgressiveVolumesCalculationsAggregator { VolumeType = VolumeComputationType.Between2Filters, AggregationStates = new[] { new ProgressiveVolumeAggregationState(SubGridTreeConsts.DefaultCellSize) } }; aggr.ProcessSubGridResult(subGrids); return(aggr); }
public void ProcessSubGridResult_FailWothNoDefinedVolumeType() { var subGrids = new[] { new[] { ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes) } }; var aggr = new ProgressiveVolumesCalculationsAggregator(); aggr.AggregationStates = new ProgressiveVolumeAggregationState[1]; Action act = () => aggr.ProcessSubGridResult(subGrids); act.Should().Throw <ArgumentException>().WithMessage("Unsupported volume type*"); }
public void ProcessSubGridResult_EmptySubGrid_NoHeightLayers() { var subGrids = new[] { new[] { ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes) } }; var aggr = new ProgressiveVolumesCalculationsAggregator { VolumeType = VolumeComputationType.Between2Filters, AggregationStates = new ProgressiveVolumeAggregationState[1] }; aggr.ProcessSubGridResult(subGrids); }
public void ProcessSubGridResult_EmptySubGrid_NoHeightsInLayers() { var subGrids = new[] { new[] { ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.ProgressiveVolumes) } }; if (!(subGrids[0][0] is ClientProgressiveHeightsLeafSubGrid progressiveSubGrid)) { throw new ArgumentException("Sub grid not a ClientProgressiveHeightsLeafSubGrid"); } progressiveSubGrid.NumberOfHeightLayers = 2; var aggr = new ProgressiveVolumesCalculationsAggregator { VolumeType = VolumeComputationType.Between2Filters, AggregationStates = new [] { new ProgressiveVolumeAggregationState(SubGridTreeConsts.DefaultCellSize) } }; aggr.ProcessSubGridResult(subGrids); }