Commit Graph
112 Commits
Author SHA1 Message Date
Magne Sjaastad b6704429cd Scope GRPC/ODB/OpenVDS/HDF5 build flags to avoid full rebuilds
- Remove unused SOURCE_GROUP_HEADER_FILES from GrpcInterface CMakeLists
- Scope the following defines to the files that need it ENABLE_GRPC, USE_ODB_API , USE_OPENVDS, USE_HDF5 
- RifOdbReader.cpp copied an odb_InstanceRepository by value, which
  fails to compile under MSVC's strict conformance mode due to an
  ambiguous implicit copy constructor in the vendor headers (diamond
  inheritance). Use a reference instead, since it was only ever read
  from.
2026-10-02 12:24:29 +02:00
Magne Sjaastad 3437cf9b94 #14778 Fix crashes from unguarded pointer and index accesses
* Skip deleted plot widgets in RiuMultiPlotBook::visiblePlotWidgets
* Guard missing calculation in detectCyclicCalculation
* Guard invalid node index in RigFemPart node lookups
* Guard null well path in RimWellLogExtractionCurve::extractGeomData
* Guard unopened case in RimGridCalculation::removeDependentObjects
* Guard empty subset in createLateralAtMeasuredDepth
2026-09-22 08:23:00 +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 d0e9f45f32 #14397 Make cvfAssert.h self-contained
cvfAssert.h tests CVF_ENABLE_ASSERTS but did not include cvfConfigCore.h, which
is where that macro gets its default value of 1. A translation unit processing
cvfAssert.h before cvfConfigCore.h evaluated the undefined identifier as 0 and
silently compiled every CVF_ASSERT, CVF_ASSERT_MSG and CVF_FAIL_MSG in that unit
into a no-op, without any warning and without evaluating the expressions.

Because the header uses pragma once, including cvfConfigCore.h later in the same
unit did not recover the macros. Alphabetical include sorting actively produces
the broken order, since cvfAssert.h sorts before cvfBase.h.

Include cvfConfigCore.h before the macro definitions. It only defines macros, has
pragma once and no dependencies, so this is immune to future include reordering.

