2018-10-05 04:49:44 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
#include "RicExportLgrUi.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
#include "RicCellRangeUi.h"
|
|
|
|
|
|
|
|
#include "RimEclipseCase.h"
|
|
|
|
#include "RimTools.h"
|
|
|
|
|
|
|
|
#include "cafPdmUiFilePathEditor.h"
|
2018-10-25 02:59:30 -05:00
|
|
|
#include "cafPdmUiTextEditor.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
#include "cafVecIjk.h"
|
|
|
|
|
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RicExportLgrUi, "RicExportLgrUi");
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-09 01:01:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
namespace caf
|
|
|
|
{
|
|
|
|
template<>
|
2018-10-29 07:38:26 -05:00
|
|
|
void Lgr::SplitTypeEnum::setUp()
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
2018-10-29 07:38:26 -05:00
|
|
|
addItem(Lgr::LGR_PER_CELL, "LGR_PER_CELL", "LGR Per Cell");
|
|
|
|
addItem(Lgr::LGR_PER_COMPLETION, "LGR_PER_COMPLETION", "LGR Per Completion");
|
|
|
|
addItem(Lgr::LGR_PER_WELL, "LGR_PER_WELL", "LGR Per Well");
|
2018-10-09 01:01:56 -05:00
|
|
|
|
2018-10-29 07:38:26 -05:00
|
|
|
setDefault(Lgr::LGR_PER_COMPLETION);
|
2018-10-09 01:01:56 -05:00
|
|
|
}
|
|
|
|
}
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
RicExportLgrUi::RicExportLgrUi()
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Export CARFIN", "", "", "");
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_exportFolder, "ExportFolder", "Export Folder", "", "", "");
|
|
|
|
m_exportFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_caseToApply, "CaseToApply", "Source Case", "", "", "");
|
2018-10-11 02:31:06 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_timeStep, "TimeStepIndex", "Time Step", "", "", "");
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-25 02:59:30 -05:00
|
|
|
CAF_PDM_InitField(&m_includePerforations, "IncludePerforations", true, "Perforations", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_includeFractures, "IncludeFractures", true, "Fractures", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_includeFishbones, "IncludeFishbones", true, "Fishbones", "", "", "");
|
|
|
|
|
2018-10-19 06:07:47 -05:00
|
|
|
QString ijkLabel = "Cell Count I, J, K";
|
|
|
|
CAF_PDM_InitField(&m_cellCountI, "CellCountI", 2, ijkLabel, "", "", "");
|
2018-10-25 02:59:30 -05:00
|
|
|
CAF_PDM_InitField(&m_cellCountJ, "CellCountJ", 2, "", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_cellCountK, "CellCountK", 2, "", "", "", "");
|
2018-10-09 01:01:56 -05:00
|
|
|
|
2018-10-19 06:07:47 -05:00
|
|
|
m_cellCountJ.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
|
|
m_cellCountK.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
|
|
|
|
2018-10-29 07:38:26 -05:00
|
|
|
CAF_PDM_InitField(&m_splitType, "SplitType", Lgr::SplitTypeEnum(), "Split Type", "", "", "");
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrUi::setCase(RimEclipseCase* rimCase)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
bool isDifferent = (rimCase != m_caseToApply);
|
|
|
|
|
|
|
|
if (isDifferent)
|
|
|
|
{
|
|
|
|
m_caseToApply = rimCase;
|
|
|
|
setDefaultValuesFromCase();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-11 02:31:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicExportLgrUi::setTimeStep(int timeStep)
|
|
|
|
{
|
|
|
|
bool isDifferent = timeStep != m_timeStep;
|
|
|
|
|
|
|
|
if (isDifferent)
|
|
|
|
{
|
|
|
|
m_timeStep = timeStep;
|
|
|
|
setDefaultValuesFromCase();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-05 04:49:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
caf::VecIjk RicExportLgrUi::lgrCellCount() const
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
return caf::VecIjk (m_cellCountI, m_cellCountJ, m_cellCountK);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
QString RicExportLgrUi::exportFolder() const
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
return m_exportFolder();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
RimEclipseCase* RicExportLgrUi::caseToApply() const
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
return m_caseToApply();
|
|
|
|
}
|
|
|
|
|
2018-10-11 02:31:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
int RicExportLgrUi::timeStep() const
|
|
|
|
{
|
|
|
|
return m_timeStep;
|
|
|
|
}
|
|
|
|
|
2018-10-25 02:59:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-26 07:24:56 -05:00
|
|
|
std::set<RigCompletionData::CompletionType> RicExportLgrUi::completionTypes() const
|
2018-10-25 02:59:30 -05:00
|
|
|
{
|
2018-10-26 07:24:56 -05:00
|
|
|
std::set<RigCompletionData::CompletionType> cts;
|
|
|
|
if (m_includePerforations()) cts.insert(RigCompletionData::PERFORATION);
|
|
|
|
if (m_includeFractures()) cts.insert(RigCompletionData::FRACTURE);
|
|
|
|
if (m_includeFishbones()) cts.insert(RigCompletionData::FISHBONES);
|
|
|
|
return cts;
|
2018-10-25 02:59:30 -05:00
|
|
|
}
|
|
|
|
|
2018-10-09 01:01:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-29 07:38:26 -05:00
|
|
|
Lgr::SplitType RicExportLgrUi::splitType() const
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
2018-10-23 04:13:12 -05:00
|
|
|
return m_splitType();
|
2018-10-09 01:01:56 -05:00
|
|
|
}
|
|
|
|
|
2018-10-25 02:59:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicExportLgrUi::hideExportFolderField(bool hide)
|
|
|
|
{
|
|
|
|
m_exportFolder.uiCapability()->setUiHidden(hide);
|
|
|
|
}
|
|
|
|
|
2018-10-05 04:49:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrUi::setExportFolder(const QString& folder)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
m_exportFolder = folder;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrUi::setDefaultValuesFromCase()
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
if (m_caseToApply)
|
|
|
|
{
|
|
|
|
QString caseFolder = m_caseToApply->locationOnDisc();
|
|
|
|
m_exportFolder = caseFolder;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_cellCountI = 2;
|
|
|
|
m_cellCountJ = 2;
|
|
|
|
m_cellCountK = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RicExportLgrUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
|
|
|
|
if (fieldNeedingOptions == &m_caseToApply)
|
|
|
|
{
|
|
|
|
RimTools::caseOptionItems(&options);
|
|
|
|
}
|
2018-10-11 02:31:06 -05:00
|
|
|
else if (fieldNeedingOptions == &m_timeStep)
|
|
|
|
{
|
|
|
|
QStringList timeStepNames;
|
|
|
|
|
|
|
|
if (m_caseToApply)
|
|
|
|
{
|
|
|
|
timeStepNames = m_caseToApply->timeStepStrings();
|
|
|
|
}
|
|
|
|
for (int i = 0; i < timeStepNames.size(); i++)
|
|
|
|
{
|
|
|
|
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
|
|
|
}
|
|
|
|
}
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrUi::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
if (changedField == &m_caseToApply)
|
|
|
|
{
|
|
|
|
setDefaultValuesFromCase();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
2018-10-25 02:59:30 -05:00
|
|
|
caf::PdmUiOrdering::LayoutOptions layout(true, 6, 1);
|
|
|
|
uiOrdering.add(&m_caseToApply, layout);
|
|
|
|
uiOrdering.add(&m_timeStep, layout);
|
|
|
|
uiOrdering.add(&m_exportFolder, layout);
|
|
|
|
uiOrdering.add(&m_includeFractures, layout);
|
|
|
|
uiOrdering.add(&m_includeFishbones, layout);
|
2018-10-29 04:57:35 -05:00
|
|
|
uiOrdering.add(&m_includePerforations, layout);
|
2018-10-25 02:59:30 -05:00
|
|
|
uiOrdering.add(&m_splitType, {true, 6, 1});
|
|
|
|
|
2018-10-05 04:49:44 -05:00
|
|
|
caf::PdmUiGroup* gridRefinement = uiOrdering.addNewGroup("Grid Refinement");
|
2018-10-25 02:59:30 -05:00
|
|
|
gridRefinement->add(&m_cellCountI, { true, 2, 1});
|
|
|
|
gridRefinement->add(&m_cellCountJ, { false });
|
|
|
|
gridRefinement->add(&m_cellCountK, { false });
|
2018-10-11 02:31:06 -05:00
|
|
|
|
2018-10-25 02:59:30 -05:00
|
|
|
// uiOrdering.add(&m_wellPathsInfo);
|
2018-10-11 02:31:06 -05:00
|
|
|
uiOrdering.skipRemainingFields(true);
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrUi::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
if (field == &m_exportFolder)
|
|
|
|
{
|
|
|
|
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
|
|
|
if (myAttr)
|
|
|
|
{
|
2018-10-09 01:01:56 -05:00
|
|
|
myAttr->m_selectDirectory = true;
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|