Exemplo n.º 1
0
        private void ComputeCorrectMinDepositionDistance_CollisionWithPrimaryParticleTwoNeighbors()
        {
            var r               = 1.0;
            var pos             = new Vector3(0, 0, 100);
            var primaryParticle = new PrimaryParticle(0, pos, r);

            var handler = new BallisticSingleParticleDepositionHandler();

            var pos2           = new Vector3(1, 0, 10);
            var pp2            = new PrimaryParticle(1, pos2, r);
            var pos3           = new Vector3(1, 0, 5);
            var pp3            = new PrimaryParticle(1, pos3, r);
            var otherParticles = new List <PrimaryParticle>()
            {
                pp2, pp3
            };

            var neighborsList = _neighborslistFactory.Build2DNeighborslist(otherParticles);

            var dist = handler.GetDepositionDistance(primaryParticle, otherParticles, neighborsList, otherParticles.GetMaxRadius(), _config.Delta);

            var shouldBeDistance = 90 - Math.Sqrt(3);

            Assert.Equal(shouldBeDistance, dist);
        }
Exemplo n.º 2
0
        private void ComputeCorrectMinDepositionDistance_NoCollision()
        {
            var r               = 1.0;
            var pos             = new Vector3(0, 0, 100);
            var primaryParticle = new PrimaryParticle(0, pos, r);

            var handler = new BallisticSingleParticleDepositionHandler();

            var pos2           = new Vector3(5, 0, 10);
            var pp2            = new PrimaryParticle(1, pos2, r);
            var otherParticles = new List <PrimaryParticle>()
            {
                pp2
            };

            var neighborsList = _neighborslistFactory.Build2DNeighborslist(otherParticles);

            var dist = handler.GetDepositionDistance(primaryParticle, otherParticles, neighborsList, otherParticles.GetMaxRadius(), _config.Delta);

            var shouldBeDistance = primaryParticle.Position.Z - primaryParticle.Radius;

            Assert.Equal(shouldBeDistance, dist);
        }
Exemplo n.º 3
0
        private void ComputeCorrectMinDepositionDistance_CollisionWithPrimaryParticleOnlyOneNeighbor()
        {
            var r               = 1.0;
            var pos             = new Vector3(0, 0, 100);
            var primaryParticle = new PrimaryParticle(0, pos, r);

            var handler = new BallisticSingleParticleDepositionHandler();

            var pos2           = new Vector3(1, 0, 10);
            var pp2            = new PrimaryParticle(1, pos2, r);
            var otherParticles = new List <PrimaryParticle>()
            {
                pp2
            };
            var neighborsList = _neighborslistFactory.Build2DNeighborslist(otherParticles);

            var dist = handler.GetDepositionDistance(primaryParticle, otherParticles, neighborsList, otherParticles.GetMaxRadius(), _config.Delta);

            // Math.Sqrt(3) results from the square of the combined radius (4) - the distance to centerline.
            // This origins from the triangle: final position pp1. position neigbor, center projection neighbor.
            var shouldBeDistance = 90 - Math.Sqrt(3);

            Assert.Equal(shouldBeDistance, dist);
        }