mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Impoved result info text presentation
Display Cell result, Fault result, NNC result, and Cell edge result as a section with a linefeed above Always show value for intersection point at top with details below.
This commit is contained in:
parent
787d44e446
commit
e2a5c449ce
@ -1031,126 +1031,6 @@ RiuViewer* RimReservoirView::viewer()
|
|||||||
return m_viewer;
|
return m_viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
/// Get pick info text for given part ID, face index, and intersection point
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RimReservoirView::pickInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, const cvf::Vec3d& point, QString itemSeparator, QString* pickInfoText) const
|
|
||||||
{
|
|
||||||
CVF_ASSERT(pickInfoText);
|
|
||||||
|
|
||||||
if (m_reservoir)
|
|
||||||
{
|
|
||||||
const RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
|
||||||
if (eclipseCase)
|
|
||||||
{
|
|
||||||
size_t i = 0;
|
|
||||||
size_t j = 0;
|
|
||||||
size_t k = 0;
|
|
||||||
if (eclipseCase->grid(gridIndex)->ijkFromCellIndex(cellIndex, &i, &j, &k))
|
|
||||||
{
|
|
||||||
// Adjust to 1-based Eclipse indexing
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
k++;
|
|
||||||
|
|
||||||
cvf::Vec3d domainCoord = point + eclipseCase->grid(gridIndex)->displayModelOffset();
|
|
||||||
|
|
||||||
cvf::StructGridInterface::FaceEnum faceEnum(face);
|
|
||||||
|
|
||||||
QString faceText = faceEnum.text();
|
|
||||||
|
|
||||||
*pickInfoText += QString("Hit grid %1").arg(gridIndex) + itemSeparator;
|
|
||||||
*pickInfoText += QString("Cell : [%1, %2, %3]").arg(i).arg(j).arg(k) + itemSeparator;
|
|
||||||
*pickInfoText += QString("Face : %1").arg(faceText) + itemSeparator;
|
|
||||||
|
|
||||||
QString formattedText;
|
|
||||||
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
|
||||||
|
|
||||||
*pickInfoText += formattedText;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
/// Append fault name and result value for the given cell to the string
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* resultInfoText)
|
|
||||||
{
|
|
||||||
CVF_ASSERT(resultInfoText);
|
|
||||||
|
|
||||||
if (m_reservoir && m_reservoir->reservoirData())
|
|
||||||
{
|
|
||||||
RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
|
||||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
|
||||||
|
|
||||||
appendTextFromResultSlot(eclipseCase, gridIndex, cellIndex, this->m_currentTimeStep, this->cellResult(), resultInfoText);
|
|
||||||
|
|
||||||
// Fault text data
|
|
||||||
if (grid->isMainGrid())
|
|
||||||
{
|
|
||||||
RigMainGrid* mainGrid = grid->mainGrid();
|
|
||||||
|
|
||||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(cellIndex, face);
|
|
||||||
if (fault)
|
|
||||||
{
|
|
||||||
resultInfoText->append(QString("\nFault Name: %1\n").arg(fault->name()));
|
|
||||||
if (this->faultResultSettings()->hasValidCustomResult())
|
|
||||||
{
|
|
||||||
resultInfoText->push_back("Fault result data:\n");
|
|
||||||
appendTextFromResultSlot(eclipseCase, gridIndex, cellIndex, this->m_currentTimeStep, this->faultResultSettings()->customFaultResult(), resultInfoText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->cellEdgeResult()->hasResult())
|
|
||||||
{
|
|
||||||
size_t resultIndices[6];
|
|
||||||
QStringList resultNames;
|
|
||||||
this->cellEdgeResult()->gridScalarIndices(resultIndices);
|
|
||||||
this->cellEdgeResult()->gridScalarResultNames(&resultNames);
|
|
||||||
|
|
||||||
resultInfoText->push_back("\nCell edge result data:\n");
|
|
||||||
for (int idx = 0; idx < 6; idx++)
|
|
||||||
{
|
|
||||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
|
||||||
|
|
||||||
// Cell edge results are static, results are loaded for first time step only
|
|
||||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
|
||||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, resultIndices[idx]);
|
|
||||||
if (resultAccessor.notNull())
|
|
||||||
{
|
|
||||||
double scalarValue = resultAccessor->cellScalar(cellIndex);
|
|
||||||
resultInfoText->append(QString("%1 : %2\n").arg(resultNames[idx]).arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoir->reservoirData()->wellResults();
|
|
||||||
for (size_t i = 0; i < wellResults.size(); i++)
|
|
||||||
{
|
|
||||||
RigSingleWellResultsData* singleWellResultData = wellResults.at(i);
|
|
||||||
|
|
||||||
if (m_currentTimeStep < static_cast<int>(singleWellResultData->firstResultTimeStep()))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RigWellResultFrame& wellResultFrame = singleWellResultData->wellResultFrame(m_currentTimeStep);
|
|
||||||
const RigWellResultPoint* wellResultCell = wellResultFrame.findResultCell(gridIndex, cellIndex);
|
|
||||||
if (wellResultCell)
|
|
||||||
{
|
|
||||||
resultInfoText->append(QString("Well-cell connection info: Well Name: %1 Branch Id: %2 Segment Id: %3\n").arg(singleWellResultData->m_wellName).arg(wellResultCell->m_ertBranchId).arg(wellResultCell->m_ertSegmentId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1322,7 +1202,7 @@ void RimReservoirView::updateLegends()
|
|||||||
updateMinMaxValuesAndAddLegendToView(QString("Cell Results: \n"), this->cellResult(), results);
|
updateMinMaxValuesAndAddLegendToView(QString("Cell Results: \n"), this->cellResult(), results);
|
||||||
if (this->faultResultSettings()->showCustomFaultResult() && this->faultResultSettings()->hasValidCustomResult())
|
if (this->faultResultSettings()->showCustomFaultResult() && this->faultResultSettings()->hasValidCustomResult())
|
||||||
{
|
{
|
||||||
updateMinMaxValuesAndAddLegendToView(QString("Fault Results: \n"), this->faultResultSettings()->customFaultResult(), results);
|
updateMinMaxValuesAndAddLegendToView(QString("Fault Results: \n"), this->currentFaultResultSlot(), results);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->cellEdgeResult()->hasResult())
|
if (this->cellEdgeResult()->hasResult())
|
||||||
@ -1797,98 +1677,6 @@ void RimReservoirView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
|
|||||||
cellGroup->add(&showInvalidCells);
|
cellGroup->add(&showInvalidCells);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimReservoirView::appendNNCResultInfo(size_t nncIndex, QString* resultInfo)
|
|
||||||
{
|
|
||||||
CVF_ASSERT(resultInfo);
|
|
||||||
|
|
||||||
if (m_reservoir && m_reservoir->reservoirData())
|
|
||||||
{
|
|
||||||
RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
|
||||||
|
|
||||||
RigMainGrid* grid = eclipseCase->mainGrid();
|
|
||||||
CVF_ASSERT(grid);
|
|
||||||
|
|
||||||
RigNNCData* nncData = grid->nncData();
|
|
||||||
CVF_ASSERT(nncData);
|
|
||||||
|
|
||||||
if (nncData)
|
|
||||||
{
|
|
||||||
const RigConnection& conn = nncData->connections()[nncIndex];
|
|
||||||
cvf::StructGridInterface::FaceEnum face(conn.m_c1Face);
|
|
||||||
|
|
||||||
// Print result value for the NNC
|
|
||||||
size_t scalarResultIdx = this->cellResult()->scalarResultIndex();
|
|
||||||
const std::vector<double>* nncValues = nncData->connectionScalarResult(scalarResultIdx);
|
|
||||||
if (nncValues)
|
|
||||||
{
|
|
||||||
resultInfo->append(QString("NNC Value : %1\n").arg((*nncValues)[nncIndex]));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString faultName;
|
|
||||||
|
|
||||||
{
|
|
||||||
CVF_ASSERT(conn.m_c1GlobIdx < grid->cells().size());
|
|
||||||
const RigCell& cell = grid->cells()[conn.m_c1GlobIdx];
|
|
||||||
|
|
||||||
RigGridBase* hostGrid = cell.hostGrid();
|
|
||||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
|
||||||
|
|
||||||
size_t i, j, k;
|
|
||||||
if (hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k))
|
|
||||||
{
|
|
||||||
// Adjust to 1-based Eclipse indexing
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
k++;
|
|
||||||
|
|
||||||
QString gridName = QString::fromStdString(hostGrid->gridName());
|
|
||||||
resultInfo->append(QString("NNC 1 : cell [%1, %2, %3] face %4 (%5)\n").arg(i).arg(j).arg(k).arg(face.text()).arg(gridName));
|
|
||||||
|
|
||||||
appendTextFromFault(hostGrid, conn.m_c1GlobIdx, conn.m_c1Face, &faultName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
CVF_ASSERT(conn.m_c2GlobIdx < grid->cells().size());
|
|
||||||
const RigCell& cell = grid->cells()[conn.m_c2GlobIdx];
|
|
||||||
|
|
||||||
RigGridBase* hostGrid = cell.hostGrid();
|
|
||||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
|
||||||
|
|
||||||
size_t i, j, k;
|
|
||||||
if (hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k))
|
|
||||||
{
|
|
||||||
// Adjust to 1-based Eclipse indexing
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
k++;
|
|
||||||
|
|
||||||
QString gridName = QString::fromStdString(hostGrid->gridName());
|
|
||||||
cvf::StructGridInterface::FaceEnum oppositeFaceEnum(cvf::StructGridInterface::oppositeFace(face));
|
|
||||||
QString faceText = oppositeFaceEnum.text();
|
|
||||||
|
|
||||||
resultInfo->append(QString("NNC 2 : cell [%1, %2, %3] face %4 (%5)\n").arg(i).arg(j).arg(k).arg(faceText).arg(gridName));
|
|
||||||
|
|
||||||
if (faultName.isEmpty())
|
|
||||||
{
|
|
||||||
appendTextFromFault(hostGrid, conn.m_c2GlobIdx, cvf::StructGridInterface::oppositeFace(conn.m_c1Face), &faultName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resultInfo->append(QString("Face: %2\n").arg(face.text()));
|
|
||||||
|
|
||||||
if (!faultName.isEmpty())
|
|
||||||
{
|
|
||||||
resultInfo->append(faultName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1991,11 +1779,7 @@ void RimReservoirView::updateFaultColors()
|
|||||||
// Update all fault geometry
|
// Update all fault geometry
|
||||||
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> faultGeometriesToRecolor = visibleFaultGeometryTypes();
|
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> faultGeometriesToRecolor = visibleFaultGeometryTypes();
|
||||||
|
|
||||||
RimResultSlot* faultResultSlot = this->cellResult();
|
RimResultSlot* faultResultSlot = currentFaultResultSlot();
|
||||||
if (this->faultResultSettings()->showCustomFaultResult())
|
|
||||||
{
|
|
||||||
faultResultSlot = this->faultResultSettings()->customFaultResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < faultGeometriesToRecolor.size(); ++i)
|
for (size_t i = 0; i < faultGeometriesToRecolor.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -2010,22 +1794,6 @@ void RimReservoirView::updateFaultColors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimReservoirView::appendTextFromFault(RigGridBase* grid, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* textString)
|
|
||||||
{
|
|
||||||
if (grid->isMainGrid())
|
|
||||||
{
|
|
||||||
RigMainGrid* mainGrid = grid->mainGrid();
|
|
||||||
|
|
||||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(cellIndex, face);
|
|
||||||
if (fault)
|
|
||||||
{
|
|
||||||
textString->append(QString("Fault Name: %1\n").arg(fault->name()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -2050,146 +1818,19 @@ bool RimReservoirView::isTimeStepDependentDataVisible() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimReservoirView::appendTextFromResultSlot(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimResultSlot* resultSlot, QString* resultInfoText)
|
RimResultSlot* RimReservoirView::currentFaultResultSlot()
|
||||||
{
|
{
|
||||||
if (!resultSlot)
|
RimResultSlot* faultResultSlot = this->cellResult();
|
||||||
|
|
||||||
|
if (this->faultResultSettings()->showCustomFaultResult())
|
||||||
{
|
{
|
||||||
return;
|
faultResultSlot = this->faultResultSettings()->customFaultResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultSlot->porosityModel());
|
return faultResultSlot;
|
||||||
if (resultSlot->isTernarySaturationSelected())
|
|
||||||
{
|
|
||||||
RimReservoirCellResultsStorage* gridCellResults = resultSlot->currentGridCellResults();
|
|
||||||
if (gridCellResults)
|
|
||||||
{
|
|
||||||
size_t soilScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
|
||||||
size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
|
||||||
size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT");
|
|
||||||
|
|
||||||
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, soilScalarSetIndex);
|
|
||||||
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, sgasScalarSetIndex);
|
|
||||||
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, swatScalarSetIndex);
|
|
||||||
|
|
||||||
double scalarValue = 0.0;
|
|
||||||
|
|
||||||
if (dataAccessObjectX.notNull()) scalarValue = dataAccessObjectX->cellScalar(cellIndex);
|
|
||||||
else scalarValue = 0.0;
|
|
||||||
resultInfoText->append(QString("SOIL : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
if (dataAccessObjectY.notNull()) scalarValue = dataAccessObjectY->cellScalar(cellIndex);
|
|
||||||
else scalarValue = 0.0;
|
|
||||||
resultInfoText->append(QString("SGAS : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
if (dataAccessObjectZ.notNull()) scalarValue = dataAccessObjectZ->cellScalar(cellIndex);
|
|
||||||
else scalarValue = 0.0;
|
|
||||||
resultInfoText->append(QString("SWAT : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (resultSlot->hasResult())
|
|
||||||
{
|
|
||||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultSlot->porosityModel());
|
|
||||||
cvf::ref<RigResultAccessor> resultAccessor;
|
|
||||||
|
|
||||||
if (resultSlot->hasStaticResult())
|
|
||||||
{
|
|
||||||
if (resultSlot->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
cvf::ref<RigResultAccessor> transResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedTransmissibilityResultName());
|
|
||||||
{
|
|
||||||
double scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
|
||||||
resultInfoText->append(QString("Tran X : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
|
||||||
resultInfoText->append(QString("Tran Y : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
|
||||||
resultInfoText->append(QString("Tran Z : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (resultSlot->resultVariable().compare(RimDefines::combinedMultResultName(), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
cvf::ref<RigResultAccessor> multResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedMultResultName());
|
|
||||||
{
|
|
||||||
double scalarValue = 0.0;
|
|
||||||
|
|
||||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
|
||||||
resultInfoText->append(QString("MULTX : %1\n").arg(scalarValue));
|
|
||||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_I);
|
|
||||||
resultInfoText->append(QString("MULTX- : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
|
||||||
resultInfoText->append(QString("MULTY : %1\n").arg(scalarValue));
|
|
||||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_J);
|
|
||||||
resultInfoText->append(QString("MULTY- : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
|
||||||
resultInfoText->append(QString("MULTZ : %1\n").arg(scalarValue));
|
|
||||||
scalarValue = multResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::NEG_K);
|
|
||||||
resultInfoText->append(QString("MULTZ- : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (resultSlot->resultVariable().compare(RimDefines::combinedRiTransResultName(), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
cvf::ref<RigResultAccessor> transResultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiTransResultName());
|
|
||||||
{
|
|
||||||
double scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
|
||||||
resultInfoText->append(QString("riTran X : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
|
||||||
resultInfoText->append(QString("riTran Y : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = transResultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
|
||||||
resultInfoText->append(QString("riTran Z : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (resultSlot->resultVariable().compare(RimDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiMultResultName());
|
|
||||||
{
|
|
||||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
|
||||||
resultInfoText->append(QString("riMult X : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
|
||||||
resultInfoText->append(QString("riMult Y : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
|
||||||
resultInfoText->append(QString("riMult Z : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (resultSlot->resultVariable().compare(RimDefines::combinedRiAreaNormTransResultName(), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, RimDefines::combinedRiAreaNormTransResultName());
|
|
||||||
{
|
|
||||||
double scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_I);
|
|
||||||
resultInfoText->append(QString("riTransByArea X : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_J);
|
|
||||||
resultInfoText->append(QString("riTransByArea Y : %1\n").arg(scalarValue));
|
|
||||||
|
|
||||||
scalarValue = resultAccessor->cellFaceScalar(cellIndex, cvf::StructGridInterface::POS_K);
|
|
||||||
resultInfoText->append(QString("riTransByArea Z : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, 0, resultSlot->scalarResultIndex());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultSlot->scalarResultIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resultAccessor.notNull())
|
|
||||||
{
|
|
||||||
double scalarValue = resultAccessor->cellScalar(cellIndex);
|
|
||||||
resultInfoText->append(resultSlot->resultVariable());
|
|
||||||
resultInfoText->append(QString(" : %1\n").arg(scalarValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ public:
|
|||||||
// Access internal objects
|
// Access internal objects
|
||||||
RimReservoirCellResultsStorage* currentGridCellResults();
|
RimReservoirCellResultsStorage* currentGridCellResults();
|
||||||
RigActiveCellInfo* currentActiveCellInfo();
|
RigActiveCellInfo* currentActiveCellInfo();
|
||||||
|
RimResultSlot* currentFaultResultSlot();
|
||||||
|
|
||||||
|
|
||||||
void setEclipseCase(RimCase* reservoir);
|
void setEclipseCase(RimCase* reservoir);
|
||||||
RimCase* eclipseCase();
|
RimCase* eclipseCase();
|
||||||
@ -157,13 +159,6 @@ public:
|
|||||||
void setShowFaultsOnly(bool showFaults);
|
void setShowFaultsOnly(bool showFaults);
|
||||||
bool isGridVisualizationMode() const;
|
bool isGridVisualizationMode() const;
|
||||||
|
|
||||||
|
|
||||||
// Picking info
|
|
||||||
bool pickInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, const cvf::Vec3d& point, QString itemSeparator, QString* pickInfoText) const;
|
|
||||||
void appendCellResultInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* resultInfoText) ;
|
|
||||||
void appendNNCResultInfo(size_t nncIndex, QString* resultInfo);
|
|
||||||
static void appendTextFromResultSlot(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimResultSlot* resultSlot, QString* resultInfoText);
|
|
||||||
|
|
||||||
// Does this belong here, really ?
|
// Does this belong here, really ?
|
||||||
void calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase * grid);
|
void calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase * grid);
|
||||||
|
|
||||||
@ -185,8 +180,6 @@ public:
|
|||||||
|
|
||||||
// Display model generation
|
// Display model generation
|
||||||
private:
|
private:
|
||||||
void appendTextFromFault(RigGridBase* grid, size_t cellIndex, cvf::StructGridInterface::FaceType face, QString* textString);
|
|
||||||
|
|
||||||
void createDisplayModel();
|
void createDisplayModel();
|
||||||
void updateDisplayModelVisibility();
|
void updateDisplayModelVisibility();
|
||||||
void updateCurrentTimeStep();
|
void updateCurrentTimeStep();
|
||||||
|
@ -44,6 +44,34 @@ RiuResultTextBuilder::RiuResultTextBuilder(RimReservoirView* reservoirView, size
|
|||||||
m_gridIndex = gridIndex;
|
m_gridIndex = gridIndex;
|
||||||
m_cellIndex = cellIndex;
|
m_cellIndex = cellIndex;
|
||||||
m_timeStepIndex = timeStepIndex;
|
m_timeStepIndex = timeStepIndex;
|
||||||
|
|
||||||
|
m_nncIndex = cvf::UNDEFINED_SIZE_T;
|
||||||
|
m_intersectionPoint = cvf::Vec3d::UNDEFINED;
|
||||||
|
m_face = cvf::StructGridInterface::NO_FACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuResultTextBuilder::setNncIndex(size_t nncIndex)
|
||||||
|
{
|
||||||
|
m_nncIndex = nncIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuResultTextBuilder::setIntersectionPoint(cvf::Vec3d intersectionPoint)
|
||||||
|
{
|
||||||
|
m_intersectionPoint = intersectionPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuResultTextBuilder::setFace(cvf::StructGridInterface::FaceType face)
|
||||||
|
{
|
||||||
|
m_face = face;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -53,14 +81,90 @@ QString RiuResultTextBuilder::mainResultText()
|
|||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
|
// Produce result text for all variants
|
||||||
|
// Priority defined as follows : NNC, Fault, Grid
|
||||||
|
{
|
||||||
QString nncText = nncResultText();
|
QString nncText = nncResultText();
|
||||||
|
QString faultText = faultResultText();
|
||||||
|
|
||||||
if (!nncText.isEmpty())
|
if (!nncText.isEmpty())
|
||||||
{
|
{
|
||||||
text = nncText;
|
text = "NNC : " + nncText;
|
||||||
|
}
|
||||||
|
else if (!faultResultText().isEmpty())
|
||||||
|
{
|
||||||
|
text = "Fault : " + faultText;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text = gridResultText();
|
text = "Grid cell : " + gridResultText();
|
||||||
|
}
|
||||||
|
|
||||||
|
text += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString topoText = this->topologyText("\n");
|
||||||
|
text += topoText;
|
||||||
|
text += "\n";
|
||||||
|
|
||||||
|
appendDetails(text, nncDetails());
|
||||||
|
|
||||||
|
if (nncDetails().isEmpty())
|
||||||
|
{
|
||||||
|
appendDetails(text, faultResultDetails());
|
||||||
|
}
|
||||||
|
|
||||||
|
appendDetails(text, cellEdgeResultDetails());
|
||||||
|
|
||||||
|
bool isCustomFaultResultVisible = m_reservoirView->faultResultSettings()->showCustomFaultResult() && m_reservoirView->faultResultSettings()->hasValidCustomResult();
|
||||||
|
if (isCustomFaultResultVisible)
|
||||||
|
{
|
||||||
|
appendDetails(text, gridResultDetails());
|
||||||
|
}
|
||||||
|
|
||||||
|
appendDetails(text, wellResultText());
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RiuResultTextBuilder::topologyText(QString itemSeparator)
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
if (m_reservoirView->eclipseCase())
|
||||||
|
{
|
||||||
|
const RigCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
|
||||||
|
if (eclipseCase)
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
size_t j = 0;
|
||||||
|
size_t k = 0;
|
||||||
|
if (eclipseCase->grid(m_gridIndex)->ijkFromCellIndex(m_cellIndex, &i, &j, &k))
|
||||||
|
{
|
||||||
|
// Adjust to 1-based Eclipse indexing
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
k++;
|
||||||
|
|
||||||
|
cvf::Vec3d domainCoord = m_intersectionPoint + eclipseCase->grid(m_gridIndex)->displayModelOffset();
|
||||||
|
|
||||||
|
cvf::StructGridInterface::FaceEnum faceEnum(m_face);
|
||||||
|
|
||||||
|
QString faceText = faceEnum.text();
|
||||||
|
|
||||||
|
text += QString("Face : %1").arg(faceText) + itemSeparator;
|
||||||
|
text += QString("Hit grid %1").arg(m_gridIndex) + itemSeparator;
|
||||||
|
text += QString("Cell : [%1, %2, %3]").arg(i).arg(j).arg(k) + itemSeparator;
|
||||||
|
|
||||||
|
QString formattedText;
|
||||||
|
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||||
|
|
||||||
|
text += formattedText;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@ -79,6 +183,11 @@ QString RiuResultTextBuilder::gridResultDetails()
|
|||||||
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||||
|
|
||||||
this->appendTextFromResultSlot(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->cellResult(), &text);
|
this->appendTextFromResultSlot(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->cellResult(), &text);
|
||||||
|
|
||||||
|
if (!text.isEmpty())
|
||||||
|
{
|
||||||
|
text.prepend("-- Grid cell result details --\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@ -100,14 +209,16 @@ QString RiuResultTextBuilder::faultResultDetails()
|
|||||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(m_cellIndex, m_face);
|
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(m_cellIndex, m_face);
|
||||||
if (fault)
|
if (fault)
|
||||||
{
|
{
|
||||||
text.append(QString("Fault Name: %1\n").arg(fault->name()));
|
text += "-- Fault result details --\n";
|
||||||
|
|
||||||
|
text += QString("Fault Name: %1\n").arg(fault->name());
|
||||||
|
|
||||||
cvf::StructGridInterface::FaceEnum faceHelper(m_face);
|
cvf::StructGridInterface::FaceEnum faceHelper(m_face);
|
||||||
text.append("Fault Face : " + faceHelper.text() + "\n");
|
text += "Fault Face : " + faceHelper.text() + "\n";
|
||||||
|
|
||||||
if (m_reservoirView->faultResultSettings()->hasValidCustomResult())
|
if (m_reservoirView->faultResultSettings()->hasValidCustomResult())
|
||||||
{
|
{
|
||||||
text.append("Fault result data:\n");
|
text += "Fault result data:\n";
|
||||||
this->appendTextFromResultSlot(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->currentFaultResultSlot(), &text);
|
this->appendTextFromResultSlot(eclipseCaseData, m_gridIndex, m_cellIndex, m_timeStepIndex, m_reservoirView->currentFaultResultSlot(), &text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,16 +227,46 @@ QString RiuResultTextBuilder::faultResultDetails()
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RiuResultTextBuilder::gridResultText()
|
QString RiuResultTextBuilder::gridResultText()
|
||||||
{
|
{
|
||||||
QString text;
|
QString text = cellResultText(m_reservoirView->cellResult());
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RiuResultTextBuilder::faultResultText()
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
||||||
|
{
|
||||||
|
RigCaseData* eclipseCaseData = m_reservoirView->eclipseCase()->reservoirData();
|
||||||
|
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||||
|
RigMainGrid* mainGrid = grid->mainGrid();
|
||||||
|
|
||||||
|
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(m_cellIndex, m_face);
|
||||||
|
if (fault)
|
||||||
|
{
|
||||||
|
cvf::StructGridInterface::FaceEnum faceHelper(m_face);
|
||||||
|
if (m_reservoirView->faultResultSettings()->hasValidCustomResult())
|
||||||
|
{
|
||||||
|
text = cellResultText(m_reservoirView->currentFaultResultSlot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -133,8 +274,40 @@ QString RiuResultTextBuilder::nncResultText()
|
|||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
return text;
|
if (m_nncIndex != cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
if (m_reservoirView.notNull() && m_reservoirView->eclipseCase())
|
||||||
|
{
|
||||||
|
RigCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
|
||||||
|
|
||||||
|
RigMainGrid* grid = eclipseCase->mainGrid();
|
||||||
|
CVF_ASSERT(grid);
|
||||||
|
|
||||||
|
RigNNCData* nncData = grid->nncData();
|
||||||
|
CVF_ASSERT(nncData);
|
||||||
|
|
||||||
|
if (nncData)
|
||||||
|
{
|
||||||
|
const RigConnection& conn = nncData->connections()[m_nncIndex];
|
||||||
|
cvf::StructGridInterface::FaceEnum face(conn.m_c1Face);
|
||||||
|
|
||||||
|
if (m_reservoirView->currentFaultResultSlot())
|
||||||
|
{
|
||||||
|
size_t scalarResultIdx = m_reservoirView->currentFaultResultSlot()->scalarResultIndex();
|
||||||
|
const std::vector<double>* nncValues = nncData->connectionScalarResult(scalarResultIdx);
|
||||||
|
if (nncValues)
|
||||||
|
{
|
||||||
|
QString resultVar = m_reservoirView->currentFaultResultSlot()->resultVariable();
|
||||||
|
double scalarValue = (*nncValues)[m_nncIndex];
|
||||||
|
|
||||||
|
text = QString("%1 : %2").arg(resultVar).arg(scalarValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -274,11 +447,11 @@ void RiuResultTextBuilder::appendTextFromResultSlot(RigCaseData* eclipseCase, si
|
|||||||
if (resultAccessor.notNull())
|
if (resultAccessor.notNull())
|
||||||
{
|
{
|
||||||
double scalarValue = resultAccessor->cellScalar(cellIndex);
|
double scalarValue = resultAccessor->cellScalar(cellIndex);
|
||||||
|
resultInfoText->append("Cell result : ");
|
||||||
resultInfoText->append(resultSlot->resultVariable());
|
resultInfoText->append(resultSlot->resultVariable());
|
||||||
resultInfoText->append(QString(" : %1\n").arg(scalarValue));
|
resultInfoText->append(QString(" : %1\n").arg(scalarValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -288,7 +461,6 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
|
|||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
//if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
|
||||||
if (m_reservoirView->cellEdgeResult()->hasResult())
|
if (m_reservoirView->cellEdgeResult()->hasResult())
|
||||||
{
|
{
|
||||||
size_t resultIndices[6];
|
size_t resultIndices[6];
|
||||||
@ -296,7 +468,7 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
|
|||||||
m_reservoirView->cellEdgeResult()->gridScalarIndices(resultIndices);
|
m_reservoirView->cellEdgeResult()->gridScalarIndices(resultIndices);
|
||||||
m_reservoirView->cellEdgeResult()->gridScalarResultNames(&resultNames);
|
m_reservoirView->cellEdgeResult()->gridScalarResultNames(&resultNames);
|
||||||
|
|
||||||
text.push_back("\nCell edge result data:\n");
|
text += "-- Cell edge result data --\n";
|
||||||
for (int idx = 0; idx < 6; idx++)
|
for (int idx = 0; idx < 6; idx++)
|
||||||
{
|
{
|
||||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||||
@ -314,3 +486,184 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
|
|||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RiuResultTextBuilder::nncDetails()
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
if (m_nncIndex != cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
if (m_reservoirView.notNull() && m_reservoirView->eclipseCase())
|
||||||
|
{
|
||||||
|
RigCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData();
|
||||||
|
|
||||||
|
RigMainGrid* grid = eclipseCase->mainGrid();
|
||||||
|
CVF_ASSERT(grid);
|
||||||
|
|
||||||
|
RigNNCData* nncData = grid->nncData();
|
||||||
|
CVF_ASSERT(nncData);
|
||||||
|
|
||||||
|
if (nncData)
|
||||||
|
{
|
||||||
|
text += "-- NNC details --\n";
|
||||||
|
{
|
||||||
|
const RigConnection& conn = nncData->connections()[m_nncIndex];
|
||||||
|
cvf::StructGridInterface::FaceEnum face(conn.m_c1Face);
|
||||||
|
|
||||||
|
// First cell of NNC
|
||||||
|
{
|
||||||
|
CVF_ASSERT(conn.m_c1GlobIdx < grid->cells().size());
|
||||||
|
const RigCell& cell = grid->cells()[conn.m_c1GlobIdx];
|
||||||
|
|
||||||
|
RigGridBase* hostGrid = cell.hostGrid();
|
||||||
|
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||||
|
|
||||||
|
size_t i, j, k;
|
||||||
|
if (hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k))
|
||||||
|
{
|
||||||
|
// Adjust to 1-based Eclipse indexing
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
k++;
|
||||||
|
|
||||||
|
QString gridName = QString::fromStdString(hostGrid->gridName());
|
||||||
|
text.append(QString("NNC 1 : cell [%1, %2, %3] face %4 (%5)\n").arg(i).arg(j).arg(k).arg(face.text()).arg(gridName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Second cell of NNC
|
||||||
|
{
|
||||||
|
CVF_ASSERT(conn.m_c2GlobIdx < grid->cells().size());
|
||||||
|
const RigCell& cell = grid->cells()[conn.m_c2GlobIdx];
|
||||||
|
|
||||||
|
RigGridBase* hostGrid = cell.hostGrid();
|
||||||
|
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||||
|
|
||||||
|
size_t i, j, k;
|
||||||
|
if (hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k))
|
||||||
|
{
|
||||||
|
// Adjust to 1-based Eclipse indexing
|
||||||
|
i++;
|
||||||
|
j++;
|
||||||
|
k++;
|
||||||
|
|
||||||
|
QString gridName = QString::fromStdString(hostGrid->gridName());
|
||||||
|
cvf::StructGridInterface::FaceEnum oppositeFaceEnum(cvf::StructGridInterface::oppositeFace(face));
|
||||||
|
QString faceText = oppositeFaceEnum.text();
|
||||||
|
|
||||||
|
text.append(QString("NNC 2 : cell [%1, %2, %3] face %4 (%5)\n").arg(i).arg(j).arg(k).arg(faceText).arg(gridName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuResultTextBuilder::appendDetails(QString& text, const QString& details)
|
||||||
|
{
|
||||||
|
if (!details.isEmpty())
|
||||||
|
{
|
||||||
|
text += "\n";
|
||||||
|
text += details;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RiuResultTextBuilder::cellResultText(RimResultSlot* resultSlot)
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
if (m_reservoirView->eclipseCase() && m_reservoirView->eclipseCase()->reservoirData())
|
||||||
|
{
|
||||||
|
RigCaseData* eclipseCaseData = m_reservoirView->eclipseCase()->reservoirData();
|
||||||
|
RigGridBase* grid = eclipseCaseData->grid(m_gridIndex);
|
||||||
|
|
||||||
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultSlot->porosityModel());
|
||||||
|
|
||||||
|
QString resultVar = resultSlot->resultVariable();
|
||||||
|
|
||||||
|
if (resultSlot->isTernarySaturationSelected())
|
||||||
|
{
|
||||||
|
RimReservoirCellResultsStorage* gridCellResults = m_reservoirView->cellResult()->currentGridCellResults();
|
||||||
|
if (gridCellResults)
|
||||||
|
{
|
||||||
|
size_t soilScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL");
|
||||||
|
size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS");
|
||||||
|
size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT");
|
||||||
|
|
||||||
|
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createResultAccessor(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, soilScalarSetIndex);
|
||||||
|
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createResultAccessor(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, sgasScalarSetIndex);
|
||||||
|
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createResultAccessor(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, swatScalarSetIndex);
|
||||||
|
|
||||||
|
double scalarValue = 0.0;
|
||||||
|
|
||||||
|
if (dataAccessObjectX.notNull()) scalarValue = dataAccessObjectX->cellScalar(m_cellIndex);
|
||||||
|
else scalarValue = 0.0;
|
||||||
|
text += QString("SOIL : %1 ").arg(scalarValue);
|
||||||
|
|
||||||
|
if (dataAccessObjectY.notNull()) scalarValue = dataAccessObjectY->cellScalar(m_cellIndex);
|
||||||
|
else scalarValue = 0.0;
|
||||||
|
text += QString("SGAS : %1 ").arg(scalarValue);
|
||||||
|
|
||||||
|
if (dataAccessObjectZ.notNull()) scalarValue = dataAccessObjectZ->cellScalar(m_cellIndex);
|
||||||
|
else scalarValue = 0.0;
|
||||||
|
text += QString("SWAT : %1 ").arg(scalarValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, resultVar);
|
||||||
|
if (resultAccessor.notNull())
|
||||||
|
{
|
||||||
|
double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face);
|
||||||
|
text = QString("%1 : %2").arg(resultVar).arg(scalarValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RiuResultTextBuilder::wellResultText()
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
|
||||||
|
if (m_reservoirView->eclipseCase() &&
|
||||||
|
m_reservoirView->eclipseCase()->reservoirData() )
|
||||||
|
{
|
||||||
|
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoirView->eclipseCase()->reservoirData()->wellResults();
|
||||||
|
for (size_t i = 0; i < wellResults.size(); i++)
|
||||||
|
{
|
||||||
|
RigSingleWellResultsData* singleWellResultData = wellResults.at(i);
|
||||||
|
|
||||||
|
if (m_timeStepIndex < static_cast<int>(singleWellResultData->firstResultTimeStep()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RigWellResultFrame& wellResultFrame = singleWellResultData->wellResultFrame(m_timeStepIndex);
|
||||||
|
const RigWellResultPoint* wellResultCell = wellResultFrame.findResultCell(m_gridIndex, m_cellIndex);
|
||||||
|
if (wellResultCell)
|
||||||
|
{
|
||||||
|
text += QString("-- Well-cell connection info --\n Well Name: %1\n Branch Id: %2\n Segment Id: %3\n").arg(singleWellResultData->m_wellName).arg(wellResultCell->m_ertBranchId).arg(wellResultCell->m_ertSegmentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -40,17 +40,28 @@ class RiuResultTextBuilder
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RiuResultTextBuilder(RimReservoirView* reservoirView, size_t gridIndex, size_t cellIndex, size_t timeStepIndex);
|
RiuResultTextBuilder(RimReservoirView* reservoirView, size_t gridIndex, size_t cellIndex, size_t timeStepIndex);
|
||||||
void setPickInfo(cvf::Part* part, cvf::uint partFaceHit, cvf::Part* nncPart, cvf::uint nncFaceHit, cvf::Vec3d intersectionPoint);
|
void setFace(cvf::StructGridInterface::FaceType face);
|
||||||
|
void setNncIndex(size_t nncIndex);
|
||||||
|
void setIntersectionPoint(cvf::Vec3d intersectionPoint);
|
||||||
|
|
||||||
QString mainResultText();
|
QString mainResultText();
|
||||||
|
|
||||||
|
QString topologyText(QString itemSeparator);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void appendDetails(QString& text, const QString& details);
|
||||||
|
|
||||||
QString gridResultDetails();
|
QString gridResultDetails();
|
||||||
QString faultResultDetails();
|
QString faultResultDetails();
|
||||||
QString cellEdgeResultDetails();
|
QString cellEdgeResultDetails();
|
||||||
|
QString nncDetails();
|
||||||
|
|
||||||
private:
|
|
||||||
QString gridResultText();
|
QString gridResultText();
|
||||||
|
QString faultResultText();
|
||||||
QString nncResultText();
|
QString nncResultText();
|
||||||
|
QString wellResultText();
|
||||||
|
|
||||||
|
QString cellResultText(RimResultSlot* resultSlot);
|
||||||
|
|
||||||
void appendTextFromResultSlot(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimResultSlot* resultSlot, QString* resultInfoText);
|
void appendTextFromResultSlot(RigCaseData* eclipseCase, size_t gridIndex, size_t cellIndex, size_t timeStepIndex, RimResultSlot* resultSlot, QString* resultInfoText);
|
||||||
|
|
||||||
@ -63,11 +74,7 @@ private:
|
|||||||
|
|
||||||
cvf::StructGridInterface::FaceType m_face;
|
cvf::StructGridInterface::FaceType m_face;
|
||||||
|
|
||||||
cvf::Part* m_part;
|
size_t m_nncIndex;
|
||||||
uint m_partFaceIndex;
|
|
||||||
|
|
||||||
cvf::Part* m_nncPart;
|
|
||||||
uint m_nncPartFaceIndex;
|
|
||||||
|
|
||||||
cvf::Vec3d m_intersectionPoint;
|
cvf::Vec3d m_intersectionPoint;
|
||||||
};
|
};
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "cafPdmFieldCvfColor.h"
|
#include "cafPdmFieldCvfColor.h"
|
||||||
#include "cafPdmFieldCvfMat4d.h"
|
#include "cafPdmFieldCvfMat4d.h"
|
||||||
#include "RivSourceInfo.h"
|
#include "RivSourceInfo.h"
|
||||||
|
#include "RiuResultTextBuilder.h"
|
||||||
|
|
||||||
using cvf::ManipulatorTrackball;
|
using cvf::ManipulatorTrackball;
|
||||||
|
|
||||||
@ -215,8 +216,9 @@ void RiuViewer::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
uint faceIndex = cvf::UNDEFINED_UINT;
|
uint faceIndex = cvf::UNDEFINED_UINT;
|
||||||
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
|
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
|
||||||
|
|
||||||
cvf::Part * firstHitPart = NULL;
|
cvf::Part* firstHitPart = NULL;
|
||||||
firstHitPart = pickPointAndFace(winPosX, winPosY, &faceIndex, &localIntersectionPoint);
|
cvf::Part* nncFirstHitPart = NULL;
|
||||||
|
pickPointAndFace(winPosX, winPosY, &localIntersectionPoint, &firstHitPart, &faceIndex, &nncFirstHitPart, NULL);
|
||||||
if (firstHitPart)
|
if (firstHitPart)
|
||||||
{
|
{
|
||||||
if (faceIndex != cvf::UNDEFINED_UINT)
|
if (faceIndex != cvf::UNDEFINED_UINT)
|
||||||
@ -375,7 +377,6 @@ void RiuViewer::keyPressEvent(QKeyEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -386,22 +387,24 @@ void RiuViewer::handlePickAction(int winPosX, int winPosY)
|
|||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||||
if (!mainWnd) return;
|
if (!mainWnd) return;
|
||||||
|
|
||||||
QString pickInfo = "No hits";
|
size_t gridIndex = cvf::UNDEFINED_SIZE_T;
|
||||||
QString resultInfo = "";
|
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
|
||||||
|
size_t nncIndex = cvf::UNDEFINED_SIZE_T;
|
||||||
uint faceIndex = cvf::UNDEFINED_UINT;
|
cvf::StructGridInterface::FaceType face = cvf::StructGridInterface::NO_FACE;
|
||||||
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
|
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
|
||||||
|
|
||||||
cvf::Part * firstHitPart = NULL;
|
{
|
||||||
firstHitPart = pickPointAndFace(winPosX, winPosY, &faceIndex, &localIntersectionPoint);
|
cvf::Part* firstHitPart = NULL;
|
||||||
|
uint firstPartFaceIndex = cvf::UNDEFINED_UINT;
|
||||||
|
|
||||||
|
cvf::Part* firstNncHitPart = NULL;
|
||||||
|
uint nncPartFaceIndex = cvf::UNDEFINED_UINT;
|
||||||
|
|
||||||
|
pickPointAndFace(winPosX, winPosY, &localIntersectionPoint, &firstHitPart, &firstPartFaceIndex, &firstNncHitPart, &nncPartFaceIndex);
|
||||||
|
|
||||||
if (firstHitPart)
|
if (firstHitPart)
|
||||||
{
|
{
|
||||||
// If a drawable geometry was hit, get info about the picked geometry
|
gridIndex = firstHitPart->id();
|
||||||
// and possibly the picked scalar value, if any
|
|
||||||
if (faceIndex != cvf::UNDEFINED_UINT)
|
|
||||||
{
|
|
||||||
size_t gridIndex = firstHitPart->id();
|
|
||||||
|
|
||||||
if (firstHitPart->sourceInfo())
|
if (firstHitPart->sourceInfo())
|
||||||
{
|
{
|
||||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||||
@ -411,41 +414,40 @@ void RiuViewer::handlePickAction(int winPosX, int winPosY)
|
|||||||
{
|
{
|
||||||
CVF_ASSERT(rivSourceInfo->m_cellFaceFromTriangleMapper.notNull());
|
CVF_ASSERT(rivSourceInfo->m_cellFaceFromTriangleMapper.notNull());
|
||||||
|
|
||||||
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
|
cellIndex = rivSourceInfo->m_cellFaceFromTriangleMapper->cellIndex(firstPartFaceIndex);
|
||||||
cellIndex = rivSourceInfo->m_cellFaceFromTriangleMapper->cellIndex(faceIndex);
|
face = rivSourceInfo->m_cellFaceFromTriangleMapper->cellFace(firstPartFaceIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cvf::StructGridInterface::FaceType face = rivSourceInfo->m_cellFaceFromTriangleMapper->cellFace(faceIndex);
|
|
||||||
|
|
||||||
m_reservoirView->pickInfo(gridIndex, cellIndex, face, localIntersectionPoint, ", ", &pickInfo);
|
if (firstNncHitPart && firstNncHitPart->sourceInfo())
|
||||||
|
|
||||||
// Build up result from from both pick info and result values
|
|
||||||
m_reservoirView->pickInfo(gridIndex, cellIndex, face, localIntersectionPoint, "\n", &resultInfo);
|
|
||||||
resultInfo += "\n";
|
|
||||||
m_reservoirView->appendCellResultInfo(gridIndex, cellIndex, face, &resultInfo);
|
|
||||||
#if 0
|
|
||||||
const RigCaseData* reservoir = m_reservoirView->eclipseCase()->reservoirData();
|
|
||||||
const RigGridBase* grid = reservoir->grid(gridIndex);
|
|
||||||
const RigCell& cell = grid->cell(cellIndex);
|
|
||||||
const caf::SizeTArray8& cellNodeIndices = cell.cornerIndices();
|
|
||||||
const std::vector<cvf::Vec3d>& nodes = reservoir->mainGrid()->nodes();
|
|
||||||
for (int i = 0; i < 8; ++i)
|
|
||||||
{
|
{
|
||||||
resultInfo += QString::number(i) + " : ";
|
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstNncHitPart->sourceInfo());
|
||||||
for (int j = 0; j < 3; ++j)
|
if (rivSourceInfo)
|
||||||
resultInfo += QString::number(nodes[cellNodeIndices[i]][j], 'g', 10) + " ";
|
|
||||||
resultInfo += "\n";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (rivSourceInfo->m_NNCIndices.notNull())
|
|
||||||
{
|
{
|
||||||
size_t nncIndex = rivSourceInfo->m_NNCIndices->get(faceIndex);
|
if (nncPartFaceIndex < rivSourceInfo->m_NNCIndices->size())
|
||||||
|
{
|
||||||
|
nncIndex = rivSourceInfo->m_NNCIndices->get(nncPartFaceIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_reservoirView->appendNNCResultInfo(nncIndex, &resultInfo);
|
QString pickInfo = "No hits";
|
||||||
}
|
QString resultInfo = "";
|
||||||
}
|
|
||||||
}
|
if (cellIndex != cvf::UNDEFINED_SIZE_T)
|
||||||
}
|
{
|
||||||
|
RiuResultTextBuilder textBuilder(m_reservoirView, gridIndex, cellIndex, m_reservoirView->currentTimeStep());
|
||||||
|
textBuilder.setFace(face);
|
||||||
|
textBuilder.setNncIndex(nncIndex);
|
||||||
|
textBuilder.setIntersectionPoint(localIntersectionPoint);
|
||||||
|
|
||||||
|
resultInfo = textBuilder.mainResultText();
|
||||||
|
|
||||||
|
pickInfo = textBuilder.topologyText(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWnd->statusBar()->showMessage(pickInfo);
|
mainWnd->statusBar()->showMessage(pickInfo);
|
||||||
@ -516,10 +518,8 @@ void RiuViewer::setEnableMask(unsigned int mask)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
|
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::Part* RiuViewer::pickPointAndFace(int winPosX, int winPosY, uint* faceHit, cvf::Vec3d* localIntersectionPoint)
|
void RiuViewer::pickPointAndFace(int winPosX, int winPosY, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(faceHit);
|
|
||||||
|
|
||||||
cvf::HitItemCollection hitItems;
|
cvf::HitItemCollection hitItems;
|
||||||
bool isSomethingHit = rayPick(winPosX, winPosY, &hitItems);
|
bool isSomethingHit = rayPick(winPosX, winPosY, &hitItems);
|
||||||
|
|
||||||
@ -531,8 +531,8 @@ cvf::Part* RiuViewer::pickPointAndFace(int winPosX, int winPosY, uint* faceHit,
|
|||||||
double pickDepthThresholdSquared = characteristicCellSize / 100.0;
|
double pickDepthThresholdSquared = characteristicCellSize / 100.0;
|
||||||
pickDepthThresholdSquared = pickDepthThresholdSquared * pickDepthThresholdSquared;
|
pickDepthThresholdSquared = pickDepthThresholdSquared * pickDepthThresholdSquared;
|
||||||
|
|
||||||
cvf::HitItem* hitItem = hitItems.firstItem();
|
cvf::HitItem* firstNonNncHitItem = NULL;
|
||||||
cvf::Vec3d firstItemIntersectionPoint = hitItem->intersectionPoint();
|
cvf::Vec3d firstItemIntersectionPoint = hitItems.item(0)->intersectionPoint();
|
||||||
|
|
||||||
// Check if we have a close hit item with NNC data
|
// Check if we have a close hit item with NNC data
|
||||||
for (size_t i = 0; i < hitItems.count(); i++)
|
for (size_t i = 0; i < hitItems.count(); i++)
|
||||||
@ -540,26 +540,47 @@ cvf::Part* RiuViewer::pickPointAndFace(int winPosX, int winPosY, uint* faceHit,
|
|||||||
cvf::HitItem* hitItemCandidate = hitItems.item(i);
|
cvf::HitItem* hitItemCandidate = hitItems.item(i);
|
||||||
cvf::Vec3d diff = firstItemIntersectionPoint - hitItemCandidate->intersectionPoint();
|
cvf::Vec3d diff = firstItemIntersectionPoint - hitItemCandidate->intersectionPoint();
|
||||||
|
|
||||||
// Hit items are ordered by distance from eye
|
|
||||||
if (diff.lengthSquared() > pickDepthThresholdSquared) break;
|
|
||||||
|
|
||||||
const cvf::Part* pickedPartCandidate = hitItemCandidate->part();
|
const cvf::Part* pickedPartCandidate = hitItemCandidate->part();
|
||||||
|
bool isNncpart = false;
|
||||||
if (pickedPartCandidate && pickedPartCandidate->sourceInfo())
|
if (pickedPartCandidate && pickedPartCandidate->sourceInfo())
|
||||||
|
{
|
||||||
|
// Hit items are ordered by distance from eye
|
||||||
|
if (diff.lengthSquared() < pickDepthThresholdSquared)
|
||||||
{
|
{
|
||||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(pickedPartCandidate->sourceInfo());
|
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(pickedPartCandidate->sourceInfo());
|
||||||
if (rivSourceInfo && rivSourceInfo->hasNNCIndices())
|
if (rivSourceInfo && rivSourceInfo->hasNNCIndices())
|
||||||
{
|
{
|
||||||
hitItem = hitItemCandidate;
|
*nncPart = const_cast<cvf::Part*>(pickedPartCandidate);
|
||||||
|
|
||||||
|
const cvf::HitDetailDrawableGeo* detail = dynamic_cast<const cvf::HitDetailDrawableGeo*>(hitItemCandidate->detail());
|
||||||
|
if (detail && nncPartFaceHit)
|
||||||
|
{
|
||||||
|
*nncPartFaceHit = detail->faceIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
isNncpart = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isNncpart && !firstNonNncHitItem)
|
||||||
|
{
|
||||||
|
firstNonNncHitItem = hitItemCandidate;
|
||||||
|
firstItemIntersectionPoint = firstNonNncHitItem->intersectionPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstNonNncHitItem && *nncPart)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const cvf::Part* pickedPart = hitItem->part();
|
const cvf::Part* pickedPart = firstNonNncHitItem->part();
|
||||||
CVF_ASSERT(pickedPart);
|
CVF_ASSERT(pickedPart);
|
||||||
|
*firstPart = const_cast<cvf::Part*>(pickedPart);
|
||||||
|
|
||||||
const cvf::Transform* xf = pickedPart->transform();
|
const cvf::Transform* xf = pickedPart->transform();
|
||||||
cvf::Vec3d globalPickedPoint = hitItem->intersectionPoint();
|
cvf::Vec3d globalPickedPoint = firstNonNncHitItem->intersectionPoint();
|
||||||
|
|
||||||
if(localIntersectionPoint)
|
if(localIntersectionPoint)
|
||||||
{
|
{
|
||||||
@ -573,21 +594,14 @@ cvf::Part* RiuViewer::pickPointAndFace(int winPosX, int winPosY, uint* faceHit,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faceHit)
|
if (firstPartFaceHit)
|
||||||
{
|
{
|
||||||
|
const cvf::HitDetailDrawableGeo* detail = dynamic_cast<const cvf::HitDetailDrawableGeo*>(firstNonNncHitItem->detail());
|
||||||
const cvf::HitDetailDrawableGeo* detail = dynamic_cast<const cvf::HitDetailDrawableGeo*>(hitItem->detail());
|
|
||||||
if (detail)
|
if (detail)
|
||||||
{
|
{
|
||||||
*faceHit = detail->faceIndex();
|
*firstPartFaceHit = detail->faceIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return const_cast<cvf::Part*>(pickedPart); // Hack. The const'ness of HitItem will probably change to non-const
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ protected:
|
|||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
|
|
||||||
void handlePickAction(int winPosX, int winPosY);
|
void handlePickAction(int winPosX, int winPosY);
|
||||||
cvf::Part* pickPointAndFace(int winPosX, int winPosY, uint* faceHit, cvf::Vec3d* localIntersectionPoint);
|
void pickPointAndFace(int winPosX, int winPosY, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotRangeFilterI();
|
void slotRangeFilterI();
|
||||||
|
Loading…
Reference in New Issue
Block a user