public void GetPreprocessorSetting_UsePreprocessorTrueAndKnownLocationId_ReturnsExpectedPreprocessorSetting()
        {
            // Setup
            using (var provider = new PreprocessorSettingsProvider(completeDatabaseDataPath))
            {
                // Call
                PreprocessorSetting setting = provider.GetPreprocessorSetting(700131, true);

                // Assert
                Assert.IsTrue(setting.RunPreprocessor);
                Assert.AreEqual(2, setting.ValueMin);
                Assert.AreEqual(8, setting.ValueMax);
                NumericsSetting numericsSetting = setting.NumericsSetting;
                Assert.AreEqual(2, numericsSetting.CalculationTechniqueId);
                Assert.AreEqual(3, numericsSetting.FormStartMethod);
                Assert.AreEqual(20, numericsSetting.FormNumberOfIterations);
                Assert.AreEqual(0.2, numericsSetting.FormRelaxationFactor);
                Assert.AreEqual(0.1, numericsSetting.FormEpsBeta);
                Assert.AreEqual(0.1, numericsSetting.FormEpsHoh);
                Assert.AreEqual(0.1, numericsSetting.FormEpsZFunc);
                Assert.AreEqual(3, numericsSetting.DsStartMethod);
                Assert.AreEqual(4, numericsSetting.DsMinNumberOfIterations);
                Assert.AreEqual(15000, numericsSetting.DsMaxNumberOfIterations);
                Assert.AreEqual(90000, numericsSetting.DsVarCoefficient);
                Assert.AreEqual(0.2, numericsSetting.NiUMin);
                Assert.AreEqual(-4, numericsSetting.NiUMax);
                Assert.AreEqual(5, numericsSetting.NiNumberSteps);
            }
        }
예제 #2
0
        /// <summary>
        /// Obtains the Hydra-Ring settings based on the location and the failure mechanism obtained from the <paramref name="calculationInput"/>
        /// and sets these value on the <paramref name="calculationInput"/>.
        /// </summary>
        /// <param name="calculationInput">The calculation input for which the settings are updated.</param>
        /// <param name="hydraulicBoundaryDatabaseFilePath">The path to the hydraulic boundary database file.</param>
        /// <param name="usePreprocessor">Indicator whether to use the preprocessor in the calculation.</param>
        /// <exception cref="ArgumentException">Thrown when the <paramref name="hydraulicBoundaryDatabaseFilePath"/>
        /// contains invalid characters.</exception>
        /// <exception cref="CriticalFileReadException">Thrown when:
        /// <list type="bullet">
        /// <item>No settings database file could be found at the location of <paramref name="hydraulicBoundaryDatabaseFilePath"/>
        /// with the same name.</item>
        /// <item>Unable to open settings database file.</item>
        /// <item>Unable to read required data from database file.</item>
        /// </list>
        /// </exception>
        public static void AssignSettingsFromDatabase(HydraRingCalculationInput calculationInput, string hydraulicBoundaryDatabaseFilePath, bool usePreprocessor)
        {
            IOUtils.ValidateFilePath(hydraulicBoundaryDatabaseFilePath);

            long   locationId = calculationInput.HydraulicBoundaryLocationId;
            string settingsDatabaseFileName = HydraulicBoundaryDatabaseHelper.GetHydraulicBoundarySettingsDatabase(hydraulicBoundaryDatabaseFilePath);

            using (var preprocessorSettingsProvider = new PreprocessorSettingsProvider(settingsDatabaseFileName))
            {
                calculationInput.PreprocessorSetting = preprocessorSettingsProvider.GetPreprocessorSetting(locationId, usePreprocessor);
            }

            using (var designTablesSettingsProviders = new DesignTablesSettingsProvider(settingsDatabaseFileName))
            {
                calculationInput.DesignTablesSetting = designTablesSettingsProviders.GetDesignTablesSetting(
                    locationId,
                    calculationInput.FailureMechanismType);
            }

            using (var numericsSettingsProvider = new NumericsSettingsProvider(settingsDatabaseFileName))
            {
                calculationInput.NumericsSettings = numericsSettingsProvider.GetNumericsSettings(
                    locationId,
                    calculationInput.FailureMechanismType);
            }

            using (var timeIntegrationSettingsProvider = new TimeIntegrationSettingsProvider(settingsDatabaseFileName))
            {
                calculationInput.TimeIntegrationSetting = timeIntegrationSettingsProvider.GetTimeIntegrationSetting(
                    locationId,
                    calculationInput.FailureMechanismType);
            }
        }
        public void GetPreprocessorSetting_UsePreprocessorTrueLocationIdExcluded_ReturnsExpectedPreprocessorSetting()
        {
            // Setup
            using (var provider = new PreprocessorSettingsProvider(completeDatabaseDataPath))
            {
                // Call
                PreprocessorSetting setting = provider.GetPreprocessorSetting(700136, true);

                // Assert
                Assert.IsFalse(setting.RunPreprocessor);
            }
        }