예제 #1
0
        public async Task <IReadOnlyCollection <ScaleDivisor> > CalculateScaleDivisorsAsync(IModelCoreSimulation simulation, ScaleDivisorOptions scaleDivisorOptions, PathCache <IMoleculeAmount> allMoleculeAmounts)
        {
            _simulationName = simulation.Name;
            var previousResults    = simulation.Results;
            var previousSelections = outputSelectionsFor(simulation);

            _allMoleculeAmounts  = allMoleculeAmounts;
            _scaleDivisorOptions = scaleDivisorOptions;
            var previousScaleDivisor = retrievePreviousScaleDivisor();

            try
            {
                resetScaleDivisor();
                settingsFor(simulation).OutputSelections = createOutputSelectionWithAllMoleculeAmountSelected();
                updateSelectedMoleculeAmount(simulation);

                var results = await runSimulation(simulation);

                return(computerScaleDivisorBasedOn(results));
            }
            finally
            {
                simulation.Results = previousResults;
                settingsFor(simulation).OutputSelections = previousSelections;
                updateSelectedMoleculeAmount(simulation);
                setPreviousScaleDivisor(previousScaleDivisor);
                _allMoleculeAmounts  = null;
                _scaleDivisorOptions = null;
            }
        }
예제 #2
0
 public async Task <IReadOnlyCollection <ScaleDivisor> > CalculateScaleDivisorsAsync(IModelCoreSimulation simulation, ScaleDivisorOptions scaleDivisorOptions)
 {
     return(await CalculateScaleDivisorsAsync(simulation, scaleDivisorOptions, _containerTask.CacheAllChildren <IMoleculeAmount>(simulation.Model.Root)));
 }