Add Manager Class for Region Level Summary Variables - #5278
Conversation
|
I'm creating this PR in draft mode because it depends on, and contains, the earlier PR #5277. I will keep the PR in a draft state until such time as it is ready for review and merging. |
07dcace to
581b0ce
Compare
|
jenkins build this please |
There was a problem hiding this comment.
Pull request overview
This PR adds a new Opm::RegionVariableCollection manager that owns region-set descriptors and value storage, and provides a simple accumulation workflow for region-level summary variables (including special handling for the FIELD “region set”).
Changes:
- Introduces
RegionVariableCollectionwithinitialise(),prepareValueAccumulation(), per-cell accumulation viaaddCellValue(), andcommitValues(). - Adds helper lookups
regionSetIndex()andvariableIndex()to bridge mapping names to numeric indices (withFIELDhandled specially). - Wires the new implementation into the build and adds a dedicated unit test suite.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| opm/output/eclipse/RegionVariableCollection.hpp | Declares the new manager API and its documentation. |
| opm/output/eclipse/RegionVariableCollection.cpp | Implements region descriptor/value initialization and per-cell accumulation logic. |
| tests/test_region_variable_collection.cpp | Adds unit tests covering non-cumulative/cumulative behavior across region sets and variables. |
| CMakeLists_files.cmake | Registers the new source, public header, and test in the build. |
Suppressed comments (1)
opm/output/eclipse/RegionVariableCollection.hpp:141
- The documentation refers to
addRegionValue(), but callers will be usingaddCellValue()on this class. This should be updated to avoid confusion.
/// Adds increment values for cumulative quantities and overwrites
/// current values for non-cumulative quantities.
///
/// Must be called after the last call to addRegionValue().
void commitValues();
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
I have addressed Copilot's initial review comments and the PR goes through a build check. I'm marking this PR as "ready for review" now. |
|
jenkins build this please |
|
jenkins build this please |
This commit introduces a new manager-style class
RegionVariableCollection
which aggregates region set descriptors and variable values and
distributes per-cell variable contributions to all pertinent region
sets. Client code is expected to create a single object of this
class and initialise it with a populated region variable mapping.
Then as needed, typically at the end of every converged time step,
client code is expected to perform a value accumulation as follows:
1. Prepare this object for accumulation (prepareValueAccumulation())
2. For each applicable variable and cell, include the per-cell
contribution (addCellValue()).
3. Commit those contributions to compute the new variable
values (commitValues()).
Once 'commitValues()' has completed, client code may retrieve those
new variable values through the regionVariableValues() member
function. The process of committing values may involve cross-rank
MPI communication in parallel and will add to or overwrite the
current values depending on whether the variable is declared
cumlative.
We also include two helper functions,
regionSetIndex()
variableIndex()
which essentially just forward a query to the variable mapping
object supplied as an argument. The one exception is that
regionSetIndex() knows that "FIELD" is a special region set
pertaining to field-level quantities and will act accordingly.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
jenkins build this please |
|
PR approved and build check is green. I'll merge into master. |
This PR introduces a new manager-style class
which aggregates region set descriptors and variable values and distributes per-cell variable contributions to all pertinent region sets. Client code is expected to create a single object of this class and initialise it with a populated region variable mapping. Then as needed, typically at the end of every converged time step, client code is expected to perform a value accumulation as follows:
prepareValueAccumulation())addCellValue()).commitValues()).Once
commitValues()has completed, client code may retrieve those new variable values through theregionVariableValues()member function. The process of committing values may involve cross-rank MPI communication in parallel and will add to or overwrite the current values depending on whether the variable is declared cumulative.We also include two helper functions,
regionSetIndex()variableIndex()which essentially just forward a query to the variable mapping object supplied as an argument. The one exception is that
regionSetIndex()knows that "FIELD" is a special region set pertaining to field-level quantities and will act accordingly.