Пример #1
0
        public void InterpolateHeightsTest(double probeX, double probeY)
        {
            LoadTheDesign();
            var Patch = new float[SubGridTreeConsts.SubGridTreeDimension, SubGridTreeConsts.SubGridTreeDimension];

            bool result = design.InterpolateHeights(Patch, probeX, probeY, SubGridTreeConsts.DefaultCellSize, 0);

            Assert.True(result, "Heights interpolation returned false");
        }
Пример #2
0
        public void ScanAllElevationsOverGiantDesign()
        {
            var Patch = new float[SubGridTreeConsts.SubGridTreeDimension, SubGridTreeConsts.SubGridTreeDimension];

            int numPatches = 0;

            design.NumTINProbeLookups     = 0;
            design.NumTINHeightRequests   = 0;
            design.NumNonNullProbeResults = 0;
            design.SpatialIndexOptimised.ScanAllSubGrids(leaf =>
            {
                double cellSize = leaf.Owner.CellSize;
                leaf.CalculateWorldOrigin(out double originX, out double originY);

                leaf.ForEach((x, y) =>
                {
                    if (design.InterpolateHeights(Patch, originX + x * cellSize, originY + y * cellSize, cellSize / SubGridTreeConsts.SubGridTreeDimension, 0))
                    {
                        numPatches++;
                    }
                });

                return(true);
            });

            Console.WriteLine($"Number of patches = {numPatches}, cells = {numPatches * 1024}, probes = {design.NumTINProbeLookups}");
        }
Пример #3
0
        public static void ScanAllElevationsOverGiantDesign()
        {
            DateTime  _start = DateTime.Now;
            TTMDesign design = new TTMDesign(SubGridTreeConsts.DefaultCellSize);

            //design.LoadFromFile(@"C:\Temp\141020 Finish Surface.ttm"); // 0.5 Mb
            design.LoadFromFile(@"C:\Temp\161006 Stripped less PRB & AS.ttm"); //600Mb
            //design.LoadFromFile(@"C:\Users\rwilson\Downloads\5644616_oba9c0bd14_FRL.ttm"); // 165Mb
            TimeSpan loadTime = DateTime.Now - _start;

            Console.WriteLine($"Perf Test: Duration for file load and index preparation = {loadTime}");

            TimeSpan bestTime = TimeSpan.MaxValue;

            var Patch = new float[SubGridTreeConsts.SubGridTreeDimension, SubGridTreeConsts.SubGridTreeDimension];

            for (int i = 0; i < 100; i++)
            {
                int numPatches = 0;
                _start = DateTime.Now;

                design.NumTINProbeLookups     = 0;
                design.NumTINHeightRequests   = 0;
                design.NumNonNullProbeResults = 0;
                design.SpatialIndexOptimised.ScanAllSubGrids(leaf =>
                {
                    double cellSize = leaf.Owner.CellSize;
                    leaf.CalculateWorldOrigin(out double originX, out double originY);

                    leaf.ForEach((x, y) =>
                    {
                        if (design.InterpolateHeights(Patch, originX + x * cellSize, originY + y * cellSize, cellSize / SubGridTreeConsts.SubGridTreeDimension, 0))
                        {
                            numPatches++;
                        }
                    });

                    return(true);
                });

                TimeSpan lookupTime = DateTime.Now - _start;

                if (lookupTime < bestTime)
                {
                    bestTime = lookupTime;
                    Console.WriteLine($"Perf Test: Run {i}: Duration for {numPatches} lookups = {lookupTime}, probes = {design.NumTINProbeLookups}, Triangle evaluations = {design.NumTINHeightRequests}, non-null results = {design.NumNonNullProbeResults}");
                }
            }
        }