#1487 - pre-proto - Adding class RigFractureGrid, which now holds RigStimPlanFracTemplateCells and functions for accessing these.

This commit is contained in:
astridkbjorke
2017-05-26 16:27:48 +02:00
parent 7420c069c7
commit 8ca5a5a90a
12 changed files with 227 additions and 73 deletions

View File

@@ -45,6 +45,7 @@
#include <vector>
#include <cmath>
#include "RigFractureTransCalc.h"
#include "RigFractureGrid.h"
@@ -68,7 +69,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void)
CAF_PDM_InitField(&showStimPlanMesh, "showStimPlanMesh", true, "Show StimPlan Mesh", "", "", "");
//TODO: Is this correct way of doing this...?
wellCenterStimPlanCellIJ = std::make_pair(0, 0);
//wellCenterStimPlanCellIJ = std::make_pair(0, 0);
}
//--------------------------------------------------------------------------------------------------
@@ -820,6 +821,7 @@ void RimStimPlanFractureTemplate::setupStimPlanCells()
QString resultUnitFromColors = activeView->stimPlanColors->unit();
std::vector<RigStimPlanFracTemplateCell> stimPlanCells;
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = std::make_pair(0,0);
bool wellCenterStimPlanCellFound = false;
@@ -889,17 +891,30 @@ void RimStimPlanFractureTemplate::setupStimPlanCells()
}
m_stimPlanCells = stimPlanCells;
RigFractureGrid fractureGrid;
fractureGrid.setFractureCells(stimPlanCells);
fractureGrid.setWellCenterStimPlanCellIJ(wellCenterStimPlanCellIJ);
fractureGrid.setIcount(getNegAndPosXcoords().size());
fractureGrid.setJcount(adjustedDepthCoordsAroundWellPathPosition().size());
m_fractureGrid = fractureGrid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RigStimPlanFracTemplateCell>& RimStimPlanFractureTemplate::getStimPlanCells() const
const RigFractureGrid& RimStimPlanFractureTemplate::fractureGrid() const
{
return m_stimPlanCells;
return m_fractureGrid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// const std::vector<RigStimPlanFracTemplateCell>& RimStimPlanFractureTemplate::getStimPlanCells() const
// {
// return m_stimPlanCells;
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -949,43 +964,43 @@ std::vector<cvf::Vec3d> RimStimPlanFractureTemplate::getStimPlanColPolygon(size_
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<size_t, size_t> RimStimPlanFractureTemplate::getStimPlanCellAtWellCenter()
{
return wellCenterStimPlanCellIJ;
}
// 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;
}
//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;
}
}
// 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;
// }
// }
//--------------------------------------------------------------------------------------------------
///
@@ -1114,18 +1129,18 @@ void RimStimPlanFractureTemplate::sortPolygon(std::vector<cvf::Vec3f> &polygon)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimStimPlanFractureTemplate::stimPlanGridNumberOfColums() const
{
return getNegAndPosXcoords().size();
}
// size_t RimStimPlanFractureTemplate::stimPlanGridNumberOfColums() const
// {
// return getNegAndPosXcoords().size();
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimStimPlanFractureTemplate::stimPlanGridNumberOfRows() const
{
return adjustedDepthCoordsAroundWellPathPosition().size();
}
// size_t RimStimPlanFractureTemplate::stimPlanGridNumberOfRows() const
// {
// return adjustedDepthCoordsAroundWellPathPosition().size();
// }
//--------------------------------------------------------------------------------------------------
///

View File

@@ -32,10 +32,13 @@
#include "cvfVector3.h"
#include <vector>
#include "RigStimPlanFracTemplateCell.h"
#include "RigFractureGrid.h"
class RigStimPlanFractureDefinition;
class RimStimPlanLegendConfig;
class RigStimPlanFracTemplateCell;
class RigFractureGrid;
//==================================================================================================
///
@@ -74,13 +77,14 @@ public:
std::vector<std::vector<double>> getDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const;
void setupStimPlanCells();
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;
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();
// std::pair<size_t, size_t> getStimPlanCellAtWellCenter();
//Functions used by upscaling only
@@ -113,6 +117,7 @@ private:
caf::PdmField<QString> m_stimPlanFileName;
cvf::ref<RigStimPlanFractureDefinition> m_stimPlanFractureDefinitionData;
std::vector<RigStimPlanFracTemplateCell> m_stimPlanCells;
std::pair<size_t, size_t> wellCenterStimPlanCellIJ;
// std::vector<RigStimPlanFracTemplateCell> m_stimPlanCells;
// std::pair<size_t, size_t> wellCenterStimPlanCellIJ;
RigFractureGrid m_fractureGrid;
};