mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
Added optional minSegmentLength parameter to prevent creating segments smaller than a specified minimum length. The parameter uses std::optional and is positioned before maxSegmentLength in the parameter list. Key features: - When subdividing would create segments smaller than minSegmentLength, the segment count is reduced to ensure all segments meet the minimum - Uses floor(length / minSegmentLength) to calculate fewer, larger segments - Custom intervals are exempt and can be smaller than minSegmentLength - Includes CVF_ASSERT to validate minSegmentLength < maxSegmentLength (only when both are specified and maxSegmentLength > 0) Example: For 55 units with maxSegmentLength=40, minSegmentLength=30: - Without min: ceil(55/40) = 2 segments of 27.5 units each - With min=30: floor(55/30) = 1 segment of 55 units (27.5 < 30) Added 9 comprehensive unit tests covering: - Prevention of too-small segments - Segment count reduction when needed - Interaction with custom intervals (gaps respect min, intervals exempt) - Edge cases (minSegmentLength=0, no maxSegmentLength) All existing tests pass unchanged (backward compatible with std::nullopt). Total test count: 599 tests (29 for createSubSegmentMDPairs).