My Project
|
Representation of a UDQ ASSIGN statement. More...
#include <UDQAssign.hpp>
Public Types | |
using | VString = std::vector< std::string > |
Type alias for a vector of strings. Simplifies function signatures. | |
using | VEnumItems = std::vector< UDQSet::EnumeratedItems > |
Type alias for a vector of enumerated items. | |
using | WGNameMatcher = std::function< VString(const VString &)> |
Call-back function type for a well/group name matcher. | |
using | ItemMatcher = std::function< VEnumItems(const VString &)> |
Call-back function type for a matcher of enumerated items. | |
Public Member Functions | |
UDQAssign ()=default | |
Default constructor. | |
UDQAssign (const std::string &keyword, const VString &selector, double value, std::size_t report_step) | |
Constructor. | |
UDQAssign (const std::string &keyword, const VEnumItems &selector, double value, std::size_t report_step) | |
Constructor. | |
UDQAssign (const std::string &keyword, VEnumItems &&selector, double value, std::size_t report_step) | |
Constructor. | |
UDQAssign (const std::string &keyword, const RestartIO::RstUDQ &assignRst, const std::size_t report_step) | |
Constructor. | |
const std::string & | keyword () const |
Name of UDQ to which this assignment applies. | |
UDQVarType | var_type () const |
Kind of UDQ to which this assignment applies. | |
void | add_record (const VString &selector, double value, std::size_t report_step) |
Add new record to existing UDQ assignment. | |
void | add_record (const VEnumItems &selector, double value, std::size_t report_step) |
Add new record to existing UDQ assignment. | |
void | add_record (VEnumItems &&selector, double value, std::size_t report_step) |
Add new record to existing UDQ assignment. | |
void | add_record (const RestartIO::RstUDQ &assignRst, const std::size_t report_step) |
Add new record to existing UDQ assignment. | |
UDQSet | eval (const VEnumItems &items) const |
Apply current assignment to a selection of enumerated items. | |
UDQSet | eval (const VString &wells) const |
Apply current assignment to a selection of named items. | |
UDQSet | eval () const |
Construct scalar UDQ set for a scalar UDQ assignment. | |
UDQSet | eval (const VString &wgNames, WGNameMatcher matcher) const |
Apply current assignment to a selection of named items. | |
UDQSet | eval (const VEnumItems &items, ItemMatcher matcher) const |
Apply current assignment to a selection of enumerated items. | |
std::size_t | report_step () const |
Time at which this assignment happens. | |
bool | operator== (const UDQAssign &data) const |
Equality predicate. | |
template<class Serializer > | |
void | serializeOp (Serializer &serializer) |
Convert between byte array and object representation. | |
Static Public Member Functions | |
static UDQAssign | serializationTestObject () |
Create a serialisation test object. | |
Representation of a UDQ ASSIGN statement.
using Opm::UDQAssign::ItemMatcher = std::function<VEnumItems(const VString&)> |
Call-back function type for a matcher of enumerated items.
Takes a selector and returns a vector of such items.
using Opm::UDQAssign::VEnumItems = std::vector<UDQSet::EnumeratedItems> |
Type alias for a vector of enumerated items.
Simplifies function signatures.
using Opm::UDQAssign::WGNameMatcher = std::function<VString(const VString&)> |
Call-back function type for a well/group name matcher.
Takes a selector and returns a vector of matching well/group names.
Opm::UDQAssign::UDQAssign | ( | const std::string & | keyword, |
const VString & | selector, | ||
double | value, | ||
std::size_t | report_step | ||
) |
Constructor.
[in] | keyword | UDQ name. |
[in] | selector | Collection of entity names to which this assignment applies. Might, for instance, be a selection of well or group names for a well/group level UDQ, or an empty vector for a scalar/field level UDQ. |
[in] | value | Numeric UDQ value for the entities named in the selector . |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
Opm::UDQAssign::UDQAssign | ( | const std::string & | keyword, |
const VEnumItems & | selector, | ||
double | value, | ||
std::size_t | report_step | ||
) |
Constructor.
[in] | keyword | UDQ name. |
[in] | selector | Collection of named and numbered entities to which this assignment applies. Might, for instance, be a selection of well segments for a segment level UDQ. |
[in] | value | Numeric UDQ value for the entities identified in the selector . |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
Opm::UDQAssign::UDQAssign | ( | const std::string & | keyword, |
VEnumItems && | selector, | ||
double | value, | ||
std::size_t | report_step | ||
) |
Constructor.
Assumes ownership over the selector.
[in] | keyword | UDQ name. |
[in] | selector | Collection of named and numbered entities to which this assignment applies. Might, for instance, be a selection of well segments for a segment level UDQ. |
[in] | value | Numeric UDQ value for the entities identified in the selector . |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
Opm::UDQAssign::UDQAssign | ( | const std::string & | keyword, |
const RestartIO::RstUDQ & | assignRst, | ||
const std::size_t | report_step | ||
) |
Constructor.
Reconstitutes an assignment from restart file information
[in] | keyword | UDQ name. |
[in] | assignRst | Aggregate UDQ assignment information restored from restart file information. |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
void Opm::UDQAssign::add_record | ( | const RestartIO::RstUDQ & | assignRst, |
const std::size_t | report_step | ||
) |
Add new record to existing UDQ assignment.
Reconstitutes an assignment from restart file information. Mostly needed for interface compatibility in generic code.
[in] | assignRst | Aggregate UDQ assignment information restored from restart file information. |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
void Opm::UDQAssign::add_record | ( | const VEnumItems & | selector, |
double | value, | ||
std::size_t | report_step | ||
) |
Add new record to existing UDQ assignment.
[in] | selector | Collection of named and numbered entities to which this assignment applies. Might, for instance, be a selection of well segments for a segment level UDQ. |
[in] | value | Numeric UDQ value for the entities identified in the selector . |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
void Opm::UDQAssign::add_record | ( | const VString & | selector, |
double | value, | ||
std::size_t | report_step | ||
) |
Add new record to existing UDQ assignment.
[in] | selector | Collection of entity names to which this assignment applies. Might, for instance, be a selection of well or group names for a well/group level UDQ, or an empty vector for a scalar/field level UDQ. |
[in] | value | Numeric UDQ value for the entities named in the selector . |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
void Opm::UDQAssign::add_record | ( | VEnumItems && | selector, |
double | value, | ||
std::size_t | report_step | ||
) |
Add new record to existing UDQ assignment.
Assumes ownership over the selector.
[in] | selector | Collection of named and numbered entities to which this assignment applies. Might, for instance, be a selection of well segments for a segment level UDQ. |
[in] | value | Numeric UDQ value for the entities identified in the selector . |
[in] | report_step | Time at which this assignment happens. Assignments should be performed exactly once and the time value ensures this behaviour. |
UDQSet Opm::UDQAssign::eval | ( | ) | const |
Construct scalar UDQ set for a scalar UDQ assignment.
Throws an exception of type
if this assignment statement does not pertain to a scalar or field level UDQ.
UDQSet Opm::UDQAssign::eval | ( | const VEnumItems & | items | ) | const |
Apply current assignment to a selection of enumerated items.
[in] | items | Collection of named and numbered entities to which apply this assignment. Might, for instance, be a selection of well segments for a segment level UDQ. |
items
. Items known at construction time, or defined in subsequent calls to member function add_record(), will have a defined value in the resulting UDQ set while unrecognised items will have an undefined value. UDQSet Opm::UDQAssign::eval | ( | const VEnumItems & | items, |
ItemMatcher | matcher | ||
) | const |
Apply current assignment to a selection of enumerated items.
[in] | items | Collection of named and numbered entities to which apply this assignment. Might, for instance, be a selection of well segments for a segment level UDQ. Return value will be sized according to this sequence. |
[in] | matcher | Call-back for identifying items matching a selector. |
items
. Those items that are identified by the matcher
, will have a defined value in the resulting UDQ set while unrecognised items will have an undefined value. Apply current assignment to a selection of named items.
[in] | wells | Collection of named entities to which apply this assignment. Might, for instance, be a selection of well names for a well level UDQ. |
wells
. Named items known at construction time, or defined in subsequent calls to member function add_record(), will have a defined value in the resulting UDQ set while unrecognised items will have an undefined value. UDQSet Opm::UDQAssign::eval | ( | const VString & | wgNames, |
WGNameMatcher | matcher | ||
) | const |
Apply current assignment to a selection of named items.
[in] | wgNames | Backing sequence of wells/groups for which to create a UDQ well/group set. Return value will be sized according to this sequence. |
[in] | matcher | Call-back for identifying wells/groups matching a selector. Might for instance be a wrapper around WellMatcher::wells(pattern)
|
wgNames
. Wells/groups identified by the matcher
, will have a defined value in the resulting UDQ set while unrecognised wells/groups will have an undefined value. bool Opm::UDQAssign::operator== | ( | const UDQAssign & | data | ) | const |
Equality predicate.
[in] | data | Object against which *this
|
data
. std::size_t Opm::UDQAssign::report_step | ( | ) | const |
Time at which this assignment happens.
Assignments should be performed exactly once and the time value ensures this behaviour.
|
inline |
Convert between byte array and object representation.
Serializer | Byte array conversion protocol. |
[in,out] | serializer | Byte array conversion object. |