private QuiverInPlane <int> GetPredefinedPointedFlowerQuiverInPlane(dynamic quiverParameter)
        {
            int       numPeriods      = quiverParameter;
            const int InnermostRadius = 50;

            return(UsefulQuiversInPlane.GetPointedFlowerQuiverInPlane(numPeriods, InnermostRadius));
        }
        private QuiverInPlane <int> GetPredefinedEvenFlowerType2QuiverInPlane(dynamic quiverParameter)
        {
            int       numVerticesInCenterPolygon = quiverParameter;
            const int InnermostRadius            = 50;

            return(UsefulQuiversInPlane.GetEvenFlowerType2QuiverInPlane(numVerticesInCenterPolygon, InnermostRadius));
        }
        private QuiverInPlane <int> GetPredefinedSquareQuiverInPlane(dynamic quiverParameter)
        {
            int numRows = quiverParameter;
            int width   = 100 * (numRows - 1);

            return(UsefulQuiversInPlane.GetSquareQuiverInPlane(numRows, width));
        }
        private QuiverInPlane <int> GetPredefinedTriangleQuiverInPlane(dynamic quiverParameter)
        {
            int numRows = quiverParameter;
            int radius  = 60 * (numRows - 1);

            return(UsefulQuiversInPlane.GetTriangleQuiverInPlane(numRows, radius));
        }
        private QuiverInPlane <int> GetPredefinedCycleQuiverInPlane(dynamic quiverParameter)
        {
            int       numVertices = quiverParameter;
            const int Radius      = 200;

            return(UsefulQuiversInPlane.GetCycleQuiverInPlane(numVertices, Radius));
        }
        private QuiverInPlane <int> GetPredefinedGeneralizedCobwebQuiverInPlane(dynamic quiverParameter)
        {
            var(numVerticesInCenterPolygon, numLayers) = ((int, int))quiverParameter;
            const int InnermostRadius = 50;

            return(UsefulQuiversInPlane.GetGeneralizedCobwebQuiverInPlane(numVerticesInCenterPolygon, numLayers, InnermostRadius));
        }
Beispiel #7
0
        public void StartGenerationFromBase_ThrowsGeneratorException_IfTooFewExplicitArrowPairs()
        {
            // The cobweb quiver has 5 implicit arrow pairs for the boundary layer
            var quiverInPlane = UsefulQuiversInPlane.GetCobwebQuiverInPlane(5, 50, firstVertex: 1);
            var potential     = UsefulQPs.GetCobwebQP(5).Potential;
            var boundaryLayer = Enumerable.Range(6, 10);
            var layerType     = CreateLayerType(10, 4, 20); // 4 < 5 explicit arrow pairs

            Assert.That(
                () => generator.StartGenerationFromBase(quiverInPlane, potential, boundaryLayer, layerType, nextVertex: 16),
                Throws.InstanceOf <GeneratorException>());
        }
Beispiel #8
0
        public void TryStartGenerationFromBase_ReturnsFalse_IfTooFewExplicitArrowPairs()
        {
            // The cobweb quiver has 5 implicit arrow pairs for the boundary layer
            var quiverInPlane = UsefulQuiversInPlane.GetCobwebQuiverInPlane(5, 50, firstVertex: 1);
            var potential     = UsefulQPs.GetCobwebQP(5).Potential;
            var boundaryLayer = Enumerable.Range(6, 10);
            var layerType     = CreateLayerType(10, 4, 20); // 4 < 5 explicit arrow pairs

            var result = generator.TryStartGenerationFromBase(quiverInPlane, potential, boundaryLayer, layerType, nextVertex: 16, out var nextCompositionParameters);

            Assert.That(result, Is.False);
            Assert.That(nextCompositionParameters, Is.Null);
        }
Beispiel #9
0
        public void QuiverGeneration_WithStartGenerationFromBase_GeneratesOddFlower5FromCobweb5Correctly()
        {
            var quiverInPlane = UsefulQuiversInPlane.GetCobwebQuiverInPlane(5, 50, firstVertex: 1);
            var qp            = UsefulQPs.GetCobwebQP(5, firstVertex: 1);
            var potential     = qp.Potential;
            var boundaryLayer = UsefulQPs.GetVerticesInCobwebQPLayer(5, 1, firstVertex: 1);
            var layerType     = CreateLayerType(10, 5, 20); // 5 arrow pairs, all implicit

            generator.StartGenerationFromBase(quiverInPlane, potential, boundaryLayer, layerType, nextVertex: qp.Quiver.Vertices.Count + 1);
            generator.SupplyComposition(CreateComposition(Utility.RepeatMany(5, 1, 1))); // No choice for the 5 arrow pairs
            generator.SupplyComposition(CreateComposition(Utility.RepeatMany(5, 3, 3))); // 2 steps left and right (both of which can be 0)

            var output = generator.EndGeneration();

            qp        = output.QP;
            potential = qp.Potential;
            var expectedPotential = CreatePotential(new Dictionary <DetachedCycle <int>, int>
            {
                { CreateDetachedCycle(1, 2, 3, 4, 5, 1), +1 },

                { CreateDetachedCycle(1, 2, 7, 6, 1), -1 },
                { CreateDetachedCycle(2, 3, 9, 8, 2), -1 },
                { CreateDetachedCycle(3, 4, 11, 10, 3), -1 },
                { CreateDetachedCycle(4, 5, 13, 12, 4), -1 },
                { CreateDetachedCycle(5, 1, 15, 14, 5), -1 },

                { CreateDetachedCycle(1, 15, 6, 1), +1 },
                { CreateDetachedCycle(2, 7, 8, 2), +1 },
                { CreateDetachedCycle(3, 9, 10, 3), +1 },
                { CreateDetachedCycle(4, 11, 12, 4), +1 },
                { CreateDetachedCycle(5, 13, 14, 5), +1 },

                { CreateDetachedCycle(6, 18, 17, 16, 15, 6), -1 },
                { CreateDetachedCycle(8, 22, 21, 20, 7, 8), -1 },
                { CreateDetachedCycle(10, 26, 25, 24, 9, 10), -1 },
                { CreateDetachedCycle(12, 30, 29, 28, 11, 12), -1 },
                { CreateDetachedCycle(14, 34, 33, 32, 13, 14), -1 },

                { CreateDetachedCycle(6, 18, 19, 20, 7, 6), +1 },
                { CreateDetachedCycle(8, 22, 23, 24, 9, 8), +1 },
                { CreateDetachedCycle(10, 26, 27, 28, 11, 10), +1 },
                { CreateDetachedCycle(12, 30, 31, 32, 13, 12), +1 },
                { CreateDetachedCycle(14, 34, 35, 16, 15, 14), +1 },
            });

            Assert.That(potential, Is.EqualTo(expectedPotential));
        }