Merge pull request #274 from blattms/non-tr1

Changed std::tr1 occurences to boost.
This commit is contained in:
Bård Skaflestad 2013-07-04 12:01:51 -07:00
commit f99377ceec
8 changed files with 32 additions and 30 deletions

View File

@ -22,7 +22,7 @@
#include <opm/core/linalg/LinearSolverInterface.hpp> #include <opm/core/linalg/LinearSolverInterface.hpp>
#include <tr1/memory> #include <boost/shared_ptr.hpp>
namespace Opm namespace Opm
{ {
@ -87,7 +87,7 @@ namespace Opm
virtual double getTolerance() const; virtual double getTolerance() const;
private: private:
std::tr1::shared_ptr<LinearSolverInterface> solver_; boost::shared_ptr<LinearSolverInterface> solver_;
}; };

View File

@ -22,7 +22,7 @@
#include <opm/core/io/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <tr1/array> #include <boost/array.hpp>
namespace Opm namespace Opm
{ {
@ -64,9 +64,9 @@ namespace Opm
const double* viscosity() const; const double* viscosity() const;
private: private:
std::tr1::array<double, 2> surface_density_; boost::array<double, 2> surface_density_;
std::tr1::array<double, 2> reservoir_density_; boost::array<double, 2> reservoir_density_;
std::tr1::array<double, 2> viscosity_; boost::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 <tr1/array> #include <boost/array.hpp>
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(std::tr1::array<int,9>& kmap, void setScalarPermIfNeeded(boost::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,
std::tr1::array<int,9>& kmap); boost::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);
std::tr1::array<int,9> kmap; boost::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(std::tr1::array<int,9>& kmap, void setScalarPermIfNeeded(boost::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,
std::tr1::array<int,9>& kmap) boost::array<int,9>& kmap)
{ {
PermeabilityKind kind = classifyPermeability(parser); PermeabilityKind kind = classifyPermeability(parser);
if (kind == Invalid) { if (kind == Invalid) {

View File

@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include <opm/core/wells/WellCollection.hpp> #include <opm/core/wells/WellCollection.hpp>
#include <boost/shared_ptr.hpp>
namespace Opm namespace Opm
{ {
@ -32,7 +33,7 @@ namespace Opm
roots_.push_back(createWellsGroup(parent_name, deck)); roots_.push_back(createWellsGroup(parent_name, deck));
parent = roots_[roots_.size() - 1].get(); parent = roots_[roots_.size() - 1].get();
} }
std::tr1::shared_ptr<WellsGroupInterface> child; boost::shared_ptr<WellsGroupInterface> child;
for (size_t i = 0; i < roots_.size(); ++i) { for (size_t i = 0; i < roots_.size(); ++i) {
if (roots_[i]->name() == child_name) { if (roots_[i]->name() == child_name) {
@ -98,7 +99,7 @@ namespace Opm
/// \param[in] child the child node /// \param[in] child the child node
/// \param[in] parent name of parent node /// \param[in] parent name of parent node
void WellCollection::addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node, void WellCollection::addChild(boost::shared_ptr<WellsGroupInterface>& child_node,
const std::string& parent_name) const std::string& parent_name)
{ {
WellsGroupInterface* parent = findNode(parent_name); WellsGroupInterface* parent = findNode(parent_name);
@ -115,7 +116,7 @@ namespace Opm
/// Adds the node to the collection (as a root node) /// Adds the node to the collection (as a root node)
void WellCollection::addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node) void WellCollection::addChild(boost::shared_ptr<WellsGroupInterface>& child_node)
{ {
roots_.push_back(child_node); roots_.push_back(child_node);
if (child_node->isLeafNode()) { if (child_node->isLeafNode()) {

View File

@ -26,6 +26,7 @@
#include <opm/core/wells/WellsGroup.hpp> #include <opm/core/wells/WellsGroup.hpp>
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/io/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <boost/shared_ptr.hpp>
namespace Opm namespace Opm
{ {
@ -47,11 +48,11 @@ namespace Opm
/// and appends it to parent's children. /// and appends it to parent's children.
/// \param[in] child the child node /// \param[in] child the child node
/// \param[in] parent name of parent node /// \param[in] parent name of parent node
void addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node, void addChild(boost::shared_ptr<WellsGroupInterface>& child_node,
const std::string& parent); const std::string& parent);
/// Adds the node to the collection (as a root node) /// Adds the node to the collection (as a root node)
void addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node); void addChild(boost::shared_ptr<WellsGroupInterface>& child_node);
/// Checks if each condition is met, applies well controls where needed /// Checks if each condition is met, applies well controls where needed
/// (that is, it either changes the active control of violating wells, or shuts /// (that is, it either changes the active control of violating wells, or shuts
@ -112,7 +113,7 @@ namespace Opm
private: private:
// To account for the possibility of a forest // To account for the possibility of a forest
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > roots_; std::vector<boost::shared_ptr<WellsGroupInterface> > roots_;
// This will be used to traverse the bottom nodes. // This will be used to traverse the bottom nodes.
std::vector<WellNode*> leaf_nodes_; std::vector<WellNode*> leaf_nodes_;

View File

@ -401,7 +401,7 @@ namespace Opm
return true; return true;
} }
void WellsGroup::addChild(std::tr1::shared_ptr<WellsGroupInterface> child) void WellsGroup::addChild(boost::shared_ptr<WellsGroupInterface> child)
{ {
children_.push_back(child); children_.push_back(child);
} }
@ -1041,12 +1041,12 @@ namespace Opm
} }
} // anonymous namespace } // anonymous namespace
std::tr1::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name, boost::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name,
const EclipseGridParser& deck) const EclipseGridParser& deck)
{ {
PhaseUsage phase_usage = phaseUsageFromDeck(deck); PhaseUsage phase_usage = phaseUsageFromDeck(deck);
std::tr1::shared_ptr<WellsGroupInterface> return_value; boost::shared_ptr<WellsGroupInterface> return_value;
// First we need to determine whether it's a group or just a well: // First we need to determine whether it's a group or just a well:
bool isWell = false; bool isWell = false;
if (deck.hasField("WELSPECS")) { if (deck.hasField("WELSPECS")) {

View File

@ -26,7 +26,7 @@
#include <opm/core/grid.h> #include <opm/core/grid.h>
#include <opm/core/props/BlackoilPhases.hpp> #include <opm/core/props/BlackoilPhases.hpp>
#include <string> #include <string>
#include <boost/shared_ptr.hpp>
namespace Opm namespace Opm
{ {
@ -232,7 +232,7 @@ namespace Opm
virtual WellsGroupInterface* findGroup(const std::string& name_of_node); virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child); void addChild(boost::shared_ptr<WellsGroupInterface> child);
virtual bool conditionsMet(const std::vector<double>& well_bhp, virtual bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
@ -301,7 +301,7 @@ namespace Opm
const std::vector<double>& well_surfacerates_phase); const std::vector<double>& well_surfacerates_phase);
private: private:
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > children_; std::vector<boost::shared_ptr<WellsGroupInterface> > children_;
}; };
@ -402,7 +402,7 @@ namespace Opm
/// Creates the WellsGroupInterface for the given name /// Creates the WellsGroupInterface for the given name
/// \param[in] name the name of the wells group. /// \param[in] name the name of the wells group.
/// \param[in] deck the deck from which to fetch information. /// \param[in] deck the deck from which to fetch information.
std::tr1::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name, boost::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name,
const EclipseGridParser& deck); const EclipseGridParser& deck);

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 <tr1/array> #include <boost/array.hpp>
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
@ -141,10 +141,10 @@ namespace
} // namespace InjectionControl } // namespace InjectionControl
std::tr1::array<double, 3> getCubeDim(const UnstructuredGrid& grid, int cell) boost::array<double, 3> getCubeDim(const UnstructuredGrid& grid, int cell)
{ {
using namespace std; using namespace std;
tr1::array<double, 3> cube; boost::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 std::tr1::array<double, 3>& cubical, const boost::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);
} }
std::tr1::array<double, 3> cubical = getCubeDim(grid, cell); boost::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_);