Merge pull request #289 from andlaus/make-gcc44-mandatory

Make gcc44 mandatory
This commit is contained in:
Bård Skaflestad 2013-07-30 13:25:35 -07:00
commit 2dac509c97
9 changed files with 83 additions and 42 deletions

View File

@ -291,3 +291,44 @@ foreach(_HEADER tuple tr1/tuple type_traits tr1/type_traits)
string(TOUPPER ${_HEADER_VAR} _HEADER_VAR ) string(TOUPPER ${_HEADER_VAR} _HEADER_VAR )
check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}") check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}")
endforeach(_HEADER tuple tr1/tuple tr1/type_traits) endforeach(_HEADER tuple tr1/tuple tr1/type_traits)
# make sure that the C++-11 features implemented by the compiler are a
# superset of those provided by GCC 4.4. This makes the test fail on
# all GCC compilers before 4.4.
set(CXX_FEATURES_MISSING "")
if (NOT HAVE_ARRAY)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Statically sized arrays (the std::array class)\n")
endif()
if (NOT HAVE_STATIC_ASSERT)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Static assertations (the static_assert() mechanism)\n")
endif()
if (NOT HAVE_AUTO)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Automatically typed variables (the 'auto' keyword)\n")
endif()
if (NOT HAVE_VARIADIC_TEMPLATES)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Variable number of template arguments\n")
endif()
if (NOT HAVE_VARIADIC_CONSTRUCTOR_SFINAE)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Constructors with variable number of template arguments obeying the SFINAE (specialization failure is not an error) rule\n")
endif()
if (NOT HAVE_RVALUE_REFERENCES)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - References to rvalue objects\n")
endif()
if (NOT HAVE_TUPLE)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Tuples (the std::tuple class)\n")
endif()
if(CXX_FEATURES_MISSING)
message(FATAL_ERROR
"Your C++ compiler does not support the minimum set of C++-2011 features required. "
"Make sure to use a compiler which implements all C++-2011 features provided by GCC 4.4. "
"Your compiler does not seem to implement the following features:\n"
"${CXX_FEATURES_MISSING}")
endif()

View File

