pre-proto - Refactoring. Vector of RigStimPlanCells is now being owned by RimStimPlanFractureTemplate

This commit is contained in:
astridkbjorke 2017-04-06 09:34:38 +02:00
parent faf36665f4
commit b73e2bb63b
10 changed files with 90 additions and 60 deletions

View File

@ -248,20 +248,17 @@ void RifEclipseExportTools::printStimPlanCellsMatrixTransContributions(const std
RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture);
//TODO: Get these more generally:
QString resultName = "CONDUCTIVITY";
QString resultUnit = "md-m";
size_t timeStepIndex = 0;
std::vector<RigStimPlanCell*> stimPlanCells = fracTemplateStimPlan->getStimPlanCells(resultName, resultUnit, timeStepIndex);
std::vector<RigStimPlanCell> stimPlanCells = fracTemplateStimPlan->getStimPlanCells();
for (RigStimPlanCell* stimPlanCell : stimPlanCells)
for (RigStimPlanCell stimPlanCell : stimPlanCells)
{
if (stimPlanCell->getValue() < 1e-7) continue;
if (stimPlanCell.getConductivtyValue() < 1e-7) continue;
transmissibilityCalculator.calculateStimPlanCellsMatrixTransmissibility(stimPlanCell);
transmissibilityCalculator.calculateStimPlanCellsMatrixTransmissibility(&stimPlanCell);
std::vector<size_t> stimPlanContributingEclipseCells = stimPlanCell->getContributingEclipseCells();
std::vector<double> stimPlanContributingEclipseCellTransmisibilities = stimPlanCell->getContributingEclipseCellTransmisibilities();
std::vector<size_t> stimPlanContributingEclipseCells = stimPlanCell.getContributingEclipseCells();
std::vector<double> stimPlanContributingEclipseCellTransmisibilities = stimPlanCell.getContributingEclipseCellTransmisibilities();
for (int i = 0; i < stimPlanContributingEclipseCells.size(); i++)
{
@ -290,8 +287,8 @@ void RifEclipseExportTools::printStimPlanCellsMatrixTransContributions(const std
out << stimPlanContributingEclipseCells[i];
out << qSetFieldWidth(5);
size_t spi = stimPlanCell->getI();
size_t spj = stimPlanCell->getJ();
size_t spi = stimPlanCell.getI();
size_t spj = stimPlanCell.getJ();
out << spi;
out << spj;

View File

@ -284,20 +284,14 @@ void RivWellFracturePartMgr::generateStimPlanMeshPart(caf::DisplayCoordTransform
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, caf::DisplayCoordTransform* displayCoordTransform)
{
//TODO: Get these more generally:
QString resultName = "CONDUCTIVITY";
QString resultUnit = "md-m";
size_t timeStepIndex = 0;
std::vector<RigStimPlanCell* > stimPlanCells = stimPlanFracTemplate->getStimPlanCells(resultName, resultUnit, timeStepIndex);
std::vector<RigStimPlanCell> stimPlanCells = stimPlanFracTemplate->getStimPlanCells();
std::vector<cvf::Vec3f> stimPlanMeshVertices;
for (RigStimPlanCell* stimPlanCell : stimPlanCells)
for (RigStimPlanCell stimPlanCell : stimPlanCells)
{
if (stimPlanCell->getValue() > 1e-7)
if (stimPlanCell.getDisplayValue() > 1e-7)
{
std::vector<cvf::Vec3d> stimPlanCellPolygon = stimPlanCell->getPolygon();
std::vector<cvf::Vec3d> stimPlanCellPolygon = stimPlanCell.getPolygon();
for (cvf::Vec3d cellCorner : stimPlanCellPolygon)
{
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));

View File

@ -327,6 +327,12 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate()
readStimPlanXMLFile(&errorMessage);
if (errorMessage.size() > 0) RiaLogging::error(errorMessage);
//TODO: Get these more generally:
QString resultName = "CONDUCTIVITY";
QString resultUnit = "md-m";
size_t timeStepIndex = 0;
setupStimPlanCells(resultName, resultUnit, timeStepIndex);
updateConnectedEditors();
}
@ -788,11 +794,17 @@ void RimStimPlanFractureTemplate::getStimPlanDataAsPolygonsAndValues(std::vector
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigStimPlanCell*> RimStimPlanFractureTemplate::getStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex)
void RimStimPlanFractureTemplate::setupStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex)
{
std::vector<RigStimPlanCell*> stimPlanCells;
std::vector<RigStimPlanCell> stimPlanCells;
std::vector<std::vector<double>> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex);
std::vector<std::vector<double>> conductivityValuesAtTimeStep = getMirroredDataAtTimeIndex("CONDUCTIVITY", unitName, timeStepIndex);
//TODO: Handle units
//TODO: Handle not having cond in files!!!
std::vector<std::vector<double>> propertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex);
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = getNegAndPosXcoords();
@ -811,13 +823,22 @@ std::vector<RigStimPlanCell*> RimStimPlanFractureTemplate::getStimPlanCells(cons
cellPolygon.push_back(cvf::Vec3d(static_cast<float>(xCoords[j + 1]), static_cast<float>(depthCoords[i + 1]), 0.0));
cellPolygon.push_back(cvf::Vec3d(static_cast<float>(xCoords[j]), static_cast<float>(depthCoords[i + 1]), 0.0));
//TODO: ikke bruke new, returner objekt i stedet for pekeren...
RigStimPlanCell* stimPlanCell = new RigStimPlanCell(cellPolygon, propertyValuesAtTimeStep[i + 1][j + 1], i, j);
RigStimPlanCell stimPlanCell(cellPolygon, i, j);
stimPlanCell.setConductivityValue(conductivityValuesAtTimeStep[i + 1][j + 1]);
stimPlanCell.setDisplayValue(displayPropertyValuesAtTimeStep[i + 1][j + 1]);
stimPlanCells.push_back(stimPlanCell);
}
}
return stimPlanCells;
m_stimPlanCells = stimPlanCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RigStimPlanCell>& RimStimPlanFractureTemplate::getStimPlanCells()
{
return m_stimPlanCells;
}
//--------------------------------------------------------------------------------------------------

View File

@ -76,9 +76,8 @@ public:
void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const;
void getStimPlanDataAsPolygonsAndValues(std::vector<std::vector<cvf::Vec3d> > &cellsAsPolygons, std::vector<double> &parameterValue, const QString& resultName, const QString& unitName, size_t timeStepIndex);
std::vector<RigStimPlanCell*> getStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex);
//const std::vector<RigStimPlanCell>& getStimPlanCells();
//TODO: replace by new get-function returning pointer to m_stimPlanCells
void setupStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex);
const std::vector<RigStimPlanCell>& getStimPlanCells();
std::vector<cvf::Vec3d> getStimPlanRowPolygon(size_t i);
std::vector<cvf::Vec3d> getStimPlanColPolygon(size_t j);
@ -112,8 +111,5 @@ private:
caf::PdmField<QString> m_stimPlanFileName;
cvf::ref<RigStimPlanFractureDefinition> m_stimPlanFractureDefinitionData;
//TODO add
// std::vector<RigStimPlanCell> m_stimPlanConductivityCells;
// std::vector<RigStimPlanCell> m_stimPlanVisibleCells;
std::vector<RigStimPlanCell> m_stimPlanCells;
};

