public void FormMultiplePolydisperseClustersTest_NoInfiniteLoop() { var file = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(file); var psd = new TabulatedPrimaryParticleSizeDistribution(dist, _rndGen, _config, integrate: true); var pca = new ParticleClusterAggregationFactory(psd, _rndGen, _config, _neighborslistFactory, _logger); for (var i = 0; i < 4; i++) { var cluster = pca.Build(6); Assert.Equal(6, cluster.PrimaryParticles.Count()); foreach (var pp1 in cluster.PrimaryParticles) { foreach (var pp2 in cluster.PrimaryParticles) { if (pp1 != pp2) { Assert.True(pp1.GetDistanceToPrimaryParticle(pp2) >= pp1.Radius + pp2.Radius); } } } } }
private async void GeneratePolydisperseAggregates_Async_Parallel_AllGenerated() { var primaryParticles = 500; var numCPU = 4; var rndGen = new Random(); var logger = new Mock <ILogger>().Object; var config = new TestAggregateFormationConfig(primaryParticles); var filePSD = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(filePSD); var psd = new TabulatedPrimaryParticleSizeDistribution(dist, _rndGen, config, integrate: true); var fileASD = _resources + "FSP_AggregateSizeDistribution.xml"; var distASD = XMLSizeDistributionBuilder <int> .Read(fileASD); var asd = new TabulatedAggregateSizeDistribution(distASD, _rndGen, config, integrate: true); var cca = new ClusterClusterAggregationFactory(psd, config, _logger, _neighborslistFactory, _seed); var service = new AggregateFormationService(asd, psd, config, cca, _logger); var progress = new Progress <ProgressReportModel>(); progress.ProgressChanged += ReportProgress; var aggs = await service.GenerateAggregates_Parallel_Async(numCPU, progress, _cts.Token); Assert.True(aggs.Sum(agg => agg.NumberOfPrimaryParticles) >= primaryParticles); }
private void XMLAggregateSizeDistributionBuilder_FileReadCorrectly() { var file = _resources + "FSP_AggregateSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <int> .Read(file); Assert.Equal(116, dist.Sizes.Length); Assert.Equal(13, dist.Sizes.First().Value); Assert.Equal(128, dist.Sizes.Last().Value); }
private void XMLPrimaryParticleSizeDistributionBuilder_FileReadCorrectly() { var file = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(file); Assert.Equal(21, dist.Sizes.Length); Assert.Equal(1.5, dist.Sizes.First().Value); Assert.Equal(11.5, dist.Sizes.Last().Value); }
public void BuildPolydisperseAggregateTest() { var file = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(file); var psd = new TabulatedPrimaryParticleSizeDistribution(dist, _rndGen, _config, integrate: true); var cca = new ClusterClusterAggregationFactory(psd, _config, _logger, _neighborslistFactory, _seed); var agg = cca.Build(24); Assert.Equal(24, agg.NumberOfPrimaryParticles); }
public void FormClusterOfFourPolydisperseParticlesTest() { var file = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(file); var psd = new TabulatedPrimaryParticleSizeDistribution(dist, _rndGen, _config, integrate: true); var pca = new ParticleClusterAggregationFactory(psd, _rndGen, _config, _neighborslistFactory, _logger); var cluster = pca.Build(4); Assert.Equal(4, cluster.PrimaryParticles.Count()); }
private void TabulatedPrimaryParticleSizeDistributionFromXML_IntegrationCorrectly() { var file = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(file); var rndGen = new Random(_seed); var config = new TestAggregateFormationConfig(); var psd = new TabulatedPrimaryParticleSizeDistribution(dist, rndGen, config, integrate: true); var list = psd._tabulatedSizeDistribution; Assert.Equal(1.0, list.Sizes.Last().Probability); }
public void FormClusterOfThreePolydisperseParticlesTest() { var file = _resources + "FSP_PrimaryParticleSizeDistribution.xml"; var dist = XMLSizeDistributionBuilder <double> .Read(file); var psd = new TabulatedPrimaryParticleSizeDistribution(dist, _rndGen, _config, integrate: true); var pca = new ParticleClusterAggregationFactory(psd, _rndGen, _config, _neighborslistFactory, _logger); var cluster = pca.Build(3); Assert.Equal(3, cluster.PrimaryParticles.Count()); var distance = Math.Round(cluster.PrimaryParticles[0].Radius + cluster.PrimaryParticles[1].Radius, 6); var realDist = cluster.PrimaryParticles[0].GetDistanceToPrimaryParticle(cluster.PrimaryParticles[1]); Assert.True(realDist >= _config.Epsilon * distance); Assert.True(realDist <= _config.Delta * distance); }
private void GenerateMonodisperseAggregates_Sync_AllGenerated() { var primaryParticles = 2000; var psd = new MonodispersePrimaryParticleSizeDistribution(5); var fileASD = _resources + "FSP_AggregateSizeDistribution.xml"; var distASD = XMLSizeDistributionBuilder <int> .Read(fileASD); var config = new TestAggregateFormationConfig(primaryParticles); var asd = new TabulatedAggregateSizeDistribution(distASD, _rndGen, config, integrate: true); var cca = new ClusterClusterAggregationFactory(psd, config, _logger, _neighborslistFactory, _seed); var service = new AggregateFormationService(asd, psd, config, cca, _logger); var aggs = service.GenerateAggregates(); Assert.True(aggs.Sum(agg => agg.NumberOfPrimaryParticles) >= primaryParticles); }