Example #1
0
        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);
        }
Example #2
0
        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);
        }