Change from std::string to const std::string& in findGroup-methods

This commit is contained in:
Kjetil Olsen Lye 2012-04-25 16:42:55 +02:00
parent d65521ae85
commit 8099e32b91
4 changed files with 9 additions and 9 deletions

View File

@ -69,7 +69,7 @@ namespace Opm
return leaf_nodes_; return leaf_nodes_;
} }
WellsGroupInterface* WellCollection::findNode(std::string name) WellsGroupInterface* WellCollection::findNode(const std::string& name)
{ {
for (size_t i = 0; i < roots_.size(); i++) { for (size_t i = 0; i < roots_.size(); i++) {
@ -81,7 +81,7 @@ namespace Opm
return NULL; return NULL;
} }
const WellsGroupInterface* WellCollection::findNode(std::string name) const const WellsGroupInterface* WellCollection::findNode(const std::string& name) const
{ {
for (size_t i = 0; i < roots_.size(); i++) { for (size_t i = 0; i < roots_.size(); i++) {

View File

@ -79,12 +79,12 @@ namespace Opm
/// Finds the group with the given name. /// Finds the group with the given name.
/// \param[in] the name of the group /// \param[in] the name of the group
/// \return the pointer to the group if found, NULL otherwise /// \return the pointer to the group if found, NULL otherwise
WellsGroupInterface* findNode(std::string name); WellsGroupInterface* findNode(const std::string& name);
/// Finds the group with the given name. /// Finds the group with the given name.
/// \param[in] the name of the group /// \param[in] the name of the group
/// \return the pointer to the group if found, NULL otherwise /// \return the pointer to the group if found, NULL otherwise
const WellsGroupInterface* findNode(std::string name) const; const WellsGroupInterface* findNode(const std::string& name) const;
private: private:
// To account for the possibility of a forest // To account for the possibility of a forest

View File

@ -90,7 +90,7 @@ namespace Opm
return injection_specification_; return injection_specification_;
} }
WellsGroupInterface* WellsGroup::findGroup(std::string name_of_node) WellsGroupInterface* WellsGroup::findGroup(const std::string& name_of_node)
{ {
if (name() == name_of_node) { if (name() == name_of_node) {
return this; return this;
@ -288,7 +288,7 @@ namespace Opm
return true; return true;
} }
WellsGroupInterface* WellNode::findGroup(std::string name_of_node) WellsGroupInterface* WellNode::findGroup(const std::string& name_of_node)
{ {
if (name() == name_of_node) { if (name() == name_of_node) {
return this; return this;

View File

@ -54,7 +54,7 @@ namespace Opm
/// \returns the pointer to the WellsGroupInterface with the given name. NULL if /// \returns the pointer to the WellsGroupInterface with the given name. NULL if
/// the name is not found.a /// the name is not found.a
virtual WellsGroupInterface* findGroup(std::string name_of_node) = 0; virtual WellsGroupInterface* findGroup(const std::string& name_of_node) = 0;
/// Sets the parent /// Sets the parent
/// \param[in] parent the pointer to the parent /// \param[in] parent the pointer to the parent
@ -125,7 +125,7 @@ namespace Opm
ProductionSpecification prod_spec, ProductionSpecification prod_spec,
InjectionSpecification inj_spec); InjectionSpecification inj_spec);
virtual WellsGroupInterface* findGroup(std::string name_of_node); virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child); void addChild(std::tr1::shared_ptr<WellsGroupInterface> child);
@ -154,7 +154,7 @@ namespace Opm
ProductionSpecification prod_spec, ProductionSpecification prod_spec,
InjectionSpecification inj_spec); InjectionSpecification inj_spec);
virtual WellsGroupInterface* findGroup(std::string name_of_node); virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
virtual bool conditionsMet(const std::vector<double>& well_bhp, virtual bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate, const std::vector<double>& well_rate,
WellPhasesSummed& summed_phases, WellPhasesSummed& summed_phases,