#1506 Fix stimPlan getGlobalIndexFromIJ() errors

Misunderstandings of row/column count and CellCounts and point counts. Quite an obfuscation to use j as fast index, and CellCountI = ColumnCount - 2. The names are not quite enlightening.
This commit is contained in:
Jacob Støren 2017-05-27 17:59:48 +02:00
parent 6cdf13a2bc
commit 38315f7bc2
2 changed files with 8 additions and 6 deletions

View File

@ -260,16 +260,16 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
////// //////
// Calculate Transmissibility in the fracture: From one StimPlan Cell to the other // Calculate Transmissibility in the fracture: From one StimPlan Cell to the other
for (size_t i = 0; i < fracTemplateStimPlan->stimPlanGridNumberOfColums(); i++) for (size_t i = 0; i < fracTemplateStimPlan->stimPlanGridNumberOfColums()-2; i++)
{ {
for (size_t j = 0; j < fracTemplateStimPlan->stimPlanGridNumberOfRows(); j++) for (size_t j = 0; j < fracTemplateStimPlan->stimPlanGridNumberOfRows()-2; j++)
{ {
size_t stimPlanCellIndex = fracTemplateStimPlan->getGlobalIndexFromIJ(i, j); size_t stimPlanCellIndex = fracTemplateStimPlan->getGlobalIndexFromIJ(i, j);
const RigStimPlanFracTemplateCell stimPlanCell = fracTemplateStimPlan->stimPlanCellFromIndex(stimPlanCellIndex); const RigStimPlanFracTemplateCell stimPlanCell = fracTemplateStimPlan->stimPlanCellFromIndex(stimPlanCellIndex);
if (stimPlanCell.getConductivtyValue() < 1e-7) continue; if (stimPlanCell.getConductivtyValue() < 1e-7) continue;
if (i < fracTemplateStimPlan->stimPlanGridNumberOfColums() - 1) if (i < fracTemplateStimPlan->stimPlanGridNumberOfColums() - 2-1)
{ {
size_t stimPlanCellNeighbourXIndex = fracTemplateStimPlan->getGlobalIndexFromIJ(i + 1, j); size_t stimPlanCellNeighbourXIndex = fracTemplateStimPlan->getGlobalIndexFromIJ(i + 1, j);
const RigStimPlanFracTemplateCell stimPlanCellNeighbourX = fracTemplateStimPlan->stimPlanCellFromIndex(stimPlanCellNeighbourXIndex); const RigStimPlanFracTemplateCell stimPlanCellNeighbourX = fracTemplateStimPlan->stimPlanCellFromIndex(stimPlanCellNeighbourXIndex);
@ -289,7 +289,7 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
} }
if (j < fracTemplateStimPlan->stimPlanGridNumberOfRows() - 1) if (j < fracTemplateStimPlan->stimPlanGridNumberOfRows() - 2-1)
{ {
size_t stimPlanCellNeighbourZIndex = fracTemplateStimPlan->getGlobalIndexFromIJ(i, j + 1); size_t stimPlanCellNeighbourZIndex = fracTemplateStimPlan->getGlobalIndexFromIJ(i, j + 1);
const RigStimPlanFracTemplateCell stimPlanCellNeighbourZ = fracTemplateStimPlan->stimPlanCellFromIndex(stimPlanCellNeighbourZIndex); const RigStimPlanFracTemplateCell stimPlanCellNeighbourZ = fracTemplateStimPlan->stimPlanCellFromIndex(stimPlanCellNeighbourZIndex);

View File

@ -959,9 +959,11 @@ std::pair<size_t, size_t> RimStimPlanFractureTemplate::getStimPlanCellAtWellCent
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RimStimPlanFractureTemplate::getGlobalIndexFromIJ(size_t i, size_t j) const size_t RimStimPlanFractureTemplate::getGlobalIndexFromIJ(size_t i, size_t j) const
{ {
size_t length_I = stimPlanGridNumberOfRows() - 1; size_t cellCountJ = stimPlanGridNumberOfRows() - 2;
size_t globIndex = j * length_I + i; size_t globIndex = i * cellCountJ + j;
CVF_ASSERT(m_stimPlanCells[globIndex].getI() == i && m_stimPlanCells[globIndex].getJ() == j);
return globIndex; return globIndex;
} }