Commit Graph
683 Commits
Author SHA1 Message Date
Kristian Bendiksen e6746cd819 RiuSummaryPlot: Fix memory leak by integrating into Qt's parent-child system. 2025-09-04 09:04:30 +02:00
Kristian Bendiksen 0cce2bb42d Fix critical RiuContextMenuLauncher memory leak by setting parent widget
Address sanitizer detected a memory leak in CmdFeatureMenuBuilder::MenuItem
objects caused by RiuContextMenuLauncher objects that were never deleted.

Problem: The RiuContextMenuLauncher class has two constructors:
1. RiuContextMenuLauncher(widget, CmdFeatureMenuBuilder&) - sets parent ✓
2. RiuContextMenuLauncher(widget, QStringList&) - missing parent ✗

The second constructor was missing the parent initialization, causing all
RiuContextMenuLauncher objects created with QStringList (used in 10+ locations)
to never be deleted, leading to memory leaks of their internal MenuItem vectors.

Root cause: Missing parent-child relationship meant Qt couldn't automatically
clean up these objects when their associated widgets were destroyed.

Fix: Added `: QObject( widget )` to the second constructor to match the first
constructor's behavior. This ensures Qt's automatic parent-child cleanup
handles the RiuContextMenuLauncher lifecycle properly.

This fixes the systemic issue affecting multiple plot types including:
- Correlation plots, Analysis plots, VFP plots, Well allocation plots
- All locations using `new RiuContextMenuLauncher(widget, {commands})`
2025-09-04 09:04:30 +02:00
Kristian Bendiksen aec17d54a7 Fix CmdFeatureMenuBuilder::MenuItem memory leak in RiuContextMenuLauncher
Address sanitizer detected a memory leak in CmdFeatureMenuBuilder::MenuItem
objects allocated during context menu creation.

Problem: The RiuContextMenuLauncher constructor was creating a temporary
CmdFeatureMenuBuilder object, populating it with menu items, then copying
the entire object to the member variable m_menuBuilder. This caused
unnecessary memory allocation and copying of std::vector<MenuItem> data.

Root cause: Inefficient constructor implementation:
  caf::CmdFeatureMenuBuilder menuBuilder;  // temp object
  for (cmd : commandIds) menuBuilder << cmd;  // populate temp
  m_menuBuilder = menuBuilder;  // copy entire vector (leak source)

Fix: Build the menu directly into the member variable instead of creating
a temporary object and copying it:
  for (cmd : commandIds) m_menuBuilder << cmd;  // direct construction

This eliminates the unnecessary temporary object creation and copy operation
that was causing the MenuItem vector allocation detected by the sanitizer.
The fix maintains identical functionality while being more efficient.
2025-09-04 09:04:30 +02:00
Kristian Bendiksen 89e940b1ea Fix QProxyStyle memory leak in PdmUiTreeViewStyle creation
Address sanitizer detected a memory leak in QProxyStyle objects
created during GUI theme updates.

Problem: The updateGuiTheme() function was called multiple times (e.g., during
initialization) and repeatedly created new PdmUiTreeViewStyle objects for
every PdmUiTreeViewWidget without checking if the widget already had the
correct style set.

Root cause: Each call to updateGuiTheme() would:
1. Iterate through ALL widgets in the application
2. Create a new PdmUiTreeViewStyle for every tree view widget
3. Call setStyle() which should take ownership, but repeated calls
   were causing memory leaks

Fix: Added a check to only create and set a new PdmUiTreeViewStyle if the
widget doesn't already have one. This prevents repeatedly creating new
styles for the same widgets during multiple theme update calls.

