Commit Graph
262 Commits
Author SHA1 Message Date
Kristian Bendiksen db1c1f1f13 #14554 Orion Events: Add WELLSPEC event 2026-08-20 11:02:55 +02:00
Magne Sjaastad 1c4c304064 #14476 ApplicationLibCode: Remove unused cvf includes
Remove 95 cvf include lines that the including file does not use. Found by
extracting the symbols declared by every VizFwk header, including symbols they
re-export, and flagging includes where none of those symbols appear anywhere in
the file. Each removal is verified by a full build.

Most of them are cvfVector3.h and cvfObject.h, left behind as the files they
were once needed by changed.

pch.h is left untouched. It includes cvfObject.h and cvfVector3.h on purpose, so
that the files using the precompiled header do not have to.

Note that a clean build after removing an include does not prove the include was
unnecessary, only that the declarations still arrive some other way. That path
can differ between platforms and with RESINSIGHT_ENABLE_UNITY_BUILD, so this
needs a CI round on Linux as well.
2026-08-07 15:05:57 +02:00
Magne Sjaastad 56e98ba1c4 #14476 ApplicationLibCode: Replace CVF_ASSERT with CAF_ASSERT
Migrate all assert macros in ApplicationLibCode to CAF_ASSERT and remove every
use of cvfAssert.h.

CVF_ASSERT is replaced one to one. CVF_TIGHT_ASSERT is also replaced by
CAF_ASSERT, which is semantically exact: CVF_ENABLE_TIGHT_ASSERTS is 1 only
under _DEBUG, and that is what CAF_ASSERT now does. The two CVF_FAIL_MSG sites
become CAF_ASSERT( false && "message" ), preserving the message with the idiom
already used elsewhere in the code base.

Counts before and after: CVF_ASSERT 1044 to 0, CVF_TIGHT_ASSERT 66 to 0,
CVF_FAIL_MSG 2 to 0, cvfAssert.h references 154 to 0.

Include handling: files that included cvfAssert.h directly now include
cafAssert.h instead, includes left dead by the migration are removed, and files
that were relying on cvfAssert.h transitively get an explicit cafAssert.h. Files
that reach cafAssert.h through another caf header are left unchanged; a missing
include here is a compile error, not a silently disabled assert.

ResultStatisticsCache links only LibCore and therefore had no path to
cafAssert.h. Add the cafPdmCore directory as a private include path rather than
linking the library, since cafAssert.h is header only.

Note that this stops these asserts from firing in Release and RelWithDebInfo,
where CVF_ASSERT was previously active.
2026-08-07 15:05:57 +02:00
Magne Sjaastad 8b07cee36d #14451 Guard against well path without geometry
RigWellPath::interpolatedVectorValuesAlongWellPath indexed vectorValuesAlongWellPath.at( vxIdx - 1 ) when no measured depths were present, causing an out of range exception and terminate. Return cvf::Vec3d::UNDEFINED for empty geometry, matching tangentAlongWellPath. RimWellPathFracture keeps the zero anchor position when the point is undefined.
2026-08-05 09:42:55 +02:00
Magne Sjaastad dd16739a37 #14452 Guard against fracture without fracture template
RimFracture::startMD() and endMD() dereferenced the fracture template without checking for null. A fracture with no template assigned crashed MSW completion export, which calls startMD() for all completions on a well path.
2026-08-05 09:20:49 +02:00
Magne Sjaastad 403450dfdf #14434 Guard against non-valve objects referring to a valve template
RimWellEventValve also holds a pointer to RimValveTemplate, so the dynamic_cast to RimWellPathValve can return nullptr.
2026-07-31 16:45:33 +02:00
Magne Sjaastad 134befead4 #14434 Guard against missing perforation interval in templateUpdated 2026-07-31 16:38:33 +02:00
Kristian Bendiksen 6357cef1ab #14334 Fix formation dip sign when aligning fracture with formation dip
The sign of the projected formation direction vector flips with the fracture
direction normal, which follows the well drilling direction, while the fracture
azimuth defining the dip rotation in RimFracture::transformMatrix() is only
defined mod 180 degrees. Canonicalize the formation direction against the
fracture azimuth direction before computing the dip, so a positive dip means
the formation descends toward the azimuth direction.

