mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Placed WellLogExtractors in the RimWellLogPlotCollection and cached them
This commit is contained in:
parent
e15a95f8b4
commit
1e6baed1dc
@ -142,9 +142,9 @@ RimProject::~RimProject(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::close()
|
||||
{
|
||||
if (mainPlotCollection()) delete mainPlotCollection();
|
||||
oilFields.deleteAllChildObjects();
|
||||
oilFields.push_back(new RimOilField);
|
||||
if (mainPlotCollection()) delete mainPlotCollection();
|
||||
|
||||
casesObsolete.deleteAllChildObjects();
|
||||
caseGroupsObsolete.deleteAllChildObjects();
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RiuWellLogTracePlot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -112,61 +113,65 @@ void RimWellLogExtractionCurve::updatePlotData()
|
||||
|
||||
if (m_showCurve)
|
||||
{
|
||||
bool hasData = false;
|
||||
|
||||
|
||||
|
||||
std::vector<double> filteredValues;
|
||||
std::vector<double> filteredDepths;
|
||||
// Make sure we have set correct case data into the result definitions.
|
||||
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
||||
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
|
||||
m_geomResultDefinition->setGeoMechCase(geomCase);
|
||||
|
||||
if (m_wellPath)
|
||||
RimWellLogPlotCollection* wellLogCollection = NULL;
|
||||
this->firstAnchestorOrThisOfType(wellLogCollection);
|
||||
|
||||
CVF_ASSERT(wellLogCollection);
|
||||
|
||||
cvf::ref<RigEclipseWellLogExtractor> eclExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, eclipseCase);
|
||||
//cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase);
|
||||
|
||||
std::vector<double> filteredValues;
|
||||
std::vector<double> filteredDepths;
|
||||
bool hasData = false;
|
||||
|
||||
if (eclExtractor.notNull())
|
||||
{
|
||||
if (eclipseCase)
|
||||
const std::vector<double>& depthValues = eclExtractor->measuredDepth();
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createResultAccessor(
|
||||
eclipseCase->reservoirData(), 0,
|
||||
porosityModel,
|
||||
m_timeStep,
|
||||
m_eclipseResultDefinition->resultVariable());
|
||||
|
||||
std::vector<double> values;
|
||||
|
||||
if (resAcc.notNull())
|
||||
{
|
||||
RigEclipseWellLogExtractor extractor(eclipseCase->reservoirData(), m_wellPath->wellPathGeometry());
|
||||
const std::vector<double>& depthValues = (extractor.measuredDepth());
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createResultAccessor(
|
||||
eclipseCase->reservoirData(), 0,
|
||||
porosityModel,
|
||||
m_timeStep,
|
||||
m_eclipseResultDefinition->resultVariable());
|
||||
|
||||
std::vector<double> values;
|
||||
|
||||
if (resAcc.notNull())
|
||||
{
|
||||
extractor.curveData(resAcc.p(), &values);
|
||||
hasData = true;
|
||||
}
|
||||
|
||||
filteredValues.reserve(values.size());
|
||||
filteredDepths.reserve(values.size());
|
||||
for (size_t vIdx = 0; vIdx < values.size(); ++vIdx)
|
||||
{
|
||||
if (values[vIdx] == HUGE_VAL || values[vIdx] == -HUGE_VAL || (values[vIdx] != values[vIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
filteredDepths.push_back(depthValues[vIdx]);
|
||||
filteredValues.push_back(values[vIdx]);
|
||||
}
|
||||
eclExtractor->curveData(resAcc.p(), &values);
|
||||
hasData = true;
|
||||
}
|
||||
else if (geomCase)
|
||||
|
||||
// Remove values that are too difficult for Qwt to handle
|
||||
|
||||
filteredValues.reserve(values.size());
|
||||
filteredDepths.reserve(values.size());
|
||||
for (size_t vIdx = 0; vIdx < values.size(); ++vIdx)
|
||||
{
|
||||
if (values[vIdx] == HUGE_VAL || values[vIdx] == -HUGE_VAL || (values[vIdx] != values[vIdx]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
filteredDepths.push_back(depthValues[vIdx]);
|
||||
filteredValues.push_back(values[vIdx]);
|
||||
}
|
||||
}
|
||||
else if (false) // geomExtractor
|
||||
{
|
||||
// Todo: do geomech log extraction
|
||||
}
|
||||
|
||||
m_plotCurve->setSamples(filteredValues.data(), filteredDepths.data(), (int)filteredValues.size());
|
||||
|
||||
@ -182,8 +187,6 @@ void RimWellLogExtractionCurve::updatePlotData()
|
||||
}
|
||||
|
||||
updateCurveTitle();
|
||||
|
||||
|
||||
m_plot->replot();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,11 @@
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RigEclipseWellLogExtractor.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellLogPlotCollection, "WellLogPlotCollection");
|
||||
|
||||
@ -43,3 +48,29 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection()
|
||||
{
|
||||
wellLogPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase)
|
||||
{
|
||||
if (!(wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->reservoirData()))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RigCaseData* eclCaseData = eclCase->reservoirData();
|
||||
RigWellPath* wellPathGeom = wellPath->wellPathGeometry();
|
||||
for (size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx)
|
||||
{
|
||||
if (m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom)
|
||||
{
|
||||
return m_extractors[exIdx].p();
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor(eclCaseData, wellPathGeom);
|
||||
m_extractors.push_back(extractor.p());
|
||||
|
||||
return extractor.p();
|
||||
}
|
||||
|
@ -22,10 +22,12 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
class RimWellLogPlot;
|
||||
|
||||
|
||||
class RigEclipseWellLogExtractor;
|
||||
class RimWellPath;
|
||||
class RimEclipseCase;
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -36,6 +38,10 @@ class RimWellLogPlotCollection : public caf::PdmObject
|
||||
public:
|
||||
RimWellLogPlotCollection();
|
||||
virtual ~RimWellLogPlotCollection();
|
||||
|
||||
RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase);
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots;
|
||||
private:
|
||||
cvf::Collection<RigEclipseWellLogExtractor> m_extractors;
|
||||
};
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
|
||||
void curveData(const RigResultAccessor* resultAccessor, std::vector<double>* values );
|
||||
|
||||
const RigCaseData* caseData() { return m_caseData.p();}
|
||||
const RigWellPath* wellPathData() { return m_wellPath.p();}
|
||||
|
||||
private:
|
||||
void calculateIntersection();
|
||||
std::vector<size_t> findCloseCells(const cvf::BoundingBox& bb);
|
||||
|
Loading…
Reference in New Issue
Block a user