Merge pull request #3224 from joakim-hove/wellcontainer-doc

Add documentation to WellContainer<T> class
This commit is contained in:
Joakim Hove 2021-05-09 14:46:18 +02:00 committed by GitHub
commit 42101774a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,19 @@
namespace Opm { namespace Opm {
/*
The WellContainer<T> class is a small utility class designed to manage the
dynamic state of per well quantities, like active control and phase rates. The
values are stored continously in a vector, but they are added with a name, and
can also be accessed and updated with the name.
The class is created to facilitate safe and piecewise refactoring of the
WellStateFullyImplicitBlackOil class, and might have a short life in the
development timeline.
*/
template <class T> template <class T>
class WellContainer { class WellContainer {
public: public:
@ -57,6 +70,10 @@ public:
this->data.at(index) = std::forward<T>(value); this->data.at(index) = std::forward<T>(value);
} }
/*
Will copy the value from other to this - for all wells which are present
in both containers.
*/
void copy_welldata(const WellContainer<T>& other) { void copy_welldata(const WellContainer<T>& other) {
if (this->index_map == other.index_map) if (this->index_map == other.index_map)
this->data = other.data; this->data = other.data;
@ -66,6 +83,10 @@ public:
} }
} }
/*
Will copy the value for well @name from other to this. The well @name must
exist in both containers, otherwise an exception is thrown.
*/
void copy_welldata(const WellContainer<T>& other, const std::string& name) { void copy_welldata(const WellContainer<T>& other, const std::string& name) {
auto this_index = this->index_map.at(name); auto this_index = this->index_map.at(name);
auto other_index = other.index_map.at(name); auto other_index = other.index_map.at(name);