Restore std::abs() in calculateFormationDipFromHorizontal() so the StimPlan
model formation dip (BedDipDeg in the Asymmetric FRK export) keeps the
non-negative convention from #8877.
2026-07-13 14:34:17 +02:00
Magne Sjaastad 2ac1948abe #14245 Remove gsl functions and ThirdParty/gsl folder 2026-06-24 18:47:04 +02:00
Kristian Bendiksen 2a158dce58 #14121 Well Path: guard remaining null wellPathGeometry() dereferences
A file-based well path whose source file is missing has a null wellPathGeometry(). Add null checks at the remaining call sites that dereferenced it without one, so operations on such a well path no longer crash:

- RimWellPathGroup: skip geometry merging for a child with no geometry (grouping runs on import and project load).
- RimWellPathFracture::computeFractureDirectionNormal: return undefined when geometry is missing.
- RivWellPathPartMgr: extend the existing well path null checks to also require geometry in the attribute, well measurement, and valve append paths.
- RimCompletionCellIntersectionCalc, RicExportLgrFeature, RicCreateMultipleWellPathLaterals, RigLasFileExporter, RiuWellPathComponentPlotItem: guard the geometry before use.

Sites that were already guarded or only reachable through guarded paths were left unchanged.
2026-06-08 08:46:40 +02:00
Magne Sjaastad 071d6cc19e #14050 CMake: Remove dead variable definitions and references
* CMake: Remove dead CODE_HEADER_FILES variable
* CMake: Remove dead COMMAND_CODE_HEADER_FILES and COMMAND_MOC_SOURCE_FILES
* CMake: Remove dead MOC_SOURCE_FILES and FORM_FILES_CPP references
* CMake: Remove dead HEADER_FILES reference
* CMake: Delete unused CustomPCH.cmake superseded by target_precompile_headers
2026-05-26 13:10:20 +02:00
Magne Sjaastad 91fed8e48c #14020 Use perforation interval cell filter to limit COMPDAT and MSW export
* Completions: Apply perforation cell filter to COMPDAT and MSW export
* PerforationInterval: Limit Cell Filter dropdown to case-level filters
* PerforationInterval: Prefix Cell Filter entries with case name when multiple cases
* Completions: Use std::format for cell filter suppression log messages
2026-05-20 16:04:40 +02:00
Kristian Bendiksen c9456bba62 Python: Add cell filter reference to perforation intervals
Lets a script attach a cell filter to a RimPerforationInterval as a
typed reference so subsequent work can gate completion-export
connections by the filter's cell mask. Pure metadata in this commit:
no consumer of RimPerforationInterval is modified, the field exists
purely as an API surface.

Add a non-scriptable caf::PdmPtrField<RimCellFilter*> m_cellFilter to
RimPerforationInterval with public cellFilter()/setCellFilter()
accessors and a "Cell Filter" group in the property panel between the
existing geometry/flow group and the Date Settings group. The field is
deliberately non-scriptable: a scriptable PdmPtrField round-trips in
Python as an opaque "ClassName:0xADDR" string rather than a resolved
object, defeating the point. Two CAF object methods on
RimcPerforationInterval expose the relationship:

- AddFilter (perf.add_filter(filter)) sets the pointer; replaces any
  existing filter (single filter per perforation).
- cell_filter (perf.cell_filter()) resolves to the referenced
  RimCellFilter object on read, mirroring the valve.template() pattern.

Composition stays in RimCombinedFilter: a script that wants AND/OR
across multiple filters attaches a combined filter as the single
filter on the perforation.

The Python example in PythonExamples builds a case-level AND combined
filter (PERMX 100..20000 AND K=5..10), creates a modeled well path
with two perforation intervals, and shares the same filter between
them. test_perforation_filter.py covers single-set, replace-on-second-
add, and shared-pointer round-trips.
2026-05-15 08:37:46 +02:00
Kristian Bendiksen 2fa7520b3a Refactor: forward-declare element type in collection headers
Move the element-type include from each migrated collection header into
its .cpp, leaving only a forward declaration in the header. Follows the
pattern from 9e4d79159 for RimJobCollection, made possible by the
constructor-time PdmObject base check.
2026-05-11 13:42:13 +02:00
Kristian Bendiksen 5e880ffc26 Refactor: migrate fourteen more collections to caf::PdmObjectCollection<T>
Migrated to the templated base, preserving each collection's existing XML
field keyword for project-file backward compatibility:

