OPM/opm-porsol — pull request #92 by bska (2013-11-14 09:57:54+00:00)
Title: Fix out-of-bounds indexing in IncompFlowSolverHybrid

This change-set fixes two instances of semantic and actual out-of-bounds indexing in the system assembly and solution post-processing codes. The issue was initially noticed and pointed out by @akva2 and @atgeirr subsequently found another instance of the same problem.

Basically, methods `assembleDynamic()` and `computePressureAndFluxes()` try to reduce the number of allocations and deallocations by preallocating work arrays of known maximum size. However, some of these work arrays were subsequently used in a way that was inconsistent with always having that maximum size. By explicitly resizing the work arrays, under the assumption that `std::vector<>::resize()` is an O(1) operation that does not affect the underlying memory if the block is large enough, we ensure that we're using the arrays in a consistent manner and don't incur out-of-bounds indexing.

This solves #91.