From 0e84c3de31d14ad1cfe21be228b6e77ef129674d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 12 Dec 2011 10:29:40 +0100 Subject: [PATCH] Replaces std::array with std::tr1::array for improved compatibility (not requiring c++11). --- examples/spu_2p.cpp | 6 +++--- opmcore/fluid/SimpleFluid2p.hpp | 10 +++++----- tests/test_sf2p.cpp | 23 ++++++++++++----------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/examples/spu_2p.cpp b/examples/spu_2p.cpp index a6c77758..5eff07c2 100644 --- a/examples/spu_2p.cpp +++ b/examples/spu_2p.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include @@ -273,8 +273,8 @@ main() using Opm::ImplicitTransportLinAlgSupport::CSRMatrixUmfpackSolver; CSRMatrixUmfpackSolver linsolve; - std::array mu = {{ 1.0, 1.0 }}; - std::array rho = {{ 0.0, 0.0 }}; + std::tr1::array mu = {{ 1.0, 1.0 }}; + std::tr1::array rho = {{ 0.0, 0.0 }}; TwophaseFluid fluid(mu, rho); std::vector porevol; diff --git a/opmcore/fluid/SimpleFluid2p.hpp b/opmcore/fluid/SimpleFluid2p.hpp index 9c4244f4..bb89fc6d 100644 --- a/opmcore/fluid/SimpleFluid2p.hpp +++ b/opmcore/fluid/SimpleFluid2p.hpp @@ -36,15 +36,15 @@ #ifndef OPM_SIMPLEFLUID2P_HPP_HEADER #define OPM_SIMPLEFLUID2P_HPP_HEADER -#include +#include #include namespace Opm { template class SimpleFluid2p { public: - SimpleFluid2p(const std::array& mu, - const std::array& rho) + SimpleFluid2p(const std::tr1::array& mu, + const std::tr1::array& rho) : mu_(mu), rho_(rho) { } @@ -99,8 +99,8 @@ namespace Opm { double s_max(int c) const { (void) c; return 1.0; } private: - std::array mu_ ; - std::array rho_; + std::tr1::array mu_ ; + std::tr1::array rho_; }; } diff --git a/tests/test_sf2p.cpp b/tests/test_sf2p.cpp index 0cc0550e..775ac46d 100644 --- a/tests/test_sf2p.cpp +++ b/tests/test_sf2p.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -7,7 +7,7 @@ template Ostream& -operator<<(Ostream& os, const std::array& a) +operator<<(Ostream& os, const std::tr1::array& a) { os << "[ "; std::copy(a.begin(), a.end(), std::ostream_iterator(os, " ")); @@ -16,32 +16,33 @@ operator<<(Ostream& os, const std::array& a) return os; } -template +template void test_simplefluid2p() { - std::array mu = { {1.0, 1.0} }; - std::array rho = { {0.0, 0.0} }; + using std::tr1::array; + array mu = { {1.0, 1.0} }; + array rho = { {0.0, 0.0} }; Opm::SimpleFluid2p fluid(mu, rho); std::cerr << "\\rho = [ " << fluid.density(0) << ", " << fluid.density(1) << " ]\n"; - std::array sl = {{ 1.0, 0.0 }}; + array sl = {{ 1.0, 0.0 }}; - std::array mob; - std::array dmob; + array mob; + array dmob; fluid.mobility(0, sl, mob, dmob); std::cerr << "s = " << sl << ", m = " << mob << ", dm = " << dmob << '\n'; - std::array sm = {{ 0.5, 0.5 }}; + array sm = {{ 0.5, 0.5 }}; fluid.mobility(0, sm, mob, dmob); std::cerr << "s = " << sm << ", m = " << mob << ", dm = " << dmob << '\n'; - std::array sr = {{ 0.0, 1.0 }}; + array sr = {{ 0.0, 1.0 }}; fluid.mobility(0, sr, mob, dmob); std::cerr << "s = " << sr << ", m = " << mob << ", dm = " << dmob << '\n'; @@ -53,7 +54,7 @@ int main() test_simplefluid2p<1>(); std::cerr << "n = 2\n"; - test_simplefluid2p<> (); + test_simplefluid2p<2> (); std::cerr << "n = 3\n"; test_simplefluid2p<3>();