Add method to get filtered UDQ assignment types
This commit is contained in:
parent
a91d47f191
commit
6bf64b18fe
@ -34,6 +34,7 @@ public:
|
||||
UDQAssign(const std::string& keyword, const std::vector<std::string>& selector, double value);
|
||||
const std::string& keyword() const;
|
||||
double value() const;
|
||||
UDQVarType var_type() const;
|
||||
const std::vector<std::string>& selector() const;
|
||||
UDQWellSet eval_wells(const std::vector<std::string>& wells) const;
|
||||
private:
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQExpression.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
@ -38,6 +39,7 @@ namespace Opm {
|
||||
const std::string& unit(const std::string& key) const;
|
||||
void assign_unit(const std::string& keyword, const std::string& unit);
|
||||
const std::vector<UDQAssign>& assignments() const;
|
||||
std::vector<UDQAssign> assignments(UDQVarType var_type) const;
|
||||
private:
|
||||
std::vector<UDQExpression> m_expressions;
|
||||
std::vector<UDQAssign> m_assignments;
|
||||
|
@ -42,6 +42,10 @@ double UDQAssign::value() const {
|
||||
return this->m_value;
|
||||
}
|
||||
|
||||
UDQVarType UDQAssign::var_type() const {
|
||||
return this->m_var_type;
|
||||
}
|
||||
|
||||
UDQWellSet UDQAssign::eval_wells(const std::vector<std::string>& wells) const {
|
||||
UDQWellSet ws(m_keyword, wells);
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
|
||||
|
||||
@ -59,6 +61,18 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
std::vector<UDQAssign> UDQInput::assignments(UDQVarType var_type) const {
|
||||
std::vector<UDQAssign> filtered_assignments;
|
||||
|
||||
std::copy_if(this->m_assignments.begin(),
|
||||
this->m_assignments.end(),
|
||||
std::back_inserter(filtered_assignments),
|
||||
[&var_type](const UDQAssign& assignment) { return assignment.var_type() == var_type; });
|
||||
|
||||
return filtered_assignments;
|
||||
}
|
||||
|
||||
|
||||
const std::string& UDQInput::unit(const std::string& key) const {
|
||||
const auto pair_ptr = this->units.find(key);
|
||||
if (pair_ptr == this->units.end())
|
||||
|
Loading…
Reference in New Issue
Block a user