mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2122 Formation/Well Path: Set formations path and key on RimWellPath
This commit is contained in:
@@ -799,7 +799,10 @@ void RiaApplication::addWellPathFormationsToModel(QList<QString> wellPathFormati
|
|||||||
m_project->updateConnectedEditors();
|
m_project->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oilField->wellPathCollection) oilField->wellPathCollection->addWellFormations(wellPathFormationsFilePaths);
|
if (oilField->wellPathCollection)
|
||||||
|
{
|
||||||
|
oilField->wellPathCollection->addWellPathFormations(wellPathFormationsFilePaths);
|
||||||
|
}
|
||||||
|
|
||||||
oilField->wellPathCollection->updateConnectedEditors();
|
oilField->wellPathCollection->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ std::map<QString, std::vector<std::pair<double, QString>>> RifWellPathFormationR
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::map<QString, cvf::ref<RigWellPathFormations>> RifWellPathFormationReader::readWellFormationsToGeometry(const QString& filePath)
|
std::map<QString, cvf::ref<RigWellPathFormations>>
|
||||||
|
RifWellPathFormationReader::readWellFormationsToGeometry(const QString& filePath)
|
||||||
{
|
{
|
||||||
std::map<QString, cvf::ref<RigWellPathFormations>> result;
|
std::map<QString, cvf::ref<RigWellPathFormations>> result;
|
||||||
|
|
||||||
@@ -48,9 +49,10 @@ std::map<QString, cvf::ref<RigWellPathFormations>> RifWellPathFormationReader::r
|
|||||||
|
|
||||||
for (it = formations.begin(); it != formations.end(); it++)
|
for (it = formations.begin(); it != formations.end(); it++)
|
||||||
{
|
{
|
||||||
cvf::ref<RigWellPathFormations> wellPathFormations = new RigWellPathFormations(it->second);
|
cvf::ref<RigWellPathFormations> wellPathFormations = new RigWellPathFormations(it->second, filePath, it->first);
|
||||||
result[it->first] = wellPathFormations;
|
result[it->first] = wellPathFormations;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,33 @@ cvf::ref<RigWellPathFormations> RifWellPathFormationsImporter::readWellPathForma
|
|||||||
const QString& wellName)
|
const QString& wellName)
|
||||||
{
|
{
|
||||||
readAllWellPathFormations(formationFilePath);
|
readAllWellPathFormations(formationFilePath);
|
||||||
return m_fileNameToWellPathFormationMap[formationFilePath][wellName];
|
if (m_fileNameToWellPathFormationMap[formationFilePath].find(wellName) != m_fileNameToWellPathFormationMap[formationFilePath].end())
|
||||||
|
{
|
||||||
|
return m_fileNameToWellPathFormationMap[formationFilePath][wellName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::map<QString, cvf::ref<RigWellPathFormations>> RifWellPathFormationsImporter::readWellPathFormationsFromPath(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 m_fileNameToWellPathFormationMap[filePath];
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<QString, cvf::ref<RigWellPathFormations>> wellPathToFormationMap =
|
||||||
|
RifWellPathFormationReader::readWellFormationsToGeometry(filePath);
|
||||||
|
|
||||||
|
m_fileNameToWellPathFormationMap[filePath] = wellPathToFormationMap;
|
||||||
|
|
||||||
|
return wellPathToFormationMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class RifWellPathFormationsImporter
|
|||||||
public:
|
public:
|
||||||
cvf::ref<RigWellPathFormations> readWellPathFormations(const QString& formationFilePath, const QString& wellName);
|
cvf::ref<RigWellPathFormations> readWellPathFormations(const QString& formationFilePath, const QString& wellName);
|
||||||
|
|
||||||
|
std::map<QString, cvf::ref<RigWellPathFormations>> readWellPathFormationsFromPath(const QString& filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readAllWellPathFormations(const QString& filePath);
|
void readAllWellPathFormations(const QString& filePath);
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ RimWellPath::RimWellPath()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_unitSystem, "UnitSystem", "Unit System", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_unitSystem, "UnitSystem", "Unit System", "", "", "");
|
||||||
m_unitSystem.uiCapability()->setUiReadOnly(true);
|
m_unitSystem.uiCapability()->setUiReadOnly(true);
|
||||||
|
|
||||||
CAF_PDM_InitField(&filepath, "WellPathFilepath", QString(""), "Filepath", "", "", "");
|
CAF_PDM_InitField(&filepath, "WellPathFilepath", QString(""), "File Path", "", "", "");
|
||||||
filepath.uiCapability()->setUiReadOnly(true);
|
filepath.uiCapability()->setUiReadOnly(true);
|
||||||
CAF_PDM_InitField(&wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in file", "", "", "");
|
CAF_PDM_InitField(&wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in file", "", "", "");
|
||||||
wellPathIndexInFile.uiCapability()->setUiReadOnly(true);
|
wellPathIndexInFile.uiCapability()->setUiReadOnly(true);
|
||||||
@@ -129,11 +129,17 @@ RimWellPath::RimWellPath()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_wellLogFiles, "WellLogFiles", "Well Log Files", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_wellLogFiles, "WellLogFiles", "Well Log Files", "", "", "");
|
||||||
m_wellLogFiles.uiCapability()->setUiTreeHidden(true);
|
m_wellLogFiles.uiCapability()->setUiTreeHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_formationKeyInFile, "WellPathFormationKeyInFile", QString(""), "Key in File", "", "", "");
|
||||||
|
m_formationKeyInFile.uiCapability()->setUiReadOnly(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_wellPathFormationFilePath, "WellPathFormationFilePath", QString(""), "File Path", "", "", "");
|
||||||
|
m_wellPathFormationFilePath.uiCapability()->setUiReadOnly(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_wellLogFile_OBSOLETE, "WellLogFile", "Well Log File", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_wellLogFile_OBSOLETE, "WellLogFile", "Well Log File", "", "", "");
|
||||||
m_wellLogFile_OBSOLETE.uiCapability()->setUiHidden(true);
|
m_wellLogFile_OBSOLETE.uiCapability()->setUiHidden(true);
|
||||||
m_wellLogFile_OBSOLETE.xmlCapability()->setIOWritable(false);
|
m_wellLogFile_OBSOLETE.xmlCapability()->setIOWritable(false);
|
||||||
|
|
||||||
m_wellPath = NULL;
|
m_wellPath = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -489,6 +495,10 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
|
|||||||
m_datumElevation.uiCapability()->setUiHidden(true);
|
m_datumElevation.uiCapability()->setUiHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caf::PdmUiGroup* formationFileInfoGroup = uiOrdering.addNewGroup("Formation Names");
|
||||||
|
formationFileInfoGroup->add(&m_wellPathFormationFilePath);
|
||||||
|
formationFileInfoGroup->add(&m_formationKeyInFile);
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,7 +606,7 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filepath = RimTools::relocateFile(filepath(), newProjectPath, oldProjectPath, NULL, NULL);
|
filepath = RimTools::relocateFile(filepath(), newProjectPath, oldProjectPath, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,17 +691,13 @@ void RimWellPath::detachWellLogFile(RimWellLogFile* logFileInfo)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellPath::setWellFormationFile(const QString& formationFilePath)
|
void RimWellPath::setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations)
|
||||||
{
|
{
|
||||||
m_wellPathFormationFilePath = formationFilePath;
|
m_wellPathFormations = wellPathFormations;
|
||||||
}
|
m_wellPathFormationFilePath = wellPathFormations->filePath();
|
||||||
|
m_formationKeyInFile = wellPathFormations->keyInFile();
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
updateConnectedEditors();
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimWellPath::wellFormationFile() const
|
|
||||||
{
|
|
||||||
return m_wellPathFormationFilePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -699,9 +705,18 @@ QString RimWellPath::wellFormationFile() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimWellPath::readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter)
|
bool RimWellPath::readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter)
|
||||||
{
|
{
|
||||||
|
if (m_wellPathFormationFilePath().isEmpty())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (caf::Utils::fileExists(m_wellPathFormationFilePath()))
|
if (caf::Utils::fileExists(m_wellPathFormationFilePath()))
|
||||||
{
|
{
|
||||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations(m_wellPathFormationFilePath(), m_name());
|
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations(m_wellPathFormationFilePath(), m_formationKeyInFile());
|
||||||
|
if (m_name().isEmpty())
|
||||||
|
{
|
||||||
|
setName(m_formationKeyInFile());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ public:
|
|||||||
void deleteWellLogFile(RimWellLogFile* logFileInfo);
|
void deleteWellLogFile(RimWellLogFile* logFileInfo);
|
||||||
void detachWellLogFile(RimWellLogFile* logFileInfo);
|
void detachWellLogFile(RimWellLogFile* logFileInfo);
|
||||||
|
|
||||||
void setWellFormationFile(const QString& formationFilePath);
|
void setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations);
|
||||||
QString wellFormationFile() const;
|
|
||||||
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
|
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
|
||||||
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
@@ -167,6 +166,8 @@ private:
|
|||||||
cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr;
|
cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr;
|
||||||
caf::PdmField<QString> m_name;
|
caf::PdmField<QString> m_name;
|
||||||
|
|
||||||
|
caf::PdmField<QString> m_formationKeyInFile;
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
|
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
|
||||||
|
|
||||||
caf::PdmField<QString> m_wellPathFormationFilePath;
|
caf::PdmField<QString> m_wellPathFormationFilePath;
|
||||||
|
|||||||
@@ -330,29 +330,27 @@ RimWellLogFile* RimWellPathCollection::addWellLogs(const QStringList& filePaths)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellPathFormations* RimWellPathCollection::addWellFormations(const QStringList& filePaths)
|
void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths)
|
||||||
{
|
{
|
||||||
RimWellPathFormations* wellFormationFile = nullptr;
|
for (QString filePath : filePaths)
|
||||||
/*
|
|
||||||
foreach(QString filePath, filePaths)
|
|
||||||
{
|
{
|
||||||
wellFormationFile = RimWellPathFormations::readWellLogFile(filePath);
|
std::map<QString, cvf::ref<RigWellPathFormations>> newFormations =
|
||||||
if (wellFormationFile)
|
m_wellPathFormationsImporter->readWellPathFormationsFromPath(filePath);
|
||||||
|
|
||||||
|
for (auto it = newFormations.begin(); it != newFormations.end(); it++)
|
||||||
{
|
{
|
||||||
RimWellPath* wellPath = tryFindMatchingWellPath(wellFormationFile->wellName());
|
RimWellPath* wellPath = tryFindMatchingWellPath(it->first);
|
||||||
if (!wellPath)
|
if (!wellPath)
|
||||||
{
|
{
|
||||||
wellPath = new RimWellPath();
|
wellPath = new RimWellPath();
|
||||||
|
wellPath->setName(it->first);
|
||||||
wellPaths.push_back(wellPath);
|
wellPaths.push_back(wellPath);
|
||||||
}
|
}
|
||||||
|
wellPath->setFormationsGeometry(it->second);
|
||||||
wellPath->setWellFormationFile(wellFormationFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->sortWellsByName();*/
|
this->sortWellsByName();
|
||||||
|
|
||||||
return wellFormationFile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -503,15 +501,12 @@ void RimWellPathCollection::readWellPathFormationFiles()
|
|||||||
|
|
||||||
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
||||||
{
|
{
|
||||||
if (!wellPaths[wpIdx]->filepath().isEmpty())
|
QString errorMessage;
|
||||||
|
if (!wellPaths[wpIdx]->readWellPathFormationsFile(&errorMessage, m_wellPathFormationsImporter))
|
||||||
{
|
{
|
||||||
QString errorMessage;
|
QMessageBox::warning(RiuMainWindow::instance(),
|
||||||
if (!wellPaths[wpIdx]->readWellPathFormationsFile(&errorMessage, m_wellPathFormationsImporter))
|
"File open error",
|
||||||
{
|
errorMessage);
|
||||||
QMessageBox::warning(RiuMainWindow::instance(),
|
|
||||||
"File open error",
|
|
||||||
errorMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.setProgressDescription(QString("Reading formation file %1").arg(wpIdx));
|
progress.setProgressDescription(QString("Reading formation file %1").arg(wpIdx));
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class RimEclipseView;
|
|||||||
class RimProject;
|
class RimProject;
|
||||||
class RimWellLogFile;
|
class RimWellLogFile;
|
||||||
class RimWellPath;
|
class RimWellPath;
|
||||||
class RimWellPathFormations;
|
|
||||||
class RifWellPathFormationsImporter;
|
class RifWellPathFormationsImporter;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
@@ -102,7 +101,7 @@ public:
|
|||||||
RimWellPath* tryFindMatchingWellPath(const QString& wellName) const;
|
RimWellPath* tryFindMatchingWellPath(const QString& wellName) const;
|
||||||
void addWellPaths(const std::vector<RimWellPath*> wellPaths);
|
void addWellPaths(const std::vector<RimWellPath*> wellPaths);
|
||||||
RimWellLogFile* addWellLogs(const QStringList& filePaths);
|
RimWellLogFile* addWellLogs(const QStringList& filePaths);
|
||||||
RimWellPathFormations* addWellFormations(const QStringList& filePaths);
|
void addWellPathFormations(const QStringList& filePaths);
|
||||||
|
|
||||||
void scheduleRedrawAffectedViews();
|
void scheduleRedrawAffectedViews();
|
||||||
|
|
||||||
|
|||||||
@@ -18,20 +18,28 @@
|
|||||||
|
|
||||||
#include "RigWellPathFormations.h"
|
#include "RigWellPathFormations.h"
|
||||||
|
|
||||||
#include "RifWellPathFormationReader.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigWellPathFormations::RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames)
|
RigWellPathFormations::RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames, const QString& filePath, const QString& key)
|
||||||
{
|
{
|
||||||
m_measuredDepthAndFormationNames = measuredDepthAndFormationNames;
|
m_measuredDepthAndFormationNames = measuredDepthAndFormationNames;
|
||||||
|
m_filePath = filePath;
|
||||||
|
m_keyInFile = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RigWellPathFormations::wellName() const
|
QString RigWellPathFormations::filePath() const
|
||||||
{
|
{
|
||||||
return m_wellName;
|
return m_filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RigWellPathFormations::keyInFile() const
|
||||||
|
{
|
||||||
|
return m_keyInFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,14 @@
|
|||||||
class RigWellPathFormations : public cvf::Object
|
class RigWellPathFormations : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames);
|
RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames, const QString& filePath, const QString& key);
|
||||||
|
|
||||||
QString wellName() const;
|
QString filePath() const;
|
||||||
|
QString keyInFile() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_wellName;
|
QString m_filePath;
|
||||||
|
QString m_keyInFile;
|
||||||
|
|
||||||
std::vector<std::pair<double, QString>> m_measuredDepthAndFormationNames;
|
std::vector<std::pair<double, QString>> m_measuredDepthAndFormationNames;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user