#4463 Working creation of grid case groups

This commit is contained in:
Gaute Lindkvist
2019-07-18 10:53:59 +02:00
parent 7a2b9926a0
commit 6b7a9b8da5
14 changed files with 228 additions and 21 deletions

View File

@@ -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

View File

@@ -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");
}

View File

@@ -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;
};

View File

@@ -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.
//
/////////////////////////////////////////////////////////////////////////////////

View File

@@ -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

View File

@@ -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()))