mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-31 17:17:50 -05:00
Improve LGR data structures and UI
Use term refinement from GUI to export code Improve naming of variables
This commit is contained in:
1 parent
da741b16ac
commit
3ff9ac3336
6 files changed
+104
-110
No files matched your search
@@ -370,9 +370,9 @@ void RicExportLgrFeature::writeLgrs( QTextStream& stream, const std::vector<LgrI
|
||||
formatter.addOneBasedCellIndex( lgrInfo.mainGridEndCell.j() );
|
||||
formatter.addOneBasedCellIndex( lgrInfo.mainGridStartCell.k() );
|
||||
formatter.addOneBasedCellIndex( lgrInfo.mainGridEndCell.k() );
|
||||
formatter.add( lgrInfo.sizes.i() );
|
||||
formatter.add( lgrInfo.sizes.j() );
|
||||
formatter.add( lgrInfo.sizes.k() );
|
||||
formatter.add( lgrInfo.lgrCellCounts().i() );
|
||||
formatter.add( lgrInfo.lgrCellCounts().j() );
|
||||
formatter.add( lgrInfo.lgrCellCounts().k() );
|
||||
formatter.rowCompleted();
|
||||
formatter.tableCompleted( "", false );
|
||||
}
|
||||
@@ -392,14 +392,14 @@ void RicExportLgrFeature::exportLgrsForWellPaths( const QString&
|
||||
std::vector<RimWellPath*> wellPaths,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
caf::VecIjk refinement,
|
||||
Lgr::SplitType splitType,
|
||||
const std::set<RigCompletionData::CompletionType>& completionTypes,
|
||||
QStringList* wellsIntersectingOtherLgrs )
|
||||
{
|
||||
std::vector<LgrInfo> lgrs;
|
||||
|
||||
lgrs = buildLgrsForWellPaths( wellPaths, eclipseCase, timeStep, lgrCellCounts, splitType, completionTypes, wellsIntersectingOtherLgrs );
|
||||
lgrs = buildLgrsForWellPaths( wellPaths, eclipseCase, timeStep, refinement, splitType, completionTypes, wellsIntersectingOtherLgrs );
|
||||
|
||||
for ( const auto& wellPath : wellPaths )
|
||||
{
|
||||
@@ -441,7 +441,7 @@ void RicExportLgrFeature::exportLgrs( const QString& exportFolder, const QString
|
||||
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPaths( std::vector<RimWellPath*> wellPaths,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
caf::VecIjk refinement,
|
||||
Lgr::SplitType splitType,
|
||||
const std::set<RigCompletionData::CompletionType>& completionTypes,
|
||||
QStringList* wellsIntersectingOtherLgrs )
|
||||
@@ -468,7 +468,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPaths( std::vector<Rim
|
||||
}
|
||||
|
||||
auto newLgrs =
|
||||
buildLgrsPerMainCell( firstLgrId + (int)lgrs.size(), eclipseCase, wellPath, intersectingCells, lgrCellCounts, lgrNameFactory );
|
||||
buildLgrsPerMainCell( firstLgrId + (int)lgrs.size(), eclipseCase, wellPath, intersectingCells, refinement, lgrNameFactory );
|
||||
|
||||
lgrs.insert( lgrs.end(), newLgrs.begin(), newLgrs.end() );
|
||||
if ( isIntersectingOtherLgrs ) wellsIntersectingOtherLgrs->push_back( wellPath->name() );
|
||||
@@ -480,8 +480,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPaths( std::vector<Rim
|
||||
cellsIntersectingCompletions_PerCompletion( eclipseCase, wellPaths, timeStep, completionTypes, wellsIntersectingOtherLgrs );
|
||||
if ( !intersectingCells.empty() )
|
||||
{
|
||||
auto newLgrs =
|
||||
buildLgrsPerCompletion( firstLgrId + (int)lgrs.size(), eclipseCase, intersectingCells, lgrCellCounts, lgrNameFactory );
|
||||
auto newLgrs = buildLgrsPerCompletion( firstLgrId + (int)lgrs.size(), eclipseCase, intersectingCells, refinement, lgrNameFactory );
|
||||
lgrs.insert( lgrs.end(), newLgrs.begin(), newLgrs.end() );
|
||||
}
|
||||
}
|
||||
@@ -502,7 +501,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPaths( std::vector<Rim
|
||||
|
||||
if ( !intersectingCells.empty() )
|
||||
{
|
||||
lgrs.push_back( buildLgr( lgrId, lgrName, eclipseCase, wellPath->name(), intersectingCells, lgrCellCounts ) );
|
||||
lgrs.push_back( buildLgr( lgrId, lgrName, wellPath->name(), intersectingCells, refinement ) );
|
||||
}
|
||||
|
||||
if ( isIntersectingOtherLgrs ) wellsIntersectingOtherLgrs->push_back( wellPath->name() );
|
||||
@@ -519,7 +518,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell( int
|
||||
RimEclipseCase* eclipseCase,
|
||||
RimWellPath* wellPath,
|
||||
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
||||
const caf::VecIjk& lgrSizes,
|
||||
const caf::VecIjk& refinement,
|
||||
LgrNameFactory& lgrNameFactory )
|
||||
{
|
||||
std::vector<LgrInfo> lgrs;
|
||||
@@ -527,7 +526,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell( int
|
||||
for ( const auto& intersectionCell : intersectingCells )
|
||||
{
|
||||
auto lgrName = lgrNameFactory.newName( "", lgrId );
|
||||
lgrs.push_back( buildLgr( lgrId++, lgrName, eclipseCase, wellPath->name(), { intersectionCell }, lgrSizes ) );
|
||||
lgrs.push_back( buildLgr( lgrId++, lgrName, wellPath->name(), { intersectionCell }, refinement ) );
|
||||
}
|
||||
return lgrs;
|
||||
}
|
||||
@@ -539,8 +538,8 @@ std::vector<LgrInfo>
|
||||
RicExportLgrFeature::buildLgrsPerCompletion( int firstLgrId,
|
||||
RimEclipseCase* eclipseCase,
|
||||
const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& completionInfo,
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell,
|
||||
LgrNameFactory& lgrNameFactory )
|
||||
const caf::VecIjk& refinement,
|
||||
LgrNameFactory& lgrNameFactory )
|
||||
{
|
||||
std::vector<LgrInfo> lgrs;
|
||||
|
||||
@@ -593,7 +592,7 @@ std::vector<LgrInfo>
|
||||
for ( auto complInfo : occupiedBbs )
|
||||
{
|
||||
auto lgrName = lgrNameFactory.newName( complInfo.first.type );
|
||||
lgrs.push_back( buildLgr( lgrId++, lgrName, eclipseCase, complInfo.first.wellPathName, complInfo.second, lgrSizesPerMainGridCell ) );
|
||||
lgrs.push_back( buildLgr( lgrId++, lgrName, complInfo.first.wellPathName, complInfo.second, refinement ) );
|
||||
}
|
||||
return lgrs;
|
||||
}
|
||||
@@ -603,31 +602,17 @@ std::vector<LgrInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
LgrInfo RicExportLgrFeature::buildLgr( int lgrId,
|
||||
const QString& lgrName,
|
||||
RimEclipseCase* eclipseCase,
|
||||
const QString& wellPathName,
|
||||
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell )
|
||||
const caf::VecIjk& refinement )
|
||||
{
|
||||
// Find min and max IJK
|
||||
auto iRange = initRange();
|
||||
auto jRange = initRange();
|
||||
auto kRange = initRange();
|
||||
|
||||
IjkBoundingBox boundingBox;
|
||||
for ( const auto& cell : intersectingCells )
|
||||
{
|
||||
iRange.first = std::min( cell.localCellIndexI(), iRange.first );
|
||||
iRange.second = std::max( cell.localCellIndexI(), iRange.second );
|
||||
jRange.first = std::min( cell.localCellIndexJ(), jRange.first );
|
||||
jRange.second = std::max( cell.localCellIndexJ(), jRange.second );
|
||||
kRange.first = std::min( cell.localCellIndexK(), kRange.first );
|
||||
kRange.second = std::max( cell.localCellIndexK(), kRange.second );
|
||||
boundingBox.addCell( cell.localCellIndexI(), cell.localCellIndexJ(), cell.localCellIndexK() );
|
||||
}
|
||||
|
||||
caf::VecIjk mainGridStartCell( iRange.first, jRange.first, kRange.first );
|
||||
caf::VecIjk mainGridEndCell( iRange.second, jRange.second, kRange.second );
|
||||
|
||||
IjkBoundingBox boundingBox( mainGridStartCell, mainGridEndCell );
|
||||
return buildLgr( lgrId, lgrName, eclipseCase, wellPathName, boundingBox, lgrSizesPerMainGridCell );
|
||||
return buildLgr( lgrId, lgrName, wellPathName, boundingBox, refinement );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -635,16 +620,11 @@ LgrInfo RicExportLgrFeature::buildLgr( int
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
LgrInfo RicExportLgrFeature::buildLgr( int lgrId,
|
||||
const QString& lgrName,
|
||||
RimEclipseCase* eclipseCase,
|
||||
const QString& wellPathName,
|
||||
const IjkBoundingBox& boundingBox,
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell )
|
||||
const caf::VecIjk& refinement )
|
||||
{
|
||||
caf::VecIjk lgrSizes( ( boundingBox.max().i() - boundingBox.min().i() + 1 ) * lgrSizesPerMainGridCell.i(),
|
||||
( boundingBox.max().j() - boundingBox.min().j() + 1 ) * lgrSizesPerMainGridCell.j(),
|
||||
( boundingBox.max().k() - boundingBox.min().k() + 1 ) * lgrSizesPerMainGridCell.k() );
|
||||
|
||||
return LgrInfo( lgrId, lgrName, wellPathName, lgrSizes, boundingBox.min(), boundingBox.max() );
|
||||
return LgrInfo( lgrId, lgrName, wellPathName, refinement, boundingBox.min(), boundingBox.max() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -790,7 +770,7 @@ void RicExportLgrFeature::onActionTriggered( bool isChecked )
|
||||
if ( dialogData )
|
||||
{
|
||||
auto eclipseCase = dialogData->caseToApply();
|
||||
auto lgrCellCounts = dialogData->lgrCellCount();
|
||||
auto lgrCellCounts = dialogData->refinement();
|
||||
size_t timeStep = dialogData->timeStep();
|
||||
|
||||
QStringList wellsIntersectingOtherLgrs;
|
||||
@@ -876,7 +856,7 @@ std::pair<caf::VecIjk, caf::VecIjk> mainGridCellBoundingBoxFromLgr( const RigGri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString /*wellName*/, std::vector<LgrInfo>> RicExportLgrFeature::createLgrInfoListForTemporaryLgrs( const RigMainGrid* mainGrid )
|
||||
std::map<QString, std::vector<LgrInfo>> RicExportLgrFeature::createLgrInfoListForTemporaryLgrs( const RigMainGrid* mainGrid )
|
||||
{
|
||||
std::map<QString, std::vector<LgrInfo>> lgrInfosPerWell;
|
||||
|
||||
@@ -885,16 +865,25 @@ std::map<QString /*wellName*/, std::vector<LgrInfo>> RicExportLgrFeature::create
|
||||
const auto grid = mainGrid->gridByIndex( i );
|
||||
if ( !grid->isTempGrid() ) continue;
|
||||
|
||||
caf::VecIjk lgrSizes( grid->cellCountI(), grid->cellCountJ(), grid->cellCountK() );
|
||||
std::pair<caf::VecIjk, caf::VecIjk> mainGridBoundingBox = mainGridCellBoundingBoxFromLgr( grid );
|
||||
|
||||
size_t mainGridCellCountI = mainGridBoundingBox.second.i() - mainGridBoundingBox.first.i() + 1;
|
||||
size_t mainGridCellCountJ = mainGridBoundingBox.second.j() - mainGridBoundingBox.first.j() + 1;
|
||||
size_t mainGridCellCountK = mainGridBoundingBox.second.k() - mainGridBoundingBox.first.k() + 1;
|
||||
|
||||
auto refinementI = mainGridCellCountI > 0 ? std::max( size_t( 1 ), grid->cellCountI() / mainGridCellCountI ) : 1;
|
||||
auto refinementJ = mainGridCellCountJ > 0 ? std::max( size_t( 1 ), grid->cellCountJ() / mainGridCellCountJ ) : 1;
|
||||
auto refinementK = mainGridCellCountK > 0 ? std::max( size_t( 1 ), grid->cellCountK() / mainGridCellCountK ) : 1;
|
||||
|
||||
caf::VecIjk refinement( refinementI, refinementJ, refinementK );
|
||||
|
||||
QString wellName = QString::fromStdString( grid->associatedWellPathName() );
|
||||
auto& item = lgrInfosPerWell[wellName];
|
||||
|
||||
item.emplace_back( LgrInfo( grid->gridId(),
|
||||
QString::fromStdString( grid->gridName() ),
|
||||
QString::fromStdString( grid->associatedWellPathName() ),
|
||||
lgrSizes,
|
||||
refinement,
|
||||
mainGridBoundingBox.first,
|
||||
mainGridBoundingBox.second ) );
|
||||
}
|
||||
|
||||
@@ -52,31 +52,42 @@ public:
|
||||
LgrInfo( int id,
|
||||
const QString& name,
|
||||
const QString& associatedWellPathName,
|
||||
const caf::VecIjk& sizes,
|
||||
const caf::VecIjk& refinement,
|
||||
const caf::VecIjk& mainGridStartCell,
|
||||
const caf::VecIjk& mainGridEndCell )
|
||||
: id( id )
|
||||
, name( name )
|
||||
, associatedWellPathName( associatedWellPathName )
|
||||
, sizes( sizes )
|
||||
, refinement( refinement )
|
||||
, mainGridStartCell( mainGridStartCell )
|
||||
, mainGridEndCell( mainGridEndCell )
|
||||
{
|
||||
}
|
||||
|
||||
caf::VecIjk sizesPerMainGridCell() const
|
||||
caf::VecIjk lgrCellCounts() const
|
||||
{
|
||||
return caf::VecIjk( sizes.i() / ( mainGridEndCell.i() - mainGridStartCell.i() + 1 ),
|
||||
sizes.j() / ( mainGridEndCell.j() - mainGridStartCell.j() + 1 ),
|
||||
sizes.k() / ( mainGridEndCell.k() - mainGridStartCell.k() + 1 ) );
|
||||
auto lgrI = ( mainGridEndCell.i() - mainGridStartCell.i() + 1 ) * refinement.i();
|
||||
auto lgrJ = ( mainGridEndCell.j() - mainGridStartCell.j() + 1 ) * refinement.j();
|
||||
auto lgrK = ( mainGridEndCell.k() - mainGridStartCell.k() + 1 ) * refinement.k();
|
||||
|
||||
lgrI = lgrI > 0 ? lgrI : 1;
|
||||
lgrJ = lgrJ > 0 ? lgrJ : 1;
|
||||
lgrK = lgrK > 0 ? lgrK : 1;
|
||||
|
||||
return { lgrI, lgrJ, lgrK };
|
||||
}
|
||||
|
||||
size_t cellCount() const { return sizes.i() * sizes.j() * sizes.k(); }
|
||||
size_t lgrCellCount() const
|
||||
{
|
||||
auto size = lgrCellCounts();
|
||||
return size.i() * size.j() * size.k();
|
||||
}
|
||||
|
||||
int id;
|
||||
QString name;
|
||||
QString associatedWellPathName;
|
||||
caf::VecIjk sizes;
|
||||
int id;
|
||||
QString name;
|
||||
QString associatedWellPathName;
|
||||
|
||||
caf::VecIjk refinement;
|
||||
|
||||
caf::VecIjk mainGridStartCell;
|
||||
caf::VecIjk mainGridEndCell;
|
||||
@@ -158,7 +169,7 @@ class RicExportLgrFeature : public caf::CmdFeature
|
||||
std::vector<RimWellPath*> wellPaths,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
caf::VecIjk refinement,
|
||||
Lgr::SplitType splitType,
|
||||
const std::set<RigCompletionData::CompletionType>& completionTypes,
|
||||
QStringList* wellsIntersectingOtherLgrs );
|
||||
@@ -168,14 +179,14 @@ class RicExportLgrFeature : public caf::CmdFeature
|
||||
static std::vector<LgrInfo> buildLgrsForWellPaths( std::vector<RimWellPath*> wellPaths,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
caf::VecIjk refinement,
|
||||
Lgr::SplitType splitType,
|
||||
const std::set<RigCompletionData::CompletionType>& completionTypes,
|
||||
QStringList* wellsIntersectingOtherLgrs );
|
||||
|
||||
static std::vector<RimWellPath*> selectedWellPaths();
|
||||
|
||||
static std::map<QString /*wellName*/, std::vector<LgrInfo>> createLgrInfoListForTemporaryLgrs( const RigMainGrid* mainGrid );
|
||||
static std::map<QString, std::vector<LgrInfo>> createLgrInfoListForTemporaryLgrs( const RigMainGrid* mainGrid );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
@@ -189,26 +200,24 @@ private:
|
||||
RimEclipseCase* eclipseCase,
|
||||
RimWellPath* wellPath,
|
||||
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
||||
const caf::VecIjk& lgrSizes,
|
||||
const caf::VecIjk& refinement,
|
||||
LgrNameFactory& lgrNameFactory );
|
||||
static std::vector<LgrInfo> buildLgrsPerCompletion( int firstLgrId,
|
||||
RimEclipseCase* eclipseCase,
|
||||
const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& completionInfo,
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell,
|
||||
const caf::VecIjk& refinement,
|
||||
LgrNameFactory& lgrNameFactory );
|
||||
static LgrInfo buildLgr( int lgrId,
|
||||
const QString& lgrName,
|
||||
RimEclipseCase* eclipseCase,
|
||||
const QString& wellPathName,
|
||||
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell );
|
||||
const caf::VecIjk& refinement );
|
||||
|
||||
static LgrInfo buildLgr( int lgrId,
|
||||
const QString& lgrName,
|
||||
RimEclipseCase* eclipseCase,
|
||||
const QString& wellPathName,
|
||||
const IjkBoundingBox& boundingBox,
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell );
|
||||
const caf::VecIjk& refinement );
|
||||
|
||||
static std::vector<RigCompletionDataGridCell> cellsIntersectingCompletions( RimEclipseCase* eclipseCase,
|
||||
const RimWellPath* wellPath,
|
||||
|
||||
@@ -62,13 +62,13 @@ RicExportLgrUi::RicExportLgrUi()
|
||||
CAF_PDM_InitField( &m_includeFractures, "IncludeFractures", true, "Fractures" );
|
||||
CAF_PDM_InitField( &m_includeFishbones, "IncludeFishbones", true, "Fishbones" );
|
||||
|
||||
QString ijkLabel = "Cell Count I, J, K";
|
||||
CAF_PDM_InitField( &m_cellCountI, "CellCountI", 2, ijkLabel );
|
||||
CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 2, "" );
|
||||
CAF_PDM_InitField( &m_cellCountK, "CellCountK", 2, "" );
|
||||
QString ijkLabel = "Refinement I, J, K";
|
||||
CAF_PDM_InitField( &m_refinementI, "CellCountI", 2, ijkLabel );
|
||||
CAF_PDM_InitField( &m_refinementJ, "CellCountJ", 2, "" );
|
||||
CAF_PDM_InitField( &m_refinementK, "CellCountK", 2, "" );
|
||||
|
||||
m_cellCountJ.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
m_cellCountK.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
m_refinementJ.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
m_refinementK.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
CAF_PDM_InitField( &m_splitType, "SplitType", Lgr::SplitTypeEnum(), "Split Type" );
|
||||
}
|
||||
@@ -104,9 +104,9 @@ void RicExportLgrUi::setTimeStep( int timeStep )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::VecIjk RicExportLgrUi::lgrCellCount() const
|
||||
caf::VecIjk RicExportLgrUi::refinement() const
|
||||
{
|
||||
return caf::VecIjk( m_cellCountI, m_cellCountJ, m_cellCountK );
|
||||
return caf::VecIjk( m_refinementI, m_refinementJ, m_refinementK );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -180,9 +180,9 @@ void RicExportLgrUi::setDefaultValuesFromCase()
|
||||
m_exportFolder = caseFolder;
|
||||
}
|
||||
|
||||
m_cellCountI = 2;
|
||||
m_cellCountJ = 2;
|
||||
m_cellCountK = 2;
|
||||
m_refinementI = 2;
|
||||
m_refinementJ = 2;
|
||||
m_refinementK = 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -230,9 +230,9 @@ void RicExportLgrUi::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add( &m_splitType, { .newRow = true, .totalColumnSpan = 6, .leftLabelColumnSpan = 1 } );
|
||||
|
||||
caf::PdmUiGroup* gridRefinement = uiOrdering.addNewGroup( "Grid Refinement" );
|
||||
gridRefinement->add( &m_cellCountI, { .newRow = true, .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } );
|
||||
gridRefinement->appendToRow( &m_cellCountJ );
|
||||
gridRefinement->appendToRow( &m_cellCountK );
|
||||
gridRefinement->add( &m_refinementI, { .newRow = true, .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } );
|
||||
gridRefinement->appendToRow( &m_refinementJ );
|
||||
gridRefinement->appendToRow( &m_refinementK );
|
||||
|
||||
// uiOrdering.add(&m_wellPathsInfo);
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void setCase( RimEclipseCase* rimCase );
|
||||
void setTimeStep( int timeStep );
|
||||
|
||||
caf::VecIjk lgrCellCount() const;
|
||||
caf::VecIjk refinement() const;
|
||||
QString exportFolder() const;
|
||||
RimEclipseCase* caseToApply() const;
|
||||
int timeStep() const;
|
||||
@@ -79,9 +79,9 @@ private:
|
||||
caf::PdmField<bool> m_includeFractures;
|
||||
caf::PdmField<bool> m_includeFishbones;
|
||||
|
||||
caf::PdmField<int> m_cellCountI;
|
||||
caf::PdmField<int> m_cellCountJ;
|
||||
caf::PdmField<int> m_cellCountK;
|
||||
caf::PdmField<int> m_refinementI;
|
||||
caf::PdmField<int> m_refinementJ;
|
||||
caf::PdmField<int> m_refinementK;
|
||||
|
||||
caf::PdmField<Lgr::SplitTypeEnum> m_splitType;
|
||||
};
|
||||
@@ -58,7 +58,7 @@ CAF_CMD_SOURCE_INIT( RicCreateTemporaryLgrFeature, "RicCreateTemporaryLgrFeature
|
||||
void RicCreateTemporaryLgrFeature::createLgrsForWellPaths( std::vector<RimWellPath*> wellPaths,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
caf::VecIjk refinement,
|
||||
Lgr::SplitType splitType,
|
||||
const std::set<RigCompletionData::CompletionType>& completionTypes,
|
||||
QStringList* wellsIntersectingOtherLgrs )
|
||||
@@ -67,19 +67,14 @@ void RicCreateTemporaryLgrFeature::createLgrsForWellPaths( std::vector<RimWellPa
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::FRACTURE_MODEL );
|
||||
|
||||
auto lgrs = RicExportLgrFeature::buildLgrsForWellPaths( wellPaths,
|
||||
eclipseCase,
|
||||
timeStep,
|
||||
lgrCellCounts,
|
||||
splitType,
|
||||
completionTypes,
|
||||
wellsIntersectingOtherLgrs );
|
||||
auto lgrs =
|
||||
RicExportLgrFeature::buildLgrsForWellPaths( wellPaths, eclipseCase, timeStep, refinement, splitType, completionTypes, wellsIntersectingOtherLgrs );
|
||||
|
||||
for ( const auto& lgr : lgrs )
|
||||
{
|
||||
createLgr( lgr, eclipseCase->eclipseCaseData()->mainGrid() );
|
||||
|
||||
size_t lgrCellCount = lgr.cellCount();
|
||||
size_t lgrCellCount = lgr.lgrCellCount();
|
||||
|
||||
activeCellInfo->addLgr( lgrCellCount );
|
||||
if ( fractureActiveCellInfo->reservoirActiveCellCount() > 0 )
|
||||
@@ -153,7 +148,7 @@ void RicCreateTemporaryLgrFeature::onActionTriggered( bool isChecked )
|
||||
if ( dialogData )
|
||||
{
|
||||
auto eclipseCase = dialogData->caseToApply();
|
||||
auto lgrCellCounts = dialogData->lgrCellCount();
|
||||
auto refinement = dialogData->refinement();
|
||||
size_t timeStep = dialogData->timeStep();
|
||||
auto splitType = dialogData->splitType();
|
||||
const auto completionTypes = dialogData->completionTypes();
|
||||
@@ -162,7 +157,7 @@ void RicCreateTemporaryLgrFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
QStringList wellsIntersectingOtherLgrs;
|
||||
|
||||
createLgrsForWellPaths( wellPaths, eclipseCase, timeStep, lgrCellCounts, splitType, completionTypes, &wellsIntersectingOtherLgrs );
|
||||
createLgrsForWellPaths( wellPaths, eclipseCase, timeStep, refinement, splitType, completionTypes, &wellsIntersectingOtherLgrs );
|
||||
|
||||
updateViews( eclipseCase );
|
||||
|
||||
@@ -192,7 +187,7 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri
|
||||
{
|
||||
int lgrId = lgrInfo.id;
|
||||
size_t totalCellCount = mainGrid->totalCellCount();
|
||||
size_t lgrCellCount = lgrInfo.cellCount();
|
||||
size_t lgrCellCount = lgrInfo.lgrCellCount();
|
||||
|
||||
// Create local grid and set properties
|
||||
RigLocalGrid* localGrid = new RigLocalGrid( mainGrid );
|
||||
@@ -201,7 +196,7 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri
|
||||
localGrid->setGridId( lgrId );
|
||||
localGrid->setIndexToStartOfCells( totalCellCount );
|
||||
localGrid->setGridName( lgrInfo.name.toStdString() );
|
||||
localGrid->setCellCounts( cvf::Vec3st( lgrInfo.sizes.i(), lgrInfo.sizes.j(), lgrInfo.sizes.k() ) );
|
||||
localGrid->setCellCounts( cvf::Vec3st( lgrInfo.lgrCellCounts().i(), lgrInfo.lgrCellCounts().j(), lgrInfo.lgrCellCounts().k() ) );
|
||||
mainGrid->addLocalGrid( localGrid );
|
||||
|
||||
size_t cellStartIndex = mainGrid->totalCellCount();
|
||||
@@ -215,21 +210,21 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri
|
||||
mainGrid->nodes().resize( nodeStartIndex + lgrCellCount * 8, cvf::Vec3d( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
auto lgrSizePerMainCell = lgrInfo.sizesPerMainGridCell();
|
||||
auto refinement = lgrInfo.refinement;
|
||||
size_t gridLocalCellIndex = 0;
|
||||
|
||||
// Loop through all new LGR cells
|
||||
for ( size_t lgrK = 0; lgrK < lgrInfo.sizes.k(); lgrK++ )
|
||||
for ( size_t lgrK = 0; lgrK < lgrInfo.lgrCellCounts().k(); lgrK++ )
|
||||
{
|
||||
size_t mainK = lgrInfo.mainGridStartCell.k() + lgrK / lgrSizePerMainCell.k();
|
||||
size_t mainK = lgrInfo.mainGridStartCell.k() + lgrK / refinement.k();
|
||||
|
||||
for ( size_t lgrJ = 0; lgrJ < lgrInfo.sizes.j(); lgrJ++ )
|
||||
for ( size_t lgrJ = 0; lgrJ < lgrInfo.lgrCellCounts().j(); lgrJ++ )
|
||||
{
|
||||
size_t mainJ = lgrInfo.mainGridStartCell.j() + lgrJ / lgrSizePerMainCell.j();
|
||||
size_t mainJ = lgrInfo.mainGridStartCell.j() + lgrJ / refinement.j();
|
||||
|
||||
for ( size_t lgrI = 0; lgrI < lgrInfo.sizes.i(); lgrI++, gridLocalCellIndex++ )
|
||||
for ( size_t lgrI = 0; lgrI < lgrInfo.lgrCellCounts().i(); lgrI++, gridLocalCellIndex++ )
|
||||
{
|
||||
size_t mainI = lgrInfo.mainGridStartCell.i() + lgrI / lgrSizePerMainCell.i();
|
||||
size_t mainI = lgrInfo.mainGridStartCell.i() + lgrI / refinement.i();
|
||||
|
||||
size_t mainCellIndex = mainGrid->cellIndexFromIJK( mainI, mainJ, mainK );
|
||||
auto& mainGridCell = mainGrid->cell( mainCellIndex );
|
||||
@@ -244,14 +239,14 @@ void RicCreateTemporaryLgrFeature::createLgr( const LgrInfo& lgrInfo, RigMainGri
|
||||
size_t cIdx;
|
||||
std::array<cvf::Vec3d, 8> vertices = mainGrid->cellCornerVertices( mainCellIndex );
|
||||
|
||||
auto cellCounts = lgrInfo.sizesPerMainGridCell();
|
||||
auto lgrCoords = RiaCellDividingTools::createHexCornerCoords( vertices, cellCounts.i(), cellCounts.j(), cellCounts.k() );
|
||||
std::vector<cvf::Vec3d> lgrCoords =
|
||||
RiaCellDividingTools::createHexCornerCoords( vertices, refinement.i(), refinement.j(), refinement.k() );
|
||||
|
||||
size_t subI = lgrI % lgrSizePerMainCell.i();
|
||||
size_t subJ = lgrJ % lgrSizePerMainCell.j();
|
||||
size_t subK = lgrK % lgrSizePerMainCell.k();
|
||||
size_t subI = lgrI % refinement.i();
|
||||
size_t subJ = lgrJ % refinement.j();
|
||||
size_t subK = lgrK % refinement.k();
|
||||
|
||||
size_t subIndex = subI + subJ * lgrSizePerMainCell.i() + subK * lgrSizePerMainCell.i() * lgrSizePerMainCell.j();
|
||||
size_t subIndex = subI + subJ * refinement.i() + subK * refinement.i() * refinement.j();
|
||||
|
||||
for ( cIdx = 0; cIdx < 8; ++cIdx )
|
||||
{
|
||||
|
||||
@@ -49,20 +49,21 @@ public:
|
||||
void createLgrsForWellPaths( std::vector<RimWellPath*> wellPaths,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
caf::VecIjk refinement,
|
||||
Lgr::SplitType splitType,
|
||||
const std::set<RigCompletionData::CompletionType>& completionTypes,
|
||||
QStringList* wellsIntersectingOtherLgrs );
|
||||
|
||||
void updateViews( RimEclipseCase* eclipseCase );
|
||||
|
||||
static void createLgr( const LgrInfo& lgrInfo, RigMainGrid* mainGrid );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
void createLgr( const LgrInfo& lgrInfo, RigMainGrid* mainGrid );
|
||||
void computeCachedData( RimEclipseCase* eclipseCase );
|
||||
void deleteAllCachedData( RimEclipseCase* eclipseCase );
|
||||
};
|
||||
Reference in new issue
Block a user