opm-common/opm/io/eclipse/ESmry.hpp

92 lines
3.0 KiB
C++
Raw Normal View History

/*
Copyright 2019 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 OPM_IO_ESMRY_HPP
#define OPM_IO_ESMRY_HPP
#include <string>
#include <unordered_map>
#include <vector>
2020-03-27 02:07:52 -05:00
#include <opm/common/utility/FileSystem.hpp>
2020-03-27 02:07:52 -05:00
#include <opm/io/eclipse/SummaryNode.hpp>
namespace Opm { namespace EclIO {
class ESmry
{
public:
2020-03-13 04:39:53 -05:00
// input is smspec (or fsmspec file)
explicit ESmry(const std::string& filename, bool loadBaseRunData=false);
2020-03-13 04:39:53 -05:00
int numberOfVectors() const { return nVect; }
bool hasKey(const std::string& key) const;
const std::vector<float>& get(const std::string& name) const;
2020-03-27 02:07:52 -05:00
const std::vector<float>& get(const SummaryNode& node) const;
std::vector<float> get_at_rstep(const std::string& name) const;
2020-03-27 02:07:52 -05:00
std::vector<float> get_at_rstep(const SummaryNode& node) const;
const std::vector<int>& get_startdat() const { return startdat; }
2020-03-27 02:07:52 -05:00
const std::vector<std::string>& keywordList() const;
const std::vector<SummaryNode>& summaryNodeList() const;
int timestepIdxAtReportstepStart(const int reportStep) const;
size_t numberOfTimeSteps() const { return param[0].size(); }
const std::string& get_unit(const std::string& name) const;
2020-03-27 02:07:52 -05:00
const std::string& get_unit(const SummaryNode& node) const;
private:
int nVect, nI, nJ, nK;
void ijk_from_global_index(int glob, int &i, int &j, int &k) const;
std::vector<std::vector<float>> param;
std::vector<std::string> keyword;
2020-03-27 02:07:52 -05:00
std::vector<SummaryNode> summaryNodes;
std::unordered_map<std::string, std::string> kwunits;
std::vector<int> seqIndex;
std::vector<float> seqTime;
2020-03-13 04:39:53 -05:00
// start of simulation year, month, day, hr, min, microsec*1000000
std::vector<int> startdat;
std::vector<std::string> checkForMultipleResultFiles(const Opm::filesystem::path& rootN, bool formatted) const;
2020-03-13 04:39:53 -05:00
void getRstString(const std::vector<std::string>& restartArray,
Opm::filesystem::path& pathRst,
Opm::filesystem::path& rootN) const;
void updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) const;
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num) const;
2020-03-27 02:07:52 -05:00
std::string unpackNumber(const SummaryNode&) const;
std::string lookupKey(const SummaryNode&) const;
};
}} // namespace Opm::EclIO
#endif // OPM_IO_ESMRY_HPP