diff --git a/ApplicationCode/FileInterface/RifEclipseExportTools.cpp b/ApplicationCode/FileInterface/RifEclipseExportTools.cpp index 39cfe1ed3a..407006f2c9 100644 --- a/ApplicationCode/FileInterface/RifEclipseExportTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseExportTools.cpp @@ -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 stimPlanCells = fracTemplateStimPlan->getStimPlanCells(resultName, resultUnit, timeStepIndex); + std::vector 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 stimPlanContributingEclipseCells = stimPlanCell->getContributingEclipseCells(); - std::vector stimPlanContributingEclipseCellTransmisibilities = stimPlanCell->getContributingEclipseCellTransmisibilities(); + std::vector stimPlanContributingEclipseCells = stimPlanCell.getContributingEclipseCells(); + std::vector 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; diff --git a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp index 9b335faacd..b7ab2fc0e1 100644 --- a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -284,20 +284,14 @@ void RivWellFracturePartMgr::generateStimPlanMeshPart(caf::DisplayCoordTransform //-------------------------------------------------------------------------------------------------- cvf::ref 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 stimPlanCells = stimPlanFracTemplate->getStimPlanCells(resultName, resultUnit, timeStepIndex); + std::vector stimPlanCells = stimPlanFracTemplate->getStimPlanCells(); std::vector stimPlanMeshVertices; - for (RigStimPlanCell* stimPlanCell : stimPlanCells) + for (RigStimPlanCell stimPlanCell : stimPlanCells) { - if (stimPlanCell->getValue() > 1e-7) + if (stimPlanCell.getDisplayValue() > 1e-7) { - std::vector stimPlanCellPolygon = stimPlanCell->getPolygon(); + std::vector stimPlanCellPolygon = stimPlanCell.getPolygon(); for (cvf::Vec3d cellCorner : stimPlanCellPolygon) { stimPlanMeshVertices.push_back(static_cast(cellCorner)); diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp index 26b805c559..1fe244e018 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp @@ -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 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 stimPlanCells; + std::vector stimPlanCells; + + std::vector> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex); + + std::vector> conductivityValuesAtTimeStep = getMirroredDataAtTimeIndex("CONDUCTIVITY", unitName, timeStepIndex); + //TODO: Handle units + //TODO: Handle not having cond in files!!! + - std::vector> propertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultName, unitName, timeStepIndex); std::vector depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition(); std::vector xCoordsAtNodes = getNegAndPosXcoords(); @@ -811,13 +823,22 @@ std::vector RimStimPlanFractureTemplate::getStimPlanCells(cons cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j + 1]), static_cast(depthCoords[i + 1]), 0.0)); cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j]), static_cast(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& RimStimPlanFractureTemplate::getStimPlanCells() +{ + return m_stimPlanCells; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h index 8a39367d18..14bf057766 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h @@ -76,9 +76,8 @@ public: void computeMinMax(const QString& resultName, const QString& unitName, double* minValue, double* maxValue) const; void getStimPlanDataAsPolygonsAndValues(std::vector > &cellsAsPolygons, std::vector ¶meterValue, const QString& resultName, const QString& unitName, size_t timeStepIndex); - std::vector getStimPlanCells(const QString& resultName, const QString& unitName, size_t timeStepIndex); - //const std::vector& 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& getStimPlanCells(); std::vector getStimPlanRowPolygon(size_t i); std::vector getStimPlanColPolygon(size_t j); @@ -112,8 +111,5 @@ private: caf::PdmField m_stimPlanFileName; cvf::ref m_stimPlanFractureDefinitionData; - - //TODO add -// std::vector m_stimPlanConductivityCells; -// std::vector m_stimPlanVisibleCells; + std::vector m_stimPlanCells; }; diff --git a/ApplicationCode/ReservoirDataModel/RigFracture.cpp b/ApplicationCode/ReservoirDataModel/RigFracture.cpp index 8b612b5892..4827c77cde 100644 --- a/ApplicationCode/ReservoirDataModel/RigFracture.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFracture.cpp @@ -26,6 +26,14 @@ RigFractureData::RigFractureData() } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFractureStimPlanCellData::RigFractureStimPlanCellData() +{ + +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigFracture.h b/ApplicationCode/ReservoirDataModel/RigFracture.h index eb039abc88..fa4ad73072 100644 --- a/ApplicationCode/ReservoirDataModel/RigFracture.h +++ b/ApplicationCode/ReservoirDataModel/RigFracture.h @@ -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 contributingEclipseCells; +// std::vector contributingEclipseCellTransmisibilities; + }; + //================================================================================================== /// //================================================================================================== diff --git a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp index e1cc16de4b..1b82b3440e 100644 --- a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp @@ -445,7 +445,7 @@ std::pair RigFractureTransCalc::flowAcrossLayersUpscaling(QStrin } else return std::make_pair(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE); - std::vector stimPlanCells = fracTemplateStimPlan->getStimPlanCells(resultName, resultUnit, timeStepIndex); + std::vector stimPlanCells = fracTemplateStimPlan->getStimPlanCells(); cvf::Vec3d localX, localY, localZ; //Not used in calculation here, but needed for function to find planCellPolygons std::vector > planeCellPolygons; @@ -500,7 +500,7 @@ std::pair RigFractureTransCalc::flowAcrossLayersUpscaling(QStrin //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers) +double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers) { std::vector DcolSum; std::vector lavgCol; @@ -515,14 +515,14 @@ double RigFractureTransCalc::computeHAupscale(RimStimPlanFractureTemplate* fracT std::vector stimPlanCellsCol = getColOfStimPlanCells(stimPlanCells, j); for (RigStimPlanCell* stimPlanCell : stimPlanCellsCol) { - if (stimPlanCell->getValue() > 1e-7) + if (stimPlanCell->getConductivtyValue() > 1e-7) { std::vector >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 stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers) +double RigFractureTransCalc::computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers) { std::vector DrowAvg; std::vector liRowSum; @@ -584,14 +584,14 @@ double RigFractureTransCalc::computeAHupscale(RimStimPlanFractureTemplate* fracT std::vector stimPlanCellsCol = getRowOfStimPlanCells(stimPlanCells, j); for (RigStimPlanCell* stimPlanCell : stimPlanCellsCol) { - if (stimPlanCell->getValue() > 1e-7) + if (stimPlanCell->getConductivtyValue() > 1e-7) { std::vector >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 RigFractureTransCalc::getRowOfStimPlanCells(std::vector allStimPlanCells, size_t i) +std::vector RigFractureTransCalc::getRowOfStimPlanCells(std::vector allStimPlanCells, size_t i) { std::vector 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 RigFractureTransCalc::getRowOfStimPlanCells(std::v //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigFractureTransCalc::getColOfStimPlanCells(std::vector allStimPlanCells, size_t j) +std::vector RigFractureTransCalc::getColOfStimPlanCells(std::vector allStimPlanCells, size_t j) { std::vector 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); } } diff --git a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h index 18be77fba7..8546b259dd 100644 --- a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h @@ -51,8 +51,8 @@ public: void computeUpscaledPropertyFromStimPlan(QString resultName, QString resultUnit, size_t timeStepIndex); std::pair flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimDefines::UnitSystem unitSystem, size_t eclipseCellIndex); - double computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers); - double computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers); + double computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers); + double computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers); static double arithmeticAverage(std::vector values); @@ -62,8 +62,8 @@ public: void computeFlowIntoTransverseWell(); - static std::vector getRowOfStimPlanCells(std::vector allStimPlanCells, size_t i); - static std::vector getColOfStimPlanCells(std::vector allStimPlanCells, size_t j); + static std::vector getRowOfStimPlanCells(std::vector allStimPlanCells, size_t i); + static std::vector getColOfStimPlanCells(std::vector allStimPlanCells, size_t j); private: double convertConductivtyValue(double Kw, RimDefines::UnitSystem fromUnit, RimDefines::UnitSystem toUnit); diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp index ee7dcb5ab3..8c7d5a85ce 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp @@ -29,10 +29,9 @@ RigStimPlanCell::RigStimPlanCell() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigStimPlanCell::RigStimPlanCell(std::vector polygon, double value, size_t i, size_t j) +RigStimPlanCell::RigStimPlanCell(std::vector polygon, size_t i, size_t j) { m_polygon = polygon; - m_value = value; m_i = i; m_j = j; } diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h index 65b45bd72f..f3d8ceb09d 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h @@ -32,17 +32,19 @@ class RigStimPlanCell public: RigStimPlanCell(); - RigStimPlanCell(std::vector polygon, double value, size_t i, size_t j); + RigStimPlanCell(std::vector polygon, size_t i, size_t j); virtual ~RigStimPlanCell(); std::vector 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 getContributingEclipseCells() { return contributingEclipseCells; } @@ -50,8 +52,8 @@ public: private: std::vector m_polygon; - double m_value; -// double m_concutivityValue; + double m_displayValue; + double m_concutivityValue; size_t m_i; size_t m_j;