2017-05-26 09:27:48 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 - Statoil ASA
|
2018-03-08 13:35:47 -06:00
|
|
|
//
|
2017-05-26 09:27:48 -05:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2018-03-08 13:35:47 -06:00
|
|
|
//
|
2017-05-26 09:27:48 -05:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2018-03-08 13:35:47 -06:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-05-26 09:27:48 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RigFractureGrid.h"
|
2018-03-08 13:35:47 -06:00
|
|
|
|
2017-05-26 09:27:48 -05:00
|
|
|
#include "RiaLogging.h"
|
2018-03-08 13:35:47 -06:00
|
|
|
|
2017-05-26 09:27:48 -05:00
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-08 13:35:47 -06:00
|
|
|
///
|
2017-05-26 09:27:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigFractureGrid::RigFractureGrid()
|
2018-03-08 13:35:47 -06:00
|
|
|
: m_iCellCount(0)
|
|
|
|
, m_jCellCount(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFractureGrid::setFractureCells(std::vector<RigFractureCell> fractureCells)
|
|
|
|
{
|
|
|
|
m_fractureCells = fractureCells;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFractureGrid::setWellCenterFractureCellIJ(std::pair<size_t, size_t> wellCenterFractureCellIJ)
|
|
|
|
{
|
|
|
|
m_wellCenterFractureCellIJ = wellCenterFractureCellIJ;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFractureGrid::setICellCount(size_t iCellCount)
|
|
|
|
{
|
|
|
|
m_iCellCount = iCellCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigFractureGrid::setJCellCount(size_t jCellCount)
|
2017-05-26 09:27:48 -05:00
|
|
|
{
|
2018-03-08 13:35:47 -06:00
|
|
|
m_jCellCount = jCellCount;
|
|
|
|
}
|
2017-05-26 09:27:48 -05:00
|
|
|
|
2018-03-08 13:35:47 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const std::vector<RigFractureCell>& RigFractureGrid::fractureCells() const
|
|
|
|
{
|
|
|
|
return m_fractureCells;
|
2017-05-26 09:27:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-08 13:35:47 -06:00
|
|
|
///
|
2017-05-26 09:27:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RigFractureGrid::getGlobalIndexFromIJ(size_t i, size_t j) const
|
|
|
|
{
|
2017-05-30 04:35:52 -05:00
|
|
|
return i * m_jCellCount + j;
|
2017-05-26 09:27:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-08 13:35:47 -06:00
|
|
|
///
|
2017-05-26 09:27:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-30 04:52:19 -05:00
|
|
|
const RigFractureCell& RigFractureGrid::cellFromIndex(size_t index) const
|
2017-05-26 09:27:48 -05:00
|
|
|
{
|
|
|
|
if (index < m_fractureCells.size())
|
|
|
|
{
|
2017-05-30 04:52:19 -05:00
|
|
|
const RigFractureCell& cell = m_fractureCells[index];
|
2017-05-26 09:27:48 -05:00
|
|
|
return cell;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-03-08 13:35:47 -06:00
|
|
|
// TODO: Better error handling?
|
2017-05-26 09:27:48 -05:00
|
|
|
RiaLogging::error(QString("Requesting non-existent StimPlanCell"));
|
|
|
|
RiaLogging::error(QString("Returning cell 0, results will be invalid"));
|
2017-05-30 04:52:19 -05:00
|
|
|
const RigFractureCell& cell = m_fractureCells[0];
|
2017-05-26 09:27:48 -05:00
|
|
|
return cell;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-08 13:35:47 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RigFractureGrid::jCellCount() const
|
|
|
|
{
|
|
|
|
return m_jCellCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RigFractureGrid::iCellCount() const
|
|
|
|
{
|
|
|
|
return m_iCellCount;
|
|
|
|
}
|
2017-05-26 09:27:48 -05:00
|
|
|
|
2018-03-08 13:35:47 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::pair<size_t, size_t> RigFractureGrid::fractureCellAtWellCenter() const
|
|
|
|
{
|
|
|
|
return m_wellCenterFractureCellIJ;
|
|
|
|
}
|