mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2122 Formation/Well Path: Add new reader. Same pattern as WellPathFile
This commit is contained in:
parent
800ac30d81
commit
7e28039ffd
@ -39,7 +39,8 @@ ${CEE_CURRENT_LIST_DIR}RifDataSourceForRftPltQMetaType.h
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseUserDataKeywordTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RifCsvUserData.h
|
||||
${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.h
|
||||
${CEE_CURRENT_LIST_DIR}RifWellFormationReader.h
|
||||
${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.h
|
||||
${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.h
|
||||
# HDF5 file reader is directly included in ResInsight main CmakeList.txt
|
||||
#${CEE_CURRENT_LIST_DIR}RifHdf5Reader.h
|
||||
)
|
||||
@ -83,7 +84,8 @@ ${CEE_CURRENT_LIST_DIR}RifDataSourceForRftPlt.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseUserDataKeywordTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifCsvUserData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifCsvUserDataParser.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifWellFormationReader.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifWellPathFormationReader.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifWellPathFormationsImporter.cpp
|
||||
|
||||
# HDF5 file reader is directly included in ResInsight main CmakeList.txt
|
||||
#${CEE_CURRENT_LIST_DIR}RifHdf5Reader.cpp
|
||||
|
@ -16,41 +16,49 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifWellFormationReader.h"
|
||||
#include "RifWellPathFormationReader.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QStringList>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, std::vector<RifWellFormation> > RifWellFormationReader::readWellFormations(const QStringList& filePaths)
|
||||
std::map<QString, std::vector<std::pair<double, QString>>> RifWellPathFormationReader::readWellFormations(const QString& filePath)
|
||||
{
|
||||
std::map<QString, std::vector<RifWellFormation>> formations;
|
||||
std::map<QString, std::vector<std::pair<double, QString>>> formations;
|
||||
|
||||
foreach (QString filePath, filePaths)
|
||||
readFileIntoMap(filePath, &formations);
|
||||
|
||||
return formations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, cvf::ref<RigWellPathFormations>> RifWellPathFormationReader::readWellFormationsToGeometry(const QString& filePath)
|
||||
{
|
||||
std::map<QString, cvf::ref<RigWellPathFormations>> result;
|
||||
|
||||
std::map<QString, std::vector<std::pair<double, QString>>> formations;
|
||||
|
||||
readFileIntoMap(filePath, &formations);
|
||||
|
||||
std::map<QString, std::vector<std::pair<double, QString>>>::iterator it;
|
||||
|
||||
for (it = formations.begin(); it != formations.end(); it++)
|
||||
{
|
||||
readFileIntoMap(filePath, &formations);
|
||||
cvf::ref<RigWellPathFormations> wellPathFormations = new RigWellPathFormations(it->second);
|
||||
result[it->first] = wellPathFormations;
|
||||
}
|
||||
|
||||
return formations;
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, std::vector<RifWellFormation> > RifWellFormationReader::readWellFormations(const QString& filePath)
|
||||
{
|
||||
std::map<QString, std::vector<RifWellFormation> > formations;
|
||||
|
||||
readFileIntoMap(filePath, &formations);
|
||||
|
||||
return formations;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifWellFormationReader::readFileIntoMap(const QString& filePath, std::map<QString, std::vector<RifWellFormation>>* formations)
|
||||
void RifWellPathFormationReader::readFileIntoMap(const QString& filePath,
|
||||
std::map<QString, std::vector<std::pair<double, QString>>>* formations)
|
||||
{
|
||||
QFile data(filePath);
|
||||
|
||||
@ -81,15 +89,19 @@ void RifWellFormationReader::readFileIntoMap(const QString& filePath, std::map<Q
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
QString line = data.readLine();
|
||||
|
||||
QStringList dataLine = line.split(';', QString::KeepEmptyParts);
|
||||
if (dataLine.size() != header.size()) continue;
|
||||
if (dataLine.size() != header.size())
|
||||
continue;
|
||||
|
||||
RifWellFormation formation(dataLine[wellNameIndex], dataLine[surfaceNameIndex], dataLine[measuredDepthIndex].toDouble());
|
||||
QString wellName = dataLine[wellNameIndex];
|
||||
QString surfaceName = dataLine[surfaceNameIndex];
|
||||
double measuredDepth = dataLine[measuredDepthIndex].toDouble();
|
||||
|
||||
(*formations)[formation.wellName].push_back(formation);
|
||||
(*formations)[wellName].push_back(std::make_pair(measuredDepth, surfaceName));
|
||||
|
||||
} while (!data.atEnd());
|
||||
}
|
@ -18,30 +18,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigWellPathFormations.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include <QStringList>
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
struct RifWellFormation
|
||||
{
|
||||
RifWellFormation(QString wellName, QString surfaceName, double measuredDepth)
|
||||
:wellName(wellName), surfaceName(surfaceName), measuredDepth(measuredDepth) {};
|
||||
|
||||
QString wellName;
|
||||
QString surfaceName;
|
||||
double measuredDepth;
|
||||
};
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifWellFormationReader
|
||||
class RifWellPathFormationReader
|
||||
{
|
||||
public:
|
||||
static std::map<QString, std::vector<RifWellFormation> > readWellFormations(const QStringList& filePaths);
|
||||
static std::map<QString, std::vector<RifWellFormation> > readWellFormations(const QString& filePath);
|
||||
static std::map<QString, std::vector<std::pair<double, QString>> > readWellFormations(const QString& filePath);
|
||||
static std::map<QString, cvf::ref<RigWellPathFormations> > readWellFormationsToGeometry(const QString& filePath);
|
||||
|
||||
private:
|
||||
static void readFileIntoMap(const QString& filePath, std::map<QString, std::vector<RifWellFormation> >* formations);
|
||||
static void readFileIntoMap(const QString& filePath, std::map<QString, std::vector<std::pair<double, QString>> >* formations);
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifWellPathFormationsImporter.h"
|
||||
#include "RifWellPathFormationReader.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigWellPathFormations> RifWellPathFormationsImporter::readWellPathFormations(const QString& formationFilePath,
|
||||
const QString& wellName)
|
||||
{
|
||||
readAllWellPathFormations(formationFilePath);
|
||||
return m_fileNameToWellPathFormationMap[formationFilePath][wellName];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifWellPathFormationsImporter::readAllWellPathFormations(const QString& filePath)
|
||||
{
|
||||
// If we have the file in the map, assume it is already read.
|
||||
if (m_fileNameToWellPathFormationMap.find(filePath) != m_fileNameToWellPathFormationMap.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<QString, cvf::ref<RigWellPathFormations>> wellPathToFormationMap =
|
||||
RifWellPathFormationReader::readWellFormationsToGeometry(filePath);
|
||||
|
||||
m_fileNameToWellPathFormationMap[filePath] = wellPathToFormationMap;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil 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 "RigWellPathFormations.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifWellPathFormationsImporter
|
||||
{
|
||||
public:
|
||||
cvf::ref<RigWellPathFormations> readWellPathFormations(const QString& formationFilePath, const QString& wellName);
|
||||
|
||||
private:
|
||||
void readAllWellPathFormations(const QString& filePath);
|
||||
|
||||
std::map<QString /*filename*/, std::map<QString /*wellName*/, cvf::ref<RigWellPathFormations>>>
|
||||
m_fileNameToWellPathFormationMap;
|
||||
};
|
@ -65,6 +65,7 @@ ${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.h
|
||||
${CEE_CURRENT_LIST_DIR}RigNumberOfFloodedPoreVolumesCalculator.h
|
||||
${CEE_CURRENT_LIST_DIR}RigWeightedMeanCalc.h
|
||||
${CEE_CURRENT_LIST_DIR}RigTimeHistoryCurveMerger.h
|
||||
${CEE_CURRENT_LIST_DIR}RigWellPathFormations.h
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
@ -136,6 +137,7 @@ ${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigNumberOfFloodedPoreVolumesCalculator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigWeightedMeanCalc.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigTimeHistoryCurveMerger.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigWellPathFormations.cpp
|
||||
)
|
||||
|
||||
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
|
37
ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp
Normal file
37
ApplicationCode/ReservoirDataModel/RigWellPathFormations.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigWellPathFormations.h"
|
||||
|
||||
#include "RifWellPathFormationReader.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellPathFormations::RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames)
|
||||
{
|
||||
m_measuredDepthAndFormationNames = measuredDepthAndFormationNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigWellPathFormations::wellName() const
|
||||
{
|
||||
return m_wellName;
|
||||
}
|
41
ApplicationCode/ReservoirDataModel/RigWellPathFormations.h
Normal file
41
ApplicationCode/ReservoirDataModel/RigWellPathFormations.h
Normal file
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil 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 "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <QString>
|
||||
#include <utility>
|
||||
|
||||
class RigWellPathFormations : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames);
|
||||
|
||||
QString wellName() const;
|
||||
|
||||
private:
|
||||
QString m_wellName;
|
||||
|
||||
std::vector<std::pair<double, QString>> m_measuredDepthAndFormationNames;
|
||||
};
|
Loading…
Reference in New Issue
Block a user