#1487 RigFractureGrid inherits from cvf::Object, and RimStimPlanFractureTemplate fractureGrid() is returning a pointer

This commit is contained in:
astridkbjorke
2017-05-30 14:57:21 +02:00
parent a8b6543c3c
commit 406bf96f3f
8 changed files with 42 additions and 116 deletions

View File

@@ -225,7 +225,7 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
using CellIdxSpace = RigTransmissibilityCondenser::CellAddress;
RimStimPlanFractureTemplate* fracTemplateStimPlan = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition());
const RigFractureGrid fractureGrid = fracTemplateStimPlan->fractureGrid();
const RigFractureGrid* fractureGrid = fracTemplateStimPlan->fractureGrid();
if (!fracTemplateStimPlan) continue; // We do not handle Elliptical fractures yet
@@ -234,7 +234,7 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
//////
// Calculate Matrix To Fracture Trans
auto stimPlanCells = fractureGrid.fractureCells();
auto stimPlanCells = fractureGrid->fractureCells();
for (const RigFractureCell stimPlanCell : stimPlanCells)
{
@@ -249,7 +249,7 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
const std::vector<size_t>& stimPlanContributingEclipseCells = eclToStimPlanTransCalc.globalIndeciesToContributingEclipseCells();
const std::vector<double>& stimPlanContributingEclipseCellTransmissibilities = eclToStimPlanTransCalc.contributingEclipseCellTransmissibilities();
size_t stimPlanCellIndex = fractureGrid.getGlobalIndexFromIJ(stimPlanCell.getI(), stimPlanCell.getJ());
size_t stimPlanCellIndex = fractureGrid->getGlobalIndexFromIJ(stimPlanCell.getI(), stimPlanCell.getJ());
for (size_t i = 0; i < stimPlanContributingEclipseCells.size(); i++)
{
@@ -262,19 +262,19 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
//////
// Calculate Transmissibility in the fracture: From one StimPlan Cell to the other
for (size_t i = 0; i < fractureGrid.iCellCount(); i++)
for (size_t i = 0; i < fractureGrid->iCellCount(); i++)
{
for (size_t j = 0; j < fractureGrid.jCellCount(); j++)
for (size_t j = 0; j < fractureGrid->jCellCount(); j++)
{
size_t stimPlanCellIndex = fractureGrid.getGlobalIndexFromIJ(i, j);
const RigFractureCell stimPlanCell = fractureGrid.cellFromIndex(stimPlanCellIndex);
size_t stimPlanCellIndex = fractureGrid->getGlobalIndexFromIJ(i, j);
const RigFractureCell stimPlanCell = fractureGrid->cellFromIndex(stimPlanCellIndex);
if (stimPlanCell.getConductivtyValue() < 1e-7) continue;
if (i < fractureGrid.iCellCount()-1)
if (i < fractureGrid->iCellCount()-1)
{
size_t stimPlanCellNeighbourXIndex = fractureGrid.getGlobalIndexFromIJ(i + 1, j);
const RigFractureCell stimPlanCellNeighbourX = fractureGrid.cellFromIndex(stimPlanCellNeighbourXIndex);
size_t stimPlanCellNeighbourXIndex = fractureGrid->getGlobalIndexFromIJ(i + 1, j);
const RigFractureCell stimPlanCellNeighbourX = fractureGrid->cellFromIndex(stimPlanCellNeighbourXIndex);
double horizontalTransToXneigbour =
RigFractureTransmissibilityEquations::computeStimPlanCellTransmissibilityInFractureCenterToCenterForTwoCells(stimPlanCell.getConductivtyValue(),
@@ -291,10 +291,10 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
}
if (j < fractureGrid.jCellCount()-1)
if (j < fractureGrid->jCellCount()-1)
{
size_t stimPlanCellNeighbourZIndex = fractureGrid.getGlobalIndexFromIJ(i, j + 1);
const RigFractureCell stimPlanCellNeighbourZ = fractureGrid.cellFromIndex(stimPlanCellNeighbourZIndex);
size_t stimPlanCellNeighbourZIndex = fractureGrid->getGlobalIndexFromIJ(i, j + 1);
const RigFractureCell stimPlanCellNeighbourZ = fractureGrid->cellFromIndex(stimPlanCellNeighbourZIndex);
double verticalTransToZneigbour =
RigFractureTransmissibilityEquations::computeStimPlanCellTransmissibilityInFractureCenterToCenterForTwoCells(stimPlanCell.getConductivtyValue(),
@@ -324,7 +324,7 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
size_t stpWellCellIdx = stpCellIdxIsectDataPair.first;
RigWellPathStimplanIntersector::WellCellIntersection intersection = stpCellIdxIsectDataPair.second;
const RigFractureCell stimPlanWellCell = fractureGrid.cellFromIndex(stpWellCellIdx);
const RigFractureCell stimPlanWellCell = fractureGrid->cellFromIndex(stpWellCellIdx);
double radialTrans = 0.0;
if (intersection.endpointCount)
@@ -523,7 +523,7 @@ void RifFractureExportTools::printStimPlanCellsMatrixTransContributions(const st
double cDarcyInCorrectUnit = caseToApply->eclipseCaseData()->darchysValue();
std::vector<RigFractureCell> stimPlanCells = fracTemplateStimPlan->fractureGrid().fractureCells();
std::vector<RigFractureCell> stimPlanCells = fracTemplateStimPlan->fractureGrid()->fractureCells();
for (RigFractureCell stimPlanCell : stimPlanCells)
{
@@ -613,7 +613,7 @@ void RifFractureExportTools::printStimPlanFractureTrans(const std::vector<RimFra
}
else return;
std::vector<RigFractureCell> stimPlanCells = fracTemplateStimPlan->fractureGrid().fractureCells();
std::vector<RigFractureCell> stimPlanCells = fracTemplateStimPlan->fractureGrid()->fractureCells();
for (RigFractureCell stimPlanCell : stimPlanCells)
{
@@ -841,14 +841,14 @@ void RifFractureExportTools::printTransmissibilityFractureToWell(const std::vect
double perforationLengthVert = fracture->perforationLength * cos(wellDip);
double perforationLengthHor = fracture->perforationLength * sin(wellDip);
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = fracTemplateStimPlan->fractureGrid().fractureCellAtWellCenter();
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = fracTemplateStimPlan->fractureGrid()->fractureCellAtWellCenter();
out << qSetFieldWidth(5);
out << wellCenterStimPlanCellIJ.first;
out << wellCenterStimPlanCellIJ.second;
//RigStimPlanCell* stimPlanCell = fracTemplateStimPlan->getStimPlanCellAtIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second);
const RigFractureCell& stimPlanCell = fracTemplateStimPlan->fractureGrid().cellFromIndex(fracTemplateStimPlan->fractureGrid().getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second));
const RigFractureCell& stimPlanCell = fracTemplateStimPlan->fractureGrid()->cellFromIndex(fracTemplateStimPlan->fractureGrid()->getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second));
double linTransInStimPlanCell = RigFractureTransmissibilityEquations::computeLinearTransmissibilityToWellinStimPlanCell(stimPlanCell.getConductivtyValue(),
stimPlanCell.cellSizeX(),
@@ -877,12 +877,12 @@ void RifFractureExportTools::printTransmissibilityFractureToWell(const std::vect
}
else continue;
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = fracTemplateStimPlan->fractureGrid().fractureCellAtWellCenter();
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = fracTemplateStimPlan->fractureGrid()->fractureCellAtWellCenter();
out << qSetFieldWidth(5);
out << wellCenterStimPlanCellIJ.first;
out << wellCenterStimPlanCellIJ.second;
const RigFractureCell& stimPlanCell = fracTemplateStimPlan->fractureGrid().cellFromIndex(fracTemplateStimPlan->fractureGrid().getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second));
const RigFractureCell& stimPlanCell = fracTemplateStimPlan->fractureGrid()->cellFromIndex(fracTemplateStimPlan->fractureGrid()->getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second));
double radTransInStimPlanCell = RigFractureTransmissibilityEquations::computeRadialTransmissibilityToWellinStimPlanCell(stimPlanCell.getConductivtyValue(),
stimPlanCell.cellSizeX(),

View File

@@ -290,7 +290,7 @@ cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(Ri
//Should probably be moved, since it now is called twice in some cases...
stimPlanFracTemplate->setupStimPlanCells();
std::vector<RigFractureCell> stimPlanCells = stimPlanFracTemplate->fractureGrid().fractureCells();
std::vector<RigFractureCell> stimPlanCells = stimPlanFracTemplate->fractureGrid()->fractureCells();
std::vector<cvf::Vec3f> stimPlanMeshVertices;
for (RigFractureCell stimPlanCell : stimPlanCells)

View File

@@ -68,8 +68,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void)
CAF_PDM_InitField(&activeTimeStepIndex, "activeTimeStepIndex", 0, "Active TimeStep Index", "", "", "");
CAF_PDM_InitField(&showStimPlanMesh, "showStimPlanMesh", true, "Show StimPlan Mesh", "", "", "");
//TODO: Is this correct way of doing this...?
//wellCenterStimPlanCellIJ = std::make_pair(0, 0);
m_fractureGrid = new RigFractureGrid();
}
//--------------------------------------------------------------------------------------------------
@@ -890,31 +889,20 @@ void RimStimPlanFractureTemplate::setupStimPlanCells()
RiaLogging::error("Did not find stim plan cell at well crossing!");
}
RigFractureGrid fractureGrid;
fractureGrid.setFractureCells(stimPlanCells);
fractureGrid.setWellCenterFractureCellIJ(wellCenterStimPlanCellIJ);
fractureGrid.setICellCount(getNegAndPosXcoords().size() - 2);
fractureGrid.setJCellCount(adjustedDepthCoordsAroundWellPathPosition().size() - 2);
m_fractureGrid = fractureGrid;
m_fractureGrid->setFractureCells(stimPlanCells);
m_fractureGrid->setWellCenterFractureCellIJ(wellCenterStimPlanCellIJ);
m_fractureGrid->setICellCount(getNegAndPosXcoords().size() - 2);
m_fractureGrid->setJCellCount(adjustedDepthCoordsAroundWellPathPosition().size() - 2);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFractureGrid& RimStimPlanFractureTemplate::fractureGrid() const
const RigFractureGrid* RimStimPlanFractureTemplate::fractureGrid() const
{
return m_fractureGrid;
return m_fractureGrid.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// const std::vector<RigStimPlanFracTemplateCell>& RimStimPlanFractureTemplate::getStimPlanCells() const
// {
// return m_stimPlanCells;
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -961,47 +949,6 @@ std::vector<cvf::Vec3d> RimStimPlanFractureTemplate::getStimPlanColPolygon(size_
return colPolygon;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// std::pair<size_t, size_t> RimStimPlanFractureTemplate::getStimPlanCellAtWellCenter()
// {
// return wellCenterStimPlanCellIJ;
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//size_t RimStimPlanFractureTemplate::getGlobalIndexFromIJ(size_t i, size_t j) const
//{
// size_t cellCountJ = stimPlanGridNumberOfRows() - 2;
// size_t globIndex = i * cellCountJ + j;
//
// CVF_ASSERT(m_stimPlanCells[globIndex].getI() == i && m_stimPlanCells[globIndex].getJ() == j);
//
// return globIndex;
//}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// const RigStimPlanFracTemplateCell& RimStimPlanFractureTemplate::stimPlanCellFromIndex(size_t index) const
// {
// if (index < m_stimPlanCells.size())
// {
// const RigStimPlanFracTemplateCell& cell = m_stimPlanCells[index];
// return cell;
// }
// else
// {
// //TODO: Better error handling?
// RiaLogging::error("Requesting non-existent StimPlanCell");
// RiaLogging::error("Returning cell 0, results will be invalid");
// const RigStimPlanFracTemplateCell& cell = m_stimPlanCells[0];
// return cell;
// }
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1126,22 +1073,6 @@ void RimStimPlanFractureTemplate::sortPolygon(std::vector<cvf::Vec3f> &polygon)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// size_t RimStimPlanFractureTemplate::stimPlanGridNumberOfColums() const
// {
// return getNegAndPosXcoords().size();
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// size_t RimStimPlanFractureTemplate::stimPlanGridNumberOfRows() const
// {
// return adjustedDepthCoordsAroundWellPathPosition().size();
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -77,15 +77,7 @@ public:
std::vector<std::vector<double>> getDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const;
void setupStimPlanCells();
const RigFractureGrid& fractureGrid() const;
// const std::vector<RigStimPlanFracTemplateCell>& getStimPlanCells() const;
// size_t getGlobalIndexFromIJ(size_t i, size_t j) const;
// const RigStimPlanFracTemplateCell& stimPlanCellFromIndex(size_t index) const;
// size_t stimPlanGridNumberOfRows() const;
// size_t stimPlanGridNumberOfColums() const;
// std::pair<size_t, size_t> getStimPlanCellAtWellCenter();
const RigFractureGrid* fractureGrid() const;
//Functions used by upscaling only
void getStimPlanDataAsPolygonsAndValues(std::vector<std::vector<cvf::Vec3d> > &cellsAsPolygons, std::vector<double> &parameterValue, const QString& resultName, const QString& unitName, size_t timeStepIndex);
@@ -96,7 +88,6 @@ protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
private:
void updateUiTreeName();
@@ -117,7 +108,6 @@ private:
caf::PdmField<QString> m_stimPlanFileName;
cvf::ref<RigStimPlanFractureDefinition> m_stimPlanFractureDefinitionData;
// std::vector<RigStimPlanFracTemplateCell> m_stimPlanCells;
// std::pair<size_t, size_t> wellCenterStimPlanCellIJ;
RigFractureGrid m_fractureGrid;
cvf::ref<RigFractureGrid> m_fractureGrid;
};

View File

@@ -18,15 +18,20 @@
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "RigFractureCell.h"
#include <vector>
class RigFractureCell;
//==================================================================================================
///
///
//==================================================================================================
class RigFractureGrid //TODO arve fra cvf::Object, skal v<>re cvf::ref i rigstimplanfracturetemplate
class RigFractureGrid : public cvf::Object
{
public:
RigFractureGrid();

View File

@@ -53,7 +53,7 @@ std::pair<double, double> RigStimPlanUpscalingCalc::flowAcrossLayersUpscaling(QS
}
else return std::make_pair(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
std::vector<RigFractureCell> stimPlanCells = fracTemplateStimPlan->fractureGrid().fractureCells();
std::vector<RigFractureCell> stimPlanCells = fracTemplateStimPlan->fractureGrid()->fractureCells();
@@ -112,7 +112,7 @@ double RigStimPlanUpscalingCalc::computeHAupscale(RimStimPlanFractureTemplate* f
std::vector<double> lavgCol;
std::vector<double> CondHarmCol;
for (size_t j = 0; j < fracTemplateStimPlan->fractureGrid().iCellCount(); j++)
for (size_t j = 0; j < fracTemplateStimPlan->fractureGrid()->iCellCount(); j++)
{
std::vector<double> conductivitiesInStimPlanCells;
std::vector<double> lengthsLiOfStimPlanCol;
@@ -181,7 +181,7 @@ double RigStimPlanUpscalingCalc::computeAHupscale(RimStimPlanFractureTemplate* f
std::vector<double> liRowSum;
std::vector<double> CondAritRow;
for (size_t j = 0; j < fracTemplateStimPlan->fractureGrid().jCellCount(); j++)
for (size_t j = 0; j < fracTemplateStimPlan->fractureGrid()->jCellCount(); j++)
{
std::vector<double> conductivitiesInStimPlanCells;
std::vector<double> lengthsLiOfStimPlanCol;

View File

@@ -200,7 +200,7 @@ void printCellAddress(std::stringstream& str,
case CellAddress::STIMPLAN:
{
str << "STP ";
const RigFractureCell& stpCell = fractureGrid->fractureGrid().cellFromIndex(cellAddr.m_globalCellIdx);
const RigFractureCell& stpCell = fractureGrid->fractureGrid()->cellFromIndex(cellAddr.m_globalCellIdx);
str << std::setw(5) << stpCell.getI()+1 << std::setw(5) << stpCell.getJ()+1 << std::setw(5) << " ";
}
break;

View File

@@ -26,7 +26,7 @@ RigWellPathStimplanIntersector::RigWellPathStimplanIntersector(const RigWellPath
fracturePolygonf = stimPlanFractureTemplate->fracturePolygon(rimFracture->fractureUnit());
{
const std::vector<RigFractureCell>& stpCells = stimPlanFractureTemplate->fractureGrid().fractureCells();
const std::vector<RigFractureCell>& stpCells = stimPlanFractureTemplate->fractureGrid()->fractureCells();
for ( const auto& stpCell: stpCells ) stpCellPolygons.push_back(stpCell.getPolygon());
}
}