mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-30 11:06:55 -06:00
Correctly initialize the Eigen arrays.
Previously, we just called the default constructor. Of course this does not allocate any memory and we experienced segmentation faults. With this patch we correctly allocate the arrays by passing the number of row and columns to the constructor.
This commit is contained in:
parent
f820e1d441
commit
622c8825a9
@ -1931,9 +1931,10 @@ namespace {
|
||||
std::array<double,MaxNumPhases> B_avg = {{0., 0., 0.}};
|
||||
std::array<double,MaxNumPhases> maxCoeff = {{0., 0., 0.}};
|
||||
std::array<double,MaxNumPhases> mass_balance_residual = {{0., 0., 0.}};
|
||||
Eigen::Array<V::Scalar, Eigen::Dynamic, MaxNumPhases> B;
|
||||
Eigen::Array<V::Scalar, Eigen::Dynamic, MaxNumPhases> R;
|
||||
Eigen::Array<V::Scalar, Eigen::Dynamic, MaxNumPhases> tempV;
|
||||
std::size_t cols = MaxNumPhases; // needed to pass the correct type to Eigen
|
||||
Eigen::Array<V::Scalar, Eigen::Dynamic, MaxNumPhases> B(nc, cols);
|
||||
Eigen::Array<V::Scalar, Eigen::Dynamic, MaxNumPhases> R(nc, cols);
|
||||
Eigen::Array<V::Scalar, Eigen::Dynamic, MaxNumPhases> tempV(nc, cols);
|
||||
|
||||
for(int idx=0; idx<MaxNumPhases; ++idx)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user