#1665 Add setTimeStep command to command file interface

This commit is contained in:
Bjørnar Grip Fjær 2017-07-27 10:39:59 +02:00
parent 8af00bc1b4
commit 2c88d4bee9
4 changed files with 100 additions and 1 deletions

View File

@ -10,6 +10,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.h
${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -23,6 +24,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfOpenProject.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,61 @@
#include "RicfSetTimeStep.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 "RicfSetTimeStep.h"
#include "RimProject.h"
#include "RimOilField.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCase.h"
#include "RimView.h"
#include "RiaApplication.h"
CAF_PDM_SOURCE_INIT(RicfSetTimeStep, "setTimeStep");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfSetTimeStep::RicfSetTimeStep()
{
RICF_InitField(&m_caseId, "case", -1, "Case ID", "", "", "");
RICF_InitField(&m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfSetTimeStep::execute()
{
RimEclipseCase* eclipseCase;
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels()->cases)
{
if (c->caseId == m_caseId)
{
eclipseCase = c;
break;
}
}
for (RimView* view : eclipseCase->views())
{
view->setCurrentTimeStepAndUpdate(m_timeStepIndex);
}
}

View File

@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicfSetTimeStep : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfSetTimeStep();
virtual void execute() override;
private:
caf::PdmField<int> m_caseId;
caf::PdmField<int> m_timeStepIndex;
};

View File

@ -139,6 +139,7 @@ public:
// Animation
int currentTimeStep() const { return m_currentTimeStep;}
void setCurrentTimeStep(int frameIdx);
void setCurrentTimeStepAndUpdate(int frameIdx);
void updateCurrentTimeStepAndRedraw();
@ -237,7 +238,6 @@ private:
RimViewLinker* viewLinkerIfMasterView() const;
friend class RiuViewer;
void setCurrentTimeStepAndUpdate(int frameIdx);
void endAnimation();
private: