From b5db3e0713e0cf4063a3c06d267b1fdbe3f4c46a Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 4 Jul 2013 16:04:35 +0200 Subject: [PATCH] Changed std::tr1 occurences to boost. std::tr1 might not be supported by all compilers and will eventually be dropped by others. Using boost instead makes this more portable. --- opm/core/linalg/LinearSolverFactory.hpp | 4 ++-- opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp | 8 ++++---- opm/core/props/rock/RockFromDeck.cpp | 12 ++++++------ opm/core/wells/WellCollection.cpp | 7 ++++--- opm/core/wells/WellCollection.hpp | 7 ++++--- opm/core/wells/WellsGroup.cpp | 6 +++--- opm/core/wells/WellsGroup.hpp | 8 ++++---- opm/core/wells/WellsManager.cpp | 10 +++++----- 8 files changed, 32 insertions(+), 30 deletions(-) diff --git a/opm/core/linalg/LinearSolverFactory.hpp b/opm/core/linalg/LinearSolverFactory.hpp index e6349c9e2..330f43a9a 100644 --- a/opm/core/linalg/LinearSolverFactory.hpp +++ b/opm/core/linalg/LinearSolverFactory.hpp @@ -22,7 +22,7 @@ #include -#include +#include namespace Opm { @@ -87,7 +87,7 @@ namespace Opm virtual double getTolerance() const; private: - std::tr1::shared_ptr solver_; + boost::shared_ptr solver_; }; diff --git a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp index 626635597..4e8a2ed5e 100644 --- a/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp +++ b/opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp @@ -22,7 +22,7 @@ #include -#include +#include namespace Opm { @@ -64,9 +64,9 @@ namespace Opm const double* viscosity() const; private: - std::tr1::array surface_density_; - std::tr1::array reservoir_density_; - std::tr1::array viscosity_; + boost::array surface_density_; + boost::array reservoir_density_; + boost::array viscosity_; }; } diff --git a/opm/core/props/rock/RockFromDeck.cpp b/opm/core/props/rock/RockFromDeck.cpp index a2349bc5a..53a5f42d7 100644 --- a/opm/core/props/rock/RockFromDeck.cpp +++ b/opm/core/props/rock/RockFromDeck.cpp @@ -21,7 +21,7 @@ #include "config.h" #include #include -#include +#include namespace Opm { @@ -32,11 +32,11 @@ namespace Opm enum PermeabilityKind { ScalarPerm, DiagonalPerm, TensorPerm, None, Invalid }; PermeabilityKind classifyPermeability(const EclipseGridParser& parser); - void setScalarPermIfNeeded(std::tr1::array& kmap, + void setScalarPermIfNeeded(boost::array& kmap, int i, int j, int k); PermeabilityKind fillTensor(const EclipseGridParser& parser, std::vector*>& tensor, - std::tr1::array& kmap); + boost::array& kmap); } // anonymous namespace @@ -99,7 +99,7 @@ namespace Opm const std::vector zero(num_global_cells, 0.0); tensor.push_back(&zero); - std::tr1::array kmap; + boost::array kmap; PermeabilityKind pkind = fillTensor(parser, tensor, kmap); if (pkind == Invalid) { THROW("Invalid permeability field."); @@ -225,7 +225,7 @@ namespace Opm /// @param [in] i /// @param [in] j /// @param [in] k - void setScalarPermIfNeeded(std::tr1::array& kmap, + void setScalarPermIfNeeded(boost::array& kmap, int i, int j, int k) { if (kmap[j] == 0) { kmap[j] = kmap[i]; } @@ -267,7 +267,7 @@ namespace Opm /// @param [out] kmap PermeabilityKind fillTensor(const EclipseGridParser& parser, std::vector*>& tensor, - std::tr1::array& kmap) + boost::array& kmap) { PermeabilityKind kind = classifyPermeability(parser); if (kind == Invalid) { diff --git a/opm/core/wells/WellCollection.cpp b/opm/core/wells/WellCollection.cpp index 19cf301a1..6107542a5 100644 --- a/opm/core/wells/WellCollection.cpp +++ b/opm/core/wells/WellCollection.cpp @@ -19,6 +19,7 @@ #include "config.h" #include +#include namespace Opm { @@ -32,7 +33,7 @@ namespace Opm roots_.push_back(createWellsGroup(parent_name, deck)); parent = roots_[roots_.size() - 1].get(); } - std::tr1::shared_ptr child; + boost::shared_ptr child; for (size_t i = 0; i < roots_.size(); ++i) { if (roots_[i]->name() == child_name) { @@ -98,7 +99,7 @@ namespace Opm /// \param[in] child the child node /// \param[in] parent name of parent node - void WellCollection::addChild(std::tr1::shared_ptr& child_node, + void WellCollection::addChild(boost::shared_ptr& child_node, const std::string& parent_name) { WellsGroupInterface* parent = findNode(parent_name); @@ -115,7 +116,7 @@ namespace Opm /// Adds the node to the collection (as a root node) - void WellCollection::addChild(std::tr1::shared_ptr& child_node) + void WellCollection::addChild(boost::shared_ptr& child_node) { roots_.push_back(child_node); if (child_node->isLeafNode()) { diff --git a/opm/core/wells/WellCollection.hpp b/opm/core/wells/WellCollection.hpp index de73a7571..b1ee743dc 100644 --- a/opm/core/wells/WellCollection.hpp +++ b/opm/core/wells/WellCollection.hpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace Opm { @@ -47,11 +48,11 @@ namespace Opm /// and appends it to parent's children. /// \param[in] child the child node /// \param[in] parent name of parent node - void addChild(std::tr1::shared_ptr& child_node, + void addChild(boost::shared_ptr& child_node, const std::string& parent); /// Adds the node to the collection (as a root node) - void addChild(std::tr1::shared_ptr& child_node); + void addChild(boost::shared_ptr& child_node); /// Checks if each condition is met, applies well controls where needed /// (that is, it either changes the active control of violating wells, or shuts @@ -112,7 +113,7 @@ namespace Opm private: // To account for the possibility of a forest - std::vector > roots_; + std::vector > roots_; // This will be used to traverse the bottom nodes. std::vector leaf_nodes_; diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 5e9c4ed45..7e1089d01 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -401,7 +401,7 @@ namespace Opm return true; } - void WellsGroup::addChild(std::tr1::shared_ptr child) + void WellsGroup::addChild(boost::shared_ptr child) { children_.push_back(child); } @@ -1041,12 +1041,12 @@ namespace Opm } } // anonymous namespace - std::tr1::shared_ptr createWellsGroup(const std::string& name, + boost::shared_ptr createWellsGroup(const std::string& name, const EclipseGridParser& deck) { PhaseUsage phase_usage = phaseUsageFromDeck(deck); - std::tr1::shared_ptr return_value; + boost::shared_ptr return_value; // First we need to determine whether it's a group or just a well: bool isWell = false; if (deck.hasField("WELSPECS")) { diff --git a/opm/core/wells/WellsGroup.hpp b/opm/core/wells/WellsGroup.hpp index 0da2008ad..75ab08b1c 100644 --- a/opm/core/wells/WellsGroup.hpp +++ b/opm/core/wells/WellsGroup.hpp @@ -26,7 +26,7 @@ #include #include #include - +#include namespace Opm { @@ -232,7 +232,7 @@ namespace Opm virtual WellsGroupInterface* findGroup(const std::string& name_of_node); - void addChild(std::tr1::shared_ptr child); + void addChild(boost::shared_ptr child); virtual bool conditionsMet(const std::vector& well_bhp, const std::vector& well_reservoirrates_phase, @@ -301,7 +301,7 @@ namespace Opm const std::vector& well_surfacerates_phase); private: - std::vector > children_; + std::vector > children_; }; @@ -402,7 +402,7 @@ namespace Opm /// Creates the WellsGroupInterface for the given name /// \param[in] name the name of the wells group. /// \param[in] deck the deck from which to fetch information. - std::tr1::shared_ptr createWellsGroup(const std::string& name, + boost::shared_ptr createWellsGroup(const std::string& name, const EclipseGridParser& deck); diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index a32545595..74f26cc76 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -141,10 +141,10 @@ namespace } // namespace InjectionControl - std::tr1::array getCubeDim(const UnstructuredGrid& grid, int cell) + boost::array getCubeDim(const UnstructuredGrid& grid, int cell) { using namespace std; - tr1::array cube; + boost::array cube; int num_local_faces = grid.cell_facepos[cell + 1] - grid.cell_facepos[cell]; vector x(num_local_faces); vector y(num_local_faces); @@ -169,7 +169,7 @@ namespace // cell_permeability is the permeability tensor of the given cell. // returns the well index of the cell. double computeWellIndex(const double radius, - const std::tr1::array& cubical, + const boost::array& cubical, const double* cell_permeability, const double skin_factor) { @@ -386,7 +386,7 @@ namespace Opm radius = 0.5*unit::feet; MESSAGE("**** Warning: Well bore internal radius set to " << radius); } - std::tr1::array cubical = getCubeDim(grid, cell); + boost::array cubical = getCubeDim(grid, cell); const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell]; pd.well_index = computeWellIndex(radius, cubical, cell_perm, compdat.compdat[kw].skin_factor_);