#1665 Add exportWellPathComplections command to command file interface

This commit is contained in:
Bjørnar Grip Fjær 2017-07-27 10:28:41 +02:00
parent 51ce7f7bde
commit 8e444d5cbe
4 changed files with 152 additions and 1 deletions

View File

@ -4,6 +4,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.h
${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.h
${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h
@ -14,6 +15,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp

View File

@ -0,0 +1,102 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicfExportWellPathCompletions.h"
#include "RicfCommandFileExecutor.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimOilField.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCase.h"
#include "RimWellPathCollection.h"
#include "RimWellPath.h"
#include "CompletionCommands/RicWellPathExportCompletionDataFeature.h"
CAF_PDM_SOURCE_INIT(RicfExportWellPathCompletions, "exportWellPathCompletions");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfExportWellPathCompletions::RicfExportWellPathCompletions()
{
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", "", "", "");
RICF_InitField(&m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "");
RICF_InitField(&m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "");
RICF_InitField(&m_excludeMainBoreForFishbones, "excludeMainBoreForFishbones", false, "Exclude Main Bore for Fishbones", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfExportWellPathCompletions::execute()
{
RicExportCompletionDataSettingsUi exportSettings(false);
exportSettings.timeStep = m_timeStep;
exportSettings.wellSelection = m_wellSelection;
exportSettings.fileSplit = m_fileSplit;
exportSettings.compdatExport = m_compdatExport;
exportSettings.includePerforations = m_includePerforations;
exportSettings.includeFishbones = m_includeFishbones;
exportSettings.excludeMainBoreForFishbones = m_excludeMainBoreForFishbones;
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
{
if (c->caseId() == m_caseId())
{
exportSettings.caseToApply = c;
break;
}
}
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
if (exportFolder.isNull())
{
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions");
}
exportSettings.folder = exportFolder;
std::vector<RimWellPath*> wellPaths;
if (m_wellPathNames().empty())
{
std::copy(RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths().begin(),
RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths().end(),
std::back_inserter(wellPaths));
}
else
{
for (const QString& wellPathName : m_wellPathNames())
{
RimWellPath* wellPath = RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPathByName(wellPathName);
if (wellPath)
{
wellPaths.push_back(wellPath);
}
}
}
RicWellPathExportCompletionDataFeature::exportCompletions(wellPaths, exportSettings);
}

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicfExportWellPathCompletions : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfExportWellPathCompletions();
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;
caf::PdmField<bool> m_includePerforations;
caf::PdmField<bool> m_includeFishbones;
caf::PdmField<bool> m_excludeMainBoreForFishbones;
};

View File

@ -150,11 +150,11 @@ public:
double wellRadius,
size_t cellIndex,
CellDirection direction);
static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings);
private:
static RigCompletionData combineEclipseCellCompletions(const std::vector<RigCompletionData>& completions,
const RicExportCompletionDataSettingsUi& settings);
static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings);
static void printCompletionsToFile(const QString& exportFolder, const QString& fileName, std::vector<RigCompletionData>& completions, RicExportCompletionDataSettingsUi::CompdatExportType exportType);
static std::vector<RigCompletionData> getCompletionsForWellAndCompletionType(const std::vector<RigCompletionData>& completions, const QString& wellName, RigCompletionData::CompletionType completionType);