#2076 RFT Plot. Support PRES_FORM las channel name

This commit is contained in:
Bjørn Erik Jensen 2017-11-02 11:05:39 +01:00
parent 5a0bab86a8
commit dc93767683
2 changed files with 37 additions and 15 deletions

View File

@ -53,7 +53,7 @@ CAF_PDM_SOURCE_INIT(RimWellRftPlot, "WellRftPlot");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const char RimWellRftPlot::PRESSURE_DATA_NAME[] = "PRESSURE"; const std::set<QString> RimWellRftPlot::PRESSURE_DATA_NAMES = { "PRESSURE", "PRES_FORM" };
const char RimWellRftPlot::PLOT_NAME_QFORMAT_STRING[] = "RFT: %1"; const char RimWellRftPlot::PLOT_NAME_QFORMAT_STRING[] = "RFT: %1";
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -557,14 +557,12 @@ std::map<QDateTime, std::set<RifWellRftAddress>> RimWellRftPlot::timeStepsFromRf
std::map<QDateTime, std::set<RifWellRftAddress>> RimWellRftPlot::timeStepsFromGridCase(RimEclipseCase* gridCase) const std::map<QDateTime, std::set<RifWellRftAddress>> RimWellRftPlot::timeStepsFromGridCase(RimEclipseCase* gridCase) const
{ {
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData();
size_t resultIndex = eclipseCaseData != nullptr ? std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(eclipseCaseData);
eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, PRESSURE_DATA_NAME) :
cvf::UNDEFINED_SIZE_T;
std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMap; std::map<QDateTime, std::set<RifWellRftAddress>> timeStepsMap;
if (resultIndex != cvf::UNDEFINED_SIZE_T) if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T)
{ {
for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(resultIndex)) for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(resultDataInfo.first))
{ {
if (timeStepsMap.count(timeStep) == 0) if (timeStepsMap.count(timeStep) == 0)
{ {
@ -802,12 +800,14 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set<std::pair<RifWellRftAddre
auto gridCase = curveDefToAdd.first.eclCase(); auto gridCase = curveDefToAdd.first.eclCase();
if (gridCase != nullptr) if (gridCase != nullptr)
{ {
std::pair<size_t, QString> resultDataInfo = pressureResultDataInfo(gridCase->eclipseCaseData());
// Case // Case
curve->setCase(gridCase); curve->setCase(gridCase);
// Result definition // Result definition
RimEclipseResultDefinition* resultDef = new RimEclipseResultDefinition(); RimEclipseResultDefinition* resultDef = new RimEclipseResultDefinition();
resultDef->setResultVariable(PRESSURE_DATA_NAME); resultDef->setResultVariable(resultDataInfo.second);
curve->setEclipseResultDefinition(resultDef); curve->setEclipseResultDefinition(resultDef);
// Time step // Time step
@ -957,13 +957,36 @@ bool RimWellRftPlot::hasPressureData(RimWellPath* wellPath)
return false; return false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<size_t, QString> RimWellRftPlot::pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData)
{
if (eclipseCaseData != nullptr)
{
for (const auto& pressureDataName : PRESSURE_DATA_NAMES)
{
size_t index = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->
findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, pressureDataName);
if (index != cvf::UNDEFINED_SIZE_T)
{
return std::make_pair(index, pressureDataName);
}
}
}
return std::make_pair(cvf::UNDEFINED_SIZE_T, "");
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellRftPlot::isPressureChannel(RimWellLogFileChannel* channel) bool RimWellRftPlot::isPressureChannel(RimWellLogFileChannel* channel)
{ {
// Todo: read pressure channel names from config/defines for (const auto& pressureDataName : PRESSURE_DATA_NAMES)
return QString::compare(channel->name(), PRESSURE_DATA_NAME) == 0; {
if (QString::compare(channel->name(), pressureDataName, Qt::CaseInsensitive) == 0) return true;
}
return false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -971,10 +994,7 @@ bool RimWellRftPlot::isPressureChannel(RimWellLogFileChannel* channel)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimWellRftPlot::hasPressureData(RimEclipseResultCase* gridCase) bool RimWellRftPlot::hasPressureData(RimEclipseResultCase* gridCase)
{ {
const RigEclipseCaseData* const eclipseCaseData = gridCase->eclipseCaseData(); return pressureResultDataInfo(gridCase->eclipseCaseData()).first != cvf::UNDEFINED_SIZE_T;
size_t resultIndex = eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->
findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, PRESSURE_DATA_NAME);
return resultIndex != cvf::UNDEFINED_SIZE_T;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -34,7 +34,7 @@
#include <QMetaType> #include <QMetaType>
#include <set> #include <set>
#include <map> #include <map>
#include <utility>
class RimEclipseCase; class RimEclipseCase;
class RimEclipseResultCase; class RimEclipseResultCase;
@ -43,6 +43,7 @@ class RimWellLogFileChannel;
class RimWellLogPlot; class RimWellLogPlot;
class RimWellPath; class RimWellPath;
class RiuWellRftPlot; class RiuWellRftPlot;
class RigEclipseCaseData;
namespace cvf { namespace cvf {
class Color3f; class Color3f;
@ -61,7 +62,7 @@ class RimWellRftPlot : public RimViewWindow
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
static const char PRESSURE_DATA_NAME[]; static const std::set<QString> PRESSURE_DATA_NAMES;
static const char PLOT_NAME_QFORMAT_STRING[]; static const char PLOT_NAME_QFORMAT_STRING[];
public: public:
@ -83,6 +84,7 @@ public:
static bool isPressureChannel(RimWellLogFileChannel* channel); static bool isPressureChannel(RimWellLogFileChannel* channel);
static bool hasPressureData(RimEclipseResultCase* gridCase); static bool hasPressureData(RimEclipseResultCase* gridCase);
static bool hasPressureData(RimWellPath* wellPath); static bool hasPressureData(RimWellPath* wellPath);
static std::pair<size_t, QString> pressureResultDataInfo(const RigEclipseCaseData* eclipseCaseData);
static const char* plotNameFormatString(); static const char* plotNameFormatString();
void applyInitialSelections(); void applyInitialSelections();