Well branches. Simple well branch cache

This commit is contained in:
Bjørn Erik Jensen 2017-10-12 11:03:00 +02:00
parent 445048c24b
commit 389234715c
4 changed files with 44 additions and 32 deletions

View File

@ -881,7 +881,7 @@ std::vector<QString> RimProject::simulationWellNames() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigWellPath*> RimProject::simulationWellBranches(const QString& simWellName)
std::vector<const RigWellPath*> RimProject::simulationWellBranches(const QString& simWellName)
{
// Find first case containing the specified simulation well
auto simCases = eclipseCases();
@ -893,7 +893,7 @@ std::vector<RigWellPath*> RimProject::simulationWellBranches(const QString& simW
RigEclipseCaseData* eclCaseData = eclipseCase != nullptr ? eclipseCase->eclipseCaseData() : nullptr;
return eclCaseData != nullptr ?
eclCaseData->simulationWellBranches(simWellName) :
std::vector<RigWellPath*>();
std::vector<const RigWellPath*>();
}
//--------------------------------------------------------------------------------------------------

View File

@ -124,7 +124,7 @@ public:
std::vector<RimEclipseCase*> eclipseCases() const;
std::vector<QString> simulationWellNames() const;
std::vector<RigWellPath*> simulationWellBranches(const QString& simWellName);
std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName);
RimWellPath* wellPathFromSimulationWell(const QString& simWellName, int branchIndex = -1);
protected:

View File

@ -462,41 +462,50 @@ bool RigEclipseCaseData::hasSimulationWell(const QString& simWellName) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigWellPath*> RigEclipseCaseData::simulationWellBranches(const QString& simWellName)
std::vector<const RigWellPath*> RigEclipseCaseData::simulationWellBranches(const QString& simWellName)
{
std::vector<RigWellPath*> branches;
std::vector<const RigWellPath*> branches;
if (!(!simWellName.isEmpty() && simWellName != "None"))
if (m_branchCache.find(simWellName) == m_branchCache.end())
{
return std::vector<RigWellPath*>();
if (!(!simWellName.isEmpty() && simWellName != "None"))
{
return branches;
}
const RigSingleWellResultsData* wellResults = findWellResult(simWellName);
if (!wellResults) return branches;
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(this,
wellResults,
-1,
true,
true,
pipeBranchesCLCoords,
pipeBranchesCellIds);
m_branchCache.insert(std::make_pair(simWellName, cvf::Collection<RigWellPath>()));
for (size_t brIdx = 0; brIdx < pipeBranchesCLCoords.size(); ++brIdx)
{
auto wellMdCalculator = RigSimulationWellCoordsAndMD(pipeBranchesCLCoords[brIdx]);
cvf::ref<RigWellPath> newWellPath = new RigWellPath();
newWellPath->m_measuredDepths = wellMdCalculator.measuredDepths();
newWellPath->m_wellPathPoints = wellMdCalculator.wellPathPoints();
m_branchCache[simWellName].push_back(newWellPath.p());
}
}
const RigSingleWellResultsData* wellResults = findWellResult(simWellName);
if (!wellResults) return std::vector<RigWellPath*>();
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(this,
wellResults,
-1,
true,
true,
pipeBranchesCLCoords,
pipeBranchesCellIds);
for (size_t brIdx = 0; brIdx < pipeBranchesCLCoords.size(); ++brIdx)
for (const auto& branch : m_branchCache[simWellName])
{
auto wellMdCalculator = RigSimulationWellCoordsAndMD(pipeBranchesCLCoords[brIdx]);
cvf::ref<RigWellPath> newWellPath = new RigWellPath();
newWellPath->m_measuredDepths = wellMdCalculator.measuredDepths();
newWellPath->m_wellPathPoints = wellMdCalculator.wellPathPoints();
branches.push_back(newWellPath.p());
branches.push_back(branch.p());
}
return branches;
}

View File

@ -31,6 +31,7 @@
#include "cvfCollection.h"
#include "cvfStructGrid.h"
#include "cvfVector3.h"
#include "cvfCollection.h"
#include <vector>
@ -95,7 +96,7 @@ public:
std::vector<QString> simulationWellNames() const;
bool hasSimulationWell(const QString& simWellName) const;
std::vector<RigWellPath*> simulationWellBranches(const QString& simWellName);
std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName);
private:
void computeActiveCellIJKBBox();
@ -119,4 +120,6 @@ private:
cvf::Collection<cvf::UIntArray> m_gridCellToResultWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in
RiaEclipseUnitTools::UnitSystem m_unitsType;
std::map<QString, cvf::Collection<RigWellPath>> m_branchCache;
};