mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2483 Refactoring : Simplify generation of well branch geometry (1)
This commit is contained in:
@@ -87,23 +87,10 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
|
||||
{
|
||||
std::vector<RigCompletionData> completionData;
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
|
||||
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||
|
||||
RimEclipseView* view = nullptr;
|
||||
well->firstAncestorOrThisOfTypeAsserted(view);
|
||||
|
||||
size_t timeStep = view->currentTimeStep();
|
||||
auto branches = well->wellPipeBranches();
|
||||
|
||||
well->calculateWellPipeDynamicCenterLine(timeStep, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||
|
||||
for (size_t branchIndex = 0; branchIndex < pipeBranchesCLCoords.size(); ++branchIndex)
|
||||
for (size_t branchIndex = 0; branchIndex < branches.size(); ++branchIndex)
|
||||
{
|
||||
RigSimulationWellCoordsAndMD coordsAndMD(pipeBranchesCLCoords[branchIndex]);
|
||||
RigWellPath wellPathGeometry;
|
||||
wellPathGeometry.m_wellPathPoints = coordsAndMD.wellPathPoints();
|
||||
wellPathGeometry.m_measuredDepths = coordsAndMD.measuredDepths();
|
||||
|
||||
std::vector<RimFracture*> fractures;
|
||||
for (RimSimWellFracture* fracture : well->simwellFractureCollection->simwellFractures())
|
||||
{
|
||||
@@ -113,7 +100,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RigCompletionData> branchCompletions = generateCompdatValues(eclipseCase, well->name(), &wellPathGeometry, fractures, outputStreamForIntermediateResultsText);
|
||||
std::vector<RigCompletionData> branchCompletions = generateCompdatValues(eclipseCase, well->name(), branches[branchIndex], fractures, outputStreamForIntermediateResultsText);
|
||||
|
||||
completionData.insert(completionData.end(), branchCompletions.begin(), branchCompletions.end());
|
||||
}
|
||||
|
@@ -490,25 +490,12 @@ void RimIntersection::updateSimulationWellCenterline() const
|
||||
{
|
||||
if (isActive() && type == CS_SIMULATION_WELL && simulationWell())
|
||||
{
|
||||
if (m_simulationWellBranchCenterlines.size() == 0)
|
||||
if (m_simulationWellBranchCenterlines.empty())
|
||||
{
|
||||
RimEclipseCase* rimEclCase = nullptr;
|
||||
simulationWell->firstAncestorOrThisOfType(rimEclCase);
|
||||
if (rimEclCase)
|
||||
auto branches = simulationWell->wellPipeBranches();
|
||||
for (const auto& branch : branches)
|
||||
{
|
||||
RimSimWellInViewCollection* simWellCollection = nullptr;
|
||||
simulationWell->firstAncestorOrThisOfTypeAsserted(simWellCollection);
|
||||
|
||||
bool includeCellCenters = simulationWell->isUsingCellCenterForPipe();
|
||||
bool detectBrances = simWellCollection->isAutoDetectingBranches;
|
||||
|
||||
RigEclipseCaseData* caseData = rimEclCase->eclipseCaseData();
|
||||
auto branches = caseData->simulationWellBranches(simulationWell->name, includeCellCenters, detectBrances);
|
||||
|
||||
for (auto b : branches)
|
||||
{
|
||||
m_simulationWellBranchCenterlines.push_back(b->m_wellPathPoints);
|
||||
}
|
||||
m_simulationWellBranchCenterlines.push_back(branch->m_wellPathPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -153,6 +153,25 @@ caf::PdmFieldHandle* RimSimWellInView::objectToggleField()
|
||||
return &showWell;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<const RigWellPath*> RimSimWellInView::wellPipeBranches() const
|
||||
{
|
||||
RimSimWellInViewCollection* simWellCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(simWellCollection);
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(eclipseCase);
|
||||
RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData();
|
||||
CVF_ASSERT(caseData);
|
||||
|
||||
bool includeCellCenters = this->isUsingCellCenterForPipe();
|
||||
bool detectBrances = simWellCollection->isAutoDetectingBranches;
|
||||
|
||||
return caseData->simulationWellBranches(this->name(), includeCellCenters, detectBrances);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -164,19 +183,6 @@ void RimSimWellInView::calculateWellPipeStaticCenterLine(std::vector<std::vector
|
||||
pipeBranchesCellIds);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
|
||||
std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds) const
|
||||
{
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(this,
|
||||
static_cast<int>(timeStepIdx),
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// frameIndex = -1 will use the static well frame
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -37,6 +37,7 @@ class RigWellResultFrame;
|
||||
struct RigWellResultPoint;
|
||||
|
||||
class RimSimWellFractureCollection;
|
||||
class RigWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -64,13 +65,11 @@ public:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
std::vector<const RigWellPath*> wellPipeBranches() const;
|
||||
|
||||
void calculateWellPipeStaticCenterLine( std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
|
||||
|
||||
void calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
|
||||
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) const;
|
||||
|
||||
void wellHeadTopBottomPosition(int frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom);
|
||||
double pipeRadius();
|
||||
caf::PdmField<bool> showWell;
|
||||
|
@@ -474,7 +474,7 @@ bool RigEclipseCaseData::hasSimulationWell(const QString& simWellName) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<const RigWellPath*> RigEclipseCaseData::simulationWellBranches(const QString& simWellName,
|
||||
bool includeAllCellCenters,
|
||||
bool useAutoDetectionOfBranches)
|
||||
bool useAutoDetectionOfBranches) const
|
||||
{
|
||||
std::vector<const RigWellPath*> branches;
|
||||
|
||||
|
@@ -108,7 +108,7 @@ public:
|
||||
|
||||
std::vector<const RigWellPath*> simulationWellBranches(const QString& simWellName,
|
||||
bool includeAllCellCenters,
|
||||
bool useAutoDetectionOfBranches);
|
||||
bool useAutoDetectionOfBranches) const;
|
||||
|
||||
private:
|
||||
void computeActiveCellIJKBBox();
|
||||
@@ -133,5 +133,5 @@ private:
|
||||
|
||||
RiaEclipseUnitTools::UnitSystem m_unitsType;
|
||||
|
||||
std::map<std::tuple<QString, bool, bool>, cvf::Collection<RigWellPath>> m_simWellBranchCache;
|
||||
mutable std::map<std::tuple<QString, bool, bool>, cvf::Collection<RigWellPath>> m_simWellBranchCache;
|
||||
};
|
||||
|
Reference in New Issue
Block a user