Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs =================================================================== diff -u -r6529 -r6530 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs (.../GeometryGenerator.cs) (revision 6529) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryGenerator.cs (.../GeometryGenerator.cs) (revision 6530) @@ -567,9 +567,10 @@ // find all the curves that are connected to the Current Curve at curveEndPoint IdentifyAttachedCurves(curvesCount, currentCurve, curveEndPoint, attachedCurveList); + // make sure there is at least one connected curve EnsureAttachedCurve(attachedCurveList); - // we have a set of curves, find the one that turns right the most + // if we have a set of curves, find the one that turns right the most minIndex = FindConnectedCurveWithMostRightAngle(attachedCurveList, minIndex, currentCurve, currentCurveDirection, minAngle); DirectionCurve pickedDirectionCurve = attachedCurveList[minIndex]; @@ -720,7 +721,6 @@ if (newSurface != null) { newSurfaceList.Add(newSurface); - AssignSurfaceAtLeftOrRightToCurves(newSurface); } } } Index: DamEngine/trunk/doc/Dam Engine - Technical Design/CreatingCalculationProfiles.tex =================================================================== diff -u -r6525 -r6530 --- DamEngine/trunk/doc/Dam Engine - Technical Design/CreatingCalculationProfiles.tex (.../CreatingCalculationProfiles.tex) (revision 6525) +++ DamEngine/trunk/doc/Dam Engine - Technical Design/CreatingCalculationProfiles.tex (.../CreatingCalculationProfiles.tex) (revision 6530) @@ -115,19 +115,14 @@ \section{Combining a 2D subsoil profile with a surface line geometry} To create a calculation profile, another option is by combining a 2D subsoil profile with a surface line geometry. +Here too, the surface line geometry is leading in the combination process. +It determines the left boundary, the right boundary and the top of the 2D calculation profile to be created. + If the surface line geometry lies entirely to the left or to the right of the 2D subsoil profile, a combination cannot be made. If the surface line geometry lies even partially below the 2D subsoil profile, no combination can be made. -In both cases, a calculation cannot be made for this situation, and an error message will follow. +In both cases, a calculation cannot be made and an error message will follow. This error message will not interrupt the entire DAM process; the message will be recorded in the log file. -Here too, the surface line geometry is leading in the combination process. -It determines the left boundary, the right boundary and the top of the 2D calculation profile to be created. - -When the 2D subsoil profile lies entirely to the left or to the right of the surface line geometry, -a combination cannot be made and an error message will follow. -Again this error message will not interrupt the entire DAM process; -the message will be recorded in the log file. - The process consists of: \begin{itemize} \item Check that the 2D subsoil profile is not null and has at least 1 valid surface. @@ -141,14 +136,14 @@ \item Create a new 2D profile as place holder for the resulting calculation profile. \item Create a new 2D geometry by combining the surface line geometry with the subsoil profile (see \autoref{sec:Creating2DGeometry}). \item Add the generated 2D geometry to the 2D profile. - \item Remove all geometry data (points, curves, loops, surface) from the genrated geometry that ly above the surface line geometry. + \item Remove all geometry data (points, curves, loops, surface) from the generated geometry that ly above the surface line geometry. \item Reconstruct the surfaces, i.e. find which new surfaces are equal to the "old" surfaces as these were part of the subsoil profile. Copy the soil, IsAquifer and WaterpressureInterpolationModel properties from the "old" surfaces when found else set default values for them (IsAquifer = false, WaterpressureInterpolationModel = Automatic, soil = filling material). \item Copy the pre-consolidation stresses from the original 2D subsoil profile to the new 2D profile. - \item Rebox the geometry of the new 2D profile to set the proper limit values for that geometry + \item Rebox the geometry of the new 2D profile to set the proper limit values for that geometry. \item Update the surfaceline property of the geometry of the new 2D profile. - \item Finally, Round all coordinates from both the geometry of the new 2D profile. + \item Finally, round all coordinates in the geometry of the new 2D profile. \end{itemize} \subsection{Creating the new 2D Geometry} @@ -178,14 +173,13 @@ \item Add the Newly Effected Points to Points. \item Add the Newly Effected Curves to Curves. \item Set up the curve-surfaces associations, i.e. whether a curve has a surface on the left and/or on the right of it. - Note that this is not required when the full combination procedure is used but it can be required when the "GenerateGeometry" procedure is used directly with an existing full geometry. - \item In a loop perform the next actions untile the generation is ready + Note that this is not required when the full combination procedure is used but it can be required when the "GenerateGeometry" procedure is used directly with an existing generated geometry. + \item In a loop perform the next actions until the generation is ready: \item - Break up all curves at any intersection even when they partially coincide whilst making sure the geometry stays correct whenever a curve needed to be split (see \autoref{sec:EnsuringCorrectGeometry}). - \item Merge coinciding points that may be the result of the step above. Note that any obsolete curve (due to the merge) is removed too. + \item - Merge coinciding points that may be the result of the step above. Note that any obsolete curve (due to the merge) is removed too. \item - Delete invalid and duplicated curves that may be the result of breaking the intersections. - \item - Initialise the geometryCurveForwardsIsUsed and geometryCurveBackwardsIsUsed dictionaries with false. - \item - Start detecting surfaces using the Plaxis algorithm (see \autoref{sec:DetectingSurfaces}). - The result of that algorithm signals whether the loop/generation is ready. + \item - Initialize the geometryCurveForwardsIsUsed and geometryCurveBackwardsIsUsed dictionaries with false. + \item - Start detecting surfaces using the Plaxis algorithm (see \autoref{sec:DetectingSurfaces}). \item Clear the Newly Effected Points. \item Clear the Newly Effected Curves. \item Update the surface line property from the geometry. @@ -207,15 +201,31 @@ \label{sec:DetectingSurfaces} Detecting surfaces involves: \begin{itemize} - \item Create a list to store new loops. - \item Create a list of direction curves (a direction curve is a curve that holds the direction of the curve next to the curve itself; it offers head and endpoint based on the direction, i.e. head-point becomes endpoint when the direction is backward) - \item Start looping through the existing curves with curve 1 as current curve. This is the outer method loop to check all relevant curves which could become loops. - \item create a new geometry loop and add the current curve. - \item remember curve 1 and its direction so you can check whether the inner method loop (started next) is finished, i.e. when the next connected curve equals curve 1 and its direction. - \item start the inner method loop to gather all relevant curves for the geometry loop. + \item Create a list to store possible new loops. + \item Create a list of direction curves (a direction curve is a curve that holds the direction of the curve next to the curve itself; it offers head and endpoint based on the direction, i.e. head-point becomes endpoint when the direction is backward). + \item Start looping through the existing curves with curve 1 as current curve. This is the outer method loop to check all relevant curves which could become loops. Note that all curves are handled twice. once with a forward direction and once with a backward direction. + \item Create a new geometry loop and add the current curve. + \item Remember curve 1 and its direction so you can check whether the inner method loop (started next) is finished, i.e. when the next connected curve equals curve 1 and its direction. + \item Start the inner method loop to gather all relevant curves for the geometry loop. \item Find all curves connected to the endpoint of the current curve. \item If there is more than 1 connected curve, select the one that turns clockwise most and add it to the new geometry loop. If there is only 1, just add that to the new geometry loop. If there is no connected curve, something is wrong and an exception is raised. - \item replace the current curve and its direction by the just found connected curve and its direction. - \item continue the inner method loop with the adapted current curve to find the next connected one. Keep doing this until the found next connected curve equals curve 1 which means the new geometry loop is ready. Add that new loop to the new loop list and continue the outer method loop with the next curve until all curve are checked. - \item Now the all new geometry loops are known and these are used to create surfaces. The number of created surfaces is used as result for the method DetectSurfaces. A number > 0 indicates success, < 0 failure due to error(s), 0 signifies that no surface could be found. -\end{itemize} \ No newline at end of file + \item Replace the current curve and its direction by the just found connected curve and its direction. + \item Continue the inner method loop with the adapted current curve to find the next connected one. Keep doing this until the found next connected curve equals curve 1 which means the new geometry loop is ready. Add that new loop to the new loop list and continue the outer method loop with the same curve but different direction or next curve in case both directions are done until all curves are checked for both directions. + \item Now the all possible new geometry loops are known and these are used to create surfaces (see \autoref{sec:CreatingSurfaces}). +\end{itemize} + +\subsection{Creating surfaces} +\label{sec:CreatingSurfaces} +When the list of possible new loops is known, the actual creation of the surfaces and its belonging loops can begin. The given list of possible new loops can contain duplicates, anti clock wise oriented loops and or erroneous loops, all of which filtered out in the process: +\begin{itemize} + \item Start looping through all possible new loops. + \item For each loop: + \item - Check the validity of the loop (is it a continuous loop, does it have an area). If it is invalid, ignore it. + \item - When the loop is clockwise and does not contain protruding curves that turn back on itself, a new surface with new loop as outer loop is created and added to the new surfaces list. Else, ignore it. + \item - When this surface is not already part of the existing geometry so far (by checking if there is any existing surface that contains the same curves), it is added to the surfaces list of the geometry. + \item Clear the SurfaceAtLeft/SurfaceAtRight status for all curves in the geometry. + \item Start a new loop over all the new surfaces. + \item For each new surface: + \item - Assign the SurfaceAtLeft/SurfaceAtRight for all curves in the new surface. + \item - Check for inner loops. See if any existing surface/outerloop is an inner loop to the new surface and add these to the new surface. See if the new surface is an inner loop to an existing surface in the geometry and if so at it as inner loop to that existing surface. +\end{itemize}