diff --git a/opm/core/wells/WellCollection.cpp b/opm/core/wells/WellCollection.cpp index ba94d0973..d1238e7c7 100644 --- a/opm/core/wells/WellCollection.cpp +++ b/opm/core/wells/WellCollection.cpp @@ -29,7 +29,7 @@ namespace Opm { - void WellCollection::addField(GroupConstPtr fieldGroup, size_t timeStep, const PhaseUsage& phaseUsage) { + void WellCollection::addField(const Group* fieldGroup, size_t timeStep, const PhaseUsage& phaseUsage) { WellsGroupInterface* fieldNode = findNode(fieldGroup->name()); if (fieldNode) { OPM_THROW(std::runtime_error, "Trying to add FIELD node, but this already exists. Can only have one FIELD node."); @@ -38,7 +38,7 @@ namespace Opm roots_.push_back(createGroupWellsGroup(fieldGroup, timeStep, phaseUsage)); } - void WellCollection::addGroup(GroupConstPtr groupChild, std::string parent_name, + void WellCollection::addGroup(const Group* groupChild, std::string parent_name, size_t timeStep, const PhaseUsage& phaseUsage) { WellsGroupInterface* parent = findNode(parent_name); if (!parent) { @@ -60,7 +60,7 @@ namespace Opm child->setParent(parent); } - void WellCollection::addWell(WellConstPtr wellChild, size_t timeStep, const PhaseUsage& phaseUsage) { + void WellCollection::addWell(const Well* wellChild, size_t timeStep, const PhaseUsage& phaseUsage) { if (wellChild->getStatus(timeStep) == WellCommon::SHUT) { //SHUT wells are not added to the well collection return; diff --git a/opm/core/wells/WellCollection.hpp b/opm/core/wells/WellCollection.hpp index b597c4b64..b00827431 100644 --- a/opm/core/wells/WellCollection.hpp +++ b/opm/core/wells/WellCollection.hpp @@ -36,11 +36,11 @@ namespace Opm { public: - void addField(GroupConstPtr fieldGroup, size_t timeStep, const PhaseUsage& phaseUsage); + void addField(const Group* fieldGroup, size_t timeStep, const PhaseUsage& phaseUsage); - void addWell(WellConstPtr wellChild, size_t timeStep, const PhaseUsage& phaseUsage); + void addWell(const Well* wellChild, size_t timeStep, const PhaseUsage& phaseUsage); - void addGroup(GroupConstPtr groupChild, std::string parent_name, + void addGroup(const Group* groupChild, std::string parent_name, size_t timeStep, const PhaseUsage& phaseUsage); /// Adds the child to the collection diff --git a/opm/core/wells/WellsGroup.cpp b/opm/core/wells/WellsGroup.cpp index 6eef1e4f0..558f39fc7 100644 --- a/opm/core/wells/WellsGroup.cpp +++ b/opm/core/wells/WellsGroup.cpp @@ -1064,7 +1064,7 @@ namespace Opm } } // anonymous namespace - std::shared_ptr createGroupWellsGroup(GroupConstPtr group, size_t timeStep, const PhaseUsage& phase_usage ) + std::shared_ptr createGroupWellsGroup(const Group* group, size_t timeStep, const PhaseUsage& phase_usage ) { InjectionSpecification injection_specification; ProductionSpecification production_specification; @@ -1099,7 +1099,7 @@ namespace Opm 'CMODE_UNDEFINED' - we do not carry that over the specification objects here. */ - std::shared_ptr createWellWellsGroup(WellConstPtr well, size_t timeStep, const PhaseUsage& phase_usage ) + std::shared_ptr createWellWellsGroup(const Well* well, size_t timeStep, const PhaseUsage& phase_usage ) { InjectionSpecification injection_specification; ProductionSpecification production_specification; diff --git a/opm/core/wells/WellsGroup.hpp b/opm/core/wells/WellsGroup.hpp index 697a23cbc..c93fcdac4 100644 --- a/opm/core/wells/WellsGroup.hpp +++ b/opm/core/wells/WellsGroup.hpp @@ -406,14 +406,14 @@ namespace Opm /// \param[in] well the Well to construct object for /// \param[in] timeStep the time step in question /// \param[in] the phase usage - std::shared_ptr createWellWellsGroup(WellConstPtr well, size_t timeStep, + std::shared_ptr createWellWellsGroup(const Well* well, size_t timeStep, const PhaseUsage& phase_usage ); /// Creates the WellsGroupInterface for the given Group /// \param[in] group the Group to construct object for /// \param[in] timeStep the time step in question /// \param[in] the phase usage - std::shared_ptr createGroupWellsGroup(GroupConstPtr group, size_t timeStep, + std::shared_ptr createGroupWellsGroup(const Group* group, size_t timeStep, const PhaseUsage& phase_usage ); } #endif /* OPM_WELLSGROUP_HPP */ diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index f9ad8569a..124d35ff1 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -414,7 +414,7 @@ namespace Opm - void WellsManager::setupWellControls(std::vector& wells, size_t timeStep, + void WellsManager::setupWellControls(std::vector< const Well* >& wells, size_t timeStep, std::vector& well_names, const PhaseUsage& phaseUsage, const std::vector& wells_on_proc) { int well_index = 0; @@ -427,7 +427,7 @@ namespace Opm continue; } - WellConstPtr well = (*wellIter); + const auto* well = (*wellIter); if (well->getStatus(timeStep) == WellCommon::STOP) { // STOPed wells are kept in the well list but marked as stopped. @@ -728,12 +728,12 @@ namespace Opm } - void WellsManager::setupGuideRates(std::vector& wells, const size_t timeStep, std::vector& well_data, std::map& well_names_to_index, + void WellsManager::setupGuideRates(std::vector< const Well* >& wells, const size_t timeStep, std::vector& well_data, std::map& well_names_to_index, const PhaseUsage& phaseUsage, const std::vector& well_potentials) { const int np = phaseUsage.num_phases; for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter ) { - WellConstPtr well = *wellIter; + const auto* well = *wellIter; if (well->getStatus(timeStep) == WellCommon::SHUT) { //SHUT wells does not need guide rates diff --git a/opm/core/wells/WellsManager.hpp b/opm/core/wells/WellsManager.hpp index 022871abf..fc41c2fd3 100644 --- a/opm/core/wells/WellsManager.hpp +++ b/opm/core/wells/WellsManager.hpp @@ -160,12 +160,12 @@ namespace Opm WellsManager(const WellsManager& other); WellsManager& operator=(const WellsManager& other); static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map& cartesian_to_compressed ); - void setupWellControls(std::vector& wells, size_t timeStep, + void setupWellControls(std::vector& wells, size_t timeStep, std::vector& well_names, const PhaseUsage& phaseUsage, const std::vector& wells_on_proc); template - void createWellsFromSpecs( std::vector& wells, size_t timeStep, + void createWellsFromSpecs( std::vector& wells, size_t timeStep, const C2F& cell_to_faces, const int* cart_dims, FC begin_face_centroids, @@ -181,7 +181,7 @@ namespace Opm std::vector& wells_on_proc); void addChildGroups(GroupTreeNodeConstPtr parentNode, std::shared_ptr< const Schedule > schedule, size_t timeStep, const PhaseUsage& phaseUsage); - void setupGuideRates(std::vector& wells, const size_t timeStep, std::vector& well_data, std::map& well_names_to_index, + void setupGuideRates(std::vector& wells, const size_t timeStep, std::vector& well_data, std::map& well_names_to_index, const PhaseUsage& phaseUsage, const std::vector& well_potentials); // Data Wells* w_; diff --git a/opm/core/wells/WellsManager_impl.hpp b/opm/core/wells/WellsManager_impl.hpp index 21c51cb23..9cfc3c92e 100644 --- a/opm/core/wells/WellsManager_impl.hpp +++ b/opm/core/wells/WellsManager_impl.hpp @@ -107,7 +107,7 @@ getCubeDim(const C2F& c2f, namespace Opm { template -void WellsManager::createWellsFromSpecs(std::vector& wells, size_t timeStep, +void WellsManager::createWellsFromSpecs(std::vector& wells, size_t timeStep, const C2F& c2f, const int* cart_dims, FC begin_face_centroids, @@ -138,7 +138,7 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t // the index of the well according to the eclipse state int well_index_on_proc = 0; for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) { - WellConstPtr well = (*wellIter); + const auto* well = (*wellIter); if (well->getStatus(timeStep) == WellCommon::SHUT) { continue; @@ -379,8 +379,8 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, std::map well_names_to_index; auto schedule = eclipseState->getSchedule(); - std::vector wells = schedule->getWells(timeStep); - std::vector wells_on_proc; + auto wells = schedule->getWells(timeStep); + std::vector wells_on_proc; well_names.reserve(wells.size()); well_data.reserve(wells.size()); @@ -418,8 +418,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, GroupTreeNodeConstPtr fieldNode = schedule->getGroupTree(timeStep)->getNode("FIELD"); - GroupConstPtr fieldGroup = - schedule->getGroup(fieldNode->name()); + const auto* fieldGroup = schedule->getGroup(fieldNode->name()); well_collection_.addField(fieldGroup, timeStep, pu); addChildGroups(fieldNode, schedule, timeStep, pu); diff --git a/tests/test_wellcollection.cpp b/tests/test_wellcollection.cpp index 6870853d3..6378941e0 100644 --- a/tests/test_wellcollection.cpp +++ b/tests/test_wellcollection.cpp @@ -54,24 +54,24 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) { WellCollection collection; // Add groups to WellCollection - GroupConstPtr fieldGroup = eclipseState->getSchedule()->getGroup(field->name()); + const auto* fieldGroup = eclipseState->getSchedule()->getGroup(field->name()); collection.addField(fieldGroup, 2, pu); for (auto iter = field->begin(); iter != field->end(); ++iter) { - GroupConstPtr childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); + const auto* childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); collection.addGroup(childGroupNode, fieldGroup->name(), 2, pu); } - GroupConstPtr g1Group = eclipseState->getSchedule()->getGroup(g1->name()); + const auto* g1Group = eclipseState->getSchedule()->getGroup(g1->name()); for (auto iter = g1->begin(); iter != g1->end(); ++iter) { - GroupConstPtr childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); + const auto* childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); collection.addGroup(childGroupNode, g1Group->name(), 2, pu); } - GroupConstPtr g2Group = eclipseState->getSchedule()->getGroup(g2->name()); + const auto* g2Group = eclipseState->getSchedule()->getGroup(g2->name()); for (auto iter = g2->begin(); iter != g2->end(); ++iter) { - GroupConstPtr childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); + const auto* childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name()); collection.addGroup(childGroupNode, g2Group->name(), 2, pu); } @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) { // Add wells to WellCollection WellCollection wellCollection; - std::vector wells = eclipseState->getSchedule()->getWells(); + auto wells = eclipseState->getSchedule()->getWells(); for (size_t i=0; i wells = eclipseState->getSchedule()->getWells(); + auto wells = eclipseState->getSchedule()->getWells(); for (size_t i=0; i wellsGroup = createWellWellsGroup(well, 2, pu); BOOST_CHECK_EQUAL(well->name(), wellsGroup->name()); if (well->isInjector(2)) { @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) { std::vector nodes = eclipseState->getSchedule()->getGroupTree(2)->getNodes(); for (size_t i=0; igetSchedule()->getGroup(nodes[i]->name()); + const auto* group = eclipseState->getSchedule()->getGroup(nodes[i]->name()); std::shared_ptr wellsGroup = createGroupWellsGroup(group, 2, pu); BOOST_CHECK_EQUAL(group->name(), wellsGroup->name()); if (group->isInjectionGroup(2)) {