mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1717 Implement exportSimWellCompletions for command file interface
This commit is contained in:
parent
aa1d7775a4
commit
a06ae58f83
@ -6,6 +6,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMultiCaseSnapshots.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.h
|
||||
@ -26,6 +27,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportMultiCaseSnapshots.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.cpp
|
||||
|
@ -0,0 +1,129 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfExportSimWellCompletions.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "CompletionCommands/RicWellPathExportCompletionDataFeature.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportSimWellCompletions, "exportSimWellCompletions");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportSimWellCompletions::RicfExportSimWellCompletions()
|
||||
{
|
||||
RICF_InitField(&m_caseId, "case", -1, "Case ID", "", "", "");
|
||||
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
|
||||
RICF_InitField(&m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "");
|
||||
RICF_InitField(&m_wellSelection, "wellSelection", RicExportCompletionDataSettingsUi::WellSelectionType(), "Well Selection", "", "", "");
|
||||
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
|
||||
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSimWellCompletions::execute()
|
||||
{
|
||||
RicExportCompletionDataSettingsUi exportSettings(false);
|
||||
exportSettings.timeStep = m_timeStep;
|
||||
exportSettings.wellSelection = m_wellSelection;
|
||||
exportSettings.fileSplit = m_fileSplit;
|
||||
exportSettings.compdatExport = m_compdatExport;
|
||||
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
exportSettings.caseToApply = c;
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
if (exportFolder.isNull())
|
||||
{
|
||||
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions");
|
||||
}
|
||||
exportSettings.folder = exportFolder;
|
||||
|
||||
// FIXME : Select correct view?
|
||||
RimEclipseView* view;
|
||||
for (RimView* v : exportSettings.caseToApply->views())
|
||||
{
|
||||
view = dynamic_cast<RimEclipseView*>(v);
|
||||
if (view) break;
|
||||
}
|
||||
if (!view)
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find a view for case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimEclipseWell*> simWells;
|
||||
if (m_wellPathNames().empty())
|
||||
{
|
||||
std::copy(view->wellCollection->wells.begin(),
|
||||
view->wellCollection->wells.end(),
|
||||
std::back_inserter(simWells));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const QString& wellPathName : m_wellPathNames())
|
||||
{
|
||||
RimEclipseWell* simWell = view->wellCollection->findWell(wellPathName);
|
||||
if (simWell)
|
||||
{
|
||||
simWells.push_back(simWell);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 on case with ID %2").arg(wellPathName).arg(m_caseId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
RicWellPathExportCompletionDataFeature::exportCompletions(wellPaths, simWells, exportSettings);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "CompletionCommands/RicExportCompletionDataSettingsUi.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportSimWellCompletions : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportSimWellCompletions();
|
||||
|
||||
virtual void execute() override;
|
||||
|
||||
private:
|
||||
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
caf::PdmField< std::vector<QString> > m_wellPathNames;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::WellSelectionType> m_wellSelection;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::ExportSplitType> m_fileSplit;
|
||||
caf::PdmField<RicExportCompletionDataSettingsUi::CompdatExportType> m_compdatExport;
|
||||
};
|
@ -105,6 +105,10 @@ void RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
wellPaths.push_back(wellPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::warning(QString("exportWellPathCompletions: Could not find well path with name %1").arg(wellPathName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user