mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 15:36:09 -06:00
#3640 File commands. New class RicfApplicationTools containing reusable functionality
This commit is contained in:
parent
06db391689
commit
e8bf189116
@ -26,6 +26,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfExportVisibleCells.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportPropertyInViews.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportLgrForCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateLgrForCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfApplicationTools.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -55,6 +56,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfExportVisibleCells.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportPropertyInViews.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportLgrForCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateLgrForCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfApplicationTools.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
135
ApplicationCode/CommandFileInterface/RicfApplicationTools.cpp
Normal file
135
ApplicationCode/CommandFileInterface/RicfApplicationTools.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicfApplicationTools.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaWellNameComparer.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Empty wellPathNames returns all well paths
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RicfApplicationTools::wellPathsFromNames(const QStringList& wellPathNames, QStringList* wellsNotFound)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
|
||||
|
||||
if (!wellPathNames.empty())
|
||||
{
|
||||
std::set<QString> wellPathNameSet(wellPathNames.begin(), wellPathNames.end());
|
||||
|
||||
for (auto wellPath : allWellPaths)
|
||||
{
|
||||
auto matchedName = RiaWellNameComparer::tryMatchNameInList(wellPath->name(), toStringVector(wellPathNames));
|
||||
if (!matchedName.isEmpty())
|
||||
{
|
||||
wellPaths.push_back(wellPath);
|
||||
wellPathNameSet.erase(matchedName);
|
||||
}
|
||||
}
|
||||
|
||||
if (wellsNotFound)
|
||||
{
|
||||
wellsNotFound->clear();
|
||||
if (!wellPathNameSet.empty())
|
||||
{
|
||||
for (const auto& wpn : wellPathNameSet)
|
||||
wellsNotFound->push_back(wpn);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wellPaths = allWellPaths;
|
||||
}
|
||||
return wellPaths;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RicfApplicationTools::toStringVector(const QStringList& stringList)
|
||||
{
|
||||
return std::vector<QString>(stringList.begin(), stringList.end());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RicfApplicationTools::toQStringList(const std::vector<QString>& v)
|
||||
{
|
||||
QStringList stringList;
|
||||
for (const auto& s : v)
|
||||
{
|
||||
stringList.push_back(s);
|
||||
}
|
||||
return stringList;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// If caseId is -1, return first case found
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicfApplicationTools::caseFromId(int caseId)
|
||||
{
|
||||
auto eclipseCases = RiaApplication::instance()->project()->eclipseCases();
|
||||
if (caseId < 0)
|
||||
{
|
||||
if (!eclipseCases.empty()) return eclipseCases.front();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (RimEclipseCase* c : eclipseCases)
|
||||
{
|
||||
if (c->caseId() == caseId) return c;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewName(int caseId, const QString& viewName)
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->eclipseCases())
|
||||
{
|
||||
if (c->caseId() == caseId)
|
||||
{
|
||||
for (auto v : c->views())
|
||||
{
|
||||
auto eclipseView = dynamic_cast<RimEclipseView*>(v);
|
||||
if (eclipseView && eclipseView->name().compare(viewName, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return eclipseView;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
44
ApplicationCode/CommandFileInterface/RicfApplicationTools.h
Normal file
44
ApplicationCode/CommandFileInterface/RicfApplicationTools.h
Normal file
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <QString>
|
||||
#include <vector>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimWellPath;
|
||||
class QStringList;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfApplicationTools
|
||||
{
|
||||
public:
|
||||
static std::vector<RimWellPath*> wellPathsFromNames(const QStringList& wellPathNames,
|
||||
QStringList* wellsNotFound);
|
||||
static RimEclipseCase* caseFromId(int caseId);
|
||||
static RimEclipseView* viewFromCaseIdAndViewName(int caseId, const QString& viewName);
|
||||
|
||||
static std::vector<QString> toStringVector(const QStringList& stringList);
|
||||
static QStringList toQStringList(const std::vector<QString>& v);
|
||||
};
|
@ -19,7 +19,7 @@
|
||||
#include "RicfCreateLgrForCompletions.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "RicfCreateMultipleFractures.h"
|
||||
#include "RicfApplicationTools.h"
|
||||
|
||||
#include "RicDeleteTemporaryLgrsFeature.h"
|
||||
#include "RicCreateTemporaryLgrFeature.h"
|
||||
@ -61,7 +61,20 @@ RicfCreateLgrForCompletions::RicfCreateLgrForCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCreateLgrForCompletions::execute()
|
||||
{
|
||||
const auto wellPaths = RicfCreateMultipleFractures::wellPaths(m_wellPathNames);
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
// Find well paths
|
||||
{
|
||||
QStringList wellsNotFound;
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("createLgrForCompletions: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPaths.empty())
|
||||
{
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicfCreateMultipleFractures.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "FractureCommands/RicCreateMultipleFracturesFeature.h"
|
||||
@ -75,13 +76,35 @@ RicfCreateMultipleFractures::RicfCreateMultipleFractures()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCreateMultipleFractures::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RiuCreateMultipleFractionsUi* settings = project->dialogData()->multipleFractionsData();
|
||||
|
||||
// Get case and fracture template
|
||||
auto gridCase = caseFromId(m_caseId);
|
||||
auto gridCase = TOOLS::caseFromId(m_caseId);
|
||||
auto fractureTemplate = fractureTemplateFromId(m_templateId);
|
||||
auto wellPaths = this->wellPaths(m_wellPathNames);
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
// Find well paths
|
||||
{
|
||||
QStringList wellsNotFound;
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
if (!gridCase)
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: Could not find case with ID %1").arg(m_caseId));
|
||||
}
|
||||
|
||||
if (!fractureTemplate)
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: Could not find fracture template with ID %1").arg(m_templateId));
|
||||
}
|
||||
|
||||
if (gridCase && fractureTemplate && !wellPaths.empty() && validateArguments())
|
||||
{
|
||||
@ -135,20 +158,6 @@ bool RicfCreateMultipleFractures::validateArguments() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicfCreateMultipleFractures::caseFromId(int caseId) const
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == caseId) return c;
|
||||
}
|
||||
|
||||
RiaLogging::error(QString("createMultipleFractures: Could not find case with ID %1").arg(caseId));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -162,35 +171,3 @@ RimFractureTemplate* RicfCreateMultipleFractures::fractureTemplateFromId(int tem
|
||||
RiaLogging::error(QString("createMultipleFractures: Could not find fracture template with ID %1").arg(templateId));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RicfCreateMultipleFractures::wellPaths(const std::vector<QString>& wellPathNames)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
|
||||
|
||||
if (!wellPathNames.empty())
|
||||
{
|
||||
std::set<QString> wellPathNameSet(wellPathNames.begin(), wellPathNames.end());
|
||||
|
||||
for (auto wellPath : allWellPaths)
|
||||
{
|
||||
if (!RiaWellNameComparer::tryMatchNameInList(wellPath->name(), wellPathNames).isEmpty())
|
||||
wellPaths.push_back(wellPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wellPaths = allWellPaths;
|
||||
}
|
||||
|
||||
if (wellPaths.empty() || wellPaths.size() < wellPathNames.size())
|
||||
{
|
||||
RiaLogging::error(QString("createMultipleFractures: One or more well paths was not found"));
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
return wellPaths;
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,9 @@ public:
|
||||
RicfCreateMultipleFractures();
|
||||
|
||||
void execute() override;
|
||||
static std::vector<RimWellPath*> wellPaths(const std::vector<QString>& wellPathNames);
|
||||
|
||||
private:
|
||||
bool validateArguments() const;
|
||||
RimEclipseCase* caseFromId(int caseId)const ;
|
||||
RimFractureTemplate* fractureTemplateFromId(int templateId) const;
|
||||
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include "RicfExportLgrForCompletions.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "RicfCreateMultipleFractures.h"
|
||||
|
||||
#include "ExportCommands/RicExportLgrFeature.h"
|
||||
|
||||
@ -61,7 +61,20 @@ RicfExportLgrForCompletions::RicfExportLgrForCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportLgrForCompletions::execute()
|
||||
{
|
||||
const auto wellPaths = RicfCreateMultipleFractures::wellPaths(m_wellPathNames);
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
// Find well paths
|
||||
{
|
||||
QStringList wellsNotFound;
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("exportLgrForCompletions: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPaths.empty())
|
||||
{
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::LGRS);
|
||||
@ -73,21 +86,11 @@ void RicfExportLgrForCompletions::execute()
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
auto feature = dynamic_cast<RicExportLgrFeature*>(commandManager->getCommandFeature("RicExportLgrFeature"));
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
RimEclipseCase* eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == m_caseId())
|
||||
{
|
||||
eclipseCase = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportLgrForCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
RiaLogging::error(QString("exportLgrForCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicfExportMsw.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@ -50,25 +51,15 @@ RicfExportMsw::RicfExportMsw()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportMsw::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RicCaseAndFileExportSettingsUi exportSettings;
|
||||
|
||||
auto eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
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("exportMsw: Could not find case with ID %1.").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
RiaLogging::error(QString("exportMsw: Could not find case with ID %1.").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
@ -78,7 +69,7 @@ void RicfExportMsw::execute()
|
||||
}
|
||||
exportSettings.folder = exportFolder;
|
||||
|
||||
RimWellPath* wellPath = RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPathByName(m_wellPathName);
|
||||
RimWellPath* wellPath = RiaApplication::instance()->project()->wellPathByName(m_wellPathName);
|
||||
if (!wellPath)
|
||||
{
|
||||
RiaLogging::error(QString("exportMsw: Could not find well path with name %1").arg(m_wellPathName()));
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "../Commands/ExportCommands/RicEclipseCellResultToFileImpl.h"
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
@ -61,21 +62,10 @@ RicfExportProperty::RicfExportProperty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportProperty::execute()
|
||||
{
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimEclipseCase* eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
RiaApplication::instance()->project()->allCases(cases);
|
||||
|
||||
for (auto* c : cases)
|
||||
{
|
||||
RimEclipseCase* eclCase = dynamic_cast<RimEclipseCase*>(c);
|
||||
if (eclCase->caseId == m_caseId)
|
||||
{
|
||||
eclipseCase = eclCase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "RicfExportPropertyInViews.h"
|
||||
|
||||
@ -56,25 +57,13 @@ RicfExportPropertyInViews::RicfExportPropertyInViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportPropertyInViews::execute()
|
||||
{
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
RiaApplication::instance()->project()->allCases(cases);
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
for (auto* c : cases)
|
||||
{
|
||||
RimEclipseCase* eclCase = dynamic_cast<RimEclipseCase*>(c);
|
||||
if (eclCase->caseId == m_caseId)
|
||||
{
|
||||
eclipseCase = eclCase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
RimEclipseCase* eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportProperty: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimEclipseView*> viewsForExport;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicfExportSimWellFractureCompletions.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@ -57,6 +58,8 @@ RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSimWellFractureCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
|
||||
@ -65,21 +68,13 @@ void RicfExportSimWellFractureCompletions::execute()
|
||||
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)
|
||||
auto eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportSimWellCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaFilePathTools.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "ExportCommands/RicSaveEclipseInputVisibleCellsFeature.h"
|
||||
#include "ExportCommands/RicSaveEclipseInputVisibleCellsUi.h"
|
||||
@ -80,7 +81,7 @@ void RicfExportVisibleCells::execute()
|
||||
return;
|
||||
}
|
||||
|
||||
auto eclipseView = viewFromCaseIdAndViewName(m_caseId, m_viewName);
|
||||
auto eclipseView = RicfApplicationTools::viewFromCaseIdAndViewName(m_caseId, m_viewName);
|
||||
if (!eclipseView)
|
||||
{
|
||||
RiaLogging::error(QString("exportVisibleCells: Could not find view '%1' in case ID %2").arg(m_viewName).arg(m_caseId));
|
||||
@ -98,29 +99,6 @@ void RicfExportVisibleCells::execute()
|
||||
RicSaveEclipseInputVisibleCellsFeature::executeCommand(eclipseView, exportSettings, "exportVisibleCells");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicfExportVisibleCells::viewFromCaseIdAndViewName(int caseId, const QString& viewName)
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == caseId)
|
||||
{
|
||||
for (auto v : c->views())
|
||||
{
|
||||
auto eclipseView = dynamic_cast<RimEclipseView*>(v);
|
||||
if (eclipseView && eclipseView->name().compare(viewName, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return eclipseView;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
void execute() override;
|
||||
|
||||
private:
|
||||
RimEclipseView* viewFromCaseIdAndViewName(int caseId, const QString& viewName);
|
||||
void buildExportSettings(const QString& exportFolder, RicSaveEclipseInputVisibleCellsUi* exportSettings);
|
||||
|
||||
caf::PdmField<int> m_caseId;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicfExportWellPathCompletions.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@ -66,6 +67,8 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportWellPathCompletions::execute()
|
||||
{
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
||||
|
||||
@ -95,21 +98,13 @@ void RicfExportWellPathCompletions::execute()
|
||||
exportSettings->setCombinationMode(m_combinationMode());
|
||||
|
||||
{
|
||||
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)
|
||||
auto eclipseCase = TOOLS::caseFromId(m_caseId());
|
||||
if (!eclipseCase)
|
||||
{
|
||||
RiaLogging::error(QString("exportWellPathCompletions: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
}
|
||||
exportSettings->caseToApply = eclipseCase;
|
||||
}
|
||||
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "RicfExportWellPaths.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "RicfCreateMultipleFractures.h"
|
||||
#include "RicfApplicationTools.h"
|
||||
|
||||
#include "ExportCommands/RicExportSelectedWellPathsFeature.h"
|
||||
|
||||
@ -54,7 +54,20 @@ RicfExportWellPaths::RicfExportWellPaths()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportWellPaths::execute()
|
||||
{
|
||||
const auto wellPaths = RicfCreateMultipleFractures::wellPaths(m_wellPathNames);
|
||||
using TOOLS = RicfApplicationTools;
|
||||
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
// Find well paths
|
||||
{
|
||||
QStringList wellsNotFound;
|
||||
wellPaths = TOOLS::wellPathsFromNames(TOOLS::toQStringList(m_wellPathNames), &wellsNotFound);
|
||||
if (!wellsNotFound.empty())
|
||||
{
|
||||
RiaLogging::error(QString("exportWellPaths: These well paths were not found: ") + wellsNotFound.join(", "));
|
||||
}
|
||||
}
|
||||
|
||||
if (!wellPaths.empty())
|
||||
{
|
||||
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::WELLPATHS);
|
||||
|
Loading…
Reference in New Issue
Block a user