mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Search for Eclipse data in project file folder in addition to the given case folder.
This allows for copy of a folder containing a project file and related Eclipse data p4#: 20437
This commit is contained in:
parent
cdd5997f76
commit
942cccfdcb
@ -25,6 +25,7 @@
|
|||||||
#include "RifReaderMockModel.h"
|
#include "RifReaderMockModel.h"
|
||||||
#include "RifReaderEclipseInput.h"
|
#include "RifReaderEclipseInput.h"
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimResultReservoir, "EclipseCase");
|
CAF_PDM_SOURCE_INIT(RimResultReservoir, "EclipseCase");
|
||||||
@ -82,19 +83,11 @@ bool RimResultReservoir::openEclipseGridFile()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString fullCaseName = caseName + ".EGRID";
|
QString fname = createAbsoluteFilenameFromCase(caseName);
|
||||||
|
if (fname.isEmpty())
|
||||||
QDir dir(caseDirectory.v());
|
|
||||||
if (!dir.exists(fullCaseName))
|
|
||||||
{
|
|
||||||
fullCaseName = caseName + ".GRID";
|
|
||||||
if (!dir.exists(fullCaseName))
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QString fname = dir.absoluteFilePath(fullCaseName);
|
|
||||||
|
|
||||||
RigReservoir* reservoir = new RigReservoir;
|
RigReservoir* reservoir = new RigReservoir;
|
||||||
readerInterface = new RifReaderEclipseOutput;
|
readerInterface = new RifReaderEclipseOutput;
|
||||||
@ -213,3 +206,43 @@ QString RimResultReservoir::locationOnDisc() const
|
|||||||
return caseDirectory;
|
return caseDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimResultReservoir::createAbsoluteFilenameFromCase(const QString& caseName)
|
||||||
|
{
|
||||||
|
QString candidate;
|
||||||
|
|
||||||
|
candidate = QDir::fromNativeSeparators(caseDirectory.v() + QDir::separator() + caseName + ".EGRID");
|
||||||
|
if (QFile::exists(candidate)) return candidate;
|
||||||
|
|
||||||
|
candidate = QDir::fromNativeSeparators(caseDirectory.v() + QDir::separator() + caseName + ".GRID");
|
||||||
|
if (QFile::exists(candidate)) return candidate;
|
||||||
|
|
||||||
|
std::vector<caf::PdmObject*> parentObjects;
|
||||||
|
this->parentObjects(parentObjects);
|
||||||
|
|
||||||
|
QString projectPath;
|
||||||
|
for (size_t i = 0; i < parentObjects.size(); i++)
|
||||||
|
{
|
||||||
|
caf::PdmObject* obj = parentObjects[i];
|
||||||
|
RimProject* proj = dynamic_cast<RimProject*>(obj);
|
||||||
|
if (proj)
|
||||||
|
{
|
||||||
|
QFileInfo fi(proj->fileName);
|
||||||
|
projectPath = fi.path();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!projectPath.isEmpty())
|
||||||
|
{
|
||||||
|
candidate = QDir::fromNativeSeparators(projectPath + QDir::separator() + caseName + ".EGRID");
|
||||||
|
if (QFile::exists(candidate)) return candidate;
|
||||||
|
|
||||||
|
candidate = QDir::fromNativeSeparators(projectPath + QDir::separator() + caseName + ".GRID");
|
||||||
|
if (QFile::exists(candidate)) return candidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -53,4 +53,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||||
|
|
||||||
|
QString createAbsoluteFilenameFromCase(const QString& caseName);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user