- RimEnsembleFractureStatisticsCollection
- RimEclipseInputPropertyCollection
- RimPlotDataFilterCollection
- RimGeoMechContourMapViewCollection
- RimIntersectionResultsDefinitionCollection
- RimCustomObjectiveFunctionCollection
- RimStimPlanModelTemplateCollection
- RimEnsembleWellLogsCollection
- RimEclipseContourMapViewCollection
- RimSeismicViewCollection
- RimGridInfoCollection
- RimEclipseStatisticsCaseCollection
- RimWellIASettingsCollection
- RimVfpDataCollection

External callers that accessed the old public/named array fields directly
(RimEclipseInputPropertyCollection::inputProperties,
RimEclipseStatisticsCaseCollection::cases) now use addItem/items() from
the base. RimCustomObjectiveFunction.h replaced its include of the
collection header with a forward declaration to break the new include
cycle introduced by the migration.
2026-05-11 13:42:13 +02:00
Kristian Bendiksen ddd413cb0b Refactor: migrate five collections to caf::PdmObjectCollection<T>
RimEnsembleFileSetCollection, RimJobCollection, RimQuickAccessCollection,
RimRefinementRegionCollection and RimFractureTemplateCollection now inherit
from the templated caf::PdmObjectCollection<T> base, reusing the shared
add/insert/delete/items plumbing introduced for RimValveTemplateCollection.

XML field keywords are preserved on every collection so existing project
files continue to load.
2026-05-11 13:42:13 +02:00
Kristian Bendiksen 5ffcb69acc #13126 RiaLogging: Use std::string_view instead of QString for logging 2026-05-08 10:11:09 +02:00
Kristian Bendiksen bb0afbf962 #13126 RiaLogging: Extract errorInMessageBox to RiuMessageDialog
Move the QMessageBox-displaying helper out of the logging utility into a
dedicated UI class. RiaLogging.h no longer pulls QMessageBox/QWidget into
the ~270 files that include it. Behavior is preserved: showError displays
the dialog when running interactively (and not under regression tests),
then forwards the text to RiaLogging::error.
2026-05-08 10:11:09 +02:00
Kristian Bendiksen cbbcbb650c #2365 Replace PdmField<QString> with PdmField<caf::FilePath> for file path fields
Convert 11 file/directory path fields from QString to caf::FilePath across
ProjectDataModel classes for type safety and consistent path handling.

Fields converted: RimCalcScript::absoluteFileName,
RimScriptCollection::directory, RimBinaryExportSettings::fileName,
RimExportInputSettings::fileName, RimFractureExportSettings::fileName,
RimReservoirCellResultsStorage::m_resultCacheFileName,
RimProcess::m_workDir, RimWellIASettings::m_baseDir,
RimPlotTemplateFileItem::m_absoluteFileName,
RimWellMeasurement::m_filePath, RimFileWellPath::m_filePath.
2026-03-31 08:46:52 +02:00
Kristian Bendiksen 5921c44be0 #4529 Remove nextValidId fields and calculate on the fly
Remove cached next-valid-ID member variables and compute them on demand
by scanning existing objects, following the pattern already used by
RimUserDefinedCalculationCollection. This eliminates unnecessary state
and potential corruption risks.

