private void GetNeighbors_3OtherPrimaryParticlesAre2DClose_1isTooFarAway() { var r = 5; var pos = new Vector3(0, 0, 100); var primaryParticle = new PrimaryParticle(0, pos, r); var handler = new BallisticSingleParticleDepositionHandler(); var pos2 = new Vector3(0, 3, 10); var pos3 = new Vector3(3, -3, 10); var pos4 = new Vector3(-3, -3, 10); var pos5 = new Vector3(-30, -30, 10); var pp2 = new PrimaryParticle(1, pos2, r); var pp3 = new PrimaryParticle(2, pos3, r); var pp4 = new PrimaryParticle(3, pos4, r); var pp5 = new PrimaryParticle(4, pos5, r); var particles = new List <PrimaryParticle>() { pp2, pp3, pp4, pp5 }; var neighborsList = _neighborslistFactory.Build2DNeighborslist(particles); var maxRadius = particles.GetMaxRadius(); var searchRadius = (primaryParticle.Radius + maxRadius) * _config.Delta; var neighbors = neighborsList.GetPrimaryParticlesWithinRadius(primaryParticle.Position, searchRadius); //var neighbors = handler.GetNeighbors(primaryParticle, neighborsList, maxRadius); Assert.Equal(3, neighbors.Count()); foreach (var neighbor in neighbors) { Assert.NotEqual(pos5, neighbor.Position); } }
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); }
public TestFilmFormationConfig() { SimulationBoxFactory = new AbsoluteTetragonalSimulationBoxFactory(); SingleParticleDepositionHandler = new BallisticSingleParticleDepositionHandler(); AggregateDepositionHandler = new BallisticAggregateDepositionHandler(SingleParticleDepositionHandler); WallCollisionHandler = new PeriodicBoundaryCollisionHandler(); NeighborslistFactory = new AccordNeighborslistFactory(); }
private void IsWithoutContactTest_HasContact_ShouldBeFalse() { var spHandler = new BallisticSingleParticleDepositionHandler(); var aggHandler = new BallisticAggregateDepositionHandler(spHandler); var isWithoutContact = aggHandler.IsWithoutContact(20, _config.LargeNumber); Assert.False(isWithoutContact); }
private void DepositAggregateOnGroundTest() { var spHandler = new BallisticSingleParticleDepositionHandler(); var aggHandler = new BallisticAggregateDepositionHandler(spHandler); var aggregate = GetExampleAggregate(); aggHandler.DepositOnGround(aggregate); Assert.Equal(1.0, aggregate.Cluster.SelectMany(c => c.PrimaryParticles).Select(p => p.Position.Z).Min()); }
private void IsWithoutContactTest_NoContact_ShouldBeTrue() { var spHandler = new BallisticSingleParticleDepositionHandler(); var aggHandler = new BallisticAggregateDepositionHandler(spHandler); var distance = _config.LargeNumber; var isWithoutContact = aggHandler.IsWithoutContact(distance, _config.LargeNumber); Assert.True(isWithoutContact); }
private void DepositAtParticleTest_CorrectDepositionDistance() { var spHandler = new BallisticSingleParticleDepositionHandler(); var aggHandler = new BallisticAggregateDepositionHandler(spHandler); var aggregate = GetExampleAggregate(); aggHandler.DepositAtParticle(aggregate, 20); Assert.Equal(78.0, aggregate.Cluster.SelectMany(c => c.PrimaryParticles).Select(p => p.Position.Z).Min()); }
private async Task DepositAggregate_DepositOnGround() { var spHandler = new BallisticSingleParticleDepositionHandler(); var aggHandler = new BallisticAggregateDepositionHandler(spHandler); var aggregate = GetExampleAggregate(); var neighborslist = new Mock <INeighborslist>().Object; var ct = new CancellationToken(); await aggHandler.DepositAggregate_Async(aggregate, GetDepositedParticlesFarAway(), neighborslist, GetDepositedParticlesFarAway().GetMaxRadius(), Environment.ProcessorCount, _config.Delta, ct); Assert.Equal(1.0, aggregate.Cluster.SelectMany(c => c.PrimaryParticles).Select(p => p.Position.Z).Min()); }
private void ComputeCorrectDepositionDistance_CollisionWithParticle() { var r = 1.0; var pos = new Vector3(0, 0, 100); var primaryParticle = new PrimaryParticle(0, pos, r); var neighbor = new PrimaryParticle(1, new Vector3(1, 0, 10), 1.0); var dist = BallisticSingleParticleDepositionHandler.Get1DDistanceToNeighbor(primaryParticle, neighbor); // 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); }
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); }
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); }