use std::shared_ptr instead of boost::shared_ptr

our policy is that we only use boost if necessary, i.e., if the oldest
supported compiler does not support a given feature but boost
does. since we recently switched to GCC 4.4 or newer, std::shared_ptr
is available unconditionally.
This commit is contained in:
Andreas Lauser
2013-08-08 12:32:01 +02:00
parent b0349793fa
commit 70949c6edb
20 changed files with 68 additions and 69 deletions

View File

@@ -26,7 +26,7 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <boost/shared_ptr.hpp> #include <memory>
#include <opm/core/linalg/sparse_sys.h> #include <opm/core/linalg/sparse_sys.h>
#include <opm/core/linalg/LinearSolverAGMG.hpp> #include <opm/core/linalg/LinearSolverAGMG.hpp>
@@ -46,14 +46,14 @@ namespace {
} }
boost::shared_ptr<CSRMatrix> std::shared_ptr<CSRMatrix>
build_laplace_1d(const std::size_t m) build_laplace_1d(const std::size_t m)
{ {
assert (m >= 2); assert (m >= 2);
const std::size_t nnz = compute_nnz(m); const std::size_t nnz = compute_nnz(m);
boost::shared_ptr<CSRMatrix> std::shared_ptr<CSRMatrix>
A(csrmatrix_new_known_nnz(m, nnz), csrmatrix_delete); A(csrmatrix_new_known_nnz(m, nnz), csrmatrix_delete);
A->ia[ 0 ] = 0; A->ia[ 0 ] = 0;
@@ -97,7 +97,7 @@ int main()
{ {
const std::size_t m = 10; const std::size_t m = 10;
boost::shared_ptr<CSRMatrix> A = build_laplace_1d(m); std::shared_ptr<CSRMatrix> A = build_laplace_1d(m);
// Form right-hand side [1, 0, 0, ...., 0, 1] // Form right-hand side [1, 0, 0, ...., 0, 1]
std::vector<double> b(m, 0.0); std::vector<double> b(m, 0.0);

View File

@@ -27,7 +27,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <stdexcept> #include <stdexcept>
#include <boost/shared_ptr.hpp> #include <memory>
namespace Opm namespace Opm
{ {
@@ -253,7 +253,7 @@ namespace Opm
} }
EclipseGridParser sp; EclipseGridParser sp;
boost::shared_ptr<SPECGRID> sg(new SPECGRID); std::shared_ptr<SPECGRID> sg(new SPECGRID);
for (int dd = 0; dd < 3; ++dd) { for (int dd = 0; dd < 3; ++dd) {
sg->dimensions[dd] = new_dims_[dd]; sg->dimensions[dd] = new_dims_[dd];
} }

View File

@@ -40,6 +40,7 @@
#include <fstream> #include <fstream>
#include <exception> #include <exception>
#include <algorithm> #include <algorithm>
#include <memory>
#include <limits> #include <limits>
#include <numeric> #include <numeric>
#include <cfloat> #include <cfloat>
@@ -710,7 +711,7 @@ const std::vector<double>& EclipseGridParser::getFloatingPointValue(const std::s
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
const boost::shared_ptr<SpecialBase> EclipseGridParser::getSpecialValue(const std::string& keyword) const const std::shared_ptr<SpecialBase> EclipseGridParser::getSpecialValue(const std::string& keyword) const
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
{ {
SpecialMap::const_iterator it = special_field_by_epoch_[current_epoch_].find(keyword); SpecialMap::const_iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
@@ -722,13 +723,13 @@ const boost::shared_ptr<SpecialBase> EclipseGridParser::getSpecialValue(const st
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
boost::shared_ptr<SpecialBase> std::shared_ptr<SpecialBase>
EclipseGridParser::createSpecialField(std::istream& is, EclipseGridParser::createSpecialField(std::istream& is,
const std::string& fieldname) const std::string& fieldname)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
{ {
string ukey = upcase(fieldname); string ukey = upcase(fieldname);
boost::shared_ptr<SpecialBase> spec_ptr std::shared_ptr<SpecialBase> spec_ptr
= Factory<SpecialBase>::createObject(fieldname); = Factory<SpecialBase>::createObject(fieldname);
is >> ignoreWhitespace; is >> ignoreWhitespace;
spec_ptr->read(is); spec_ptr->read(is);
@@ -736,13 +737,13 @@ EclipseGridParser::createSpecialField(std::istream& is,
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
boost::shared_ptr<SpecialBase> std::shared_ptr<SpecialBase>
EclipseGridParser::cloneSpecialField(const std::string& fieldname, EclipseGridParser::cloneSpecialField(const std::string& fieldname,
const boost::shared_ptr<SpecialBase> original) const std::shared_ptr<SpecialBase> original)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
{ {
string ukey = upcase(fieldname); string ukey = upcase(fieldname);
boost::shared_ptr<SpecialBase> spec_ptr std::shared_ptr<SpecialBase> spec_ptr
= Factory<SpecialBase>::cloneObject(fieldname, original); = Factory<SpecialBase>::cloneObject(fieldname, original);
return spec_ptr; return spec_ptr;
} }
@@ -766,7 +767,7 @@ void EclipseGridParser::setFloatingPointField(const std::string& keyword,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void EclipseGridParser::setSpecialField(const std::string& keyword, void EclipseGridParser::setSpecialField(const std::string& keyword,
boost::shared_ptr<SpecialBase> field) std::shared_ptr<SpecialBase> field)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
{ {
special_field_by_epoch_[current_epoch_][keyword] = field; special_field_by_epoch_[current_epoch_][keyword] = field;

View File

@@ -40,7 +40,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <set> #include <set>
#include <boost/shared_ptr.hpp> #include <memory>
#include <opm/core/io/eclipse/SpecialEclipseFields.hpp> #include <opm/core/io/eclipse/SpecialEclipseFields.hpp>
#include <opm/core/io/eclipse/EclipseUnits.hpp> #include <opm/core/io/eclipse/EclipseUnits.hpp>
#include <opm/core/utility/Factory.hpp> #include <opm/core/utility/Factory.hpp>
@@ -138,7 +138,7 @@ namespace Opm
/// corresponding to the given floating-point keyword. /// corresponding to the given floating-point keyword.
const std::vector<double>& getFloatingPointValue(const std::string& keyword) const; const std::vector<double>& getFloatingPointValue(const std::string& keyword) const;
typedef boost::shared_ptr<SpecialBase> SpecialFieldPtr; typedef std::shared_ptr<SpecialBase> SpecialFieldPtr;
/// Returns a reference to a vector containing pointers to the values /// Returns a reference to a vector containing pointers to the values
/// corresponding to the given keyword when the values are not only integers /// corresponding to the given keyword when the values are not only integers
@@ -245,7 +245,7 @@ private:
SpecialFieldPtr createSpecialField(std::istream& is, const std::string& fieldname); SpecialFieldPtr createSpecialField(std::istream& is, const std::string& fieldname);
SpecialFieldPtr cloneSpecialField(const std::string& fieldname, SpecialFieldPtr cloneSpecialField(const std::string& fieldname,
const boost::shared_ptr<SpecialBase> original); const std::shared_ptr<SpecialBase> original);
void readImpl(std::istream& is); void readImpl(std::istream& is);
void getNumericErtFields(const std::string& filename); void getNumericErtFields(const std::string& filename);

View File

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

View File

@@ -26,7 +26,7 @@
#include <opm/core/props/BlackoilPhases.hpp> #include <opm/core/props/BlackoilPhases.hpp>
#include <opm/core/io/eclipse/EclipseGridParser.hpp> #include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <string> #include <string>
#include <boost/shared_ptr.hpp> #include <memory>
namespace Opm namespace Opm
{ {
@@ -116,7 +116,7 @@ namespace Opm
int region_number_; int region_number_;
std::vector<boost::shared_ptr<SinglePvtInterface> > props_; std::vector<std::shared_ptr<SinglePvtInterface> > props_;
double densities_[MaxNumPhases]; double densities_[MaxNumPhases];
mutable std::vector<double> data1_; mutable std::vector<double> data1_;

View File

@@ -20,7 +20,7 @@
#ifndef OPM_SIMULATORCOMPRESSIBLETWOPHASE_HEADER_INCLUDED #ifndef OPM_SIMULATORCOMPRESSIBLETWOPHASE_HEADER_INCLUDED
#define OPM_SIMULATORCOMPRESSIBLETWOPHASE_HEADER_INCLUDED #define OPM_SIMULATORCOMPRESSIBLETWOPHASE_HEADER_INCLUDED
#include <boost/shared_ptr.hpp> #include <memory>
#include <vector> #include <vector>
struct UnstructuredGrid; struct UnstructuredGrid;
@@ -91,7 +91,7 @@ namespace Opm
private: private:
class Impl; class Impl;
// Using shared_ptr instead of scoped_ptr since scoped_ptr requires complete type for Impl. // Using shared_ptr instead of scoped_ptr since scoped_ptr requires complete type for Impl.
boost::shared_ptr<Impl> pimpl_; std::shared_ptr<Impl> pimpl_;
}; };
} // namespace Opm } // namespace Opm

View File

@@ -20,7 +20,7 @@
#ifndef OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED #ifndef OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED
#define OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED #define OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED
#include <boost/shared_ptr.hpp> #include <memory>
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <vector> #include <vector>
@@ -120,7 +120,7 @@ namespace Opm
private: private:
struct Impl; struct Impl;
// Using shared_ptr instead of scoped_ptr since scoped_ptr requires complete type for Impl. // Using shared_ptr instead of scoped_ptr since scoped_ptr requires complete type for Impl.
boost::shared_ptr<Impl> pimpl_; std::shared_ptr<Impl> pimpl_;
// implementation which is not templated, and can be in library // implementation which is not templated, and can be in library
void connect_timestep_impl (boost::function0<void> hook); void connect_timestep_impl (boost::function0<void> hook);

View File

@@ -21,7 +21,7 @@
#define OPM_TOFDISCGALREORDER_HEADER_INCLUDED #define OPM_TOFDISCGALREORDER_HEADER_INCLUDED
#include <opm/core/transport/reorder/ReorderSolverInterface.hpp> #include <opm/core/transport/reorder/ReorderSolverInterface.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#include <vector> #include <vector>
#include <map> #include <map>
#include <ostream> #include <ostream>
@@ -128,7 +128,7 @@ namespace Opm
// Data members // Data members
const UnstructuredGrid& grid_; const UnstructuredGrid& grid_;
boost::shared_ptr<VelocityInterpolationInterface> velocity_interpolation_; std::shared_ptr<VelocityInterpolationInterface> velocity_interpolation_;
bool use_cvi_; bool use_cvi_;
bool use_limiter_; bool use_limiter_;
double limiter_relative_flux_threshold_; double limiter_relative_flux_threshold_;
@@ -139,7 +139,7 @@ namespace Opm
const double* darcyflux_; // one flux per grid face const double* darcyflux_; // one flux per grid face
const double* porevolume_; // one volume per cell const double* porevolume_; // one volume per cell
const double* source_; // one volumetric source term per cell const double* source_; // one volumetric source term per cell
boost::shared_ptr<DGBasisInterface> basis_func_; std::shared_ptr<DGBasisInterface> basis_func_;
double* tof_coeff_; double* tof_coeff_;
// For tracers. // For tracers.
double* tracer_coeff_; double* tracer_coeff_;

View File

@@ -36,7 +36,7 @@
#define OPM_FACTORY_HEADER #define OPM_FACTORY_HEADER
#include <map> #include <map>
#include <boost/shared_ptr.hpp> #include <memory>
namespace Opm namespace Opm
{ {
@@ -52,7 +52,7 @@ namespace Opm
{ {
public: public:
/// The type of pointer returned by createObject(). /// The type of pointer returned by createObject().
typedef boost::shared_ptr<Base> ProductPtr; typedef std::shared_ptr<Base> ProductPtr;
/// Creates a new object of the class associated with the given type string, /// Creates a new object of the class associated with the given type string,
/// and returns a pointer to it. /// and returns a pointer to it.
@@ -128,7 +128,7 @@ namespace Opm
} }
}; };
typedef boost::shared_ptr<Creator> CreatorPtr; typedef std::shared_ptr<Creator> CreatorPtr;
typedef std::map<std::string, CreatorPtr> CreatorMap; typedef std::map<std::string, CreatorPtr> CreatorMap;
// This map contains the whole factory, i.e. all the Creators. // This map contains the whole factory, i.e. all the Creators.
CreatorMap string_to_creator_; CreatorMap string_to_creator_;

View File

@@ -42,7 +42,7 @@
#include <cstdlib> #include <cstdlib>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <boost/shared_ptr.hpp> #include <memory>
#include <opm/core/utility/parameters/Parameter.hpp> #include <opm/core/utility/parameters/Parameter.hpp>
#include <opm/core/utility/parameters/ParameterStrings.hpp> #include <opm/core/utility/parameters/ParameterStrings.hpp>
@@ -173,7 +173,7 @@ namespace Opm {
} }
void ParameterGroup::insert(const std::string& name, void ParameterGroup::insert(const std::string& name,
const boost::shared_ptr<ParameterMapItem>& data) const std::shared_ptr<ParameterMapItem>& data)
{ {
std::pair<std::string, std::string> name_path = split(name); std::pair<std::string, std::string> name_path = split(name);
map_type::const_iterator it = map_.find(name_path.first); map_type::const_iterator it = map_.find(name_path.first);
@@ -214,10 +214,10 @@ namespace Opm {
map_type::const_iterator it = map_.find(name_path.first); map_type::const_iterator it = map_.find(name_path.first);
if (it == map_.end()) { if (it == map_.end()) {
if (name_path.second == "") { if (name_path.second == "") {
boost::shared_ptr<ParameterMapItem> data(new Parameter(value, ID_param_type__cmdline)); std::shared_ptr<ParameterMapItem> data(new Parameter(value, ID_param_type__cmdline));
map_[name_path.first] = data; map_[name_path.first] = data;
} else { } else {
boost::shared_ptr<ParameterMapItem> data(new ParameterGroup(this->path() + ID_delimiter_path + name_path.first, std::shared_ptr<ParameterMapItem> data(new ParameterGroup(this->path() + ID_delimiter_path + name_path.first,
this)); this));
ParameterGroup& child = dynamic_cast<ParameterGroup&>(*data); ParameterGroup& child = dynamic_cast<ParameterGroup&>(*data);
child.insertParameter(name_path.second, value); child.insertParameter(name_path.second, value);
@@ -235,7 +235,7 @@ namespace Opm {
<< ID_xmltag__param << ID_xmltag__param
<< " element.\n"; << " element.\n";
} }
boost::shared_ptr<ParameterMapItem> data(new Parameter(value, ID_param_type__cmdline)); std::shared_ptr<ParameterMapItem> data(new Parameter(value, ID_param_type__cmdline));
map_[name_path.first] = data; map_[name_path.first] = data;
} else { } else {
ParameterGroup& pg = dynamic_cast<ParameterGroup&>(*(*it).second); ParameterGroup& pg = dynamic_cast<ParameterGroup&>(*(*it).second);

View File

@@ -40,7 +40,7 @@
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/shared_ptr.hpp> #include <memory>
#include <opm/core/utility/parameters/ParameterMapItem.hpp> #include <opm/core/utility/parameters/ParameterMapItem.hpp>
#include <opm/core/utility/parameters/ParameterRequirement.hpp> #include <opm/core/utility/parameters/ParameterRequirement.hpp>
@@ -262,13 +262,13 @@ namespace Opm {
/// Insert a new item into the group. /// Insert a new item into the group.
void insert(const std::string& name, void insert(const std::string& name,
const boost::shared_ptr<ParameterMapItem>& data); const std::shared_ptr<ParameterMapItem>& data);
/// Insert a new parameter item into the group. /// Insert a new parameter item into the group.
void insertParameter(const std::string& name, const std::string& value); void insertParameter(const std::string& name, const std::string& value);
private: private:
typedef boost::shared_ptr<ParameterMapItem> data_type; typedef std::shared_ptr<ParameterMapItem> data_type;
typedef std::pair<std::string, data_type> pair_type; typedef std::pair<std::string, data_type> pair_type;
typedef std::map<std::string, data_type> map_type; typedef std::map<std::string, data_type> map_type;

View File

@@ -43,14 +43,11 @@
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <memory>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
#include <opm/core/utility/parameters/tinyxml/tinyxml.h> #include <opm/core/utility/parameters/tinyxml/tinyxml.h>
namespace Opm { namespace Opm {
namespace parameter { namespace parameter {
@@ -105,7 +102,7 @@ namespace Opm {
continue; continue;
} }
std::string name = getProperty(ID_xmlatt__name, elem); std::string name = getProperty(ID_xmlatt__name, elem);
boost::shared_ptr<ParameterMapItem> data; std::shared_ptr<ParameterMapItem> data;
if (tag_name == ID_xmltag__param) { if (tag_name == ID_xmltag__param) {
std::string value = getProperty(ID_xmlatt__value, elem); std::string value = getProperty(ID_xmlatt__value, elem);
std::string type = getProperty(ID_xmlatt__type, elem); std::string type = getProperty(ID_xmlatt__type, elem);

View File

@@ -19,7 +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> #include <memory>
namespace Opm namespace Opm
{ {
@@ -33,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();
} }
boost::shared_ptr<WellsGroupInterface> child; std::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) {
@@ -99,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(boost::shared_ptr<WellsGroupInterface>& child_node, void WellCollection::addChild(std::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);
@@ -116,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(boost::shared_ptr<WellsGroupInterface>& child_node) void WellCollection::addChild(std::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,7 +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> #include <memory>
namespace Opm namespace Opm
{ {
@@ -48,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(boost::shared_ptr<WellsGroupInterface>& child_node, void addChild(std::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(boost::shared_ptr<WellsGroupInterface>& child_node); void addChild(std::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
@@ -113,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<boost::shared_ptr<WellsGroupInterface> > roots_; std::vector<std::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

@@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include <opm/core/wells/WellsGroup.hpp> #include <opm/core/wells/WellsGroup.hpp>
#include <cmath> #include <cmath>
#include <memory>
#include <opm/core/wells.h> #include <opm/core/wells.h>
#include <opm/core/props/phaseUsageFromDeck.hpp> #include <opm/core/props/phaseUsageFromDeck.hpp>
@@ -401,7 +402,7 @@ namespace Opm
return true; return true;
} }
void WellsGroup::addChild(boost::shared_ptr<WellsGroupInterface> child) void WellsGroup::addChild(std::shared_ptr<WellsGroupInterface> child)
{ {
children_.push_back(child); children_.push_back(child);
} }
@@ -1041,12 +1042,12 @@ namespace Opm
} }
} // anonymous namespace } // anonymous namespace
boost::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name, std::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name,
const EclipseGridParser& deck) const EclipseGridParser& deck)
{ {
PhaseUsage phase_usage = phaseUsageFromDeck(deck); PhaseUsage phase_usage = phaseUsageFromDeck(deck);
boost::shared_ptr<WellsGroupInterface> return_value; std::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> #include <memory>
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(boost::shared_ptr<WellsGroupInterface> child); void addChild(std::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<boost::shared_ptr<WellsGroupInterface> > children_; std::vector<std::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.
boost::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name, std::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name,
const EclipseGridParser& deck); const EclipseGridParser& deck);

View File

@@ -19,7 +19,7 @@
#define BOOST_TEST_MODULE BlackoilFluidTest #define BOOST_TEST_MODULE BlackoilFluidTest
#define BOOST_TEST_MAIN #define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/shared_ptr.hpp> #include <memory>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <vector> #include <vector>
@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
const EclipseGridParser deck (filename); const EclipseGridParser deck (filename);
// setup pvt interface // setup pvt interface
std::vector<boost::shared_ptr<SinglePvtInterface> > props_; std::vector<std::shared_ptr<SinglePvtInterface> > props_;
PhaseUsage phase_usage_ = phaseUsageFromDeck(deck); PhaseUsage phase_usage_ = phaseUsageFromDeck(deck);
enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2 }; enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2 };
int samples = 0; int samples = 0;

View File

@@ -32,7 +32,7 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <boost/shared_ptr.hpp> #include <memory>
BOOST_AUTO_TEST_CASE(Construction) BOOST_AUTO_TEST_CASE(Construction)
{ {
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(Construction)
const int nwells = 2; const int nwells = 2;
const int nperfs = 2; const int nperfs = 2;
boost::shared_ptr<Wells> W(create_wells(nphases, nwells, nperfs), std::shared_ptr<Wells> W(create_wells(nphases, nwells, nperfs),
destroy_wells); destroy_wells);
if (W) { if (W) {
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(Controls)
const int nwells = 1; const int nwells = 1;
const int nperfs = 2; const int nperfs = 2;
boost::shared_ptr<Wells> W(create_wells(nphases, nwells, nperfs), std::shared_ptr<Wells> W(create_wells(nphases, nwells, nperfs),
destroy_wells); destroy_wells);
if (W) { if (W) {
@@ -130,9 +130,9 @@ BOOST_AUTO_TEST_CASE(Copy)
const int nwells = 2; const int nwells = 2;
const int nperfs = 2; const int nperfs = 2;
boost::shared_ptr<Wells> W1(create_wells(nphases, nwells, nperfs), std::shared_ptr<Wells> W1(create_wells(nphases, nwells, nperfs),
destroy_wells); destroy_wells);
boost::shared_ptr<Wells> W2; std::shared_ptr<Wells> W2;
if (W1) { if (W1) {
int cells[] = { 0, 9 }; int cells[] = { 0, 9 };

View File

@@ -264,8 +264,8 @@ int main ()
/// what the interface expects. The first argument is the (unique) name of the group. /// what the interface expects. The first argument is the (unique) name of the group.
/// \snippet tutorial4.cpp injection specification /// \snippet tutorial4.cpp injection specification
/// \internal[injection specification] /// \internal[injection specification]
boost::shared_ptr<WellsGroupInterface> well_group(new WellsGroup("group", well_group_prod_spec, InjectionSpecification(), std::shared_ptr<WellsGroupInterface> well_group(new WellsGroup("group", well_group_prod_spec, InjectionSpecification(),
phase_usage)); phase_usage));
/// \internal[injection specification] /// \internal[injection specification]
/// \endinternal /// \endinternal
@@ -289,8 +289,8 @@ int main ()
well_name << "well" << i; well_name << "well" << i;
ProductionSpecification production_specification; ProductionSpecification production_specification;
production_specification.control_mode_ = ProductionSpecification::GRUP; production_specification.control_mode_ = ProductionSpecification::GRUP;
boost::shared_ptr<WellsGroupInterface> well_leaf_node(new WellNode(well_name.str(), production_specification, InjectionSpecification(), std::shared_ptr<WellsGroupInterface> well_leaf_node(new WellNode(well_name.str(), production_specification, InjectionSpecification(),
phase_usage)); phase_usage));
well_collection.addChild(well_leaf_node, "group"); well_collection.addChild(well_leaf_node, "group");
} }