This turns the asserts back on in the affected translation units, in both debug
and release builds, and immediately exposed one assert that had never compiled:
in RigFemPartResultCalculatorNormalized::calculate, isNormalizableResult was
called unqualified even though it is a static member of
RigFemPartResultsCollection. Qualify it, matching isMatching in the same file.
2026-08-07 15:05:57 +02:00
Magne Sjaastad fe0e691e6c #14448 Fix dangling formation names pointer in case data
RigCaseCellResultsData and RigFemPartResultsCollection held a raw pointer to RigFormationNames owned by a unique_ptr in RimFormationNames. Reloading or deleting the formation names left the case data with a dangling pointer. Store a copy instead, as RigFormationNames is a small value type with no identity.
2026-08-04 13:05:26 +02:00
Magne Sjaastad f409fd8a4d #14376 Guard ODB API calls in RifOdbReader destructor 2026-07-28 09:46:24 +02:00
Magne Sjaastad 0df1df119e #14289 Guard against deleted result definition in geometry selection items 2026-06-23 07:29:21 +02:00
Kristian Bendiksen 7f39dc5a1e #12731 Reference_layer in compaction plot not updated
Fixes #12731.
2026-06-12 16:31:00 +02:00
Magne Sjaastad 7d977ac522 #14116 GeoMech: fix out-of-bounds crash mapping step index to time step
stepListIndexToTimeStepAndDataFrameIndex only guarded against negative indices, relying on a CVF_ASSERT for the upper bound. That assert is compiled out in release builds, so when a GeoMech case has no steps loaded (empty m_stepList) the clamped current time step of 0 caused an out-of-bounds read of m_stepList[0]. Extend the early-return guard to also cover indices past the end, returning the existing (stepIndex, -1) sentinel.
2026-06-04 16:07:27 +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
Kristian Bendiksen 5ffcb69acc #13126 RiaLogging: Use std::string_view instead of QString for logging 2026-05-08 10:11:09 +02:00
Magne Sjaastad c5af814ba1 #12572 VTK: Display stress/strain as folder with component sub-items
Use field name constants S_VTK/E_VTK with a shared separator constant to
derive internal storage keys, filter them from the flat result list, and
expose them as folders with S11-S23 / E11-E23 sub-items in the UI.
2026-04-16 17:09:43 +02:00
Magne Sjaastad e3d5b05125 VTK: Read geometry only on first timestep, log displacements per timestep
Move points and connectivity reading inside the isFirst guard to avoid redundant parsing on subsequent timesteps. Move displacements reading outside the guard so they are read for every timestep, and update the log message accordingly.
2026-04-14 14:56:43 +02:00
Magne Sjaastad b4d0c92d74 GeoMech: Apply displacement to cell selection wireframe 2026-04-14 14:56:43 +02:00
Magne Sjaastad fb6a0624c8 VTK: Invert IJK indices to match ResInsight convention
VTK coordinates are negated (z positive downward) to match ResInsight
internal convention, which flips the IJK directions relative to what the
structured grid algorithm expects. Add invertIJK flag to RigFemPartGrid
and RigFemPart so the inversion is applied during struct grid construction.
2026-04-14 14:56:43 +02:00
Magne Sjaastad 1f0c47fb5f VTK: Add displacement field U with components U1/U2/U3 in RifVtkReader 2026-04-14 14:56:43 +02:00
Magne Sjaastad 601a3bbb78 Refactor RigFormationNames
- Rename RifColorLegendData to RifFormationNamesReader to better reflect the
class purpose of reading formation names from .lyr files.
- Remove inheritance of cvf::Object
- Improve const correctness
2026-02-27 14:17:21 +01:00
Magne Sjaastad d52f595c41 Refactor: Rename RiaStatisticsTools to RigStatisticsTools
Replaced all references to RiaStatisticsTools with RigStatisticsTools across the codebase, including header includes, static method calls, and test files. Updated CMake configuration to remove RiaStatisticsTools and add RigStatisticsTools. Renamed and updated related unit tests. No changes to logic or algorithms; this is a namespace and organizational refactor for consistency. Also added ApplicationLibCode include directories as PRIVATE to relevant targets.
2026-02-18 09:22:39 +01:00
Magne Sjaastad 544e9eedd9 Improve spell checker using codespell
* Configures automated spell checking with codespell
Adds GitHub workflows and configuration files for automated spell checking using `codespell`.

This includes:
- A workflow for checking pull requests and preventing new typos
- A workflow for automatically fixing typos in the main codebase
- Configuration files for `codespell` to ignore specific terms and file types
- Documentation on how to use and configure the spell checking workflows.

* Corrects minor spelling and grammar errors.
2025-11-19 10:25:32 +01:00
Kristian Bendiksen 4a8af2ff9d Add [[nodiscard]] to new api. 2025-09-03 14:21:19 +02:00
Kristian Bendiksen 10182e99a7 Refactor: Change RigGridBase::cellCornerVertices to return std::array
Refactored RigGridBase::cellCornerVertices to return std::array<cvf::Vec3d, 8> by value instead of taking a reference to std::array as an output parameter. This change improves code readability and leverages modern C++ return value optimizations.

