#3518 LGR export/temp LGR. Checkbox for completion types. Dialog adjustments

This commit is contained in:
Bjørn Erik Jensen 2018-10-25 09:59:30 +02:00
parent 58655c481e
commit a3cf7ff2ac
8 changed files with 159 additions and 86 deletions

View File

@ -22,6 +22,7 @@
#include "RicfCreateMultipleFractures.h" #include "RicfCreateMultipleFractures.h"
#include "ExportCommands/RicExportLgrFeature.h" #include "ExportCommands/RicExportLgrFeature.h"
#include "ExportCommands/RicExportLgrUi.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimDialogData.h" #include "RimDialogData.h"
@ -97,7 +98,9 @@ void RicfExportLgrForCompletions::execute()
{ {
try try
{ {
feature->exportLgrsForWellPath(exportFolder, wellPath, eclipseCase, m_timeStep, lgrCellCounts, m_splitType()); auto completionTypes = (RicExportLgrUi::CompletionType)(RicExportLgrUi::CT_PERFORATION | RicExportLgrUi::CT_FRACTURE | RicExportLgrUi::CT_FISHBONE);
feature->exportLgrsForWellPath(exportFolder, wellPath, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
completionTypes);
} }
catch(CreateLgrException e) catch(CreateLgrException e)
{ {

View File

@ -68,7 +68,10 @@ CAF_CMD_SOURCE_INIT(RicExportLgrFeature, "RicExportLgrFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RicExportLgrUi* RicExportLgrFeature::openDialog(const QString& dialogTitle, RimEclipseCase* defaultCase, int defaultTimeStep) RicExportLgrUi* RicExportLgrFeature::openDialog(const QString& dialogTitle,
RimEclipseCase* defaultCase,
int defaultTimeStep,
bool hideExportFolderField)
{ {
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project(); RimProject* proj = app->project();
@ -102,10 +105,11 @@ RicExportLgrUi* RicExportLgrFeature::openDialog(const QString& dialogTitle, RimE
} }
if (defaultCase) featureUi->setCase(defaultCase); if (defaultCase) featureUi->setCase(defaultCase);
featureUi->setTimeStep(defaultTimeStep); featureUi->setTimeStep(defaultTimeStep);
featureUi->hideExportFolderField(hideExportFolderField);
caf::PdmUiPropertyViewDialog propertyDialog( caf::PdmUiPropertyViewDialog propertyDialog(
nullptr, featureUi, dialogTitle, "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel); nullptr, featureUi, dialogTitle, "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
propertyDialog.resize(QSize(600, 230)); propertyDialog.resize(QSize(300, 285 - (hideExportFolderField ? 25 : 0)));
if (propertyDialog.exec() == QDialog::Accepted && !featureUi->exportFolder().isEmpty()) if (propertyDialog.exec() == QDialog::Accepted && !featureUi->exportFolder().isEmpty())
{ {
@ -192,13 +196,19 @@ void RicExportLgrFeature::exportLgrsForWellPath(const QString& export
RimEclipseCase* eclipseCase, RimEclipseCase* eclipseCase,
size_t timeStep, size_t timeStep,
caf::VecIjk lgrCellCounts, caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType) RicExportLgrUi::SplitType splitType,
RicExportLgrUi::CompletionType completionTypes)
{ {
std::vector<LgrInfo> lgrs; std::vector<LgrInfo> lgrs;
try try
{ {
lgrs = buildLgrsForWellPath(wellPath, eclipseCase, timeStep, lgrCellCounts, splitType); lgrs = buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes);
// Export // Export
QFile file; QFile file;
@ -219,18 +229,19 @@ void RicExportLgrFeature::exportLgrsForWellPath(const QString& export
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath* wellPath, std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase, RimEclipseCase* eclipseCase,
size_t timeStep, size_t timeStep,
caf::VecIjk lgrCellCounts, caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType) RicExportLgrUi::SplitType splitType,
RicExportLgrUi::CompletionType completionTypes)
{ {
std::vector<LgrInfo> lgrs; std::vector<LgrInfo> lgrs;
bool intersectsWithExistingLgr = false; bool intersectsWithExistingLgr = false;
if (splitType == RicExportLgrUi::LGR_PER_CELL) if (splitType == RicExportLgrUi::LGR_PER_CELL)
{ {
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep); auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes);
if (containsAnyNonMainGridCells(intersectingCells)) if (containsAnyNonMainGridCells(intersectingCells))
{ {
@ -243,7 +254,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
} }
else if (splitType == RicExportLgrUi::LGR_PER_COMPLETION) else if (splitType == RicExportLgrUi::LGR_PER_COMPLETION)
{ {
auto intersectingCells = cellsIntersectingCompletions_PerCompletion(eclipseCase, wellPath, timeStep); auto intersectingCells = cellsIntersectingCompletions_PerCompletion(eclipseCase, wellPath, timeStep, completionTypes);
if (containsAnyNonMainGridCells(intersectingCells)) if (containsAnyNonMainGridCells(intersectingCells))
{ {
@ -256,7 +267,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
} }
else if (splitType == RicExportLgrUi::LGR_PER_WELL) else if (splitType == RicExportLgrUi::LGR_PER_WELL)
{ {
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep); auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes);
if (containsAnyNonMainGridCells(intersectingCells)) if (containsAnyNonMainGridCells(intersectingCells))
{ {
@ -349,7 +360,10 @@ LgrInfo RicExportLgrFeature::buildLgr(int
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RigCompletionDataGridCell> std::vector<RigCompletionDataGridCell>
RicExportLgrFeature::cellsIntersectingCompletions(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, size_t timeStep) RicExportLgrFeature::cellsIntersectingCompletions(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
size_t timeStep,
RicExportLgrUi::CompletionType completionTypes)
{ {
std::vector<RigCompletionDataGridCell> cells; std::vector<RigCompletionDataGridCell> cells;
@ -360,6 +374,9 @@ std::vector<RigCompletionDataGridCell>
for (auto intCell : intCells) for (auto intCell : intCells)
{ {
QString name = completionNameIfIncluded(intCell.second.front().sourcePdmObject(), completionTypes);
if (name.isEmpty()) continue;
cells.push_back(intCell.first); cells.push_back(intCell.first);
} }
} }
@ -372,7 +389,8 @@ std::vector<RigCompletionDataGridCell>
std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase, RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath, const RimWellPath* wellPath,
size_t timeStep) size_t timeStep,
RicExportLgrUi::CompletionType completionTypes)
{ {
std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> completionToCells; std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> completionToCells;
@ -383,19 +401,7 @@ std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
for (auto intCell : intCells) for (auto intCell : intCells)
{ {
auto pdmSrcObj = intCell.second.front().sourcePdmObject(); QString name = completionNameIfIncluded(intCell.second.front().sourcePdmObject(), completionTypes);
auto perf = dynamic_cast<const RimPerforationInterval*>(pdmSrcObj);
auto frac = dynamic_cast<const RimFracture*>(pdmSrcObj);
auto fish = dynamic_cast<const RimFishbonesMultipleSubs*>(pdmSrcObj);
QString name;
if (perf)
name = perf->name();
else if (frac)
name = frac->name();
else if (fish)
name = fish->generatedName();
if (name.isEmpty()) continue; if (name.isEmpty()) continue;
for (auto completion : intCell.second) for (auto completion : intCell.second)
@ -413,8 +419,9 @@ std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
bool RicExportLgrFeature::isCommandEnabled() bool RicExportLgrFeature::isCommandEnabled()
{ {
std::vector<RimWellPathCompletions*> completions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>(); std::vector<RimWellPathCompletions*> completions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
std::vector<RimWellPath*> wellPaths = caf::selectedObjectsByTypeStrict<RimWellPath*>();
return !completions.empty(); return !completions.empty() || !wellPaths.empty();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -423,7 +430,7 @@ bool RicExportLgrFeature::isCommandEnabled()
void RicExportLgrFeature::onActionTriggered(bool isChecked) void RicExportLgrFeature::onActionTriggered(bool isChecked)
{ {
std::vector<RimWellPath*> wellPaths = selectedWellPaths(); std::vector<RimWellPath*> wellPaths = selectedWellPaths();
CVF_ASSERT(wellPaths.size() > 0); if(wellPaths.size() == 0) return;
QString dialogTitle = "LGR Export"; QString dialogTitle = "LGR Export";
@ -448,8 +455,7 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked)
{ {
try try
{ {
exportLgrsForWellPath( exportLgrsForWellPath(dialogData->exportFolder(), wellPath, eclipseCase, timeStep, lgrCellCounts, dialogData->splitType(), dialogData->completionTypes());
dialogData->exportFolder(), wellPath, eclipseCase, timeStep, lgrCellCounts, dialogData->splitType());
} }
catch (CreateLgrException e) catch (CreateLgrException e)
{ {
@ -480,7 +486,7 @@ void RicExportLgrFeature::setupActionLook(QAction* actionToSetup)
std::vector<RimWellPath*> RicExportLgrFeature::selectedWellPaths() std::vector<RimWellPath*> RicExportLgrFeature::selectedWellPaths()
{ {
std::vector<RimWellPathCompletions*> selectedCompletions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>(); std::vector<RimWellPathCompletions*> selectedCompletions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
std::vector<RimWellPath*> wellPaths; std::vector<RimWellPath*> wellPaths = caf::selectedObjectsByTypeStrict<RimWellPath*>();
for (auto completion : selectedCompletions) for (auto completion : selectedCompletions)
{ {
@ -528,3 +534,23 @@ int RicExportLgrFeature::firstAvailableLgrId(const RigMainGrid* mainGrid)
} }
return lastUsedId + 1; return lastUsedId + 1;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicExportLgrFeature::completionNameIfIncluded(const caf::PdmObject* object,
RicExportLgrUi::CompletionType includedCompletionTypes)
{
auto perf = dynamic_cast<const RimPerforationInterval*>(object);
auto frac = dynamic_cast<const RimFracture*>(object);
auto fish = dynamic_cast<const RimFishbonesMultipleSubs*>(object);
QString name;
if (perf && (includedCompletionTypes & RicExportLgrUi::CT_PERFORATION))
name = perf->name();
else if (frac && (includedCompletionTypes & RicExportLgrUi::CT_FRACTURE))
name = frac->name();
else if (fish && (includedCompletionTypes & RicExportLgrUi::CT_FISHBONE))
name = fish->generatedName();
return name;
}

View File

@ -111,20 +111,27 @@ class RicExportLgrFeature : public caf::CmdFeature
typedef std::pair<size_t, size_t> Range; typedef std::pair<size_t, size_t> Range;
static Range initRange() { return std::make_pair(std::numeric_limits<size_t>::max(), 0); } static Range initRange() { return std::make_pair(std::numeric_limits<size_t>::max(), 0); }
static RicExportLgrUi* openDialog(const QString& dialogTitle, RimEclipseCase* defaultCase = nullptr, int defaultTimeStep = 0); static RicExportLgrUi* openDialog(const QString& dialogTitle,
RimEclipseCase* defaultCase = nullptr,
int defaultTimeStep = 0,
bool hideExportFolderField = false);
static bool openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile); static bool openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile);
static void exportLgrsForWellPath(const QString& exportFolder, static void exportLgrsForWellPath(const QString& exportFolder,
RimWellPath* wellPath, RimWellPath* wellPath,
RimEclipseCase* eclipseCase, RimEclipseCase* eclipseCase,
size_t timeStep, size_t timeStep,
caf::VecIjk lgrCellCounts, caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType); RicExportLgrUi::SplitType splitType,
RicExportLgrUi::CompletionType completionTypes);
static std::vector<LgrInfo> buildLgrsForWellPath(RimWellPath* wellPath, static std::vector<LgrInfo> buildLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase, RimEclipseCase* eclipseCase,
size_t timeStep, size_t timeStep,
caf::VecIjk lgrCellCounts, caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType); RicExportLgrUi::SplitType splitType,
RicExportLgrUi::CompletionType completionTypes);
static std::vector<RimWellPath*> selectedWellPaths();
protected: protected:
bool isCommandEnabled() override; bool isCommandEnabled() override;
@ -146,12 +153,18 @@ private:
const std::vector<RigCompletionDataGridCell>& intersectingCells, const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizesPerMainGridCell); const caf::VecIjk& lgrSizesPerMainGridCell);
static std::vector<RigCompletionDataGridCell> static std::vector<RigCompletionDataGridCell> cellsIntersectingCompletions(RimEclipseCase* eclipseCase,
cellsIntersectingCompletions(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, size_t timeStep); const RimWellPath* wellPath,
size_t timeStep,
RicExportLgrUi::CompletionType completionTypes);
static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, size_t timeStep); cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase,
static std::vector<RimWellPath*> selectedWellPaths(); const RimWellPath* wellPath,
size_t timeStep,
RicExportLgrUi::CompletionType completionTypes);
static bool containsAnyNonMainGridCells(const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& cellsPerCompletion); static bool containsAnyNonMainGridCells(const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& cellsPerCompletion);
static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells); static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells);
static int firstAvailableLgrId(const RigMainGrid* mainGrid); static int firstAvailableLgrId(const RigMainGrid* mainGrid);
static QString completionNameIfIncluded(const caf::PdmObject* object, RicExportLgrUi::CompletionType includedCompletionTypes);
}; };

View File

@ -24,6 +24,7 @@
#include "RimTools.h" #include "RimTools.h"
#include "cafPdmUiFilePathEditor.h" #include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiTextEditor.h"
#include "cafVecIjk.h" #include "cafVecIjk.h"
@ -58,10 +59,14 @@ RicExportLgrUi::RicExportLgrUi()
CAF_PDM_InitFieldNoDefault(&m_caseToApply, "CaseToApply", "Source Case", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_caseToApply, "CaseToApply", "Source Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStepIndex", "Time Step", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStepIndex", "Time Step", "", "", "");
CAF_PDM_InitField(&m_includePerforations, "IncludePerforations", true, "Perforations", "", "", "");
CAF_PDM_InitField(&m_includeFractures, "IncludeFractures", true, "Fractures", "", "", "");
CAF_PDM_InitField(&m_includeFishbones, "IncludeFishbones", true, "Fishbones", "", "", "");
QString ijkLabel = "Cell Count I, J, K"; QString ijkLabel = "Cell Count I, J, K";
CAF_PDM_InitField(&m_cellCountI, "CellCountI", 2, ijkLabel, "", "", ""); CAF_PDM_InitField(&m_cellCountI, "CellCountI", 2, ijkLabel, "", "", "");
CAF_PDM_InitField(&m_cellCountJ, "CellCountJ", 2, "Cell Count J", "", "", ""); CAF_PDM_InitField(&m_cellCountJ, "CellCountJ", 2, "", "", "", "");
CAF_PDM_InitField(&m_cellCountK, "CellCountK", 2, "Cell Count K", "", "", ""); CAF_PDM_InitField(&m_cellCountK, "CellCountK", 2, "", "", "", "");
m_cellCountJ.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_cellCountJ.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_cellCountK.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_cellCountK.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
@ -129,6 +134,18 @@ int RicExportLgrUi::timeStep() const
return m_timeStep; return m_timeStep;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicExportLgrUi::CompletionType RicExportLgrUi::completionTypes() const
{
CompletionType ct = CT_NONE;
if (m_includePerforations()) ct = ct | CompletionType::CT_PERFORATION;
if (m_includeFractures()) ct = ct | CompletionType::CT_FRACTURE;
if (m_includeFishbones()) ct = ct | CompletionType::CT_FISHBONE;
return ct;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -137,6 +154,14 @@ RicExportLgrUi::SplitType RicExportLgrUi::splitType() const
return m_splitType(); return m_splitType();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportLgrUi::hideExportFolderField(bool hide)
{
m_exportFolder.uiCapability()->setUiHidden(hide);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -205,16 +230,21 @@ void RicExportLgrUi::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportLgrUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RicExportLgrUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{ {
uiOrdering.add(&m_caseToApply); caf::PdmUiOrdering::LayoutOptions layout(true, 6, 1);
uiOrdering.add(&m_timeStep); uiOrdering.add(&m_caseToApply, layout);
uiOrdering.add(&m_exportFolder); uiOrdering.add(&m_timeStep, layout);
uiOrdering.add(&m_exportFolder, layout);
caf::PdmUiGroup* gridRefinement = uiOrdering.addNewGroup("Grid Refinement"); uiOrdering.add(&m_includePerforations, layout);
gridRefinement->add(&m_cellCountI, {true, 2, 1}); uiOrdering.add(&m_includeFractures, layout);
gridRefinement->add(&m_cellCountJ, false); uiOrdering.add(&m_includeFishbones, layout);
gridRefinement->add(&m_cellCountK, false); uiOrdering.add(&m_splitType, {true, 6, 1});
gridRefinement->add(&m_splitType, { true, 2});
caf::PdmUiGroup* gridRefinement = uiOrdering.addNewGroup("Grid Refinement");
gridRefinement->add(&m_cellCountI, { true, 2, 1});
gridRefinement->add(&m_cellCountJ, { false });
gridRefinement->add(&m_cellCountK, { false });
// uiOrdering.add(&m_wellPathsInfo);
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields(true);
} }
@ -232,4 +262,3 @@ void RicExportLgrUi::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
} }
} }
} }

View File

@ -22,6 +22,9 @@
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmPtrField.h" #include "cafPdmPtrField.h"
#include "cafPdmProxyValueField.h"
#include <QStringList>
class RimEclipseCase; class RimEclipseCase;
class RicCellRangeUi; class RicCellRangeUi;
@ -41,6 +44,8 @@ public:
enum SplitType { LGR_PER_CELL, LGR_PER_COMPLETION, LGR_PER_WELL}; enum SplitType { LGR_PER_CELL, LGR_PER_COMPLETION, LGR_PER_WELL};
typedef caf::AppEnum<RicExportLgrUi::SplitType> LgrSplitTypeEnum; typedef caf::AppEnum<RicExportLgrUi::SplitType> LgrSplitTypeEnum;
enum CompletionType {CT_NONE = 0x0, CT_PERFORATION = 0x1, CT_FRACTURE = 0x2, CT_FISHBONE = 0x4};
RicExportLgrUi(); RicExportLgrUi();
void setCase(RimEclipseCase* rimCase); void setCase(RimEclipseCase* rimCase);
@ -50,8 +55,10 @@ public:
QString exportFolder() const; QString exportFolder() const;
RimEclipseCase* caseToApply() const; RimEclipseCase* caseToApply() const;
int timeStep() const; int timeStep() const;
CompletionType completionTypes() const;
SplitType splitType() const; SplitType splitType() const;
void hideExportFolderField(bool hide);
void setExportFolder(const QString& folder); void setExportFolder(const QString& folder);
private: private:
@ -62,11 +69,14 @@ private:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
private: private:
caf::PdmField<QString> m_exportFolder; caf::PdmField<QString> m_exportFolder;
caf::PdmPtrField<RimEclipseCase*> m_caseToApply; caf::PdmPtrField<RimEclipseCase*> m_caseToApply;
caf::PdmField<int> m_timeStep; caf::PdmField<int> m_timeStep;
caf::PdmField<bool> m_includePerforations;
caf::PdmField<bool> m_includeFractures;
caf::PdmField<bool> m_includeFishbones;
caf::PdmField<int> m_cellCountI; caf::PdmField<int> m_cellCountI;
caf::PdmField<int> m_cellCountJ; caf::PdmField<int> m_cellCountJ;
@ -74,3 +84,8 @@ private:
caf::PdmField<LgrSplitTypeEnum> m_splitType; caf::PdmField<LgrSplitTypeEnum> m_splitType;
}; };
inline RicExportLgrUi::CompletionType operator|(RicExportLgrUi::CompletionType a, RicExportLgrUi::CompletionType b)
{
return static_cast<RicExportLgrUi::CompletionType>(static_cast<int>(a) | static_cast<int>(b));
}

View File

@ -73,8 +73,9 @@ CAF_CMD_SOURCE_INIT(RicCreateTemporaryLgrFeature, "RicCreateTemporaryLgrFeature"
bool RicCreateTemporaryLgrFeature::isCommandEnabled() bool RicCreateTemporaryLgrFeature::isCommandEnabled()
{ {
std::vector<RimWellPathCompletions*> completions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>(); std::vector<RimWellPathCompletions*> completions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
std::vector<RimWellPath*> wellPaths = caf::selectedObjectsByTypeStrict<RimWellPath*>();
return !completions.empty(); return !completions.empty() || !wellPaths.empty();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -82,8 +83,8 @@ bool RicCreateTemporaryLgrFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked) void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
{ {
std::vector<RimWellPath*> wellPaths = selectedWellPaths(); std::vector<RimWellPath*> wellPaths = RicExportLgrFeature::selectedWellPaths();
CVF_ASSERT(wellPaths.size() > 0); if(wellPaths.size() == 0) return;
std::vector<RimSimWellInView*> simWells; std::vector<RimSimWellInView*> simWells;
QString dialogTitle = "Create Temporary LGR"; QString dialogTitle = "Create Temporary LGR";
@ -97,13 +98,14 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
defaultTimeStep = activeView->currentTimeStep(); defaultTimeStep = activeView->currentTimeStep();
} }
auto dialogData = RicExportLgrFeature::openDialog(dialogTitle, defaultEclipseCase, defaultTimeStep); auto dialogData = RicExportLgrFeature::openDialog(dialogTitle, defaultEclipseCase, defaultTimeStep, true);
if (dialogData) if (dialogData)
{ {
auto eclipseCase = dialogData->caseToApply(); auto eclipseCase = dialogData->caseToApply();
auto lgrCellCounts = dialogData->lgrCellCount(); auto lgrCellCounts = dialogData->lgrCellCount();
size_t timeStep = dialogData->timeStep(); size_t timeStep = dialogData->timeStep();
auto splitType = dialogData->splitType(); auto splitType = dialogData->splitType();
auto completionTypes = dialogData->completionTypes();
auto eclipseCaseData = eclipseCase->eclipseCaseData(); auto eclipseCaseData = eclipseCase->eclipseCaseData();
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::MATRIX_MODEL); RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::MATRIX_MODEL);
@ -116,7 +118,12 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
try try
{ {
lgrs = RicExportLgrFeature::buildLgrsForWellPath(wellPath, eclipseCase, timeStep, lgrCellCounts, splitType); lgrs = RicExportLgrFeature::buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes);
auto mainGrid = eclipseCase->eclipseCaseData()->mainGrid(); auto mainGrid = eclipseCase->eclipseCaseData()->mainGrid();
@ -314,24 +321,6 @@ void RicCreateTemporaryLgrFeature::computeCachedData(RimEclipseCase* eclipseCase
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RicCreateTemporaryLgrFeature::selectedWellPaths()
{
std::vector<RimWellPathCompletions*> selectedCompletions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
std::vector<RimWellPath*> wellPaths;
for (auto completion : selectedCompletions)
{
RimWellPath* parentWellPath;
completion->firstAncestorOrThisOfType(parentWellPath);
if (parentWellPath) wellPaths.push_back(parentWellPath);
}
return wellPaths;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -48,9 +48,7 @@ protected:
private: private:
static void createLgr(LgrInfo& lgrInfo, RigMainGrid* mainGrid); static void createLgr(LgrInfo& lgrInfo, RigMainGrid* mainGrid);
static void computeCachedData(RimEclipseCase* eclipseCase);
static void deleteAllCachedData(RimEclipseCase* eclipseCase); static void deleteAllCachedData(RimEclipseCase* eclipseCase);
static void computeCachedData(RimEclipseCase* eclipseCase);
static std::vector<RimWellPath*> selectedWellPaths();
static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells); static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells);
}; };

View File

@ -783,9 +783,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder.subMenuEnd(); menuBuilder.subMenuEnd();
} }
menuBuilder << "RicExportLgrFeature";
menuBuilder << "RicCreateTemporaryLgrFeature";
} }
menuBuilder << "RicCreateMultipleFracturesFeature"; menuBuilder << "RicCreateMultipleFracturesFeature";
@ -804,6 +801,9 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicDeleteSummaryCaseCollectionFeature"; menuBuilder << "RicDeleteSummaryCaseCollectionFeature";
menuBuilder << "RicCloseObservedDataFeature"; menuBuilder << "RicCloseObservedDataFeature";
menuBuilder << "RicExportLgrFeature";
menuBuilder << "RicCreateTemporaryLgrFeature";
// Work in progress -- End // Work in progress -- End
caf::PdmUiItem* uiItem = uiItems[0]; caf::PdmUiItem* uiItem = uiItems[0];