#1665 Add computeCaseGroupStatistics command to command file interface

This commit is contained in:
Bjørnar Grip Fjær 2017-07-27 11:49:03 +02:00
parent f6c27a1774
commit ab1322c5d7
3 changed files with 102 additions and 0 deletions

View File

@ -2,6 +2,7 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.h
${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.h
${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.h
@ -18,6 +19,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicfCloseProject.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfCommandFileExecutor.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.cpp

View File

@ -0,0 +1,65 @@
#include "RicfComputeCaseGroupStatistics.h"
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicfComputeCaseGroupStatistics.h"
#include "RimProject.h"
#include "RimOilField.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseStatisticsCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimCaseCollection.h"
#include "RimView.h"
#include "RiaApplication.h"
CAF_PDM_SOURCE_INIT(RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfComputeCaseGroupStatistics::RicfComputeCaseGroupStatistics()
{
RICF_InitField(&m_caseIds, "cases", std::vector<int>(), "Case IDs", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfComputeCaseGroupStatistics::execute()
{
for (int caseId : m_caseIds())
{
for (RimIdenticalGridCaseGroup* group : RiaApplication::instance()->project()->activeOilField()->analysisModels()->caseGroups)
{
for (RimEclipseCase* c : group->statisticsCaseCollection->reservoirs)
{
if (c->caseId == caseId)
{
RimEclipseStatisticsCase* statsCase = dynamic_cast<RimEclipseStatisticsCase*>(c);
if (statsCase)
{
statsCase->computeStatisticsAndUpdateViews();
}
}
}
}
}
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmField.h"
class RicfComputeCaseGroupStatistics : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfComputeCaseGroupStatistics();
virtual void execute() override;
private:
caf::PdmField< std::vector<int> > m_caseIds;
};