This commit extracts the internal helpers of class
InterRegFlowMap
out to a new public helper class template, CSRGraphFromCoordinates.
Client code can, at the expense of one additional data member and
some dynamic memory, elect to track the index pairs. This enables
O(1) assembly per element when used as part of a CSR matrix with a
value array, SA.
Class CSRGraphFromCoordinates does not track values. It is purely
for the sake of forming the IA and JA structure arrays. Upon
calling 'compress()', column indices are sorted per row and
duplicate column indices condensed to a single, unique,
representative.
The rest of the code allows an ACTIONX keyword without any
condition (Such an action will never be evaluated). Yet
AggregateActionXData assumed that there is always at least one
condition. This lead to a segmentation fault if that was not the case.
It seemed like iAC[offset + Ix::FirstGreater] is used nowhere and
therefore we now always use 0 there. I was not brave enouogh to remove
the storage for it, because I fear this might break backwards
compatibility of the output layer.
Member function SummaryState::update_udq() did not take into account
the possibility that wells or groups might not yet have come online.
In particular, UDQSet::operator[](const string&) will throw an
exception if the argument string does not name an existing member of
the UDQ set.
This commit makes the call to operator[]() conditional on the named
entity existing and thereby enables updating well and group level
UDQs before these names have been entered in, e.g., WELSPECS or
GRUPTREE. Missing entities get the 'undefined_value'.
Running simulations on those does not make sense as it seriously
limits the time span that can be simulated. In addition the OPM code
neglects 32bit issues at various places as it was written at a time
where 64bit was already ubiquitous.
Currently, we would fail in some regression tests on 32bit
systems. With this change CMake will already check whether it is run
on a 64bit system and already fail if this is not the case.
Fixes
```
/opm/input/eclipse/Schedule/Schedule.hpp:241:14: error: ‘function’ in namespace ‘std’ does not name a template type
241 | std::function<std::unique_ptr<SegmentMatcher>()> segmentMatcherFactory(std::size_t report_step) const;
| ^~~~~~~~
```
The existing implementation used the UDQ State object to track
pending ASSIGN operations, mainly in terms of the report step index,
but this implies that the logic implicitly assumes an ASSIGN
operation can run at most once per report step. That assumption
usually holds, but fails if the ASSIGN operation is triggered from
an ACTIONX block that happens to run multiple times within a report
step.
This commit instead introduces a new data member,
UDQConfig::pending_assignments_
that keeps track of all ASSIGN operations that have been added for
the current report step. We clear those pending assignments when
forming a new Schedule block (ScheduleState object), under the
assumption that all pending ASSIGN operations have been affected at
the previous time level (report step).
In effect, this new data member assumes the role of
UDQState::assignments
and we therefore remove that data member and update the signature of
UDQState::add_assign()
to account for the fact that the 'report_step' parameter is no
longer needed.
We don't need to reimplement logic that's already present and it is
always an error to pass a 'report_step' argument that exceeds
Schedule::size().
Pointed out by: [at]blattms.
If there are errors at the top level (e.g. RUNSPEC comes after
NOECHO), we might get very many errors and the user might miss
the relevant ones on top.
To fix this we will now print those errors last just before exiting
the simulator because of these errors.
This commit adds parser and evaluation logic necessary to handle
ASSIGN statements for segment level UDQs. This requires a segment
matching facility in UDQConfig::add_assign() which, in turn, must be
passed from the calling context in Schedule::handleUDQ(). Update
APIs accordingly.
We also split handling segment level UDQ assignments to a new helper
function, UDQConfig::add_enumerated_assign(), which might be
generalised to handle block level UDQs in the future.
In particular, use a single loop over the 'input_index' instead of
one separate loop for each supported variable type. This is in
preparation of adding suport for segment level UDQ ASSIGN statements.
This commit adds logic that enables recognizing segment level UDQs
in the summary output writer. We calculate all segment level UDQs
and add the values to the summary state for possible use in ACTIONX
too. The latter is not yet tested.
This commit adds support for calculating UDQs at the segment level,
i.e., UDQs named 'SU*'. This necessitates an API change for the UDQ
context constructor and, transitively, every function that forms UDQ
context objects. We pass a factory function that will create
segment matcher objects on demand, and provide a default
implementation of this factory function in the Schedule class.
The existing algorithm was a little too fragile and dependent on
branch numbers. This new version starts at segment 1/branch 1 and
follows Segment::inletSegments() in depth-first order, taking care
to enqueue new branches as they're encountered instead of in
numerical order. We search to the end of each branch before
switching to the next branch. This ensures determinism regardless
of branch numbering and input ordering.
While here, switch iLBR_ to a WindowedMatrix<int> to simplify branch
references in the output table.
The value in ISEG[0] does not necessarily correspond to the search
order of that segment. Rather, ISEG[0] is the depth-first ordering
of the segment search tree when traversing kick-off branches before
the main stem from which those branches kick off.
This is in preparation of revising the algorithm for ILBR/ILBS.
Mostly splitting long lines, adding missing headers, passing scalars
by value, and making three helper structures private to the
implementation file. There are no external users of these types.