Fixes #4529.
2026-03-30 17:03:06 +02:00
Magne Sjaastad 20052771ad CompletionExport: Simplify findFishboneLateralsWellBoreParts and add unit tests
- Make findFishboneLateralsWellBoreParts public and return result by value
- Move WellBorePartForTransCalc to its own header RicWellBorePartForTransCalc.h
- Replace MSW tree traversal with direct RimFishbones lateral geometry iteration
- Add setSubsOrientationMode() to RimFishbones for deterministic test angles
- Add unit tests validating intersected cells and result values
2026-03-23 10:29:58 +01:00
Magne Sjaastad ba0474616c MSW: Suppress logging when null check fails during UI-triggered update 2026-03-19 15:10:26 +01:00
Magne Sjaastad 211ae24241 Auto-update MSW segments on UI changes (opt-in)
Adds an 'Auto Update Segments' toggle (default: on) to the MSW Segment
Visualization group in WellPathCollection. When enabled, MSW segments
are automatically recomputed and redrawn whenever the user modifies:
- Well path geometry or targets
- Perforation intervals
- Fishbone laterals
- Fractures
- Well path fields

The update is triggered via a new updateMswSegmentsForObject()
method, which resolves the top-level well from the changed object, clears
existing segments for all lateral wells in that group, recomputes segments
using updateSegments(), and schedules a full redraw.

