public void MergeCalculationMethodInModel(IModel model, IBuildConfiguration buildConfiguration)
        {
            try
            {
                _buildConfiguration    = buildConfiguration;
                _allContainers         = model.Root.GetAllContainersAndSelf <IContainer>().ToList();
                _allBlackBoxParameters = model.Root.GetAllChildren <IParameter>().Where(p => p.Formula.IsBlackBox()).ToList();
                _model = model;
                foreach (var calculationMethod in buildConfiguration.AllCalculationMethods())
                {
                    var allMoleculesUsingMethod = allMoleculesUsing(calculationMethod, buildConfiguration.Molecules).ToList();

                    createFormulaForBlackBoxParameters(calculationMethod, allMoleculesUsingMethod);

                    addHelpParametersFor(calculationMethod, allMoleculesUsingMethod);
                }
            }
            finally
            {
                _buildConfiguration = null;
                _allContainers.Clear();
                _allBlackBoxParameters.Clear();
                _model = null;
            }
        }
Exemplo n.º 2
0
        public void AddCalculationMethodsToBuildConfiguration(IBuildConfiguration buildConfiguration)
        {
            _calculationMethodRepository.All().Each(
                cm => buildConfiguration.AddCalculationMethod(_cloneManager.Clone(cm, new FormulaCache())));

            correctPathsInCalculationMethods(buildConfiguration.AllCalculationMethods(), firstTopContainerName(buildConfiguration));
        }
        public ValidationResult Validate(IBuildConfiguration buildConfiguration)
        {
            var validationResult = new ValidationResult();

            validateBuildingBlockWithFormulaCache(buildConfiguration.Molecules, validationResult);
            validateBuildingBlockWithFormulaCache(buildConfiguration.Reactions, validationResult);
            validateBuildingBlockWithFormulaCache(buildConfiguration.SpatialStructure, validationResult);
            validateBuildingBlockWithFormulaCache(buildConfiguration.PassiveTransports, validationResult);
            validateBuildingBlockWithFormulaCache(buildConfiguration.Observers, validationResult);
            validateEventGroupBuildingBlock(buildConfiguration.EventGroups, buildConfiguration.Molecules, validationResult);
            validateBuildingBlockWithFormulaCache(buildConfiguration.MoleculeStartValues, validationResult);
            validateBuildingBlockWithFormulaCache(buildConfiguration.ParameterStartValues, validationResult);
            buildConfiguration.AllCalculationMethods().Each(cm => validateBuildingBlockWithFormulaCache(cm, validationResult));
            return(validationResult);
        }
 public void should_have_set_the_used_calculation_method_in_the_build_configuration()
 {
     _buildConfiguration.AllCalculationMethods().ShouldOnlyContain(_cm1, _cm2);
 }