Loading...
Searching...
No Matches
RPTConfig.hpp
/*
Copyright 2020 Equinor 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 RPT_CONFIG_HPP
#define RPT_CONFIG_HPP
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
namespace Opm {
class DeckKeyword;
class ParseContext;
class ErrorGuard;
} // namespace Opm
namespace Opm {
class RPTConfig
{
public:
RPTConfig() = default;
explicit RPTConfig(const DeckKeyword& keyword);
explicit RPTConfig(const DeckKeyword& keyword,
const RPTConfig* prev,
const ParseContext& parseContext,
ErrorGuard& errors);
bool contains(const std::string& key) const;
auto begin() const { return this->mnemonics_.begin(); }
auto end() const { return this->mnemonics_.end(); }
auto size() const { return this->mnemonics_.size(); }
unsigned& at(const std::string& key) { return this->mnemonics_.at(key); }
unsigned at(const std::string& key) const { return this->mnemonics_.at(key); }
bool operator==(const RPTConfig& other) const;
static RPTConfig serializationTestObject();
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->mnemonics_);
}
private:
std::unordered_map<std::string, unsigned int> mnemonics_{};
void assignMnemonics(const std::vector<std::pair<std::string, int>>& mnemonics);
};
} // namespace Opm
#endif // RPT_CONFIG_HPP
Opm::DeckKeyword
Definition DeckKeyword.hpp:36
Opm::ErrorGuard
Definition ErrorGuard.hpp:30
Opm::ParseContext
Definition ParseContext.hpp:84
Opm::RPTConfig
Configuration manager for RPTSCHED and RPTSOL keywords.
Definition RPTConfig.hpp:40
Opm::RPTConfig::RPTConfig
RPTConfig()=default
Default constructor.
Opm::RPTConfig::at
unsigned & at(const std::string &key)
Get read/write access to particular mnemonic value.
Definition RPTConfig.hpp:112
Opm::RPTConfig::at
unsigned at(const std::string &key) const
Get read-only access to particular mnemonic value.
Definition RPTConfig.hpp:122
Opm::RPTConfig::begin
auto begin() const
Start of internal mnemonic sequence.
Definition RPTConfig.hpp:94
Opm::RPTConfig::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition RPTConfig.hpp:141
Opm::RPTConfig::end
auto end() const
End of internal mnemonic sequence.
Definition RPTConfig.hpp:99
Opm::RPTConfig::serializationTestObject
static RPTConfig serializationTestObject()
Create a serialisation test object.
Definition RPTConfig.cpp:95
Opm::RPTConfig::operator==
bool operator==(const RPTConfig &other) const
Equality predicate.
Definition RPTConfig.cpp:90
Opm::RPTConfig::contains
bool contains(const std::string &key) const
Mnemonic existence predicate.
Definition RPTConfig.cpp:85
Opm::RPTConfig::size
auto size() const
Number of mnemonics in internal sequence.
Definition RPTConfig.hpp:102
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30