mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 13:47:12 -05:00
122 lines
5.1 KiB
C++
122 lines
5.1 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2025 Equinor ASA
|
|
//
|
|
// ResInsight 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.
|
|
//
|
|
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include <ctime>
|
|
#include <expected>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "opm/input/eclipse/Deck/FileDeck.hpp"
|
|
|
|
namespace Opm
|
|
{
|
|
class Deck;
|
|
class DeckKeyword;
|
|
class DeckItem;
|
|
class DeckRecord;
|
|
class ParseContext;
|
|
} // namespace Opm
|
|
|
|
//==================================================================================================
|
|
///
|
|
///
|
|
//==================================================================================================
|
|
class RifOpmFlowDeckFile
|
|
{
|
|
public:
|
|
RifOpmFlowDeckFile();
|
|
~RifOpmFlowDeckFile();
|
|
|
|
std::expected<void, std::string> loadDeck( std::string filename );
|
|
bool saveDeck( std::string folder, std::string filename );
|
|
bool saveDeckInline( std::string folder, std::string filename );
|
|
|
|
int addKeywordAtPosition( int deckPosition, const Opm::DeckKeyword& keyword );
|
|
bool addKeywordAtTimeStep( int timeStep, const Opm::DeckKeyword& keyword, std::string insertAfterKeyword = "" );
|
|
|
|
int mergeKeywordAtPosition( int deckPosition, const Opm::DeckKeyword& keyword );
|
|
bool mergeKeywordAtTimeStep( int timeStep, const Opm::DeckKeyword& keyword, std::string insertAfterKeyword = "" );
|
|
|
|
bool openWellAtTimeStep( int timeStep, Opm::DeckKeyword& openKeyword );
|
|
bool openWellAtDeckPosition( int deckPosition, Opm::DeckKeyword& openKeyword );
|
|
|
|
bool restartAtTimeStep( int timeStep, std::string deckName );
|
|
bool stopAtTimeStep( int timeStep );
|
|
|
|
std::vector<std::string> keywords( bool includeDates = true );
|
|
std::optional<Opm::DeckKeyword> findKeyword( const std::string& keyword );
|
|
std::vector<Opm::DeckKeyword> findAllKeywords( const std::string& keyword );
|
|
std::vector<std::pair<Opm::FileDeck::Index, Opm::DeckKeyword>> findAllKeywordsWithIndices( const std::string& keyword );
|
|
bool hasDatesKeyword();
|
|
bool isRestartFile();
|
|
std::vector<std::string> dateStrings();
|
|
std::vector<std::time_t> dates();
|
|
bool appendDateKeywords( const std::vector<std::time_t>& dates );
|
|
|
|
std::set<std::string> wellGroupsInFile();
|
|
|
|
std::vector<int> welldims();
|
|
bool setWelldims( int maxWells, int maxConnections, int maxGroups, int maxWellsInGroup );
|
|
|
|
std::vector<int> wsegdims();
|
|
bool setWsegdims( int maxMSWells, int maxSegmentsPerWell, int maxBranchesPerWell );
|
|
|
|
bool setSpecgrid( int nx, int ny, int nz );
|
|
bool setDimens( int nx, int ny, int nz );
|
|
|
|
std::vector<int> regdims();
|
|
bool setRegdims( int maxRegions,
|
|
int maxRegionDefinitions,
|
|
int maxRegionFlowConnections,
|
|
int maxFIPRegions,
|
|
int maxEtrack,
|
|
int maxCompRegions,
|
|
int maxOperNum );
|
|
bool ensureRegdimsKeyword();
|
|
|
|
bool addIncludeKeyword( std::string section, std::string keyword, std::string filePath );
|
|
|
|
Opm::FileDeck* fileDeck();
|
|
const Opm::Deck* deck() const;
|
|
|
|
bool addKeyword( const std::string& section, const Opm::DeckKeyword& keyword );
|
|
|
|
bool replaceKeyword( const std::string& section, const Opm::DeckKeyword& keyword );
|
|
bool insertKeywordAtSectionStart( const std::string& section, const Opm::DeckKeyword& keyword );
|
|
bool replaceKeyword( const std::string& keyword, const std::vector<double>& data, bool dataKeyword = false );
|
|
bool replaceKeyword( const std::string& keyword, const std::vector<int>& data, bool dataKeyword = false );
|
|
|
|
bool replaceAllKeywords( const std::string& keywordName, const std::vector<Opm::DeckKeyword>& keywords );
|
|
bool replaceKeywordAtIndex( const Opm::FileDeck::Index& index, const Opm::DeckKeyword& keyword );
|
|
|
|
int removeKeywords( const std::string& keywordName );
|
|
bool removeKeywordAtIndex( const Opm::FileDeck::Index& index );
|
|
|
|
private:
|
|
void splitDatesIfNecessary();
|
|
|
|
private:
|
|
std::unique_ptr<Opm::Deck> m_deck;
|
|
std::unique_ptr<Opm::FileDeck> m_fileDeck;
|
|
};
|