intital changes for adding opm/output/data/Groups
This commit is contained in:
parent
89479c5c75
commit
a18439bbcc
@ -727,6 +727,7 @@ if(ENABLE_ECL_OUTPUT)
|
|||||||
opm/output/data/Cells.hpp
|
opm/output/data/Cells.hpp
|
||||||
opm/output/data/Solution.hpp
|
opm/output/data/Solution.hpp
|
||||||
opm/output/data/Wells.hpp
|
opm/output/data/Wells.hpp
|
||||||
|
opm/output/data/Groups.hpp
|
||||||
opm/output/eclipse/VectorItems/aquifer.hpp
|
opm/output/eclipse/VectorItems/aquifer.hpp
|
||||||
opm/output/eclipse/VectorItems/connection.hpp
|
opm/output/eclipse/VectorItems/connection.hpp
|
||||||
opm/output/eclipse/VectorItems/group.hpp
|
opm/output/eclipse/VectorItems/group.hpp
|
||||||
|
121
opm/output/data/Groups.hpp
Normal file
121
opm/output/data/Groups.hpp
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 Statoil ASA.
|
||||||
|
|
||||||
|
This file is part of the Open Porous Media project (OPM).
|
||||||
|
|
||||||
|
OPM is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OPM is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPM_OUTPUT_GROUPS_HPP
|
||||||
|
#define OPM_OUTPUT_GROUPS_HPP
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <map>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
namespace data {
|
||||||
|
|
||||||
|
struct currentGroupConstraints {
|
||||||
|
Opm::Group::ProductionCMode currentProdConstraint;
|
||||||
|
Opm::Group::InjectionCMode currentGasInjectionConstraint;
|
||||||
|
Opm::Group::InjectionCMode currentWaterInjectionConstraint;
|
||||||
|
|
||||||
|
template <class MessageBufferType>
|
||||||
|
void write(MessageBufferType& buffer) const;
|
||||||
|
template <class MessageBufferType>
|
||||||
|
void read(MessageBufferType& buffer);
|
||||||
|
|
||||||
|
inline currentGroupConstraints& set( Opm::Group::ProductionCMode cpc,
|
||||||
|
Opm::Group::InjectionCMode cgic,
|
||||||
|
Opm::Group::InjectionCMode cwic);
|
||||||
|
|
||||||
|
inline bool has();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Group : public std::map<std::string, Opm::data::currentGroupConstraints> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
template <class MessageBufferType>
|
||||||
|
void write(MessageBufferType& buffer) const {
|
||||||
|
unsigned int size = this->size();
|
||||||
|
buffer.write(size);
|
||||||
|
for (const auto& witr : *this) {
|
||||||
|
const std::string& name = witr.first;
|
||||||
|
buffer.write(witr);
|
||||||
|
const auto& pi_constr = witr.second;
|
||||||
|
pi_constr.write(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class MessageBufferType>
|
||||||
|
void read(MessageBufferType& buffer) {
|
||||||
|
unsigned int size;
|
||||||
|
buffer.read(size);
|
||||||
|
for (size_t i = 0; i < size; ++i) {
|
||||||
|
std::string name;
|
||||||
|
buffer.read(name);
|
||||||
|
currentGroupConstraints cgc;
|
||||||
|
cgc.read(buffer);
|
||||||
|
this->emplace(name, cgc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* IMPLEMENTATIONS */
|
||||||
|
|
||||||
|
template <class MessageBufferType>
|
||||||
|
void currentGroupConstraints::write(MessageBufferType& buffer) const {
|
||||||
|
buffer.write(this->currentProdConstraint);
|
||||||
|
buffer.write(this->currentGasInjectionConstraint);
|
||||||
|
buffer.write(this->currentWaterInjectionConstraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class MessageBufferType>
|
||||||
|
void currentGroupConstraints::read(MessageBufferType& buffer) {
|
||||||
|
buffer.read(this->currentProdConstraint);
|
||||||
|
buffer.read(this->currentGasInjectionConstraint);
|
||||||
|
buffer.read(this->currentWaterInjectionConstraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline currentGroupConstraints& currentGroupConstraints::set( Opm::Group::ProductionCMode cpc,
|
||||||
|
Opm::Group::InjectionCMode cgic,
|
||||||
|
Opm::Group::InjectionCMode cwic) {
|
||||||
|
this->currentGasInjectionConstraint = cgic;
|
||||||
|
this->currentWaterInjectionConstraint = cwic;
|
||||||
|
this->currentProdConstraint = cpc;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool currentGroupConstraints::has() {
|
||||||
|
return ((&this->currentGasInjectionConstraint != nullptr) && (&this->currentGasInjectionConstraint != nullptr)
|
||||||
|
&& (&this->currentProdConstraint != nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}} // Opm::data
|
||||||
|
|
||||||
|
#endif //OPM_OUTPUT_GROUPS_HPP
|
Loading…
Reference in New Issue
Block a user