mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5757 Python : Add access to time_t values
This commit is contained in:
parent
27def6c132
commit
ae15122632
@ -5,6 +5,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -13,6 +14,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerTime.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimcDataContainerTime.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include "cafPdmObjectScriptability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimcDataContainerTime, "DataContainerTime" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcDataContainerTime::RimcDataContainerTime()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Data Container Time", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_timeValues, "TimeValues", "Data Time Values", "", "", "" );
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcDataContainerTime : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcDataContainerTime();
|
||||
|
||||
caf::PdmField<std::vector<time_t>> m_timeValues;
|
||||
};
|
@ -20,9 +20,11 @@
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimcDataContainerDouble.h"
|
||||
|
||||
#include "RimcDataContainerDouble.h"
|
||||
#include "RimcDataContainerString.h"
|
||||
#include "RimcDataContainerTime.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimcSummaryCase_summaryVectorValues, "SummaryVectorValues" );
|
||||
@ -132,3 +134,47 @@ std::unique_ptr<caf::PdmObjectHandle> RimcSummaryCase_AvailableAddresses::defaul
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimcDataContainerString );
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimcSummaryCase_TimeSteps, "AvailableTimeSteps" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcSummaryCase_TimeSteps::RimcSummaryCase_TimeSteps( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Available TimeSteps", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSummaryCase_TimeSteps::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
|
||||
RifEclipseSummaryAddress adr;
|
||||
auto timeValues = sumReader->timeSteps( adr );
|
||||
|
||||
auto dataObject = new RimcDataContainerTime();
|
||||
dataObject->m_timeValues = timeValues;
|
||||
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcSummaryCase_TimeSteps::resultIsPersistent() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcSummaryCase_TimeSteps::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimcDataContainerTime );
|
||||
}
|
||||
|
@ -58,3 +58,18 @@ public:
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcSummaryCase_TimeSteps : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcSummaryCase_TimeSteps( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute();
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user