/// <summary> /// Tries to read and create a <see cref="SoilProfile1D"/>. /// </summary> /// <returns>The read <see cref="SoilProfile1D"/>.</returns> /// <exception cref="CriticalFileReadException">Thrown when encountering an unrecoverable error /// while reading the profile.</exception> /// <exception cref="SoilProfileReadException">Thrown when reading properties of the profile /// failed.</exception> private SoilProfile1D TryReadSoilProfile() { var criticalProperties = new CriticalProfileProperties(this); var soilLayers = new List <SoilLayer1D>(); RequiredProfileProperties properties; try { properties = new RequiredProfileProperties(this, criticalProperties.ProfileName); for (var i = 1; i <= criticalProperties.LayerCount; i++) { soilLayers.Add(ReadSoilLayerFrom(this, criticalProperties.ProfileName)); MoveNext(); } } catch (SoilProfileReadException) { MoveToNextProfile(criticalProperties.ProfileId); throw; } MoveToNextProfile(criticalProperties.ProfileId); return(new SoilProfile1D(criticalProperties.ProfileId, criticalProperties.ProfileName, properties.Bottom, soilLayers)); }
/// <summary> /// Tries to read and create a <see cref="SoilProfile2D"/>. /// </summary> /// <returns>The read <see cref="SoilProfile2D"/>.</returns> /// <exception cref="CriticalFileReadException">Thrown when encountering an unrecoverable error /// while reading the profile.</exception> /// <exception cref="SoilProfileReadException">Thrown when reading properties of the profile failed.</exception> private SoilProfile2D TryReadSoilProfile() { var criticalProperties = new CriticalProfileProperties(this); var soilLayerGeometryLookup = new Dictionary <SoilLayer2DGeometry, Layer2DProperties>(); long soilProfileId = criticalProperties.ProfileId; RequiredProfileProperties properties; try { properties = new RequiredProfileProperties(this, criticalProperties.ProfileName); var geometryReader = new SoilLayer2DGeometryReader(); for (var i = 1; i <= criticalProperties.LayerCount; i++) { ReadSoilLayerGeometryFrom(this, geometryReader, criticalProperties.ProfileName, soilLayerGeometryLookup); MoveNext(); } } catch (SoilProfileReadException) { MoveToNextProfile(soilProfileId); throw; } MoveToNextProfile(soilProfileId); return(new SoilProfile2D(soilProfileId, criticalProperties.ProfileName, GetHierarchicallyOrderedSoilLayers(soilLayerGeometryLookup).ToArray(), GetPreconsolidationStresses(soilProfileId).ToArray()) { IntersectionX = properties.IntersectionX }); }