mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6978 Fault Import : Make sure faults in separate text file is imported
This commit is contained in:
parent
5abf2b3b00
commit
f94cd760e5
@ -40,7 +40,8 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
void RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||||
RigEclipseCaseData* eclipseCaseData,
|
RigEclipseCaseData* eclipseCaseData,
|
||||||
const std::vector<QString>& filenames )
|
const std::vector<QString>& filenames,
|
||||||
|
bool allowImportOfFaults )
|
||||||
{
|
{
|
||||||
CVF_ASSERT( inputPropertyCollection );
|
CVF_ASSERT( inputPropertyCollection );
|
||||||
CVF_ASSERT( eclipseCaseData );
|
CVF_ASSERT( eclipseCaseData );
|
||||||
@ -65,6 +66,7 @@ void RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( RimEclipse
|
|||||||
eclipseCaseData,
|
eclipseCaseData,
|
||||||
filename,
|
filename,
|
||||||
isExistingFile,
|
isExistingFile,
|
||||||
|
allowImportOfFaults,
|
||||||
&fileKeywordSet,
|
&fileKeywordSet,
|
||||||
&progInfo,
|
&progInfo,
|
||||||
progress );
|
progress );
|
||||||
@ -105,22 +107,75 @@ bool RifEclipseInputPropertyLoader::readInputPropertiesFromFiles( RimEclipseInpu
|
|||||||
inputPropertyCollection->inputProperties.push_back( inputProperty );
|
inputPropertyCollection->inputProperties.push_back( inputProperty );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid importing faults from the input property files when faults already exists in
|
if ( importFaults )
|
||||||
// the eclipse case. Faults can theoretically appear in any of the files, but reading
|
|
||||||
// and appending them to the existing fault collection is not currently supported.
|
|
||||||
if ( importFaults && eclipseCaseData->mainGrid()->faults().empty() )
|
|
||||||
{
|
{
|
||||||
cvf::Collection<RigFault> faultCollection;
|
bool anyFaultsImported = importFaultsFromFile( eclipseCaseData, propertyFileName );
|
||||||
RifEclipseInputFileTools::parseAndReadFaults( propertyFileName, &faultCollection );
|
if ( anyFaultsImported )
|
||||||
|
|
||||||
if ( !faultCollection.empty() )
|
|
||||||
{
|
{
|
||||||
eclipseCaseData->mainGrid()->setFaults( faultCollection );
|
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
||||||
|
inputProperty->resultName = "FAULTS";
|
||||||
|
inputProperty->eclipseKeyword = "FAULTS";
|
||||||
|
inputProperty->fileName = propertyFileName;
|
||||||
|
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||||
|
inputPropertyCollection->inputProperties.push_back( inputProperty );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: seems a bit optimistic?
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RifEclipseInputPropertyLoader::importFaultsFromFile( RigEclipseCaseData* eclipseCaseData, const QString& fileName )
|
||||||
|
{
|
||||||
|
cvf::Collection<RigFault> faultCollectionFromFile;
|
||||||
|
RifEclipseInputFileTools::parseAndReadFaults( fileName, &faultCollectionFromFile );
|
||||||
|
if ( faultCollectionFromFile.empty() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cvf::Collection<RigFault> faults;
|
||||||
|
{
|
||||||
|
cvf::Collection<RigFault> faultCollection = eclipseCaseData->mainGrid()->faults();
|
||||||
|
for ( size_t i = 0; i < faultCollection.size(); i++ )
|
||||||
|
{
|
||||||
|
RigFault* f = faultCollection.at( i );
|
||||||
|
if ( f->name() == RiaDefines::undefinedGridFaultName() || f->name() == RiaDefines::undefinedGridFaultName() )
|
||||||
|
{
|
||||||
|
// Do not include undefined grid faults, as these are recomputed based on the imported faults from filesa
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
faults.push_back( f );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < faultCollectionFromFile.size(); i++ )
|
||||||
|
{
|
||||||
|
RigFault* faultFromFile = faultCollectionFromFile.at( i );
|
||||||
|
|
||||||
|
bool existFaultWithSameName = false;
|
||||||
|
for ( size_t j = 0; j < faults.size(); j++ )
|
||||||
|
{
|
||||||
|
RigFault* existingFault = faults.at( j );
|
||||||
|
|
||||||
|
if ( existingFault->name() == faultFromFile->name() )
|
||||||
|
{
|
||||||
|
existFaultWithSameName = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !existFaultWithSameName )
|
||||||
|
{
|
||||||
|
faults.push_back( faultFromFile );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eclipseCaseData->mainGrid()->setFaults( faults );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,9 +221,10 @@ void RifEclipseInputPropertyLoader::readDataForEachInputProperty( RimEclipseInpu
|
|||||||
RigEclipseCaseData* eclipseCaseData,
|
RigEclipseCaseData* eclipseCaseData,
|
||||||
const QString& filename,
|
const QString& filename,
|
||||||
bool isExistingFile,
|
bool isExistingFile,
|
||||||
std::set<QString>* fileKeywordSet,
|
bool allowImportOfFaults,
|
||||||
caf::ProgressInfo* progressInfo,
|
std::set<QString>* fileKeywordSet,
|
||||||
int progressOffset )
|
caf::ProgressInfo* progressInfo,
|
||||||
|
int progressOffset )
|
||||||
{
|
{
|
||||||
// Find the input property objects referring to the file
|
// Find the input property objects referring to the file
|
||||||
std::vector<RimEclipseInputProperty*> ipsUsingThisFile = inputPropertyCollection->findInputProperties( filename );
|
std::vector<RimEclipseInputProperty*> ipsUsingThisFile = inputPropertyCollection->findInputProperties( filename );
|
||||||
@ -186,14 +242,24 @@ void RifEclipseInputPropertyLoader::readDataForEachInputProperty( RimEclipseInpu
|
|||||||
inputProperty->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
|
inputProperty->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
|
||||||
|
|
||||||
QString kw = inputProperty->eclipseKeyword();
|
QString kw = inputProperty->eclipseKeyword();
|
||||||
if ( fileKeywordSet->count( kw ) )
|
if ( kw == "FAULTS" )
|
||||||
{
|
{
|
||||||
if ( RifEclipseInputFileTools::readProperty( filename, eclipseCaseData, kw, inputProperty->resultName ) )
|
if ( allowImportOfFaults )
|
||||||
{
|
{
|
||||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
importFaultsFromFile( eclipseCaseData, filename );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fileKeywordSet->erase( kw );
|
else
|
||||||
|
{
|
||||||
|
if ( fileKeywordSet->count( kw ) )
|
||||||
|
{
|
||||||
|
if ( RifEclipseInputFileTools::readProperty( filename, eclipseCaseData, kw, inputProperty->resultName ) )
|
||||||
|
{
|
||||||
|
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileKeywordSet->erase( kw );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
progressInfo->setProgress( static_cast<int>( progressOffset + progress ) );
|
progressInfo->setProgress( static_cast<int>( progressOffset + progress ) );
|
||||||
|
@ -42,13 +42,16 @@ class RifEclipseInputPropertyLoader
|
|||||||
public:
|
public:
|
||||||
static void loadAndSyncronizeInputProperties( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
static void loadAndSyncronizeInputProperties( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||||
RigEclipseCaseData* eclipseCaseData,
|
RigEclipseCaseData* eclipseCaseData,
|
||||||
const std::vector<QString>& filenames );
|
const std::vector<QString>& filenames,
|
||||||
|
bool allowImportOfFaults );
|
||||||
|
|
||||||
static bool readInputPropertiesFromFiles( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
static bool readInputPropertiesFromFiles( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||||
RigEclipseCaseData* eclipseCaseData,
|
RigEclipseCaseData* eclipseCaseData,
|
||||||
bool importFaults,
|
bool importFaults,
|
||||||
const std::vector<QString>& filenames );
|
const std::vector<QString>& filenames );
|
||||||
|
|
||||||
|
static bool importFaultsFromFile( RigEclipseCaseData* eclipseCase, const QString& fileName );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Hide constructor to prevent instantiation
|
// Hide constructor to prevent instantiation
|
||||||
RifEclipseInputPropertyLoader();
|
RifEclipseInputPropertyLoader();
|
||||||
@ -63,6 +66,7 @@ private:
|
|||||||
RigEclipseCaseData* eclipseCaseData,
|
RigEclipseCaseData* eclipseCaseData,
|
||||||
const QString& filename,
|
const QString& filename,
|
||||||
bool isExistingFile,
|
bool isExistingFile,
|
||||||
|
bool allowImportOfFaults,
|
||||||
std::set<QString>* fileKeywordSet,
|
std::set<QString>* fileKeywordSet,
|
||||||
caf::ProgressInfo* progressInfo,
|
caf::ProgressInfo* progressInfo,
|
||||||
int progressOffset );
|
int progressOffset );
|
||||||
|
@ -670,7 +670,7 @@ std::vector<QString> RimEclipseCase::additionalFiles() const
|
|||||||
/// Loads input property data from the gridFile and additional files
|
/// Loads input property data from the gridFile and additional files
|
||||||
/// Creates new InputProperties if necessary, and flags the unused ones as obsolete
|
/// Creates new InputProperties if necessary, and flags the unused ones as obsolete
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseCase::loadAndSyncronizeInputProperties( bool includeGridFileName )
|
void RimEclipseCase::loadAndSyncronizeInputProperties( bool importGridOrFaultData )
|
||||||
{
|
{
|
||||||
// Make sure we actually have reservoir data
|
// Make sure we actually have reservoir data
|
||||||
|
|
||||||
@ -685,9 +685,12 @@ void RimEclipseCase::loadAndSyncronizeInputProperties( bool includeGridFileName
|
|||||||
filenames.push_back( fileName );
|
filenames.push_back( fileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( includeGridFileName ) filenames.push_back( gridFileName() );
|
if ( importGridOrFaultData ) filenames.push_back( gridFileName() );
|
||||||
|
|
||||||
RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(), eclipseCaseData(), filenames );
|
RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(),
|
||||||
|
eclipseCaseData(),
|
||||||
|
filenames,
|
||||||
|
importGridOrFaultData );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
|
|
||||||
std::set<QString> sortedSimWellNames() const;
|
std::set<QString> sortedSimWellNames() const;
|
||||||
|
|
||||||
void loadAndSyncronizeInputProperties( bool includeGridFileName );
|
void loadAndSyncronizeInputProperties( bool importGridOrFaultData );
|
||||||
|
|
||||||
void ensureFaultDataIsComputed();
|
void ensureFaultDataIsComputed();
|
||||||
bool ensureNncDataIsComputed();
|
bool ensureNncDataIsComputed();
|
||||||
|
@ -177,6 +177,12 @@ bool RimEclipseInputCase::openDataFileSet( const QStringList& fileNames )
|
|||||||
this->eclipseCaseData(),
|
this->eclipseCaseData(),
|
||||||
importFaults,
|
importFaults,
|
||||||
filesToRead );
|
filesToRead );
|
||||||
|
|
||||||
|
if ( importFaults )
|
||||||
|
{
|
||||||
|
this->ensureFaultDataIsComputed();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,8 +221,8 @@ bool RimEclipseInputCase::openEclipseGridFile()
|
|||||||
|
|
||||||
this->eclipseCaseData()->mainGrid()->setFlipAxis( m_flipXAxis, m_flipYAxis );
|
this->eclipseCaseData()->mainGrid()->setFlipAxis( m_flipXAxis, m_flipYAxis );
|
||||||
|
|
||||||
computeCachedData();
|
|
||||||
loadAndSyncronizeInputProperties( true );
|
loadAndSyncronizeInputProperties( true );
|
||||||
|
computeCachedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
Loading…
Reference in New Issue
Block a user