mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#788 opm-parser: Read faults as part of reading input data
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RifReaderOpmParserInput::importGridAndProperties(const QString& fileName, RigCaseData* caseData, std::map<QString, QString>* mapFromResultNameToKeyword)
|
void RifReaderOpmParserInput::importGridPropertiesFaults(const QString& fileName, RigCaseData* caseData)
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("\nStarted reading of grid and properties from file : " + fileName + "\n"));
|
RiuMainWindow::instance()->processMonitor()->addStringToLog(QString("\nStarted reading of grid and properties from file : " + fileName + "\n"));
|
||||||
|
|
||||||
@@ -96,8 +96,6 @@ void RifReaderOpmParserInput::importGridAndProperties(const QString& fileName, R
|
|||||||
{
|
{
|
||||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||||
newPropertyData.push_back(allValues);
|
newPropertyData.push_back(allValues);
|
||||||
|
|
||||||
mapFromResultNameToKeyword->insert(std::make_pair(newResultName, QString::fromStdString(keyword)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (properties.hasDeckIntGridProperty(keyword))
|
else if (properties.hasDeckIntGridProperty(keyword))
|
||||||
@@ -116,11 +114,18 @@ void RifReaderOpmParserInput::importGridAndProperties(const QString& fileName, R
|
|||||||
doubleValues.insert(std::end(doubleValues), std::begin(intValues), std::end(intValues));
|
doubleValues.insert(std::end(doubleValues), std::begin(intValues), std::end(intValues));
|
||||||
|
|
||||||
newPropertyData.push_back(doubleValues);
|
newPropertyData.push_back(doubleValues);
|
||||||
|
|
||||||
mapFromResultNameToKeyword->insert(std::make_pair(newResultName, QString::fromStdString(keyword)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caseData->mainGrid())
|
||||||
|
{
|
||||||
|
cvf::Collection<RigFault> faults;
|
||||||
|
importFaults(*deck, faults);
|
||||||
|
if (faults.size() > 0)
|
||||||
|
{
|
||||||
|
caseData->mainGrid()->setFaults(faults);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,14 +198,36 @@ void RifReaderOpmParserInput::readFaults(const QString& fileName, cvf::Collectio
|
|||||||
auto deckptr = parser.parseFile(fileName.toStdString(), parseContext);
|
auto deckptr = parser.parseFile(fileName.toStdString(), parseContext);
|
||||||
const Opm::Deck& deck = *deckptr;
|
const Opm::Deck& deck = *deckptr;
|
||||||
|
|
||||||
std::shared_ptr<Opm::GRIDSection> gridSection(std::make_shared<Opm::GRIDSection>(deck));
|
importFaults(deck, faults);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
errorMessage = e.what();
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
errorMessage = "Unknown exception throwm from Opm::Parser";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RifReaderOpmParserInput::importFaults(const Opm::Deck& deck, cvf::Collection<RigFault>& faults)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::string errorMessage;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
RigFault* fault = NULL;
|
RigFault* fault = NULL;
|
||||||
|
|
||||||
// The following is based on Opm::FaultCollection
|
// The following is based on Opm::FaultCollection
|
||||||
// Not possible to use this class, as the logic in ResInsight handles IJK-values instead
|
// Not possible to use this class, as the logic in ResInsight handles IJK-values instead
|
||||||
// of cell indices
|
// of cell indices
|
||||||
const auto& faultKeywords = gridSection->getKeywordList<Opm::ParserKeywords::FAULTS>();
|
const auto& faultKeywords = deck.getKeywordList<Opm::ParserKeywords::FAULTS>();
|
||||||
for (auto keyword_iter = faultKeywords.begin(); keyword_iter != faultKeywords.end(); ++keyword_iter) {
|
for (auto keyword_iter = faultKeywords.begin(); keyword_iter != faultKeywords.end(); ++keyword_iter) {
|
||||||
const auto& faultsKeyword = *keyword_iter;
|
const auto& faultsKeyword = *keyword_iter;
|
||||||
for (auto iter = faultsKeyword->begin(); iter != faultsKeyword->end(); ++iter) {
|
for (auto iter = faultsKeyword->begin(); iter != faultsKeyword->end(); ++iter) {
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ namespace Opm {
|
|||||||
class RifReaderOpmParserInput
|
class RifReaderOpmParserInput
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static void importGridPropertiesFaults(const QString& fileName, RigCaseData* eclipseCase);
|
||||||
static void importGridAndProperties(const QString& fileName, RigCaseData* eclipseCase, std::map<QString, QString>* mapFromResultNameToKeyword);
|
|
||||||
|
|
||||||
static void readFaults(const QString& fileName, cvf::Collection<RigFault>& faults);
|
static void readFaults(const QString& fileName, cvf::Collection<RigFault>& faults);
|
||||||
|
|
||||||
@@ -57,6 +56,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void importFaults(const Opm::Deck& deck, cvf::Collection<RigFault>& faults);
|
||||||
static std::vector<std::string> knownPropertyKeywords();
|
static std::vector<std::string> knownPropertyKeywords();
|
||||||
static std::vector<std::string> allParserConfigKeys();
|
static std::vector<std::string> allParserConfigKeys();
|
||||||
static size_t findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name);
|
static size_t findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name);
|
||||||
|
|||||||
@@ -113,9 +113,7 @@ void RimEclipseInputCaseOpm::importEclipseGridAndProperties(const QString& fileN
|
|||||||
{
|
{
|
||||||
this->setReservoirData(new RigCaseData);
|
this->setReservoirData(new RigCaseData);
|
||||||
|
|
||||||
std::map<QString, QString> mapUiNameToKeyword;
|
RifReaderOpmParserInput::importGridPropertiesFaults(fileName, reservoirData());
|
||||||
|
|
||||||
RifReaderOpmParserInput::importGridAndProperties(fileName, reservoirData(), &mapUiNameToKeyword);
|
|
||||||
|
|
||||||
if (this->reservoirData()->mainGrid() == NULL)
|
if (this->reservoirData()->mainGrid() == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user