@ -45,7 +45,7 @@
#include <opm/core/io/eclipse/EclipseGridInspector.hpp> #include <opm/core/io/eclipse/EclipseGridInspector.hpp>
#include <opm/core/io/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/core/io/eclipse/SpecialEclipseFields.hpp> #include <opm/core/io/eclipse/SpecialEclipseFields.hpp>
#include <boost/array.hpp> #include <array>
namespace Opm namespace Opm
{ {
@ -101,7 +101,7 @@ std::pair<double,double> EclipseGridInspector::cellDips(int i, int j, int k) con
} }
// Pick ZCORN-value for all 8 corners of the given cell // Pick ZCORN-value for all 8 corners of the given cell
boost::array<double, 8> cellz = cellZvals(i, j, k); std::array<double, 8> cellz = cellZvals(i, j, k);
// Compute rise in positive x-direction for all four edges (and then find mean) // Compute rise in positive x-direction for all four edges (and then find mean)
// Current implementation is for regularly placed and vertical pillars! // Current implementation is for regularly placed and vertical pillars!
@ -126,7 +126,7 @@ std::pair<double,double> EclipseGridInspector::cellDips(int i, int j, int k) con
// don't follow an overall dip for the model if it exists. // don't follow an overall dip for the model if it exists.
int x_edges = 4; int x_edges = 4;
int y_edges = 4; int y_edges = 4;
boost::array<double, 6> gridlimits = getGridLimits(); std::array<double, 6> gridlimits = getGridLimits();
double zmin = gridlimits[4]; double zmin = gridlimits[4];
double zmax = gridlimits[5]; double zmax = gridlimits[5];
// LLL -> HLL // LLL -> HLL
@ -170,11 +170,11 @@ std::pair<double,double> EclipseGridInspector::cellDips(int i, int j, int k) con
*/ */
std::pair<double,double> EclipseGridInspector::cellDips(int cell_idx) const std::pair<double,double> EclipseGridInspector::cellDips(int cell_idx) const
{ {
boost::array<int, 3> idxs = cellIdxToLogicalCoords(cell_idx); std::array<int, 3> idxs = cellIdxToLogicalCoords(cell_idx);
return cellDips(idxs[0], idxs[1], idxs[2]); return cellDips(idxs[0], idxs[1], idxs[2]);
} }
boost::array<int, 3> EclipseGridInspector::cellIdxToLogicalCoords(int cell_idx) const std::array<int, 3> EclipseGridInspector::cellIdxToLogicalCoords(int cell_idx) const
{ {
int i,j,k; // Position of cell in cell hierarchy int i,j,k; // Position of cell in cell hierarchy
@ -189,8 +189,8 @@ boost::array<int, 3> EclipseGridInspector::cellIdxToLogicalCoords(int cell_idx)
j = (horIdx-i)/logical_gridsize_[0]+1; j = (horIdx-i)/logical_gridsize_[0]+1;
k = ((cell_idx+1)-logical_gridsize_[0]*(j-1)-1)/(logical_gridsize_[0]*logical_gridsize_[1])+1; k = ((cell_idx+1)-logical_gridsize_[0]*(j-1)-1)/(logical_gridsize_[0]*logical_gridsize_[1])+1;
boost::array<int, 3> a = {{i-1, j-1, k-1}}; std::array<int, 3> a = {{i-1, j-1, k-1}};
return a; //boost::array<int, 3> {{i-1, j-1, k-1}}; return a; //std::array<int, 3> {{i-1, j-1, k-1}};
} }
double EclipseGridInspector::cellVolumeVerticalPillars(int i, int j, int k) const double EclipseGridInspector::cellVolumeVerticalPillars(int i, int j, int k) const
@ -243,7 +243,7 @@ double EclipseGridInspector::cellVolumeVerticalPillars(int i, int j, int k) cons
double EclipseGridInspector::cellVolumeVerticalPillars(int cell_idx) const double EclipseGridInspector::cellVolumeVerticalPillars(int cell_idx) const
{ {
boost::array<int, 3> idxs = cellIdxToLogicalCoords(cell_idx); std::array<int, 3> idxs = cellIdxToLogicalCoords(cell_idx);
return cellVolumeVerticalPillars(idxs[0], idxs[1], idxs[2]); return cellVolumeVerticalPillars(idxs[0], idxs[1], idxs[2]);
} }
@ -258,7 +258,7 @@ void EclipseGridInspector::checkLogicalCoords(int i, int j, int k) const
} }
boost::array<double, 6> EclipseGridInspector::getGridLimits() const std::array<double, 6> EclipseGridInspector::getGridLimits() const
{ {
if (! (parser_.hasField("COORD") && parser_.hasField("ZCORN") && parser_.hasField("SPECGRID")) ) { if (! (parser_.hasField("COORD") && parser_.hasField("ZCORN") && parser_.hasField("SPECGRID")) ) {
throw std::runtime_error("EclipseGridInspector: Grid does not have SPECGRID, COORD, and ZCORN, can't find dimensions."); throw std::runtime_error("EclipseGridInspector: Grid does not have SPECGRID, COORD, and ZCORN, can't find dimensions.");
@ -294,7 +294,7 @@ boost::array<double, 6> EclipseGridInspector::getGridLimits() const
ymin = coord[pillarindex * 6 + 4]; ymin = coord[pillarindex * 6 + 4];
} }
boost::array<double, 6> gridlimits = {{ xmin, xmax, ymin, ymax, std::array<double, 6> gridlimits = {{ xmin, xmax, ymin, ymax,
*min_element(zcorn.begin(), zcorn.end()), *min_element(zcorn.begin(), zcorn.end()),
*max_element(zcorn.begin(), zcorn.end()) }}; *max_element(zcorn.begin(), zcorn.end()) }};
return gridlimits; return gridlimits;
@ -302,16 +302,16 @@ boost::array<double, 6> EclipseGridInspector::getGridLimits() const
boost::array<int, 3> EclipseGridInspector::gridSize() const std::array<int, 3> EclipseGridInspector::gridSize() const
{ {
boost::array<int, 3> retval = {{ logical_gridsize_[0], std::array<int, 3> retval = {{ logical_gridsize_[0],
logical_gridsize_[1], logical_gridsize_[1],
logical_gridsize_[2] }}; logical_gridsize_[2] }};
return retval; return retval;
} }
boost::array<double, 8> EclipseGridInspector::cellZvals(int i, int j, int k) const std::array<double, 8> EclipseGridInspector::cellZvals(int i, int j, int k) const
{ {
// Get the zcorn field. // Get the zcorn field.
const std::vector<double>& z = parser_.getFloatingPointValue("ZCORN"); const std::vector<double>& z = parser_.getFloatingPointValue("ZCORN");
@ -325,7 +325,7 @@ boost::array<double, 8> EclipseGridInspector::cellZvals(int i, int j, int k) con
2*logical_gridsize_[0], 2*logical_gridsize_[0],
4*logical_gridsize_[0]*logical_gridsize_[1] }; 4*logical_gridsize_[0]*logical_gridsize_[1] };
int ix = 2*(i*delta[0] + j*delta[1] + k*delta[2]); int ix = 2*(i*delta[0] + j*delta[1] + k*delta[2]);
boost::array<double, 8> cellz = {{ z[ix], z[ix + delta[0]], std::array<double, 8> cellz = {{ z[ix], z[ix + delta[0]],
z[ix + delta[1]], z[ix + delta[1] + delta[0]], z[ix + delta[1]], z[ix + delta[1] + delta[0]],
z[ix + delta[2]], z[ix + delta[2] + delta[0]], z[ix + delta[2]], z[ix + delta[2] + delta[0]],
z[ix + delta[2] + delta[1]], z[ix + delta[2] + delta[1] + delta[0]] }}; z[ix + delta[2] + delta[1]], z[ix + delta[2] + delta[1] + delta[0]] }};

View File

@ -36,7 +36,7 @@
#define OPM_ECLIPSEGRIDINSPECTOR_HEADER #define OPM_ECLIPSEGRIDINSPECTOR_HEADER
#include <vector> #include <vector>
#include <boost/array.hpp> #include <array>
namespace Opm namespace Opm
@ -76,22 +76,22 @@ public:
std::pair<double,double> cellDips(int cell_idx) const; std::pair<double,double> cellDips(int cell_idx) const;
// Convert global cell index to logical ijk-coordinates // Convert global cell index to logical ijk-coordinates
boost::array<int, 3> cellIdxToLogicalCoords(int cell_idx) const; std::array<int, 3> cellIdxToLogicalCoords(int cell_idx) const;
/// Returns a vector with the outer limits of grid (in the grid's unit). /// Returns a vector with the outer limits of grid (in the grid's unit).
/// The vector contains [xmin, xmax, ymin, ymax, zmin, zmax], as /// The vector contains [xmin, xmax, ymin, ymax, zmin, zmax], as
/// read from COORDS and ZCORN /// read from COORDS and ZCORN
boost::array<double, 6> getGridLimits() const; std::array<double, 6> getGridLimits() const;
/// Returns the extent of the logical cartesian grid /// Returns the extent of the logical cartesian grid
/// as number of cells in the (i, j, k) directions. /// as number of cells in the (i, j, k) directions.
boost::array<int, 3> gridSize() const; std::array<int, 3> gridSize() const;
/// Returns the eight z-values associated with a given cell. /// Returns the eight z-values associated with a given cell.
/// The ordering is such that i runs fastest. That is, with /// The ordering is such that i runs fastest. That is, with
/// L = low and H = high: /// L = low and H = high:
/// {LLL, HLL, LHL, HHL, LLH, HLH, LHH, HHH }. /// {LLL, HLL, LHL, HHL, LLH, HLH, LHH, HHH }.
boost::array<double, 8> cellZvals(int i, int j, int k) const; std::array<double, 8> cellZvals(int i, int j, int k) const;
private: private:
const EclipseGridParser& parser_; const EclipseGridParser& parser_;

View File

@ -35,8 +35,8 @@
namespace Opm namespace Opm
{ {
void writeVtkData(const boost::array<int, 3>& dims, void writeVtkData(const std::array<int, 3>& dims,
const boost::array<double, 3>& cell_size, const std::array<double, 3>& cell_size,
const DataMap& data, const DataMap& data,
std::ostream& os) std::ostream& os)
{ {

View File

@ -24,7 +24,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include <boost/array.hpp> #include <array>
#include <iosfwd> #include <iosfwd>
#include <opm/core/utility/DataMap.hpp> #include <opm/core/utility/DataMap.hpp>
@ -34,8 +34,8 @@ namespace Opm
{ {
/// Vtk output for cartesian grids. /// Vtk output for cartesian grids.
void writeVtkData(const boost::array<int, 3>& dims, void writeVtkData(const std::array<int, 3>& dims,
const boost::array<double, 3>& cell_size, const std::array<double, 3>& cell_size,
const DataMap& data, const DataMap& data,
std::ostream& os); std::ostream& os);

View File

@ -22,7 +22,7 @@
#include <opm/core/io/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <boost/array.hpp> #include <array>
namespace Opm namespace Opm
{ {
@ -64,9 +64,9 @@ namespace Opm
const double* viscosity() const; const double* viscosity() const;
private: private:
boost::array<double, 2> surface_density_; std::array<double, 2> surface_density_;
boost::array<double, 2> reservoir_density_; std::array<double, 2> reservoir_density_;
boost::array<double, 2> viscosity_; std::array<double, 2> viscosity_;
}; };
} }

View File

@ -21,7 +21,7 @@
#include "config.h" #include "config.h"
#include <opm/core/props/rock/RockFromDeck.hpp> #include <opm/core/props/rock/RockFromDeck.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <boost/array.hpp> #include <array>
namespace Opm namespace Opm
{ {
@ -32,11 +32,11 @@ namespace Opm
enum PermeabilityKind { ScalarPerm, DiagonalPerm, TensorPerm, None, Invalid }; enum PermeabilityKind { ScalarPerm, DiagonalPerm, TensorPerm, None, Invalid };
PermeabilityKind classifyPermeability(const EclipseGridParser& parser); PermeabilityKind classifyPermeability(const EclipseGridParser& parser);
void setScalarPermIfNeeded(boost::array<int,9>& kmap, void setScalarPermIfNeeded(std::array<int,9>& kmap,
int i, int j, int k); int i, int j, int k);
PermeabilityKind fillTensor(const EclipseGridParser& parser, PermeabilityKind fillTensor(const EclipseGridParser& parser,
std::vector<const std::vector<double>*>& tensor, std::vector<const std::vector<double>*>& tensor,
boost::array<int,9>& kmap); std::array<int,9>& kmap);
} // anonymous namespace } // anonymous namespace
@ -99,7 +99,7 @@ namespace Opm
const std::vector<double> zero(num_global_cells, 0.0); const std::vector<double> zero(num_global_cells, 0.0);
tensor.push_back(&zero); tensor.push_back(&zero);
boost::array<int,9> kmap; std::array<int,9> kmap;
PermeabilityKind pkind = fillTensor(parser, tensor, kmap); PermeabilityKind pkind = fillTensor(parser, tensor, kmap);
if (pkind == Invalid) { if (pkind == Invalid) {
THROW("Invalid permeability field."); THROW("Invalid permeability field.");
@ -225,7 +225,7 @@ namespace Opm
/// @param [in] i /// @param [in] i
/// @param [in] j /// @param [in] j
/// @param [in] k /// @param [in] k
void setScalarPermIfNeeded(boost::array<int,9>& kmap, void setScalarPermIfNeeded(std::array<int,9>& kmap,
int i, int j, int k) int i, int j, int k)
{ {
if (kmap[j] == 0) { kmap[j] = kmap[i]; } if (kmap[j] == 0) { kmap[j] = kmap[i]; }
@ -267,7 +267,7 @@ namespace Opm
/// @param [out] kmap /// @param [out] kmap
PermeabilityKind fillTensor(const EclipseGridParser& parser, PermeabilityKind fillTensor(const EclipseGridParser& parser,
std::vector<const std::vector<double>*>& tensor, std::vector<const std::vector<double>*>& tensor,
boost::array<int,9>& kmap) std::array<int,9>& kmap)
{ {
PermeabilityKind kind = classifyPermeability(parser); PermeabilityKind kind = classifyPermeability(parser);
if (kind == Invalid) { if (kind == Invalid) {

View File

@ -27,7 +27,7 @@
#include <opm/core/wells/WellCollection.hpp> #include <opm/core/wells/WellCollection.hpp>
#include <opm/core/props/phaseUsageFromDeck.hpp> #include <opm/core/props/phaseUsageFromDeck.hpp>
#include <boost/array.hpp> #include <array>
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
@ -141,10 +141,10 @@ namespace
} // namespace InjectionControl } // namespace InjectionControl
boost::array<double, 3> getCubeDim(const UnstructuredGrid& grid, int cell) std::array<double, 3> getCubeDim(const UnstructuredGrid& grid, int cell)
{ {
using namespace std; using namespace std;
boost::array<double, 3> cube; std::array<double, 3> cube;
int num_local_faces = grid.cell_facepos[cell + 1] - grid.cell_facepos[cell]; int num_local_faces = grid.cell_facepos[cell + 1] - grid.cell_facepos[cell];
vector<double> x(num_local_faces); vector<double> x(num_local_faces);
vector<double> y(num_local_faces); vector<double> y(num_local_faces);
@ -169,7 +169,7 @@ namespace
// cell_permeability is the permeability tensor of the given cell. // cell_permeability is the permeability tensor of the given cell.
// returns the well index of the cell. // returns the well index of the cell.
double computeWellIndex(const double radius, double computeWellIndex(const double radius,
const boost::array<double, 3>& cubical, const std::array<double, 3>& cubical,
const double* cell_permeability, const double* cell_permeability,
const double skin_factor) const double skin_factor)
{ {
@ -386,7 +386,7 @@ namespace Opm
radius = 0.5*unit::feet; radius = 0.5*unit::feet;
MESSAGE("**** Warning: Well bore internal radius set to " << radius); MESSAGE("**** Warning: Well bore internal radius set to " << radius);
} }
boost::array<double, 3> cubical = getCubeDim(grid, cell); std::array<double, 3> cubical = getCubeDim(grid, cell);
const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell];
pd.well_index = computeWellIndex(radius, cubical, cell_perm, pd.well_index = computeWellIndex(radius, cubical, cell_perm,
compdat.compdat[kw].skin_factor_); compdat.compdat[kw].skin_factor_);

View File

@ -20,12 +20,12 @@
#include "config.h" #include "config.h"
#include <opm/core/utility/writeVtkData.hpp> #include <opm/core/utility/writeVtkData.hpp>
#include <fstream> #include <fstream>
#include <boost/array.hpp> #include <array>
int main() int main()
{ {
boost::array<int, 3> dims = {{ 2, 2, 2 }}; std::array<int, 3> dims = {{ 2, 2, 2 }};
boost::array<double, 3> cell_size = {{ 1.0, 2.0, 3.0 }}; std::array<double, 3> cell_size = {{ 1.0, 2.0, 3.0 }};
Opm::DataMap m; Opm::DataMap m;
double foov[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; double foov[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
std::vector<double> foo(foov, foov + sizeof foov/sizeof foov[0]); std::vector<double> foo(foov, foov + sizeof foov/sizeof foov[0]);