Conversation
havahol
force-pushed
the
uniformXTabulated2DFunction-builder
branch
from
October 2, 2026 10:11
8993b47 to
59a4469
Compare
…ctionBuilder Follows the opm-common split of UniformXTabulated2DFunction into an append-only Builder and an immutable SparseTable-backed evaluation type. Rock-compaction tables in FlowGenericProblem_impl.hpp and the 10 EXTBO tables in blackoilextboparams.cpp now build via a local UniformXTabulated2DFunctionBuilder and finalize with .build(). CPU-only, behavior-preserving. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
havahol
force-pushed
the
uniformXTabulated2DFunction-builder
branch
from
October 2, 2026 11:15
59a4469 to
9792c64
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR splits
UniformXTabulated2DFunctioninto an append-onlyUniformXTabulated2DFunctionBuilderand an immutable,SparseTable-backed evaluation type, and migrates every call site over to the new split. It targets CPU-work only, and is behaviour preserving.This PR builds on the four PRs that moved
SparseTable/IteratorRangefrom opm-grid into opm-common (see [1-4]), and is prep work for GPU-portingUniformXTabulated2DFunctionandLiveOilPvtin a later PR, the same wayTabulated1DFunction/BrineCo2Pvtwere ported. With this PR, portingUniformXTabulated2DFunctionto GPU becomes easier asSparseTableis already GPU-ready, in contrast to thestd::vector<std::vector<SamplePoint>>data structure originally used.This PR should be reviewed together with OPM/opm-common#5411
Changes
opm-common
opm/material/common/UniformXTabulated2DFunctionBuilder.hpp: carries the old append logic (appendXPos/appendSamplePoint) plus the plain accessors needed by the four PVT classes'initEnd()-style derivation code (xAt/yAt/valueAt/numX/numY).build() &&is rvalue-qualified (move-only) and flattens the appended columns into aSparseTable<SamplePoint>, then returns the immutable type via a private constructor.opm/material/common/UniformXTabulated2DFunction.hpp:samples_is now aSparseTable<SamplePoint>(defaultstd::vectorstorage, not GPU-templated yet) instead ofstd::vector<std::vector<SamplePoint>>. DroppedappendXPos/appendSamplePointand the old(xPos, yPos, samples)constructor (no external callers); kept the default constructor for.resize(n, Policy)call sites and theoperator==/accessors.opm/common/utility/IteratorRange.hpp: addedfront()/back()toiterator_rangeandmutable_iterator_range— needed forSparseTable-backed row access (yMin/yMax/applies), mirrors the "behaves like a vector of vectors" contractSparseTablealready documents.LiveOilPvt,WetGasPvt,DryHumidGasPvt,WetHumidGasPvt: each gets Builder-typed private members for tables that are appended across multiple methods (initFromState,extendPvt*Table_, and the standalonesetSaturated*setters used by the manual-PVT-setup path inexamples/problems/reservoirproblem.hh), finalized via.build()at the top ofinitEnd(). Tables built entirely within one function scope (DryHumidGasPvt/WetHumidGasPvt's RWGSALT-derivedsaturatedWaterVaporizationSaltFactorTable_) use a local Builder instead of a persistent member.WetHumidGasPvtrepeats the pattern twice (RvSat and RvwSat pairs).tests/material/test_2dtables.cpp: table-construction helpers build viaUniformXTabulated2DFunctionBuilderand returnstd::move(tab).build().opm-simulators
opm/simulators/flow/FlowGenericProblem_impl.hpp: rock-compaction tables (rockCompPoroMultWc_/rockCompTransMultWc_) built via a local Builder per region, then.build().opm/models/blackoil/blackoilextboparams.cpp: all 10 EXTBO tables (X_, Y_, PBUB_RS_, PBUB_RV_, VISCO_, VISCG_, BO_, BG_, RS_, RV_) built via local Builders, finalized per-region right after that region's construction loop (verified no cross-region reads of an already-finalized table).Verify
ctest -R 2dtables(opm-common) — passes, 14 cases.eclblackoilpvt(opm-common) — passes, 8 cases. ExercisesLiveOilPvt/WetGasPvt/DryHumidGasPvt/WetHumidGasPvtvia the ECL-deckinitFromState/extendPvt*Table_/initEndpath (PVTO/PVTG/PVTGW keywords).opmcommonandopmsimulatorslibraries build clean (no new warnings attributable to these changes).reservoir_blackoil_ecfv/reservoir_blackoil_vcfv(opm-simulators) — pass, including the reference-result checksum comparison. These exerciseexamples/problems/reservoirproblem.hh, the only external caller ofLiveOilPvt's standalonesetSaturatedOilFormationVolumeFactor/setSaturatedOilViscosityappend path (as opposed to the ECL-deckinitFromStatepath), end to end.RockTableTests(opm-common) — passes.operator==dependency on the touched PVT classes was found in opm-simulators, so this has no restart-format implications.Stacked dependencies