#3531 Temporary LGR : Move function and whitespace changes

This commit is contained in:
Magne Sjaastad 2018-10-23 21:33:54 +02:00
parent 577a706b57
commit 08776a09b3
2 changed files with 354 additions and 303 deletions

View File

@ -25,8 +25,8 @@
#include "RigEclipseCaseData.h"
#include "RigEclipseMultiPropertyStatCalc.h"
#include "RigEclipseNativeStatCalc.h"
#include "RigMainGrid.h"
#include "RigEclipseResultInfo.h"
#include "RigMainGrid.h"
#include "RigStatisticsDataCache.h"
#include "RigStatisticsMath.h"
@ -46,7 +46,8 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigCaseCellResultsData::RigCaseCellResultsData(RigEclipseCaseData* ownerCaseData) : m_activeCellInfo(nullptr)
RigCaseCellResultsData::RigCaseCellResultsData(RigEclipseCaseData* ownerCaseData)
: m_activeCellInfo(nullptr)
{
CVF_ASSERT(ownerCaseData != nullptr);
CVF_ASSERT(ownerCaseData->mainGrid() != nullptr);
@ -63,6 +64,14 @@ void RigCaseCellResultsData::setMainGrid(RigMainGrid* ownerGrid)
m_ownerMainGrid = ownerGrid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::setActiveCellInfo(RigActiveCellInfo* activeCellInfo)
{
m_activeCellInfo = activeCellInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -204,7 +213,7 @@ size_t RigCaseCellResultsData::timeStepCount(size_t scalarResultIndex) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector< std::vector<double> > & RigCaseCellResultsData::cellScalarResults( size_t scalarResultIndex ) const
const std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex) const
{
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
@ -214,7 +223,7 @@ const std::vector< std::vector<double> > & RigCaseCellResultsData::cellScalarRes
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector< std::vector<double> > & RigCaseCellResultsData::cellScalarResults( size_t scalarResultIndex )
std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex)
{
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
@ -276,7 +285,7 @@ size_t RigCaseCellResultsData::findScalarResultIndex(const QString& resultName)
scalarResultIndex = this->findScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName);
}
if(scalarResultIndex == cvf::UNDEFINED_SIZE_T)
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
{
scalarResultIndex = this->findScalarResultIndex(RiaDefines::FORMATION_NAMES, resultName);
}
@ -288,7 +297,9 @@ size_t RigCaseCellResultsData::findScalarResultIndex(const QString& resultName)
/// Adds an empty scalar set, and returns the scalarResultIndex to it.
/// if resultName already exists, it just returns the scalarResultIndex to the existing result.
//--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName, bool needsToBeStored)
size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultCatType type,
const QString& resultName,
bool needsToBeStored)
{
size_t scalarResultIndex = this->findScalarResultIndex(type, resultName);
@ -302,7 +313,7 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultC
// Create the new empty result with metadata
scalarResultIndex = this->resultCount();
m_cellScalarResults.push_back(std::vector<std::vector<double> >());
m_cellScalarResults.push_back(std::vector<std::vector<double>>());
RigEclipseResultInfo resInfo(type, resultName, needsToBeStored, false, scalarResultIndex);
m_resultInfos.push_back(resInfo);
@ -337,25 +348,34 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultC
else if (resultName == RiaDefines::combinedRiTranResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedRiMultResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultZResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultZResultName()));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedRiAreaNormTranResultName())
{
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranYResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranZResultName()));
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranXResultName()));
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranYResultName()));
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranZResultName()));
statisticsCalculator = calc;
}
else if (resultName == RiaDefines::combinedWaterFluxResultName())
@ -411,7 +431,7 @@ QStringList RigCaseCellResultsData::resultNames(RiaDefines::ResultCatType resTyp
std::vector<RigEclipseResultInfo>::const_iterator it;
for (it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it)
{
if (it->resultType() == resType )
if (it->resultType() == resType)
{
varList.push_back(it->resultName());
}
@ -419,6 +439,22 @@ QStringList RigCaseCellResultsData::resultNames(RiaDefines::ResultCatType resTyp
return varList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RigCaseCellResultsData::activeCellInfo()
{
return m_activeCellInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigActiveCellInfo* RigCaseCellResultsData::activeCellInfo() const
{
return m_activeCellInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -549,11 +585,11 @@ std::vector<RigEclipseTimeStepInfo> RigCaseCellResultsData::timeStepInfos(size_t
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::setTimeStepInfos(size_t scalarResultIndex, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos)
{
CVF_ASSERT(scalarResultIndex < m_resultInfos.size() );
CVF_ASSERT(scalarResultIndex < m_resultInfos.size());
m_resultInfos[scalarResultIndex].setTimeStepInfos(timeStepInfos);
std::vector< std::vector<double> >& dataValues = this->cellScalarResults(scalarResultIndex);
std::vector<std::vector<double>>& dataValues = this->cellScalarResults(scalarResultIndex);
dataValues.resize(timeStepInfos.size());
}
@ -607,7 +643,7 @@ QString RigCaseCellResultsData::makeResultNameUnique(const QString& resultNamePr
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, const QString & resultName)
void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, const QString& resultName)
{
size_t scalarResultIndex = this->findScalarResultIndex(type, resultName);
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) return;
@ -674,7 +710,10 @@ bool RigCaseCellResultsData::isResultLoaded(const RigEclipseResultInfo& resultIn
/// Make sure we have a result with given type and name, and make sure one "timestep" result vector
// for the static result values are allocated
//--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::addStaticScalarResult(RiaDefines::ResultCatType type, const QString& resultName, bool needsToBeStored, size_t resultValueCount)
size_t RigCaseCellResultsData::addStaticScalarResult(RiaDefines::ResultCatType type,
const QString& resultName,
bool needsToBeStored,
size_t resultValueCount)
{
size_t resultIdx = findOrCreateScalarResultIndex(type, resultName, needsToBeStored);
@ -706,7 +745,11 @@ bool RigCaseCellResultsData::updateResultName(RiaDefines::ResultCatType resultTy
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>* RigCaseCellResultsData::getResultIndexableStaticResult(RigActiveCellInfo* actCellInfo, RigCaseCellResultsData* gridCellResults, QString porvResultName, std::vector<double> &activeCellsResultsTempContainer)
const std::vector<double>*
RigCaseCellResultsData::getResultIndexableStaticResult(RigActiveCellInfo* actCellInfo,
RigCaseCellResultsData* gridCellResults,
QString porvResultName,
std::vector<double>& activeCellsResultsTempContainer)
{
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
size_t reservoirCellCount = actCellInfo->reservoirCellCount();
@ -739,6 +782,14 @@ const std::vector<double>* RigCaseCellResultsData::getResultIndexableStaticResul
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RigEclipseResultInfo>& RigCaseCellResultsData::infoForEachResultIndex()
{
return m_resultInfos;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -859,9 +910,9 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
// riTRANSXYZ and X,Y,Z
{
if ( findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMX") != cvf::UNDEFINED_SIZE_T
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMY") != cvf::UNDEFINED_SIZE_T
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMZ") != cvf::UNDEFINED_SIZE_T)
if (findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMX") != cvf::UNDEFINED_SIZE_T &&
findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMY") != cvf::UNDEFINED_SIZE_T &&
findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMZ") != cvf::UNDEFINED_SIZE_T)
{
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName(), false, 0);
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName(), false, 0);
@ -873,10 +924,10 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
// riMULTXYZ and X, Y, Z
{
size_t tranX, tranY, tranZ;
if (findTransmissibilityResults(tranX, tranY, tranZ)
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()) != cvf::UNDEFINED_SIZE_T
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()) != cvf::UNDEFINED_SIZE_T
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()) != cvf::UNDEFINED_SIZE_T)
if (findTransmissibilityResults(tranX, tranY, tranZ) &&
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()) != cvf::UNDEFINED_SIZE_T &&
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()) != cvf::UNDEFINED_SIZE_T &&
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()) != cvf::UNDEFINED_SIZE_T)
{
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName(), false, 0);
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName(), false, 0);
@ -909,7 +960,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
}
}
//Mobile Pore Volume
// Mobile Pore Volume
{
if (findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PORV") != cvf::UNDEFINED_SIZE_T)
{
@ -927,9 +978,7 @@ bool RigCaseCellResultsData::findTransmissibilityResults(size_t& tranX, size_t&
tranY = findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANY");
tranZ = findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANZ");
if (tranX == cvf::UNDEFINED_SIZE_T ||
tranY == cvf::UNDEFINED_SIZE_T ||
tranZ == cvf::UNDEFINED_SIZE_T)
if (tranX == cvf::UNDEFINED_SIZE_T || tranY == cvf::UNDEFINED_SIZE_T || tranZ == cvf::UNDEFINED_SIZE_T)
{
return false;
}
@ -937,7 +986,6 @@ bool RigCaseCellResultsData::findTransmissibilityResults(size_t& tranX, size_t&
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1002,9 +1050,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
computeRiTransComponent(RiaDefines::riTranZResultName());
computeNncCombRiTrans();
}
else if (resultName == RiaDefines::riTranXResultName()
|| resultName == RiaDefines::riTranYResultName()
|| resultName == RiaDefines::riTranZResultName())
else if (resultName == RiaDefines::riTranXResultName() || resultName == RiaDefines::riTranYResultName() ||
resultName == RiaDefines::riTranZResultName())
{
computeRiTransComponent(resultName);
}
@ -1016,9 +1063,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
computeNncCombRiTrans();
computeNncCombRiMULT();
}
else if (resultName == RiaDefines::riMultXResultName()
|| resultName == RiaDefines::riMultYResultName()
|| resultName == RiaDefines::riMultZResultName())
else if (resultName == RiaDefines::riMultXResultName() || resultName == RiaDefines::riMultYResultName() ||
resultName == RiaDefines::riMultZResultName())
{
computeRiMULTComponent(resultName);
}
@ -1029,9 +1075,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
computeRiTRANSbyAreaComponent(RiaDefines::riAreaNormTranZResultName());
computeNncCombRiTRANSbyArea();
}
else if (resultName == RiaDefines::riAreaNormTranXResultName()
|| resultName == RiaDefines::riAreaNormTranYResultName()
|| resultName == RiaDefines::riAreaNormTranZResultName())
else if (resultName == RiaDefines::riAreaNormTranXResultName() || resultName == RiaDefines::riAreaNormTranYResultName() ||
resultName == RiaDefines::riAreaNormTranZResultName())
{
computeRiTRANSbyAreaComponent(resultName);
}
@ -1168,7 +1213,7 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
this->cellScalarResults(scalarResultIndex).resize(timeStepCount);
size_t i;
for ( i = 0; i < timeStepCount; i++ )
for (i = 0; i < timeStepCount; i++)
{
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[i];
eclReader->sourSimRlResult(resultName, i, &values);
@ -1183,7 +1228,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
/// This method is intended to be used for multicase cross statistical calculations, when
/// we need process one timestep at a time, freeing memory as we go.
//--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex)
size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type,
const QString& resultName,
size_t timeStepIndex)
{
// Special handling for SOIL
if (type == RiaDefines::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL")
@ -1268,7 +1315,7 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[timeStepIndex];
if ( values.size() == 0)
if (values.size() == 0)
{
eclReader->sourSimRlResult(resultName, timeStepIndex, &values);
}
@ -1276,10 +1323,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
}
return scalarResultIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1369,7 +1414,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
std::vector<double>& soilForTimeStep = this->cellScalarResults(soilResultScalarIndex, timeStepIndex);
#pragma omp parallel for
#pragma omp parallel for
for (int idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
{
double soilValue = 1.0;
@ -1392,7 +1437,6 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1523,12 +1567,12 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
computeBottom = true;
}
std::vector< std::vector<double> >& depth = this->cellScalarResults(depthResultGridIndex);
std::vector< std::vector<double> >& dx = this->cellScalarResults(dxResultGridIndex);
std::vector< std::vector<double> >& dy = this->cellScalarResults(dyResultGridIndex);
std::vector< std::vector<double> >& dz = this->cellScalarResults(dzResultGridIndex);
std::vector< std::vector<double> >& tops = this->cellScalarResults(topsResultGridIndex);
std::vector< std::vector<double> >& bottom = this->cellScalarResults(bottomResultGridIndex);
std::vector<std::vector<double>>& depth = this->cellScalarResults(depthResultGridIndex);
std::vector<std::vector<double>>& dx = this->cellScalarResults(dxResultGridIndex);
std::vector<std::vector<double>>& dy = this->cellScalarResults(dyResultGridIndex);
std::vector<std::vector<double>>& dz = this->cellScalarResults(dzResultGridIndex);
std::vector<std::vector<double>>& tops = this->cellScalarResults(topsResultGridIndex);
std::vector<std::vector<double>>& bottom = this->cellScalarResults(bottomResultGridIndex);
size_t cellIdx = 0;
for (cellIdx = 0; cellIdx < m_ownerMainGrid->globalCellArray().size(); cellIdx++)
@ -1542,19 +1586,22 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
if (computeDx)
{
cvf::Vec3d cellWidth = cell.faceCenter(cvf::StructGridInterface::NEG_I) - cell.faceCenter(cvf::StructGridInterface::POS_I);
cvf::Vec3d cellWidth =
cell.faceCenter(cvf::StructGridInterface::NEG_I) - cell.faceCenter(cvf::StructGridInterface::POS_I);
dx[0][cellIdx] = cellWidth.length();
}
if (computeDy)
{
cvf::Vec3d cellWidth = cell.faceCenter(cvf::StructGridInterface::NEG_J) - cell.faceCenter(cvf::StructGridInterface::POS_J);
cvf::Vec3d cellWidth =
cell.faceCenter(cvf::StructGridInterface::NEG_J) - cell.faceCenter(cvf::StructGridInterface::POS_J);
dy[0][cellIdx] = cellWidth.length();
}
if (computeDz)
{
cvf::Vec3d cellWidth = cell.faceCenter(cvf::StructGridInterface::NEG_K) - cell.faceCenter(cvf::StructGridInterface::POS_K);
cvf::Vec3d cellWidth =
cell.faceCenter(cvf::StructGridInterface::NEG_K) - cell.faceCenter(cvf::StructGridInterface::POS_K);
dz[0][cellIdx] = cellWidth.length();
}
@ -1572,8 +1619,11 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
namespace RigTransmissibilityCalcTools
{
void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std::vector<cvf::Vec3d>& nodes,
cvf::StructGridInterface::FaceType faceId, cvf::Vec3d* faceAreaVec)
void calculateConnectionGeometry(const RigCell& c1,
const RigCell& c2,
const std::vector<cvf::Vec3d>& nodes,
cvf::StructGridInterface::FaceType faceId,
cvf::Vec3d* faceAreaVec)
{
CVF_TIGHT_ASSERT(faceAreaVec);
@ -1586,8 +1636,7 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
c1.faceIndices(faceId, &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2);
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(
&polygon,
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon,
&intersections,
(cvf::EdgeIntersectStorage<size_t>*)nullptr,
cvf::wrapArrayConst(&nodes),
@ -1595,7 +1644,6 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
face2.data(),
1e-6);
if (foundOverlap)
{
std::vector<cvf::Vec3d> realPolygon;
@ -1611,9 +1659,7 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
// Polygon area vector
*faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
}
}
//--------------------------------------------------------------------------------------------------
@ -1621,7 +1667,7 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
//--------------------------------------------------------------------------------------------------
double halfCellTransmissibility(double perm, double ntg, const cvf::Vec3d& centerToFace, const cvf::Vec3d& faceAreaVec)
{
return perm*ntg*(faceAreaVec*centerToFace) / (centerToFace*centerToFace);
return perm * ntg * (faceAreaVec * centerToFace) / (centerToFace * centerToFace);
}
//--------------------------------------------------------------------------------------------------
@ -1642,7 +1688,7 @@ double newtran(double cdarchy, double mult, double halfCellTrans, double neighbo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
typedef size_t(*ResultIndexFunction)(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex);
typedef size_t (*ResultIndexFunction)(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex);
//--------------------------------------------------------------------------------------------------
///
@ -1661,7 +1707,7 @@ size_t reservoirActiveCellIndex(const RigActiveCellInfo* activeCellinfo, size_t
{
return activeCellinfo->cellResultIndex(reservoirCellIndex);
}
}
} // namespace RigTransmissibilityCalcTools
using namespace RigTransmissibilityCalcTools;
@ -1721,9 +1767,9 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
// Get all the actual result values
std::vector<double> & permResults = this->cellScalarResults(permResultIdx)[0];
std::vector<double> & riTransResults = this->cellScalarResults(riTransResultIdx)[0];
std::vector<double> * ntgResults = nullptr;
std::vector<double>& permResults = this->cellScalarResults(permResultIdx)[0];
std::vector<double>& riTransResults = this->cellScalarResults(riTransResultIdx)[0];
std::vector<double>* ntgResults = nullptr;
if (hasNTGResults)
{
ntgResults = &(this->cellScalarResults(ntgResultIdx)[0]);
@ -1790,7 +1836,6 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
const RigFault* fault = grid->mainGrid()->findFaultFromCellIndexAndCellFace(nativeResvCellIndex, faceId);
bool isOnFault = fault;
cvf::Vec3d faceAreaVec;
cvf::Vec3d faceCenter;
@ -1800,7 +1845,6 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
}
else
{
faceAreaVec = nativeCell.faceNormalWithAreaLenght(faceId);
}
@ -1828,7 +1872,8 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
// Neighbor cell half cell transm
{
cvf::Vec3d centerToFace = neighborCell.faceCenter(cvf::StructGridInterface::oppositeFace(faceId)) - neighborCell.center();
cvf::Vec3d centerToFace =
neighborCell.faceCenter(cvf::StructGridInterface::oppositeFace(faceId)) - neighborCell.center();
double perm = permResults[neighborCellPermResIdx];
@ -1844,7 +1889,6 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
riTransResults[tranResIdx] = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans);
}
}
}
@ -1853,7 +1897,8 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiTrans()
{
size_t riCombTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
size_t riCombTransScalarResultIndex =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex)) return;
double cdarchy = darchysValue();
@ -1870,13 +1915,14 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
// Get all the actual result values
std::vector<double> & permXResults = this->cellScalarResults(permXResultIdx)[0];
std::vector<double> & permYResults = this->cellScalarResults(permYResultIdx)[0];
std::vector<double> & permZResults = this->cellScalarResults(permZResultIdx)[0];
std::vector<double> & riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans());
std::vector<double>& permXResults = this->cellScalarResults(permXResultIdx)[0];
std::vector<double>& permYResults = this->cellScalarResults(permYResultIdx)[0];
std::vector<double>& permZResults = this->cellScalarResults(permZResultIdx)[0];
std::vector<double>& riCombTransResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans());
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex);
std::vector<double> * ntgResults = nullptr;
std::vector<double>* ntgResults = nullptr;
if (hasNTGResults)
{
ntgResults = &(this->cellScalarResults(ntgResultIdx)[0]);
@ -1920,7 +1966,7 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
cvf::StructGridInterface::FaceType faceId = nncConnections[connIdx].m_c1Face;
ResultIndexFunction permIdxFunc = nullptr;
std::vector<double> * permResults = nullptr;
std::vector<double>* permResults = nullptr;
switch (faceId)
{
@ -1939,7 +1985,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
permIdxFunc = permZIdxFunc;
permResults = &permZResults;
break;
default: break;
default:
break;
}
if (!permIdxFunc) continue;
@ -1952,15 +1999,13 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
size_t neighborCellPermResIdx = (*permIdxFunc)(activeCellInfo, neighborResvCellIdx);
if (neighborCellPermResIdx == cvf::UNDEFINED_SIZE_T) continue;
const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex];
const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx];
// Connection geometry
cvf::Vec3d faceAreaVec = cvf::Vec3d::ZERO;;
cvf::Vec3d faceCenter = cvf::Vec3d::ZERO;;
cvf::Vec3d faceAreaVec = cvf::Vec3d::ZERO;
cvf::Vec3d faceCenter = cvf::Vec3d::ZERO;
// Polygon center
const std::vector<cvf::Vec3d>& realPolygon = nncConnections[connIdx].m_polygon;
@ -1998,7 +2043,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
// Neighbor cell half cell transm
{
cvf::Vec3d centerToFace = neighborCell.faceCenter(cvf::StructGridInterface::oppositeFace(faceId)) - neighborCell.center();
cvf::Vec3d centerToFace =
neighborCell.faceCenter(cvf::StructGridInterface::oppositeFace(faceId)) - neighborCell.center();
double perm = (*permResults)[neighborCellPermResIdx];
@ -2015,18 +2061,16 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
double newtranTemp = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans);
riCombTransResults[connIdx] = newtranTemp;
}
}
double riMult(double transResults, double riTransResults)
{
if (transResults == HUGE_VAL || riTransResults == HUGE_VAL) return HUGE_VAL;
// To make 0.0 values give 1.0 in mult value
if (cvf::Math::abs (riTransResults) < 1e-12)
if (cvf::Math::abs(riTransResults) < 1e-12)
{
if (cvf::Math::abs (transResults) < 1e-12)
if (cvf::Math::abs(transResults) < 1e-12)
{
return 1.0;
}
@ -2034,7 +2078,6 @@ double riMult(double transResults, double riTransResults)
return HUGE_VAL;
}
double result = transResults / riTransResults;
return result;
@ -2088,10 +2131,10 @@ void RigCaseCellResultsData::computeRiMULTComponent(const QString& riMultCompNam
// Get all the actual result values
std::vector<double> & riTransResults = this->cellScalarResults(riTransResultIdx)[0];
std::vector<double> & transResults = this->cellScalarResults(transResultIdx)[0];
std::vector<double>& riTransResults = this->cellScalarResults(riTransResultIdx)[0];
std::vector<double>& transResults = this->cellScalarResults(transResultIdx)[0];
std::vector<double> & riMultResults = this->cellScalarResults(riMultResultIdx)[0];
std::vector<double>& riMultResults = this->cellScalarResults(riMultResultIdx)[0];
// Set up output container to correct number of results
@ -2108,15 +2151,21 @@ void RigCaseCellResultsData::computeRiMULTComponent(const QString& riMultCompNam
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiMULT()
{
size_t riCombMultScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiMultResultName());
size_t riCombTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
size_t combTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
size_t riCombMultScalarResultIndex =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiMultResultName());
size_t riCombTransScalarResultIndex =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName());
size_t combTransScalarResultIndex =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombMultScalarResultIndex)) return;
std::vector<double> & riMultResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult());
const std::vector<double> * riTransResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex);
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex);
std::vector<double>& riMultResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult());
const std::vector<double>* riTransResults =
m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex);
const std::vector<double>* transResults =
m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex);
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombMult(), riCombMultScalarResultIndex);
for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx)
@ -2170,8 +2219,8 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
// Get all the actual result values
std::vector<double> & transResults = this->cellScalarResults(tranCompScResIdx)[0];
std::vector<double> & riTransByAreaResults = this->cellScalarResults(riTranByAreaScResIdx)[0];
std::vector<double>& transResults = this->cellScalarResults(tranCompScResIdx)[0];
std::vector<double>& riTransByAreaResults = this->cellScalarResults(riTranByAreaScResIdx)[0];
// Set up output container to correct number of results
@ -2230,7 +2279,6 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
riTransByAreaResults[nativeCellResValIdx] = transCompValue / areaOfOverlap;
}
}
}
@ -2239,14 +2287,18 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiTRANSbyArea()
{
size_t riCombTransByAreaScResIdx = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName());
size_t combTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
size_t riCombTransByAreaScResIdx =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName());
size_t combTransScalarResultIndex =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransByAreaScResIdx)) return;
std::vector<double> & riAreaNormTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTransByArea());
std::vector<double>& riAreaNormTransResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTransByArea());
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTransByArea(), riCombTransByAreaScResIdx);
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex);
const std::vector<double>* transResults =
m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex);
const std::vector<RigConnection>& connections = m_ownerMainGrid->nncData()->connections();
@ -2265,7 +2317,8 @@ void RigCaseCellResultsData::computeNncCombRiTRANSbyArea()
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeCompletionTypeForTimeStep(size_t timeStep)
{
size_t completionTypeResultIndex = this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
size_t completionTypeResultIndex =
this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
if (this->cellScalarResults(completionTypeResultIndex).size() < this->maxTimeStepCount())
{
@ -2291,7 +2344,6 @@ void RigCaseCellResultsData::computeCompletionTypeForTimeStep(size_t timeStep)
RimCompletionCellIntersectionCalc::calculateCompletionTypeResult(eclipseCase, completionTypeResult, timeStep);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2321,11 +2373,12 @@ void RigCaseCellResultsData::computeMobilePV()
}
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "SWCR", swcrDataTemp);
multpvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "MULTPV", multpvDataTemp);
multpvResults =
RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "MULTPV", multpvDataTemp);
size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false);
std::vector<double> &mobPVResults = this->cellScalarResults(mobPVIdx)[0];
std::vector<double>& mobPVResults = this->cellScalarResults(mobPVIdx)[0];
// Set up output container to correct number of results
mobPVResults.resize(porvResults->size());
@ -2365,7 +2418,6 @@ void RigCaseCellResultsData::setReaderInterface(RifReaderInterface* readerInterf
m_readerInterface = readerInterface;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2388,7 +2440,7 @@ bool RigCaseCellResultsData::isDataPresent(size_t scalarResultIndex) const
return false;
}
const std::vector< std::vector<double> >& data = this->cellScalarResults(scalarResultIndex);
const std::vector<std::vector<double>>& data = this->cellScalarResults(scalarResultIndex);
for (size_t tsIdx = 0; tsIdx < data.size(); ++tsIdx)
{
@ -2437,4 +2489,3 @@ void RigCaseCellResultsData::assignValuesToTemporaryLgrs(std::vector<double>& va
}
}
}

View File

@ -50,9 +50,9 @@ public:
void setHdf5Filename(const QString& hdf5SourSimFilename );
void setMainGrid(RigMainGrid* ownerGrid);
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo) { m_activeCellInfo = activeCellInfo;}
RigActiveCellInfo* activeCellInfo() { return m_activeCellInfo;}
const RigActiveCellInfo* activeCellInfo() const { return m_activeCellInfo;}
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo);
RigActiveCellInfo* activeCellInfo();
const RigActiveCellInfo* activeCellInfo() const;
// Max and min values of the results
void recalculateStatistics(size_t scalarResultIndex);
@ -125,7 +125,7 @@ public:
std::vector<double> &activeCellsResultsTempContainer);
public:
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex() { return m_resultInfos;}
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex();
bool mustBeCalculated(size_t scalarResultIndex) const;
void setMustBeCalculated(size_t scalarResultIndex);