Updated all call sites across the codebase to reflect the new function signature.
2025-09-03 14:21:19 +02:00
Kristian Bendiksen da69eef72b #1584 Replace cvf::vec3d[8] with std::array<cvf::vec3d, 8> 2025-09-03 14:21:19 +02:00
Magne Sjaastad 21bd5730f5 Move warnings as errors config and use in geomech libs 2025-06-17 14:43:47 +02:00
Magne Sjaastad c204593f08 Fix type conversion issues 2025-06-17 14:43:47 +02:00
Kristian Bendiksen fe9cac4fba #12414 GeoMech: import geomech data from VTK. 2025-05-30 08:38:51 +02:00
Magne Sjaastad 37041ad0a6 clang-19-tidy and clang-19-format fixes 2025-05-19 14:31:30 +02:00
Magne Sjaastad 932e99017d Fix backwards compability for time history curves 2025-03-14 11:48:32 +01:00
Magne Sjaastad 860588d755 #12008 Improve display of curves from selected cells in 3D view
* Remove obsolete base class
* Add conversion between one/zero-based IJK
* Move code to RiaTextStringTools
* Add automatic update of grid cell curves when clicking in 3D view
* Fix missing conversion to QString
2025-02-14 09:35:28 +01:00
Magne Sjaastad ca0179d118 Remove obsolete CMake statements
When using modern CMake and Qt6 we can remove obsolete source_group() and QT_MOC_HEADERS
2025-01-28 07:01:42 +01:00
Jon Jenssen dde369f568 Avoid crash if displacements are missing 2025-01-07 21:11:04 +01:00
Magne Sjaastad 7877cdf62d #11994 GeoMech: Allow property filter to be linked to cell result 2024-12-20 07:37:33 +01:00
jonjenssen d7d1026841 Fix build issue 2024-10-31 15:08:59 +01:00
jonjenssen da683bed9e Move Rig well related things to subfolder and update include statements 2024-10-31 15:08:59 +01:00
Magne Sjaastad 6fb74654a1 Improve interface for string operations
Trim incoming string before converting to number
Remove use of std::strtod and std::stoi
Use std::string_view instead of std::string when possible
2024-07-25 21:21:53 +02:00
jonjenssen fb5758a363 Support both AND and OR operations when combining range and index filters (#11275)
Support both AND and OR operations when combining range and index filters
2024-03-11 20:02:47 +01:00
jonjenssen 5391179e16 Add separate target for unit tests for easier test access. Remove unit tests from ResInsight application. (#11184)
Clean up cmake configuration a bit, and pull down gtest when needed, no longer use a thirdparty subfolder
Add a ResInsight-tests target to run the unit tests
2024-02-11 20:04:04 +01:00
Magne Sjaastad 833a0e8584 Performance: Cellcount functions are used in many loops, and must be as fast as possible
cellCountIJK was computed based on the value of griPointDimensions. These converstion turned up during profiling. Change implementation to have cellcount as a member variable instead of being computed every time.
2024-01-22 14:52:49 +01:00
jonjenssen 210f03752f Make INP reader a bit more generic, do not require steps defined in file and allow multiple element types (all types must be 8 nodes) 2024-01-22 14:45:55 +01:00
Kristian Bendiksen 544e6974e7 Refactor: improve interface for finding intersecting cells. 2024-01-03 13:00:09 +01:00
Kristian Bendiksen ffa117e736 Refactor: Extract getPartIndexFromPoint to avoid duplication. 2024-01-03 13:00:09 +01:00
Jon Jenssen 62c7007654 Minor code cleanup 2024-01-03 12:44:10 +01:00
jonjenssen 50a766591b Enable INP support without ODB libraries (#10990)
Enable INP support without ODB libraries
2024-01-03 11:55:35 +01:00
jonjenssen 850b1a1894 Support importing stress, too 2023-12-19 00:09:31 +01:00
jonjenssen 858c1227bc Use correct result name for Void ratio (#10969)
Use correct result name for Void ratio
Enable porosity calculator for imported inp data
Add model validation check for export/show model
Fix last res. layer not being splitted into subelements
Add model validation check in file exporter
Bump version to dev.04
2023-12-18 15:03:08 +01:00
Magne Sjaastad 958587e76c Disable unity build for OdbReader
Unity build was recently broken, hard to find source to the broken build. Few files in this library, no unity build is required.
2023-12-16 16:09:37 +01:00
jonjenssen 1fab743d56 INP import updates (#10952)
Support reading element type results
Automatically load properties from INP include files generated by Fault Reactivation Model exporter
Some refactoring of element and result types.
2023-12-14 08:46:41 +01:00
Kristian Bendiksen a2919d4b0e #10842 INP grid importer: create sets for GENERATE keyword.
Fixes #10842.
2023-11-17 15:02:44 +01:00
Kristian Bendiksen 2beb830102 INP reader: fix incorrect zero element for line shift. 2023-11-17 15:02:44 +01:00
Kristian Bendiksen 065e37a437 Fault Reactivation: parse element sets from INP file. 2023-11-06 15:20:47 +01:00