The fix uses dynamic_cast to check if the current style is already a
PdmUiTreeViewStyle before creating a new one.
2025-09-04 09:04:30 +02:00
JJ 393917e6f3 Histogram drag/drop and paste improvements (#12851)
* Add drag'n'drop support for ensemble summary vectors and ensembles into histogram plots

* Make sure histogram plot is shown and all update signals are connected when loading a project.

* Support ensemble parameter drag'n'drop from data sources into histogram plots. 

* Show ensemble parameters in data sources tree.

* Add copy/paste of histogram curves

* Re-use all existing parameters in a plot when dragging a new ensemble into it
2025-08-29 15:12:32 +02:00
Magne Sjaastad 4135a743fe Release preparations
* Adds a bounds check on the node index to prevent accessing invalid memory locations.
This prevents potential crashes caused by out-of-bounds access when retrieving summary variable values.
* Updates warning message for incomplete deltas
* Plot based on a single realization from a file set ensemble is not restored correctly on project load
* Populate result addresses if no addresses are present
* Adds CNV_ (convergence) result name
* Avoid include of RiaResultNames.h in header file
2025-08-27 14:22:11 +02:00
Santiago Ospina De Los Ríos 66756ff21e Use template function prefix 2025-08-25 12:45:22 +02:00
Kristian Bendiksen 8f825c3cef #12534 Refactor: Simplify RiaDefines::MultiPlotPageUpdateType usage 2025-08-22 16:10:04 +02:00
jonjenssen a53fa416a5 Set minimum preferred height of legend in 3d view 2025-08-10 20:11:18 +02:00
Kristian Bendiksen ade8e1d7e6 Remove QT_CHARTS dependency. 2025-07-30 13:39:02 +02:00
Magne Sjaastad 2f9971cb30 Enhances ensemble curve handling and performance
* Removes obsolete code
* Return first non-empty return value from reader
* Simplifies water cut curve visibility check
* Defers the page update until after all plots have been added.
* Add settings to control number of threads
* Refactors ensemble curve handling and visibility

Improves the efficiency of ensemble curve set management by separating realization and statistics curves into distinct collections. This allows for more targeted operations, such as selectively showing/hiding realization curves without affecting statistics.
Also defers data loading of curves until they are actually displayed, optimizing performance.
The visibility updates are modified to optionally skip updating the parent plot, providing more control over replotting behavior and preventing unnecessary updates.
2025-07-30 07:16:29 +02:00
Magne Sjaastad b9f13f742d Select the first visible plot item in the Project Tree
When clicking on a plot, this change ensures that the first visible ancestor plot in the hierarchy is selected in the project tree.
2025-07-25 08:42:13 +02:00
Magne Sjaastad b4e99e9a3a Improves summary import for ensemble workflows
- Introducing a configuration system to automatically detect file patterns for restart and parameter files across ensemble realizations.
- Adding UI elements to control improved summary import settings.
- Modifying summary file reader to use the determined file patterns.
2025-07-23 15:58:56 +02:00
Magne Sjaastad 3727a12634 Add reordering and drag/drop for summary ensembles 2025-07-23 10:34:27 +02:00
Magne Sjaastad 054001cef4 Selects plot on right-click as well 2025-07-23 10:34:27 +02:00
Kristian Bendiksen 11d85583dd Histogram: Use new plot for "Create Grid Statistics in 3d view". 2025-07-04 16:57:41 +02:00
Kristian Bendiksen e095f524c8 Histogram: Use vertical labels. 2025-07-03 08:35:10 +02:00
JJ bda598dd37 Run Opm Flow jobs from ResInsight (#12580) 2025-06-11 15:43:53 +02:00
jonjenssen 7b7878e0af EDFM grid data support 2025-05-19 17:40:39 +02:00
Magne Sjaastad 37041ad0a6 clang-19-tidy and clang-19-format fixes 2025-05-19 14:31:30 +02:00
Magne Sjaastad 957adc3c4c Adjustments for ensemble file sets
* Add support for reload of ensemble file set
* Fix Replace for ensemble file sets
* Workaround for update of connected plots
* Use summary icon for ensemble data sources
2025-05-19 12:51:52 +02:00
Magne Sjaastad dc4cd33c6e #12495 Refactors ensemble statistics handling
Removes the dedicated `SUMMARY_ENSEMBLE_STATISTICS` category and instead uses a `statisticsType` field within `RifEclipseSummaryAddress` to represent ensemble statistics.

This change simplifies the code and avoids potential confusion by representing statistics as attributes of existing summary types, rather than a separate category. It also improves code robustness.
2025-05-16 07:53:46 +02:00
Magne Sjaastad 84f9ad0dcd First prototype on ensemble file set summary ensembles 2025-05-15 18:16:27 +02:00
Magne Sjaastad 9b613ba4f0 Create a menu for each ensemble in the plot
Create a QVariant using caf::PdmPointer, and send this variant to the feature. The feature converts the QVariant to an ensemble curve set.

Make sure the right-click menu in the summary plot shows the Create from filtered cases independent to the selection in project tree.
2025-05-08 07:27:42 +02:00
Magne Sjaastad 7e38cc79b1 Remove duplicate parenthesis 2025-04-22 08:22:22 +02:00
magnesj 77c2d624fc Fixes by clang-tidy 2025-04-19 08:26:02 +02:00
Magne Sjaastad a09a189214 Update to clang-tidy 18
* remove unused variable
* Use clang-18 for ResInsight build
* Update to clang-tidy-18
* Add NOLINTNEXTLINE
2025-04-14 20:31:11 +02:00
Magne Sjaastad 892d7251ee Update to clang-format-18
Update to clang-format-18
Code changes related to clang-format-18
2025-04-11 18:34:32 +02:00
Jon Jenssen 9c26664522 Make sure the clear all messages slot is defined as a slot. 2025-04-10 14:39:56 +02:00
Magne Sjaastad ae8446073b Refactors selection handling for improved code clarity
Modernize the interface to selection system. Create and return data instead of populating incoming parameters.
2025-04-09 07:21:54 +02:00
Magne Sjaastad d78a83038c Closes all subwindows on project close 2025-04-07 09:25:46 +02:00
Magne Sjaastad 5f0dd58de9 Improves zoom behavior in multi-plots
Refactors zoom handling in multi-plot scenarios to ensure consistent
axis ranges and proper synchronization between subplots, especially
when linking subplot axes.

Removes direct zoom event handling from subplots and centralizes zoom
logic in the multi-plot container.

This ensures that the 'Zoom All' operation correctly adjusts the
Y-axis ranges based on the configured aggregation method and linked
axes settings.
2025-04-04 13:37:53 +02:00
Magne Sjaastad 70e37e8f5d #12283 Add filter based on summary value at timestep
* Show collapsed range as a single line
* Improves plot annotation label placement
* Adds option to show/hide axis properties
* Adjusts plot info label alignment
* Adds filter by summary value functionality
* Enables ensemble creation from filtered cases
2025-04-01 14:51:13 +02:00
Magne Sjaastad 3cd03c8e1c #12310 Summary plot and RFT plot adjustments
* Use vector name as axis object text, avoid identifier text
* Select the plot clicked at in the Project Tree
* Make sure RFT plots are updated when summary case and ensemble is changed
* Make sure all plots are updated for multiselect and toggle statistics
* Allow paste of plot on top level plot collection
* Allow multiple top level plots as destination for Append operations
2025-03-31 08:02:00 +02:00
Magne Sjaastad c4249e7a64 #12280 Grid Cross Plot: Crash when no data is visible in 3D view 2025-03-28 13:54:23 +01:00
Magne Sjaastad 0635d5870a #12291 Several minor adjustments
* Use same naming for ensemble grid cases as ensemble summary cases
* Create Polygons: Ask for polygon area cutoff when polygon count is high
* Show Create Polygons from Contour Map in polygon collection menu
* Update titles in crossplots
* Clear message panel when project is closed
* Show text message for start and complete of replace ensemble
2025-03-26 21:50:39 +01:00
Magne Sjaastad 0d0fc1aca5 #12282 Improve auto naming to avoid ensembles with identical names 2025-03-25 06:45:39 +01:00
Kristian Bendiksen c5ef75e368 Result Plot: simplify curve names. 2025-03-21 14:09:34 +01:00
Kristian Bendiksen 483e78267c Result Info: remove extra space before colon. 2025-03-21 14:09:34 +01:00
Kristian Bendiksen 2ce846dd98 #12210 Optionally update the content of Result Info and Depth plot when time step changes 2025-03-21 14:09:34 +01:00
Kristian Bendiksen a9890af031 Janitor: rename variable. 2025-03-21 14:09:34 +01:00
Magne Sjaastad 3baaad8755 Make sure all 3D views are resized for regression tests 2025-03-17 06:54:53 +01:00
Magne Sjaastad 7e33fee1ac Avoid include in headers 2025-03-14 14:03:09 +01:00
Magne Sjaastad 587bf67994 #12203 Improve selection of curves
Interpolate distance from mouse cursor to the line between index above and below closest index. This will make sure selection works when zoomed, and clear highlighting if mouse click is far from curves.
2025-03-14 13:44:00 +01:00
Magne Sjaastad 61ff5748ce #12236 Summary Cases: Allow reordering of summary cases 2025-03-12 12:55:20 +01:00
Magne Sjaastad 6506fde63b Merge pull request #12231 from OPM/improve-correlation-plot
Improve default settings correlation plot
2025-03-11 09:06:07 +01:00
Kristian Bendiksen afeedb1e22 Janitor: remove unnecessary disabling of clang-format. 2025-03-10 17:58:59 +01:00
Magne Sjaastad 5f7823b8d3 Use point size when defining font size
Avoid pixel size for easier config across multiple environments
Set default font size for plots to 10 points
Use Small instead of XSmall for default font in plot
Remove pt postfix to indicate point size
2025-03-10 16:56:16 +01:00
Magne Sjaastad 3709b858d1 Exclude nan values when computing min max for depth curves 2025-03-07 14:41:38 +01:00
Magne Sjaastad cebb2bfbe6 Guard null pointer access 2025-03-07 14:41:38 +01:00