mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#1691 Add time step filter to RimCase and use from RimEclipseResultCase
This commit is contained in:
parent
624f14da46
commit
78da4c6469
@ -84,9 +84,9 @@ const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderInterface::setTimestepIndicesForImport(const std::vector<size_t>& timeStepIndices)
|
||||
void RifReaderInterface::setTimeStepFilter(const std::vector<size_t>& fileTimeStepIndices)
|
||||
{
|
||||
m_includedTimeStepIndices = timeStepIndices;
|
||||
m_fileTimeStepIndices = fileTimeStepIndices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -94,9 +94,9 @@ void RifReaderInterface::setTimestepIndicesForImport(const std::vector<size_t>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::isTimeStepIncludedByFilter(size_t timeStepIndex) const
|
||||
{
|
||||
if (m_includedTimeStepIndices.empty()) return true;
|
||||
if (m_fileTimeStepIndices.empty()) return true;
|
||||
|
||||
for (auto i : m_includedTimeStepIndices)
|
||||
for (auto i : m_fileTimeStepIndices)
|
||||
{
|
||||
if (i == timeStepIndex)
|
||||
{
|
||||
@ -112,9 +112,9 @@ bool RifReaderInterface::isTimeStepIncludedByFilter(size_t timeStepIndex) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RifReaderInterface::timeStepIndexOnFile(size_t timeStepIndex) const
|
||||
{
|
||||
if (timeStepIndex < m_includedTimeStepIndices.size())
|
||||
if (timeStepIndex < m_fileTimeStepIndices.size())
|
||||
{
|
||||
return m_includedTimeStepIndices[timeStepIndex];
|
||||
return m_fileTimeStepIndices[timeStepIndex];
|
||||
}
|
||||
|
||||
return timeStepIndex;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
void setFilenamesWithFaults(const std::vector<QString>& filenames) { m_filenamesWithFaults = filenames; }
|
||||
std::vector<QString> filenamesWithFaults() { return m_filenamesWithFaults; }
|
||||
|
||||
void setTimestepIndicesForImport(const std::vector<size_t>& timeStepIndices);
|
||||
void setTimeStepFilter(const std::vector<size_t>& fileTimeStepIndices);
|
||||
|
||||
protected:
|
||||
bool isTimeStepIncludedByFilter(size_t timeStepIndex) const;
|
||||
@ -80,5 +80,5 @@ private:
|
||||
std::vector<QString> m_filenamesWithFaults;
|
||||
caf::PdmPointer<RifReaderSettings> m_settings;
|
||||
|
||||
std::vector<size_t> m_includedTimeStepIndices;
|
||||
std::vector<size_t> m_fileTimeStepIndices;
|
||||
};
|
||||
|
@ -90,6 +90,7 @@ ${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.h
|
||||
${CEE_CURRENT_LIST_DIR}RimDialogData.h
|
||||
${CEE_CURRENT_LIST_DIR}RimTimeStepFilter.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -178,6 +179,7 @@ ${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimDialogData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimTimeStepFilter.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -19,17 +19,15 @@
|
||||
|
||||
#include "RimCase.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
|
||||
#include "cafPdmObjectFactory.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include "RimProject.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFormationNames.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimCase, "RimCase");
|
||||
|
||||
@ -45,7 +43,11 @@ RimCase::RimCase()
|
||||
caseId.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&activeFormationNames, "DefaultFormationNames", "Formation Names File", "", "", "");
|
||||
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeStepFilter, "TimeStepFilter", "Time Step Filter", "", "", "");
|
||||
m_timeStepFilter.uiCapability()->setUiHidden(true);
|
||||
m_timeStepFilter.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
m_timeStepFilter = new RimTimeStepFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
@ -30,6 +31,7 @@
|
||||
|
||||
class RimView;
|
||||
class RimFormationNames;
|
||||
class RimTimeStepFilter;
|
||||
|
||||
namespace cvf {
|
||||
class BoundingBox;
|
||||
@ -68,6 +70,9 @@ protected:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
private:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override { return &caseUserDescription; }
|
||||
|
||||
protected:
|
||||
caf::PdmChildField<RimTimeStepFilter*> m_timeStepFilter;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,14 +29,15 @@
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagSolverInterface.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimMockModelSettings.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RigFlowDiagSolverInterface.h"
|
||||
|
||||
#include "cafPdmSettings.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
@ -111,6 +112,11 @@ bool RimEclipseResultCase::openEclipseGridFile()
|
||||
readerInterface->setReaderSetting(prefs->readerSettings());
|
||||
readerInterface->setFilenamesWithFaults(this->filesContainingFaults());
|
||||
|
||||
if (!m_timeStepFilter->timeStepIndicesToImport().empty())
|
||||
{
|
||||
readerInterface->setTimeStepFilter(m_timeStepFilter->timeStepIndicesToImport());
|
||||
}
|
||||
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData;
|
||||
if (!readerInterface->open(caseFileName(), eclipseCase.p()))
|
||||
{
|
||||
@ -460,5 +466,8 @@ void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
|
||||
group->add(&flipXAxis);
|
||||
group->add(&flipYAxis);
|
||||
|
||||
auto group1 = uiOrdering.addNewGroup("Time Step Filter");
|
||||
group1->setCollapsedByDefault(true);
|
||||
m_timeStepFilter->uiOrdering(uiConfigName, *group1);
|
||||
}
|
||||
|
||||
|
47
ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp
Normal file
47
ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimTimeStepFilter.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimTimeStepFilter, "TimeStepFilter");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTimeStepFilter::RimTimeStepFilter()
|
||||
{
|
||||
CAF_PDM_InitObject("Time Step Filter", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeStepIndicesToImport, "TimeStepIndicesToImport", "Values", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RimTimeStepFilter::timeStepIndicesToImport() const
|
||||
{
|
||||
std::vector<size_t> indices;
|
||||
|
||||
// Convert vector from int to size_t
|
||||
for (auto intValue : m_timeStepIndicesToImport.v())
|
||||
{
|
||||
indices.push_back(intValue);
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
40
ApplicationCode/ProjectDataModel/RimTimeStepFilter.h
Normal file
40
ApplicationCode/ProjectDataModel/RimTimeStepFilter.h
Normal file
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimTimeStepFilter : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimTimeStepFilter();
|
||||
|
||||
std::vector<size_t> timeStepIndicesToImport() const;
|
||||
|
||||
private:
|
||||
caf::PdmField< std::vector<int> > m_timeStepIndicesToImport;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user