diff --git a/opm/io/eclipse/EGrid.hpp b/opm/io/eclipse/EGrid.hpp index c16e4d843..9e1455b80 100644 --- a/opm/io/eclipse/EGrid.hpp +++ b/opm/io/eclipse/EGrid.hpp @@ -44,8 +44,8 @@ public: std::array ijk_from_active_index(int actInd) const; std::array ijk_from_global_index(int globInd) const; - void getCellCorners(int globindex, std::vector& X, std::vector& Y, std::vector& Z) const; - void getCellCorners(const std::array& ijk, std::vector& X, std::vector& Y, std::vector& Z) const; + void getCellCorners(int globindex, std::array& X, std::array& Y, std::array& Z) const; + void getCellCorners(const std::array& ijk, std::array& X, std::array& Y, std::array& Z) const; int activeCells() const { return nactive; } int totalNumberOfCells() const { return nijk[0] * nijk[1] * nijk[2]; } diff --git a/src/opm/io/eclipse/EGrid.cpp b/src/opm/io/eclipse/EGrid.cpp index fd9e2601e..f92c078b9 100644 --- a/src/opm/io/eclipse/EGrid.cpp +++ b/src/opm/io/eclipse/EGrid.cpp @@ -127,21 +127,13 @@ std::array EGrid::ijk_from_global_index(int globInd) const void EGrid::getCellCorners(const std::array& ijk, - std::vector& X, - std::vector& Y, - std::vector& Z) const + std::array& X, + std::array& Y, + std::array& Z) const { std::vector zind; std::vector pind; - if (X.size() < 8 || Y.size() < 8 || Z.size() < 8) { - OPM_THROW(std::invalid_argument, - "In routine cellConrner. X, Y and Z should be a vector of size 8"); - } - - if (ijk[0] < 0 || ijk[0] >= nijk[0] || ijk[1] < 0 || ijk[1] >= nijk[1] || ijk[2] < 0 || ijk[2] >= nijk[2]) { - OPM_THROW(std::invalid_argument, "i, j and/or k out of range"); - } // calculate indices for grid pillars in COORD arrray pind.push_back(ijk[1]*(nijk[0]+1)*6 + ijk[0]*6); @@ -181,8 +173,8 @@ void EGrid::getCellCorners(const std::array& ijk, } -void EGrid::getCellCorners(int globindex, std::vector& X, - std::vector& Y, std::vector& Z) const +void EGrid::getCellCorners(int globindex, std::array& X, + std::array& Y, std::array& Z) const { return getCellCorners(ijk_from_global_index(globindex),X,Y,Z); } diff --git a/test_util/EclRegressionTest.cpp b/test_util/EclRegressionTest.cpp index da4b6520c..9579e9b92 100644 --- a/test_util/EclRegressionTest.cpp +++ b/test_util/EclRegressionTest.cpp @@ -407,8 +407,13 @@ void ECLRegressionTest::gridCompare() std::cout << "X, Y and Z coordinates " << " ... "; - std::vector X1(8,0.0), Y1(8,0.0) , Z1(8,0.0); - std::vector X2(8,0.0), Y2(8,0.0), Z2(8,0.0); + std::array X1 = {0.0}; + std::array Y1 = {0.0}; + std::array Z1 = {0.0}; + + std::array X2 = {0.0}; + std::array Y2 = {0.0}; + std::array Z2 = {0.0}; for (int k = 0; k < dim1[2]; k++) { for (int j = 0; j < dim1[1]; j++) { diff --git a/tests/test_EGrid.cpp b/tests/test_EGrid.cpp index 9143bf90f..40492535c 100644 --- a/tests/test_EGrid.cpp +++ b/tests/test_EGrid.cpp @@ -156,15 +156,15 @@ BOOST_AUTO_TEST_CASE(getCellCorners) { std::string testFile="SPE1CASE1.EGRID"; - std::vector ref_X = {3000,4000,3000,4000,3000,4000,3000,4000}; - std::vector ref_Y = {2000,2000,3000,3000,2000,2000,3000,3000}; - std::vector ref_Z = {8345,8345,8345,8345,8375,8375,8375,8375}; + std::array ref_X = {3000,4000,3000,4000,3000,4000,3000,4000}; + std::array ref_Y = {2000,2000,3000,3000,2000,2000,3000,3000}; + std::array ref_Z = {8345,8345,8345,8345,8375,8375,8375,8375}; EGrid grid1(testFile); - std::vector X(8,0.0); - std::vector Y(8,0.0); - std::vector Z(8,0.0); + std::array X = {0.0}; + std::array Y = {0.0}; + std::array Z = {0.0}; // cell 4,3,2 => zero based 3,2,1 grid1.getCellCorners({3, 2, 1}, X, Y, Z); @@ -173,9 +173,9 @@ BOOST_AUTO_TEST_CASE(getCellCorners) { BOOST_CHECK_EQUAL(Y == ref_Y, true); BOOST_CHECK_EQUAL(Z == ref_Z, true); - X.assign(8,0.0); - Y.assign(8,0.0); - Z.assign(8,0.0); + X = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + Y = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + Z = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; int globInd=grid1.global_index(3,2,1);