mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4463 Working creation of grid case groups
This commit is contained in:
@@ -29,6 +29,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateLgrForCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfApplicationTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateSaturationPressurePlots.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportFlowCharacteristics.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -61,6 +62,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateLgrForCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfApplicationTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateSaturationPressurePlots.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportFlowCharacteristics.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RicfCreateGridCaseGroup.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaImportEclipseCaseTools.h"
|
||||
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateGridCaseGroupResult, "createGridCaseGroupResult");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateGridCaseGroupResult::RicfCreateGridCaseGroupResult(int caseGroupId /*= -1*/, const QString& caseGroupName /*= ""*/)
|
||||
{
|
||||
CAF_PDM_InitObject("case_group_result", "", "", "");
|
||||
CAF_PDM_InitField(&this->caseGroupId, "groupId", caseGroupId, "", "", "", "");
|
||||
CAF_PDM_InitField(&this->caseGroupName, "groupName", caseGroupName, "", "", "", "");
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfCreateGridCaseGroup, "createGridCaseGroup");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateGridCaseGroup::RicfCreateGridCaseGroup()
|
||||
{
|
||||
RICF_InitFieldNoDefault(&m_casePaths, "casePaths", "List of Paths to Case Files", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateGridCaseGroup::execute()
|
||||
{
|
||||
QStringList casePaths;
|
||||
for (QString casePath : m_casePaths())
|
||||
{
|
||||
QFileInfo casePathInfo(casePath);
|
||||
if (!casePathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
casePath = startDir.absoluteFilePath(casePath);
|
||||
}
|
||||
casePaths.push_back(casePath);
|
||||
}
|
||||
|
||||
RimIdenticalGridCaseGroup* caseGroup = nullptr;
|
||||
|
||||
if (RiaImportEclipseCaseTools::addEclipseCases(casePaths, &caseGroup) && caseGroup)
|
||||
{
|
||||
RicfCommandResponse response;
|
||||
response.setResult(new RicfCreateGridCaseGroupResult(caseGroup->groupId(), caseGroup->name()));
|
||||
return response;
|
||||
}
|
||||
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, "Could not load grid case group");
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor 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 "cafPdmField.h"
|
||||
|
||||
class RicfCreateGridCaseGroupResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateGridCaseGroupResult(int caseGroupId = -1, const QString& caseGroupName = "");
|
||||
|
||||
public:
|
||||
caf::PdmField<int> caseGroupId;
|
||||
caf::PdmField<QString> caseGroupName;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateGridCaseGroup : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateGridCaseGroup();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_casePaths;
|
||||
};
|
||||
@@ -1,17 +1,18 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// Copyright (C) 2017-2019 Statoil ASA
|
||||
// Copyright (C) 2019- Equinor 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2017-2019 Statoil ASA
|
||||
// Copyright (C) 2019- Equinor 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
|
||||
|
||||
@@ -82,11 +82,11 @@ RicfCommandResponse RicfSingleCaseReplace::execute()
|
||||
|
||||
if (m_caseId() < 0)
|
||||
{
|
||||
projectModifier->setReplaceCaseFirstOccurrence(m_newGridFile());
|
||||
projectModifier->setReplaceCaseFirstOccurrence(filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectModifier->setReplaceCase(m_caseId(), );
|
||||
projectModifier->setReplaceCase(m_caseId(), filePath);
|
||||
}
|
||||
|
||||
if (!RiaApplication::instance()->loadProject(lastProjectPath, RiaApplication::PLA_NONE, projectModifier.p()))
|
||||
|
||||
Reference in New Issue
Block a user