View File

@ -26,6 +26,14 @@ RigFractureData::RigFractureData()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFractureStimPlanCellData::RigFractureStimPlanCellData()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -49,10 +49,23 @@ public:
//TODO: Used for upscaling - should be moved?
double upscaledStimPlanValueHA;
double upscaledStimPlanValueAH;
};
class RigFractureStimPlanCellData
{
public:
RigFractureStimPlanCellData();
size_t m_i;
size_t m_j;
// std::vector<size_t> contributingEclipseCells;
// std::vector<double> contributingEclipseCellTransmisibilities;
};
//==================================================================================================
///
//==================================================================================================

View File

@ -445,7 +445,7 @@ std::pair<double, double> RigFractureTransCalc::flowAcrossLayersUpscaling(QStrin
}
else return std::make_pair(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
std::vector<RigStimPlanCell* > stimPlanCells = fracTemplateStimPlan->getStimPlanCells(resultName, resultUnit, timeStepIndex);
std::vector<RigStimPlanCell> stimPlanCells = fracTemplateStimPlan->getStimPlanCells();
cvf::Vec3d localX, localY, localZ; //Not used in calculation here, but needed for function to find planCellPolygons
std::vector<std::vector<cvf::Vec3d> > planeCellPolygons;
@ -500,7 +500,7 @@ std::pair<double, double> RigFractureTransCalc::flowAcrossLayersUpscaling(QStrin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell *> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers)
double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers)
{
std::vector<double> DcolSum;
std::vector<double> lavgCol;
@ -515,14 +515,14 @@ double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracT
std::vector<RigStimPlanCell*> stimPlanCellsCol = getColOfStimPlanCells(stimPlanCells, j);
for (RigStimPlanCell* stimPlanCell : stimPlanCellsCol)
{
if (stimPlanCell->getValue() > 1e-7)
if (stimPlanCell->getConductivtyValue() > 1e-7)
{
std::vector<std::vector<cvf::Vec3d> >clippedStimPlanPolygons = RigCellGeometryTools::clipPolygons(stimPlanCell->getPolygon(), planeCellPolygon);
if (clippedStimPlanPolygons.size() > 0)
{
for (auto clippedStimPlanPolygon : clippedStimPlanPolygons)
{
conductivitiesInStimPlanCells.push_back(stimPlanCell->getValue());
conductivitiesInStimPlanCells.push_back(stimPlanCell->getConductivtyValue());
lengthsLiOfStimPlanCol.push_back(RigCellGeometryTools::polygonAreaWeightedLength(directionAlongLayers, clippedStimPlanPolygon));
heightsDiOfStimPlanCells.push_back(RigCellGeometryTools::polygonAreaWeightedLength(directionAcrossLayers, clippedStimPlanPolygon));
}
@ -569,7 +569,7 @@ double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracT
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigFractureTransCalc::computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell *> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers)
double RigFractureTransCalc::computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers)
{
std::vector<double> DrowAvg;
std::vector<double> liRowSum;
@ -584,14 +584,14 @@ double RigFractureTransCalc::computeAHupscale(RimStimPlanFractureTemplate* fracT
std::vector<RigStimPlanCell*> stimPlanCellsCol = getRowOfStimPlanCells(stimPlanCells, j);
for (RigStimPlanCell* stimPlanCell : stimPlanCellsCol)
{
if (stimPlanCell->getValue() > 1e-7)
if (stimPlanCell->getConductivtyValue() > 1e-7)
{
std::vector<std::vector<cvf::Vec3d> >clippedStimPlanPolygons = RigCellGeometryTools::clipPolygons(stimPlanCell->getPolygon(), planeCellPolygon);
if (clippedStimPlanPolygons.size() > 0)
{
for (auto clippedStimPlanPolygon : clippedStimPlanPolygons)
{
conductivitiesInStimPlanCells.push_back(stimPlanCell->getValue());
conductivitiesInStimPlanCells.push_back(stimPlanCell->getConductivtyValue());
lengthsLiOfStimPlanCol.push_back(RigCellGeometryTools::polygonAreaWeightedLength(directionAlongLayers, clippedStimPlanPolygon));
heightsDiOfStimPlanCells.push_back(RigCellGeometryTools::polygonAreaWeightedLength(directionAcrossLayers, clippedStimPlanPolygon));
}
@ -810,15 +810,15 @@ void RigFractureTransCalc::computeFlowIntoTransverseWell()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigStimPlanCell*> RigFractureTransCalc::getRowOfStimPlanCells(std::vector<RigStimPlanCell*> allStimPlanCells, size_t i)
std::vector<RigStimPlanCell*> RigFractureTransCalc::getRowOfStimPlanCells(std::vector<RigStimPlanCell> allStimPlanCells, size_t i)
{
std::vector<RigStimPlanCell*> stimPlanCellRow;
for (RigStimPlanCell* stimPlanCell : allStimPlanCells)
for (RigStimPlanCell stimPlanCell : allStimPlanCells)
{
if (stimPlanCell->getI() == i)
if (stimPlanCell.getI() == i)
{
stimPlanCellRow.push_back(stimPlanCell);
stimPlanCellRow.push_back(&stimPlanCell);
}
}
@ -828,15 +828,15 @@ std::vector<RigStimPlanCell*> RigFractureTransCalc::getRowOfStimPlanCells(std::v
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigStimPlanCell*> RigFractureTransCalc::getColOfStimPlanCells(std::vector<RigStimPlanCell*> allStimPlanCells, size_t j)
std::vector<RigStimPlanCell*> RigFractureTransCalc::getColOfStimPlanCells(std::vector<RigStimPlanCell> allStimPlanCells, size_t j)
{
std::vector<RigStimPlanCell*> stimPlanCellCol;
for (RigStimPlanCell* stimPlanCell : allStimPlanCells)
for (RigStimPlanCell stimPlanCell : allStimPlanCells)
{
if (stimPlanCell->getJ() == j)
if (stimPlanCell.getJ() == j)
{
stimPlanCellCol.push_back(stimPlanCell);
stimPlanCellCol.push_back(&stimPlanCell);
}
}

View File

@ -51,8 +51,8 @@ public:
void computeUpscaledPropertyFromStimPlan(QString resultName, QString resultUnit, size_t timeStepIndex);
std::pair<double, double> flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimDefines::UnitSystem unitSystem, size_t eclipseCellIndex);
double computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell *> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers);
double computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell *> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers);
double computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers);
double computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigStimPlanCell> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers);
static double arithmeticAverage(std::vector<double> values);
@ -62,8 +62,8 @@ public:
void computeFlowIntoTransverseWell();
static std::vector<RigStimPlanCell*> getRowOfStimPlanCells(std::vector<RigStimPlanCell*> allStimPlanCells, size_t i);
static std::vector<RigStimPlanCell*> getColOfStimPlanCells(std::vector<RigStimPlanCell*> allStimPlanCells, size_t j);
static std::vector<RigStimPlanCell*> getRowOfStimPlanCells(std::vector<RigStimPlanCell> allStimPlanCells, size_t i);
static std::vector<RigStimPlanCell*> getColOfStimPlanCells(std::vector<RigStimPlanCell> allStimPlanCells, size_t j);
private:
double convertConductivtyValue(double Kw, RimDefines::UnitSystem fromUnit, RimDefines::UnitSystem toUnit);

View File

@ -29,10 +29,9 @@ RigStimPlanCell::RigStimPlanCell()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigStimPlanCell::RigStimPlanCell(std::vector<cvf::Vec3d> polygon, double value, size_t i, size_t j)
RigStimPlanCell::RigStimPlanCell(std::vector<cvf::Vec3d> polygon, size_t i, size_t j)
{
m_polygon = polygon;
m_value = value;
m_i = i;
m_j = j;
}

View File

@ -32,17 +32,19 @@ class RigStimPlanCell
public:
RigStimPlanCell();
RigStimPlanCell(std::vector<cvf::Vec3d> polygon, double value, size_t i, size_t j);
RigStimPlanCell(std::vector<cvf::Vec3d> polygon, size_t i, size_t j);
virtual ~RigStimPlanCell();
std::vector<cvf::Vec3d> getPolygon() { return m_polygon; }
double getValue() { return m_value; }
double getConductivtyValue() { return m_concutivityValue; }
double getDisplayValue() { return m_displayValue; }
size_t getI() { return m_i; }
size_t getJ() { return m_j; }
//TODO: set-funksjoner...
void setConductivityValue(double cond) { m_concutivityValue = cond; }
void setDisplayValue(double value) { m_displayValue = value; };
void addContributingEclipseCell(size_t fracCell, double transmissibility);
std::vector<size_t> getContributingEclipseCells() { return contributingEclipseCells; }
@ -50,8 +52,8 @@ public:
private:
std::vector<cvf::Vec3d> m_polygon;
double m_value;
// double m_concutivityValue;
double m_displayValue;
double m_concutivityValue;
size_t m_i;
size_t m_j;