mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Pick info and result info: Added face type
This commit is contained in:
parent
be81dbf711
commit
49a43a036e
@ -245,6 +245,22 @@ cvf::ref<cvf::Array<size_t> > RivFaultGeometryGenerator::triangleToSourceGridCel
|
||||
return triangles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Array<cvf::StructGridInterface::FaceType> > RivFaultGeometryGenerator::triangleToFaceType() const
|
||||
{
|
||||
cvf::ref<cvf::Array<cvf::StructGridInterface::FaceType> > triangles = new cvf::Array<cvf::StructGridInterface::FaceType>(2*m_quadsToFace.size());
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < static_cast<int>(m_quadsToFace.size()); i++)
|
||||
{
|
||||
triangles->set(i*2, m_quadsToFace[i]);
|
||||
triangles->set(i*2+1, m_quadsToFace[i]);
|
||||
}
|
||||
|
||||
return triangles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -52,10 +52,11 @@ public:
|
||||
const cvf::ScalarMapper* mapper) const;
|
||||
|
||||
// Mapping between cells and geometry
|
||||
cvf::ref<cvf::Array<size_t> > triangleToSourceGridCellMap() const;
|
||||
cvf::ref<cvf::Array<size_t> > triangleToSourceGridCellMap() const;
|
||||
cvf::ref<cvf::Array<cvf::StructGridInterface::FaceType> > triangleToFaceType() const;
|
||||
|
||||
const std::vector<size_t>& quadToGridCellIndices() const;
|
||||
const std::vector<cvf::StructGridInterface::FaceType>& quadToFace() const;
|
||||
const std::vector<size_t>& quadToGridCellIndices() const;
|
||||
const std::vector<cvf::StructGridInterface::FaceType>& quadToFace() const;
|
||||
|
||||
// Generated geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
@ -82,4 +83,5 @@ private:
|
||||
std::vector<size_t> m_triangleIndexToGridCellIndex;
|
||||
std::vector<size_t> m_quadsToGridCells;
|
||||
std::vector<cvf::StructGridInterface::FaceType> m_quadsToFace;
|
||||
std::vector<cvf::StructGridInterface::FaceType> m_triangleToFace;
|
||||
};
|
||||
|
@ -252,6 +252,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
|
||||
si->m_cellIndices = m_nativeFaultGenerator->triangleToSourceGridCellMap().p();
|
||||
si->m_faceTypes = m_nativeFaultGenerator->triangleToFaceType().p();
|
||||
part->setSourceInfo(si.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
@ -305,6 +306,7 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
|
||||
si->m_cellIndices = m_oppositeFaultGenerator->triangleToSourceGridCellMap().p();
|
||||
si->m_faceTypes = m_oppositeFaultGenerator->triangleToFaceType().p();
|
||||
part->setSourceInfo(si.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
|
@ -117,6 +117,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivSourceInfo> si = new RivSourceInfo;
|
||||
si->m_cellIndices = geoBuilder.triangleToSourceGridCellMap().p();
|
||||
si->m_faceTypes = geoBuilder.triangleToFaceTypes().p();
|
||||
part->setSourceInfo(si.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
class RivSourceInfo : public cvf::Object
|
||||
{
|
||||
@ -29,6 +30,8 @@ public:
|
||||
bool hasNNCIndices() const;
|
||||
|
||||
public:
|
||||
cvf::ref<cvf::Array<size_t> > m_cellIndices;
|
||||
cvf::ref<cvf::Array<size_t> > m_NNCIndices;
|
||||
cvf::ref<cvf::Array<size_t> > m_cellIndices;
|
||||
cvf::ref<cvf::Array<cvf::StructGridInterface::FaceType> > m_faceTypes;
|
||||
|
||||
cvf::ref<cvf::Array<size_t> > m_NNCIndices;
|
||||
};
|
||||
|
@ -1077,7 +1077,7 @@ RiuViewer* RimReservoirView::viewer()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get pick info text for given part ID, face index, and intersection point
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimReservoirView::pickInfo(size_t gridIndex, size_t cellIndex, const cvf::Vec3d& point, QString* pickInfoText) const
|
||||
bool RimReservoirView::pickInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, const cvf::Vec3d& point, QString* pickInfoText) const
|
||||
{
|
||||
CVF_ASSERT(pickInfoText);
|
||||
|
||||
@ -1098,7 +1098,16 @@ bool RimReservoirView::pickInfo(size_t gridIndex, size_t cellIndex, const cvf::V
|
||||
|
||||
cvf::Vec3d domainCoord = point + eclipseCase->grid(gridIndex)->displayModelOffset();
|
||||
|
||||
pickInfoText->sprintf("Hit grid %u, cell [%u, %u, %u], intersection point: [E: %.2f, N: %.2f, Depth: %.2f]", static_cast<unsigned int>(gridIndex), static_cast<unsigned int>(i), static_cast<unsigned int>(j), static_cast<unsigned int>(k), domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||
cvf::StructGridInterface::FaceEnum faceEnum(face);
|
||||
|
||||
QString faceText = faceEnum.text();
|
||||
|
||||
*pickInfoText = QString("Hit grid %1, cell [%2, %3, %4] face %5, ").arg(gridIndex).arg(i).arg(j).arg(k).arg(faceText);
|
||||
|
||||
QString formattedText;
|
||||
formattedText.sprintf("intersection point: [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
||||
|
||||
*pickInfoText += formattedText;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
|
||||
|
||||
// Picking info
|
||||
bool pickInfo(size_t gridIndex, size_t cellIndex, const cvf::Vec3d& point, QString* pickInfoText) const;
|
||||
bool pickInfo(size_t gridIndex, size_t cellIndex, cvf::StructGridInterface::FaceType face, const cvf::Vec3d& point, QString* pickInfoText) const;
|
||||
void appendCellResultInfo(size_t gridIndex, size_t cellIndex, QString* resultInfoText) ;
|
||||
void appendNNCResultInfo(size_t nncIndex, QString* resultInfo);
|
||||
|
||||
|
@ -431,7 +431,6 @@ void RiuViewer::handlePickAction(int winPosX, int winPosY)
|
||||
{
|
||||
size_t gridIndex = firstHitPart->id();
|
||||
|
||||
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
if (firstHitPart->sourceInfo())
|
||||
{
|
||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||
@ -439,9 +438,17 @@ void RiuViewer::handlePickAction(int winPosX, int winPosY)
|
||||
{
|
||||
if (rivSourceInfo->hasCellIndices())
|
||||
{
|
||||
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
cellIndex = rivSourceInfo->m_cellIndices->get(faceIndex);
|
||||
|
||||
m_reservoirView->pickInfo(gridIndex, cellIndex, localIntersectionPoint, &pickInfo);
|
||||
CVF_ASSERT(rivSourceInfo->m_faceTypes.notNull());
|
||||
cvf::StructGridInterface::FaceType face = rivSourceInfo->m_faceTypes->get(faceIndex);
|
||||
|
||||
m_reservoirView->pickInfo(gridIndex, cellIndex, face, localIntersectionPoint, &pickInfo);
|
||||
|
||||
// Build up result from from both pick info and result values
|
||||
m_reservoirView->pickInfo(gridIndex, cellIndex, face, localIntersectionPoint, &resultInfo);
|
||||
resultInfo += "\n";
|
||||
m_reservoirView->appendCellResultInfo(gridIndex, cellIndex, &resultInfo);
|
||||
#if 0
|
||||
const RigCaseData* reservoir = m_reservoirView->eclipseCase()->reservoirData();
|
||||
|
@ -427,6 +427,21 @@ ref<cvf::Array<size_t> > StructGridGeometryGenerator::triangleToSourceGridCellMa
|
||||
return triangles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Array<cvf::StructGridInterface::FaceType> > StructGridGeometryGenerator::triangleToFaceTypes() const
|
||||
{
|
||||
ref<Array<cvf::StructGridInterface::FaceType> > triangles = new Array<cvf::StructGridInterface::FaceType>(2*m_quadsToFace.size());
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < static_cast<int>(m_quadsToFace.size()); i++)
|
||||
{
|
||||
triangles->set(i*2, m_quadsToFace[i]);
|
||||
triangles->set(i*2+1, m_quadsToFace[i]);
|
||||
}
|
||||
|
||||
return triangles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -147,6 +147,9 @@ public:
|
||||
// Mapping between cells and geometry
|
||||
ref<cvf::Array<size_t> >
|
||||
triangleToSourceGridCellMap() const;
|
||||
|
||||
cvf::ref<cvf::Array<cvf::StructGridInterface::FaceType> >
|
||||
triangleToFaceTypes() const;
|
||||
|
||||
const std::vector<size_t>&
|
||||
quadToGridCellIndices() const;
|
||||
|
Loading…
Reference in New Issue
Block a user