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

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

View File

@@ -40,6 +40,7 @@
#include <fstream>
#include <exception>
#include <algorithm>
#include <memory>
#include <limits>
#include <numeric>
#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);
@@ -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,
const std::string& fieldname)
//---------------------------------------------------------------------------
{
string ukey = upcase(fieldname);
boost::shared_ptr<SpecialBase> spec_ptr
std::shared_ptr<SpecialBase> spec_ptr
= Factory<SpecialBase>::createObject(fieldname);
is >> ignoreWhitespace;
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,
const boost::shared_ptr<SpecialBase> original)
const std::shared_ptr<SpecialBase> original)
//---------------------------------------------------------------------------
{
string ukey = upcase(fieldname);
boost::shared_ptr<SpecialBase> spec_ptr
std::shared_ptr<SpecialBase> spec_ptr
= Factory<SpecialBase>::cloneObject(fieldname, original);
return spec_ptr;
}
@@ -766,7 +767,7 @@ void EclipseGridParser::setFloatingPointField(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;

View File

@@ -40,7 +40,7 @@
#include <vector>
#include <map>
#include <set>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <opm/core/io/eclipse/SpecialEclipseFields.hpp>
#include <opm/core/io/eclipse/EclipseUnits.hpp>
#include <opm/core/utility/Factory.hpp>
@@ -138,7 +138,7 @@ namespace Opm
/// corresponding to the given floating-point keyword.
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
/// 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 cloneSpecialField(const std::string& fieldname,
const boost::shared_ptr<SpecialBase> original);
const std::shared_ptr<SpecialBase> original);
void readImpl(std::istream& is);
void getNumericErtFields(const std::string& filename);

View File

@@ -22,7 +22,7 @@
#include <opm/core/linalg/LinearSolverInterface.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Opm
{
@@ -87,7 +87,7 @@ namespace Opm
virtual double getTolerance() const;
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/io/eclipse/EclipseGridParser.hpp>
#include <string>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Opm
{
@@ -116,7 +116,7 @@ namespace Opm
int region_number_;
std::vector<boost::shared_ptr<SinglePvtInterface> > props_;
std::vector<std::shared_ptr<SinglePvtInterface> > props_;
double densities_[MaxNumPhases];
mutable std::vector<double> data1_;

View File

@@ -20,7 +20,7 @@
#ifndef OPM_SIMULATORCOMPRESSIBLETWOPHASE_HEADER_INCLUDED
#define OPM_SIMULATORCOMPRESSIBLETWOPHASE_HEADER_INCLUDED
#include <boost/shared_ptr.hpp>
#include <memory>
#include <vector>
struct UnstructuredGrid;
@@ -91,7 +91,7 @@ namespace Opm
private:
class 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

View File

@@ -20,7 +20,7 @@
#ifndef OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED
#define OPM_SIMULATORINCOMPTWOPHASE_HEADER_INCLUDED
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <vector>
@@ -120,7 +120,7 @@ namespace Opm
private:
struct 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
void connect_timestep_impl (boost::function0<void> hook);

View File

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

View File

@@ -36,7 +36,7 @@
#define OPM_FACTORY_HEADER
#include <map>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Opm
{
@@ -52,7 +52,7 @@ namespace Opm
{
public:
/// 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,
/// 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;
// This map contains the whole factory, i.e. all the Creators.
CreatorMap string_to_creator_;

View File

@@ -42,7 +42,7 @@
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <opm/core/utility/parameters/Parameter.hpp>
#include <opm/core/utility/parameters/ParameterStrings.hpp>
@@ -173,7 +173,7 @@ namespace Opm {
}
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);
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);
if (it == map_.end()) {
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;
} 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));
ParameterGroup& child = dynamic_cast<ParameterGroup&>(*data);
child.insertParameter(name_path.second, value);
@@ -235,7 +235,7 @@ namespace Opm {
<< ID_xmltag__param
<< " 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;
} else {
ParameterGroup& pg = dynamic_cast<ParameterGroup&>(*(*it).second);

View File

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

View File

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

View File

@@ -19,7 +19,7 @@
#include "config.h"
#include <opm/core/wells/WellCollection.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Opm
{
@@ -33,7 +33,7 @@ namespace Opm
roots_.push_back(createWellsGroup(parent_name, deck));
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) {
if (roots_[i]->name() == child_name) {
@@ -99,7 +99,7 @@ namespace Opm
/// \param[in] child the child 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)
{
WellsGroupInterface* parent = findNode(parent_name);
@@ -116,7 +116,7 @@ namespace Opm
/// 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);
if (child_node->isLeafNode()) {

View File

@@ -26,7 +26,7 @@
#include <opm/core/wells/WellsGroup.hpp>
#include <opm/core/grid.h>
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Opm
{
@@ -48,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(boost::shared_ptr<WellsGroupInterface>& child_node,
void addChild(std::shared_ptr<WellsGroupInterface>& child_node,
const std::string& parent);
/// 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
/// (that is, it either changes the active control of violating wells, or shuts
@@ -113,7 +113,7 @@ namespace Opm
private:
// 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.
std::vector<WellNode*> leaf_nodes_;

View File

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

View File

@@ -26,7 +26,7 @@
#include <opm/core/grid.h>
#include <opm/core/props/BlackoilPhases.hpp>
#include <string>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Opm
{
@@ -232,7 +232,7 @@ namespace Opm
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,
const std::vector<double>& well_reservoirrates_phase,
@@ -301,7 +301,7 @@ namespace Opm
const std::vector<double>& well_surfacerates_phase);
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
/// \param[in] name the name of the wells group.
/// \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);