#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 "RigEclipseCaseData.h"
#include "RigEclipseMultiPropertyStatCalc.h" #include "RigEclipseMultiPropertyStatCalc.h"
#include "RigEclipseNativeStatCalc.h" #include "RigEclipseNativeStatCalc.h"
#include "RigMainGrid.h"
#include "RigEclipseResultInfo.h" #include "RigEclipseResultInfo.h"
#include "RigMainGrid.h"
#include "RigStatisticsDataCache.h" #include "RigStatisticsDataCache.h"
#include "RigStatisticsMath.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 != nullptr);
CVF_ASSERT(ownerCaseData->mainGrid() != nullptr); CVF_ASSERT(ownerCaseData->mainGrid() != nullptr);
@ -63,6 +64,14 @@ void RigCaseCellResultsData::setMainGrid(RigMainGrid* ownerGrid)
m_ownerMainGrid = ownerGrid; m_ownerMainGrid = ownerGrid;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::setActiveCellInfo(RigActiveCellInfo* activeCellInfo)
{
m_activeCellInfo = activeCellInfo;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -288,7 +297,9 @@ size_t RigCaseCellResultsData::findScalarResultIndex(const QString& resultName)
/// Adds an empty scalar set, and returns the scalarResultIndex to it. /// Adds an empty scalar set, and returns the scalarResultIndex to it.
/// if resultName already exists, it just returns the scalarResultIndex to the existing result. /// 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); size_t scalarResultIndex = this->findScalarResultIndex(type, resultName);
@ -337,25 +348,34 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex(RiaDefines::ResultC
else if (resultName == RiaDefines::combinedRiTranResultName()) else if (resultName == RiaDefines::combinedRiTranResultName())
{ {
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc(); cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName())); calc->addNativeStatisticsCalculator(this,
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName())); findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName())); calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()));
statisticsCalculator = calc; statisticsCalculator = calc;
} }
else if (resultName == RiaDefines::combinedRiMultResultName()) else if (resultName == RiaDefines::combinedRiMultResultName())
{ {
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc(); cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName())); calc->addNativeStatisticsCalculator(this,
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName())); findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultZResultName())); calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName()));
calc->addNativeStatisticsCalculator(this,
findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riMultZResultName()));
statisticsCalculator = calc; statisticsCalculator = calc;
} }
else if (resultName == RiaDefines::combinedRiAreaNormTranResultName()) else if (resultName == RiaDefines::combinedRiAreaNormTranResultName())
{ {
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc(); cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranXResultName())); calc->addNativeStatisticsCalculator(
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranYResultName())); this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranZResultName())); calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranYResultName()));
calc->addNativeStatisticsCalculator(
this, findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riAreaNormTranZResultName()));
statisticsCalculator = calc; statisticsCalculator = calc;
} }
else if (resultName == RiaDefines::combinedWaterFluxResultName()) else if (resultName == RiaDefines::combinedWaterFluxResultName())
@ -419,6 +439,22 @@ QStringList RigCaseCellResultsData::resultNames(RiaDefines::ResultCatType resTyp
return varList; return varList;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RigCaseCellResultsData::activeCellInfo()
{
return m_activeCellInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigActiveCellInfo* RigCaseCellResultsData::activeCellInfo() const
{
return m_activeCellInfo;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -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 /// 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 // 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); 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 resultCellCount = actCellInfo->reservoirCellResultCount();
size_t reservoirCellCount = actCellInfo->reservoirCellCount(); 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 // riTRANSXYZ and X,Y,Z
{ {
if ( findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMX") != 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, "PERMY") != cvf::UNDEFINED_SIZE_T &&
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PERMZ") != 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::riTranXResultName(), false, 0);
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName(), false, 0); addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riTranYResultName(), false, 0);
@ -873,10 +924,10 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
// riMULTXYZ and X, Y, Z // riMULTXYZ and X, Y, Z
{ {
size_t tranX, tranY, tranZ; size_t tranX, tranY, tranZ;
if (findTransmissibilityResults(tranX, tranY, tranZ) if (findTransmissibilityResults(tranX, tranY, tranZ) &&
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranXResultName()) != cvf::UNDEFINED_SIZE_T 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::riTranYResultName()) != cvf::UNDEFINED_SIZE_T &&
&& findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riTranZResultName()) != 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::riMultXResultName(), false, 0);
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName(), false, 0); addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::riMultYResultName(), false, 0);
@ -927,9 +978,7 @@ bool RigCaseCellResultsData::findTransmissibilityResults(size_t& tranX, size_t&
tranY = findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANY"); tranY = findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANY");
tranZ = findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANZ"); tranZ = findScalarResultIndex(RiaDefines::STATIC_NATIVE, "TRANZ");
if (tranX == cvf::UNDEFINED_SIZE_T || if (tranX == cvf::UNDEFINED_SIZE_T || tranY == cvf::UNDEFINED_SIZE_T || tranZ == cvf::UNDEFINED_SIZE_T)
tranY == cvf::UNDEFINED_SIZE_T ||
tranZ == cvf::UNDEFINED_SIZE_T)
{ {
return false; return false;
} }
@ -937,7 +986,6 @@ bool RigCaseCellResultsData::findTransmissibilityResults(size_t& tranX, size_t&
return true; return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1002,9 +1050,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
computeRiTransComponent(RiaDefines::riTranZResultName()); computeRiTransComponent(RiaDefines::riTranZResultName());
computeNncCombRiTrans(); computeNncCombRiTrans();
} }
else if (resultName == RiaDefines::riTranXResultName() else if (resultName == RiaDefines::riTranXResultName() || resultName == RiaDefines::riTranYResultName() ||
|| resultName == RiaDefines::riTranYResultName() resultName == RiaDefines::riTranZResultName())
|| resultName == RiaDefines::riTranZResultName())
{ {
computeRiTransComponent(resultName); computeRiTransComponent(resultName);
} }
@ -1016,9 +1063,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
computeNncCombRiTrans(); computeNncCombRiTrans();
computeNncCombRiMULT(); computeNncCombRiMULT();
} }
else if (resultName == RiaDefines::riMultXResultName() else if (resultName == RiaDefines::riMultXResultName() || resultName == RiaDefines::riMultYResultName() ||
|| resultName == RiaDefines::riMultYResultName() resultName == RiaDefines::riMultZResultName())
|| resultName == RiaDefines::riMultZResultName())
{ {
computeRiMULTComponent(resultName); computeRiMULTComponent(resultName);
} }
@ -1029,9 +1075,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
computeRiTRANSbyAreaComponent(RiaDefines::riAreaNormTranZResultName()); computeRiTRANSbyAreaComponent(RiaDefines::riAreaNormTranZResultName());
computeNncCombRiTRANSbyArea(); computeNncCombRiTRANSbyArea();
} }
else if (resultName == RiaDefines::riAreaNormTranXResultName() else if (resultName == RiaDefines::riAreaNormTranXResultName() || resultName == RiaDefines::riAreaNormTranYResultName() ||
|| resultName == RiaDefines::riAreaNormTranYResultName() resultName == RiaDefines::riAreaNormTranZResultName())
|| resultName == RiaDefines::riAreaNormTranZResultName())
{ {
computeRiTRANSbyAreaComponent(resultName); computeRiTRANSbyAreaComponent(resultName);
} }
@ -1183,7 +1228,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
/// This method is intended to be used for multicase cross statistical calculations, when /// 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. /// 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 // Special handling for SOIL
if (type == RiaDefines::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL") if (type == RiaDefines::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL")
@ -1276,10 +1323,8 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
} }
return scalarResultIndex; return scalarResultIndex;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1392,7 +1437,6 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1542,19 +1586,22 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
if (computeDx) 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(); dx[0][cellIdx] = cellWidth.length();
} }
if (computeDy) 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(); dy[0][cellIdx] = cellWidth.length();
} }
if (computeDz) 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(); dz[0][cellIdx] = cellWidth.length();
} }
@ -1572,8 +1619,11 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
namespace RigTransmissibilityCalcTools namespace RigTransmissibilityCalcTools
{ {
void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std::vector<cvf::Vec3d>& nodes, void calculateConnectionGeometry(const RigCell& c1,
cvf::StructGridInterface::FaceType faceId, cvf::Vec3d* faceAreaVec) const RigCell& c2,
const std::vector<cvf::Vec3d>& nodes,
cvf::StructGridInterface::FaceType faceId,
cvf::Vec3d* faceAreaVec)
{ {
CVF_TIGHT_ASSERT(faceAreaVec); CVF_TIGHT_ASSERT(faceAreaVec);
@ -1586,8 +1636,7 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
c1.faceIndices(faceId, &face1); c1.faceIndices(faceId, &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2); c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2);
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads( bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon,
&polygon,
&intersections, &intersections,
(cvf::EdgeIntersectStorage<size_t>*)nullptr, (cvf::EdgeIntersectStorage<size_t>*)nullptr,
cvf::wrapArrayConst(&nodes), cvf::wrapArrayConst(&nodes),
@ -1595,7 +1644,6 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
face2.data(), face2.data(),
1e-6); 1e-6);
if (foundOverlap) if (foundOverlap)
{ {
std::vector<cvf::Vec3d> realPolygon; std::vector<cvf::Vec3d> realPolygon;
@ -1611,9 +1659,7 @@ void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std
// Polygon area vector // Polygon area vector
*faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon); *faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1661,7 +1707,7 @@ size_t reservoirActiveCellIndex(const RigActiveCellInfo* activeCellinfo, size_t
{ {
return activeCellinfo->cellResultIndex(reservoirCellIndex); return activeCellinfo->cellResultIndex(reservoirCellIndex);
} }
} } // namespace RigTransmissibilityCalcTools
using namespace RigTransmissibilityCalcTools; using namespace RigTransmissibilityCalcTools;
@ -1790,7 +1836,6 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
const RigFault* fault = grid->mainGrid()->findFaultFromCellIndexAndCellFace(nativeResvCellIndex, faceId); const RigFault* fault = grid->mainGrid()->findFaultFromCellIndexAndCellFace(nativeResvCellIndex, faceId);
bool isOnFault = fault; bool isOnFault = fault;
cvf::Vec3d faceAreaVec; cvf::Vec3d faceAreaVec;
cvf::Vec3d faceCenter; cvf::Vec3d faceCenter;
@ -1800,7 +1845,6 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
} }
else else
{ {
faceAreaVec = nativeCell.faceNormalWithAreaLenght(faceId); faceAreaVec = nativeCell.faceNormalWithAreaLenght(faceId);
} }
@ -1828,7 +1872,8 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
// Neighbor cell half cell transm // 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]; double perm = permResults[neighborCellPermResIdx];
@ -1844,7 +1889,6 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
riTransResults[tranResIdx] = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans); riTransResults[tranResIdx] = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans);
} }
} }
} }
@ -1853,7 +1897,8 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiTrans() 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; if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex)) return;
double cdarchy = darchysValue(); double cdarchy = darchysValue();
@ -1873,7 +1918,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
std::vector<double>& permXResults = this->cellScalarResults(permXResultIdx)[0]; std::vector<double>& permXResults = this->cellScalarResults(permXResultIdx)[0];
std::vector<double>& permYResults = this->cellScalarResults(permYResultIdx)[0]; std::vector<double>& permYResults = this->cellScalarResults(permYResultIdx)[0];
std::vector<double>& permZResults = this->cellScalarResults(permZResultIdx)[0]; std::vector<double>& permZResults = this->cellScalarResults(permZResultIdx)[0];
std::vector<double> & riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans()); std::vector<double>& riCombTransResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans());
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex); m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex);
std::vector<double>* ntgResults = nullptr; std::vector<double>* ntgResults = nullptr;
@ -1939,7 +1985,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
permIdxFunc = permZIdxFunc; permIdxFunc = permZIdxFunc;
permResults = &permZResults; permResults = &permZResults;
break; break;
default: break; default:
break;
} }
if (!permIdxFunc) continue; if (!permIdxFunc) continue;
@ -1952,15 +1999,13 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
size_t neighborCellPermResIdx = (*permIdxFunc)(activeCellInfo, neighborResvCellIdx); size_t neighborCellPermResIdx = (*permIdxFunc)(activeCellInfo, neighborResvCellIdx);
if (neighborCellPermResIdx == cvf::UNDEFINED_SIZE_T) continue; if (neighborCellPermResIdx == cvf::UNDEFINED_SIZE_T) continue;
const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex]; const RigCell& nativeCell = m_ownerMainGrid->globalCellArray()[nativeResvCellIndex];
const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx]; const RigCell& neighborCell = m_ownerMainGrid->globalCellArray()[neighborResvCellIdx];
// Connection geometry // Connection geometry
cvf::Vec3d faceAreaVec = cvf::Vec3d::ZERO;; cvf::Vec3d faceAreaVec = cvf::Vec3d::ZERO;
cvf::Vec3d faceCenter = cvf::Vec3d::ZERO;; cvf::Vec3d faceCenter = cvf::Vec3d::ZERO;
// Polygon center // Polygon center
const std::vector<cvf::Vec3d>& realPolygon = nncConnections[connIdx].m_polygon; const std::vector<cvf::Vec3d>& realPolygon = nncConnections[connIdx].m_polygon;
@ -1998,7 +2043,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
// Neighbor cell half cell transm // 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]; double perm = (*permResults)[neighborCellPermResIdx];
@ -2015,10 +2061,8 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
double newtranTemp = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans); double newtranTemp = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans);
riCombTransResults[connIdx] = newtranTemp; riCombTransResults[connIdx] = newtranTemp;
} }
} }
double riMult(double transResults, double riTransResults) double riMult(double transResults, double riTransResults)
{ {
if (transResults == HUGE_VAL || riTransResults == HUGE_VAL) return HUGE_VAL; if (transResults == HUGE_VAL || riTransResults == HUGE_VAL) return HUGE_VAL;
@ -2034,7 +2078,6 @@ double riMult(double transResults, double riTransResults)
return HUGE_VAL; return HUGE_VAL;
} }
double result = transResults / riTransResults; double result = transResults / riTransResults;
return result; return result;
@ -2108,15 +2151,21 @@ void RigCaseCellResultsData::computeRiMULTComponent(const QString& riMultCompNam
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiMULT() void RigCaseCellResultsData::computeNncCombRiMULT()
{ {
size_t riCombMultScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiMultResultName()); size_t riCombMultScalarResultIndex =
size_t riCombTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiTranResultName()); this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiMultResultName());
size_t combTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName()); 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; if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombMultScalarResultIndex)) return;
std::vector<double> & riMultResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult()); std::vector<double>& riMultResults =
const std::vector<double> * riTransResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransScalarResultIndex); m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombMult());
const std::vector<double> * transResults = m_ownerMainGrid->nncData()->staticConnectionScalarResult(combTransScalarResultIndex); 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); m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombMult(), riCombMultScalarResultIndex);
for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx) for (size_t nncConIdx = 0; nncConIdx < riMultResults.size(); ++nncConIdx)
@ -2230,7 +2279,6 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
riTransByAreaResults[nativeCellResValIdx] = transCompValue / areaOfOverlap; riTransByAreaResults[nativeCellResValIdx] = transCompValue / areaOfOverlap;
} }
} }
} }
@ -2239,14 +2287,18 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncCombRiTRANSbyArea() void RigCaseCellResultsData::computeNncCombRiTRANSbyArea()
{ {
size_t riCombTransByAreaScResIdx = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName()); size_t riCombTransByAreaScResIdx =
size_t combTransScalarResultIndex = this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName()); this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName());
size_t combTransScalarResultIndex =
this->findScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::combinedTransmissibilityResultName());
if (m_ownerMainGrid->nncData()->staticConnectionScalarResult(riCombTransByAreaScResIdx)) return; 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); 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(); const std::vector<RigConnection>& connections = m_ownerMainGrid->nncData()->connections();
@ -2265,7 +2317,8 @@ void RigCaseCellResultsData::computeNncCombRiTRANSbyArea()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeCompletionTypeForTimeStep(size_t timeStep) 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()) if (this->cellScalarResults(completionTypeResultIndex).size() < this->maxTimeStepCount())
{ {
@ -2291,7 +2344,6 @@ void RigCaseCellResultsData::computeCompletionTypeForTimeStep(size_t timeStep)
RimCompletionCellIntersectionCalc::calculateCompletionTypeResult(eclipseCase, completionTypeResult, timeStep); RimCompletionCellIntersectionCalc::calculateCompletionTypeResult(eclipseCase, completionTypeResult, timeStep);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -2321,7 +2373,8 @@ void RigCaseCellResultsData::computeMobilePV()
} }
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "SWCR", swcrDataTemp); 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); size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false);
@ -2365,7 +2418,6 @@ void RigCaseCellResultsData::setReaderInterface(RifReaderInterface* readerInterf
m_readerInterface = readerInterface; m_readerInterface = readerInterface;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -2437,4 +2489,3 @@ void RigCaseCellResultsData::assignValuesToTemporaryLgrs(std::vector<double>& va
} }
} }
} }

View File

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