When auto-update is disabled, an 'Update Segments' button is shown
instead, allowing manual control.
2026-03-17 20:15:07 +01:00
JJ 24be78f105 Tie-in valve improvements (#13661)
Support (bool, something) pairs as tuples on python side.
Support custom outlet valve md
Add python test for custom outlet valve md
Use tie-in depth as default for custom valve md
Standalone valve creation and display updates
Update MSW valve export
Add valve open/shut flag.
Add python examples
2026-03-06 12:01:14 +01:00
Magne Sjaastad 50009ac4d2 Use cafPdmUiButton instead of bool PdmField in multiple classes
Replace PdmField<bool> push button pattern with addNewButton() lambdas
in RiaPreferences, RiaPreferencesSummary, RicUserDefinedCalculatorUi,
RimUserDefinedPolylinesAnnotation, RimPolygonFilter, RimFractureTemplate,
RimEllipseFractureTemplate, RimMeshFractureTemplate, and
RicSummaryPlotEditorWidgetCreator.
2026-03-04 09:52:17 +01:00
Magne Sjaastad 9f30c981bc Remove unused cafPdmUiPushButtonEditor.h includes
Follow-up cleanup after switching from bool PdmField push buttons to cafPdmUiButton.
2026-03-04 09:52:17 +01:00
Magne Sjaastad 61a69bacc4 Use cafPdmUiButton instead of bool in PdmField
* Adopts dynamic PDM buttons with lambda callbacks

Refactors PDM push buttons from boolean fields to use the `addNewButton` API with direct lambda callbacks.

This change enforces a new coding guideline to extract complex or multi-line lambdas to dedicated `on*Clicked()` methods, improving code readability and maintainability.

- Replaces `PdmField` button fields with `PdmUiOrdering::addNewButton` calls.
- Extracts multi-line/control-flow lambdas into named methods in `RimFlowCharacteristicsPlot`, `RimGeoMechCase`, and `RimStatisticsContourMap`.
- Removes obsolete `defineEditorAttribute` overrides and `fieldChangedByUi` logic for these buttons.
- Updates `RimWellPathFracture` to utilize base class-provided button creation.
- Adds new lambda line-count guideline to the coding style documentation.
- Includes minor build fixes, such as adding `cafPdmUiButton.h` and correcting tooltip API usage.
2026-03-03 08:54:45 +01:00
Magne Sjaastad e8bab38b49 Refactor MSW segment model to support more detailed fields
Refactored RimMswSegment to store join segment, length, depth, and next segment length
2026-02-18 09:22:14 +01:00
Magne Sjaastad e6e6d5b818 Refactor MSW segment update to use static method
Refactored RimMswSegmentCollection::updateSegments from an instance method to a static method that requires explicit top-level RimWellPath and RimEclipseCase parameters. Updated RimWellPathCollection to collect unique top-level wells and call the new static method.
2026-02-18 09:22:14 +01:00
Magne Sjaastad 9aa5a3d222 Move number formatting setting to CAF to enable use in UI editors
* Move RiaNumberFormat to cafPdmUiNumberFormat in caf framework
* Add unit test
2026-02-16 11:32:04 +01:00
magnesj 10e8d9e39a Fixes by clang-tidy 2026-02-13 08:22:16 +01:00
Kristian Bendiksen 82e2dbc434 #13425 Fix WELSEGS date scoping: tubing events only appear at their event dates
Tubing event diameter/roughness values were leaking into earlier date
sections in the generated schedule. The WELSEGS collection functions
did not filter intervals by export date, unlike COMPSEGS and other
keywords which already received the exportDate parameter.

Thread exportDate through collectWelsegsData, collectWelsegsDataRecursively,
and collectWelsegsSegment. Add date-aware overloads of getDiameterAtMD and
getRoughnessAtMD that use isActiveOnDate to filter intervals. Update test
to verify tubing values only appear at their scheduled dates.
2026-02-12 08:15:22 +01:00
Kristian Bendiksen 561006c60c Refactor: Use export date instead of time step for MSW export. 2026-02-12 08:15:22 +01:00
Kristian Bendiksen a4dad97024 #13425 Add time-dependent well events and schedule data generation
Implement timeline-based event system for managing temporal changes in
well completions, perforations, valves, and production controls.

Features:
- Event timeline container with date-based querying
- Six event types: PERF, VALVE, TUBING, WSTATE, WTYPE, WCONTROL
- Schedule keyword generation (DATES, COMPDAT, WELSEGS, WCONPROD, WCONINJE)
- Multi-well schedule generation support
- Python GRPC API for event management
- YAML configuration file support
- Comprehensive test suite

Implementation:
- New directory: ApplicationLibCode/ProjectDataModel/WellEvents/
- Event classes inherit from RimWellEvent base class
- RimWellEventTimeline integrated into RimWellPath
- RicScheduleDataGenerator for multi-well schedule export
- Python API: event_timeline(), add_perf_event(), add_valve_event(), etc.
- Tests verify all event types and YAML config parsing

#13425 Add date tracking to valves and diameter/roughness intervals

Add creation date fields to RimWellPathValve and RimDiameterRoughnessInterval
to support filtering objects by date during completion data export.

- Add m_useCustomStartDate and m_startDate fields
- Add enableCustomStartDate(), setCustomStartDate(), isActiveOnDate() methods
- Set creation dates when applying valve and tubing events in RimWellEventTimeline

#13425 Add date-based filtering for schedule data export

Add optional export date parameter to MSW data collection functions to filter
valves and perforations based on their creation dates during schedule export.

- Add exportDate parameter to collectWsegvalvData, collectWsegAicdData,
  collectWsegSicdData, and collectCompsegData functions
- Filter valves by checking isActiveOnDate() on the associated RimWellPathValve
- Add RimPerforationInterval reference to RicMswPerforation for date filtering
- Pass export date from RicScheduleDataGenerator through the extraction chain

This ensures segment numbers reflect the full model while only including
objects active on the export date in output keywords.

Add test to prove compsegs changes over time.

#13425 Fix mypy type checking errors in well_events.py

- Add type annotations to all function parameters
- Fix generic type hints (dict -> Dict[str, Any])
- Import Any type for proper type safety
- Add type: ignore for method reassignment
- All 31 tests pass

#13425 Add schedule-level keyword events for non-well-specific keywords

Add a new event type called "Keyword Event" for schedule-level Eclipse
keywords (RPTRST, GRUPTREE, RPTSCHED, etc.) that are NOT tied to a
specific well path. This complements the existing RimWellEventKeyword
which operates at the well level.

- Add RimKeywordEvent class inheriting from RimWellEvent with null wellPath
- Add SCHEDULE_KEYWORD enum value to EventType
- Add addKeywordEvent() method to RimWellEventTimeline
- Add AddKeywordEvent Python API method to RimcWellEventTimeline
- Update RicScheduleDataGenerator to output global keywords after well sections
- Add Python wrapper add_keyword_event() with type inference
- Add tests and examples for RPTRST, GRUPTREE keywords
2026-02-12 08:15:22 +01:00
JJ 94c3059fd8 Add support for SICD valves (#13496)
* Add SICD parameters
* Add wsegsicd valves to completion export
* Add python method to read template info from valve
* Update tests
2026-01-29 11:16:05 +01:00
jonjenssen 415ad7869e Make sure optional parameters with 0 values are treated as default values in welspecs keyword export 2026-01-29 07:21:29 +01:00
Magne Sjaastad de3758cf60 Set PdmUiButton default alignment to right
Removed manual setAlignment(Qt::AlignRight) calls for UI buttons,
as PdmUiButton now defaults to right alignment. Also removed
unused cafPdmUiButton.h includes from several files.
2026-01-27 13:37:26 +01:00
Magne Sjaastad 4b3ebd2a95 Add MSW segment support to well path completions/collection
Introduce MSW segment collection to RimWellPathCompletions, including UI tree integration and completion list updates. Add MSW Eclipse case and show bands fields to RimWellPathCollection, with new UI controls and update logic. Implement segment update and visualization methods, option calculation for Eclipse case selection, and update headers and includes accordingly.
2026-01-20 14:13:22 +01:00
Magne Sjaastad d53f71ae45 Add MSW segment support for WELSEGS-based visualization
Introduce RimMswSegment and RimMswSegmentCollection classes to manage and visualize Multi-Segment Well (MSW) segments from Eclipse WELSEGS data. Update WelsegsRow to include source well name for correct segment grouping. Integrate new classes into the build system and UI, enabling accurate 3D well path representation and improved segment management in ResInsight.
2026-01-20 14:13:22 +01:00
Magne Sjaastad 9851afc621 #2070 AppFwk : Disable default IO for proxy fields
Proxy fields usually reads and transforms data from other sources, usually other Pdm fields. This commit disables IO for proxy fields in the constructor. If XML serialization is required, this must be set on the proxy field, like this

field.xmlCapability()->setIOWritable(true)
field.xmlCapability()->setIOReadable(true)
2026-01-19 16:10:14 +01:00
Kristian Bendiksen a71fb9ad19 #13398 Python: Add API for custom well path segments
Add Python GRPC interface support for creating and managing custom segment
intervals for multi-segment wells. This provides API parity with the existing
GUI functionality.

Changes:
- Add createInterval() method to RimCustomSegmentIntervalCollection
- Add GRPC method addCustomSegmentInterval to RimcWellPathCompletionSettings
- Add validation to prevent creating intervals with start_md >= end_md
- Add Python test test_custom_segment_intervals.py with validation test
- Add usage example to modeled_well_path.py

Follows the pattern established by diameter roughness intervals.

Fixes #13398.
2026-01-13 10:44:55 +01:00
Magne Sjaastad cfd634e206 Updates PDM UI label positioning
Updates the way UI label positions are set for PDM fields.
2026-01-08 21:44:58 +01:00
Kristian Bendiksen 79984604cc Refactor RimValveTemplateCollection. 2026-01-05 13:15:47 +01:00
Kristian Bendiksen bd7e5ac1b9 Refactor: reduce duplicated code for collections 2026-01-05 13:15:47 +01:00
Magne Sjaastad 405a32e2da Removes QIntValidator and uses setRange
Replaces the usage of `QIntValidator` with the `setRange` function available in the PDM framework for limiting integer input in UI fields.
This approach provides a more direct and maintainable way to specify value ranges for UI elements.

This change simplifies the code and reduces dependencies.
2025-12-22 10:17:00 +01:00
Kristian Bendiksen b8575e6b5e #13355 Use validation framework for RimCustomSegmentInterval 2025-12-19 12:36:10 +01:00
Jon Jenssen b8141fbbe5 Refresh after deleting a fishbone 2025-12-18 07:42:00 +01:00
Kristian Bendiksen da48c78b02 #13316 Custom MSW well segment definitions 2025-12-17 16:34:04 +01:00
Magne Sjaastad 0732489d6a #12256 Update views when perforation interval is deleted 2025-12-10 10:35:03 +01:00
JJ 9f17dd81ff Add support for COMPLUMP keyword (#13273)
* Add support for COMPLUMP keyword, both in python interface, file export and opm flow jobs
* Add support for WPIMULT kw in opm flow jobs
* Always provide per connection dFactors in COMPDAT kw (negative value)
* Include LGR support in COMPLUMP file export
2025-12-04 19:25:41 +01:00