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); }
public AggregateFormationSimulationRunner( IAggregateSizeDistributionFactory aggregateSizeDistributionFactory, IPrimaryParticleSizeDistributionFactory primaryParticleSizeDistributionFactory, IAggregateFormationFactory aggregateFormationFactory, INeighborslistFactory neighborslistFactory, IAggregateFormationConfig aggregateFormationConfig, ILogger logger) { _aggregateFormationConfig = aggregateFormationConfig ?? throw new ArgumentException(nameof(aggregateFormationConfig)); _logger = logger ?? throw new ArgumentException(nameof(logger)); _aggregateFormationService = new AggregateFormationService(aggregateSizeDistributionFactory, primaryParticleSizeDistributionFactory, aggregateFormationFactory, neighborslistFactory, _aggregateFormationConfig, logger); Progress = new Progress <ProgressReportModel>(); _cts = new CancellationTokenSource(); }
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); }
public FullSimulationRunner( IAggregateFormationConfig aggregateFormationConfig, SimulationMonitor simulationMonitor, IAggregateSizeDistributionFactory aggregateSizeDistributionFactory, IPrimaryParticleSizeDistributionFactory primaryParticleSizeDistributionFactory, IAggregateFormationFactory aggregateFormationFactory, INeighborslistFactory neighborslistFactory, IFilmFormationConfig filmFormationConfig, ILogger logger) { _filmFormationConfig = filmFormationConfig; _progress = new Progress <ProgressReportModel>(); _filmFormationService = new FilmFormationService(filmFormationConfig); _cts = new CancellationTokenSource(); _aggregateFormationConfig = aggregateFormationConfig ?? throw new ArgumentException(nameof(aggregateFormationConfig)); _aggregateSizeDistributionFactory = aggregateSizeDistributionFactory; _primaryParticleSizeDistributionFactory = primaryParticleSizeDistributionFactory; _aggregateFormationFactory = aggregateFormationFactory; _neighborslistFactory = neighborslistFactory; _logger = logger ?? throw new ArgumentException(nameof(logger)); _aggregateFormationService = new AggregateFormationService(_aggregateSizeDistributionFactory, _primaryParticleSizeDistributionFactory, _aggregateFormationFactory, _neighborslistFactory, _aggregateFormationConfig, logger); }