mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-13 17:05:59 -06:00
#2436 Intersection Fault lines are now separated and have a separate color
This commit is contained in:
parent
3b724e07bd
commit
97c2ebd955
@ -89,6 +89,15 @@ void RivEclipseIntersectionGrid::cellCornerIndices(size_t cellIndex, size_t corn
|
||||
memcpy(cornerIndices, cornerIndicesSource.data(), 8);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFault* RivEclipseIntersectionGrid::findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex,
|
||||
cvf::StructGridInterface::FaceType face) const
|
||||
{
|
||||
return m_mainGrid->findFaultFromCellIndexAndCellFace(reservoirCellIndex, face);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -172,3 +181,12 @@ void RivFemIntersectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIn
|
||||
cornerIndices[7] = m_femPart->elementNodeResultIdx(elmIdx, 7);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFault* RivFemIntersectionGrid::findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex,
|
||||
cvf::StructGridInterface::FaceType face) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,12 @@
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#include <vector>
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
class RigActiveCellInfo;
|
||||
class RigFemPart;
|
||||
class RigMainGrid;
|
||||
|
||||
class RigFault;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Interface definition used to compute the geometry for planes intersecting a grid
|
||||
@ -42,6 +43,8 @@ public:
|
||||
virtual bool useCell(size_t cellIndex) const = 0;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const = 0;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const = 0;
|
||||
virtual const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex,
|
||||
cvf::StructGridInterface::FaceType face) const = 0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -58,6 +61,8 @@ public:
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
virtual const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex,
|
||||
cvf::StructGridInterface::FaceType face) const override;
|
||||
|
||||
private:
|
||||
cvf::cref<RigMainGrid> m_mainGrid;
|
||||
@ -79,6 +84,8 @@ public:
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
virtual const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex,
|
||||
cvf::StructGridInterface::FaceType face) const override;
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPart> m_femPart;
|
||||
|
@ -71,6 +71,8 @@ RivIntersectionGeometryGenerator::RivIntersectionGeometryGenerator( RimIntersect
|
||||
{
|
||||
m_triangleVxes = new cvf::Vec3fArray;
|
||||
m_cellBorderLineVxes = new cvf::Vec3fArray;
|
||||
m_faultCellBorderLineVxes = new cvf::Vec3fArray;
|
||||
|
||||
if (m_isFlattened) m_extrusionDirection = -cvf::Vec3d::Z_AXIS;
|
||||
}
|
||||
|
||||
@ -152,6 +154,7 @@ void RivIntersectionGeometryGenerator::calculateArrays()
|
||||
m_extrusionDirection.normalize();
|
||||
std::vector<cvf::Vec3f> triangleVertices;
|
||||
std::vector<cvf::Vec3f> cellBorderLineVxes;
|
||||
std::vector<cvf::Vec3f> faultCellBorderLineVxes;
|
||||
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
|
||||
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
|
||||
|
||||
@ -315,21 +318,46 @@ void RivIntersectionGeometryGenerator::calculateArrays()
|
||||
|
||||
// Accumulate mesh lines
|
||||
#define isFace( faceEnum ) (0 <= faceEnum && faceEnum <= 5 )
|
||||
using FaceType = cvf::StructGridInterface::FaceType;
|
||||
|
||||
if ( isFace( cellFaceForEachClippedTriangleEdge[triVxIdx]) )
|
||||
if ( isFace(cellFaceForEachClippedTriangleEdge[triVxIdx]) )
|
||||
{
|
||||
cellBorderLineVxes.emplace_back(p0);
|
||||
cellBorderLineVxes.emplace_back(p1);
|
||||
if ( m_hexGrid->findFaultFromCellIndexAndCellFace(globalCellIdx, (FaceType)cellFaceForEachClippedTriangleEdge[triVxIdx]) )
|
||||
{
|
||||
faultCellBorderLineVxes.emplace_back(p0);
|
||||
faultCellBorderLineVxes.emplace_back(p1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellBorderLineVxes.emplace_back(p0);
|
||||
cellBorderLineVxes.emplace_back(p1);
|
||||
}
|
||||
}
|
||||
if ( isFace( cellFaceForEachClippedTriangleEdge[triVxIdx+1]) )
|
||||
if ( isFace(cellFaceForEachClippedTriangleEdge[triVxIdx+1]) )
|
||||
{
|
||||
cellBorderLineVxes.emplace_back(p1);
|
||||
cellBorderLineVxes.emplace_back(p2);
|
||||
if ( m_hexGrid->findFaultFromCellIndexAndCellFace(globalCellIdx, (FaceType)cellFaceForEachClippedTriangleEdge[triVxIdx+1]) )
|
||||
{
|
||||
faultCellBorderLineVxes.emplace_back(p1);
|
||||
faultCellBorderLineVxes.emplace_back(p2);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellBorderLineVxes.emplace_back(p1);
|
||||
cellBorderLineVxes.emplace_back(p2);
|
||||
}
|
||||
}
|
||||
if ( isFace( cellFaceForEachClippedTriangleEdge[triVxIdx+2]) )
|
||||
if ( isFace(cellFaceForEachClippedTriangleEdge[triVxIdx+2]) )
|
||||
{
|
||||
cellBorderLineVxes.emplace_back(p2);
|
||||
cellBorderLineVxes.emplace_back(p0);
|
||||
if ( m_hexGrid->findFaultFromCellIndexAndCellFace(globalCellIdx, (FaceType)cellFaceForEachClippedTriangleEdge[triVxIdx+2]) )
|
||||
{
|
||||
faultCellBorderLineVxes.emplace_back(p2);
|
||||
faultCellBorderLineVxes.emplace_back(p0);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellBorderLineVxes.emplace_back(p2);
|
||||
cellBorderLineVxes.emplace_back(p0);
|
||||
}
|
||||
}
|
||||
|
||||
// Mapping to cell index
|
||||
@ -352,9 +380,8 @@ void RivIntersectionGeometryGenerator::calculateArrays()
|
||||
|
||||
m_triVxToCellCornerWeights.push_back(
|
||||
RivIntersectionVertexWeights(cvx1.clippedEdgeVx1Id, cvx1.clippedEdgeVx2Id, cvx1.normDistFromEdgeVx1,
|
||||
cvx2.clippedEdgeVx1Id, cvx2.clippedEdgeVx2Id, cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1));
|
||||
|
||||
cvx2.clippedEdgeVx1Id, cvx2.clippedEdgeVx2Id, cvx2.normDistFromEdgeVx1,
|
||||
cvx.normDistFromEdgeVx1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,6 +391,7 @@ void RivIntersectionGeometryGenerator::calculateArrays()
|
||||
}
|
||||
m_triangleVxes->assign(triangleVertices);
|
||||
m_cellBorderLineVxes->assign(cellBorderLineVxes);
|
||||
m_faultCellBorderLineVxes->assign(faultCellBorderLineVxes);
|
||||
}
|
||||
|
||||
|
||||
@ -405,6 +433,24 @@ cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createMeshDrawable(
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionGeometryGenerator::createFaultMeshDrawable()
|
||||
{
|
||||
if (!(m_faultCellBorderLineVxes.notNull() && m_faultCellBorderLineVxes->size() != 0)) return nullptr;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray(m_faultCellBorderLineVxes.p());
|
||||
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> prim = new cvf::PrimitiveSetDirect(cvf::PT_LINES);
|
||||
prim->setIndexCount(m_faultCellBorderLineVxes->size());
|
||||
|
||||
geo->addPrimitiveSet(prim.p());
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
// Generate geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createFaultMeshDrawable();
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongPolylineDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> createLineAlongExtrusionLineDrawable(const std::vector<cvf::Vec3d>& extrusionLine);
|
||||
cvf::ref<cvf::DrawableGeo> createPointsFromPolylineDrawable();
|
||||
@ -98,6 +100,7 @@ private:
|
||||
// Output arrays
|
||||
cvf::ref<cvf::Vec3fArray> m_triangleVxes;
|
||||
cvf::ref<cvf::Vec3fArray> m_cellBorderLineVxes;
|
||||
cvf::ref<cvf::Vec3fArray> m_faultCellBorderLineVxes;
|
||||
std::vector<size_t> m_triangleToCellIdxMap;
|
||||
std::vector<RivIntersectionVertexWeights> m_triVxToCellCornerWeights;
|
||||
std::vector<std::vector<cvf::Vec3d> > m_flattenedOrOffsettedPolyLines;
|
||||
|
@ -70,6 +70,8 @@
|
||||
#include "cvfTransform.h"
|
||||
|
||||
#include <functional>
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -116,16 +118,25 @@ void RivIntersectionPartMgr::applySingleColorEffect()
|
||||
}
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
//RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(cvf::Color3::WHITE);//prefs->defaultCrossSectionGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
||||
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(prefs->defaultGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
|
||||
m_crossSectionGridLines->setEffect(eff.p());
|
||||
}
|
||||
|
||||
if (m_crossSectionFaultGridLines.notNull())
|
||||
{
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(prefs->defaultFaultGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
|
||||
m_crossSectionFaultGridLines->setEffect(eff.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -546,6 +557,27 @@ void RivIntersectionPartMgr::generatePartGeometry()
|
||||
}
|
||||
}
|
||||
|
||||
// Mesh geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geoMesh = m_crossSectionGenerator->createFaultMeshDrawable();
|
||||
if (geoMesh.notNull())
|
||||
{
|
||||
if (useBufferObjects)
|
||||
{
|
||||
geoMesh->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("Cross Section faultmesh");
|
||||
part->setDrawable(geoMesh.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(RivPartPriority::PartType::FaultMeshLines);
|
||||
|
||||
m_crossSectionFaultGridLines = part;
|
||||
}
|
||||
}
|
||||
createPolyLineParts(useBufferObjects);
|
||||
|
||||
createExtrusionDirParts(useBufferObjects);
|
||||
@ -796,6 +828,12 @@ void RivIntersectionPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* mod
|
||||
m_crossSectionGridLines->setTransform(scaleTransform);
|
||||
model->addPart(m_crossSectionGridLines.p());
|
||||
}
|
||||
|
||||
if (m_crossSectionFaultGridLines.notNull())
|
||||
{
|
||||
m_crossSectionFaultGridLines->setTransform(scaleTransform);
|
||||
model->addPart(m_crossSectionFaultGridLines.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,6 +121,8 @@ private:
|
||||
cvf::ref<RivIntersectionGeometryGenerator> m_crossSectionGenerator;
|
||||
cvf::ref<cvf::Part> m_crossSectionFaces;
|
||||
cvf::ref<cvf::Part> m_crossSectionGridLines;
|
||||
cvf::ref<cvf::Part> m_crossSectionFaultGridLines;
|
||||
|
||||
cvf::ref<cvf::Vec2fArray> m_crossSectionFacesTextureCoords;
|
||||
|
||||
cvf::ref<cvf::Part> m_highlightLineAlongPolyline;
|
||||
|
@ -474,7 +474,7 @@ bool RigMainGrid::isFaceNormalsOutwards() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFault* RigMainGrid::findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const
|
||||
{
|
||||
CVF_ASSERT(m_faultsPrCellAcc.notNull());
|
||||
CVF_TIGHT_ASSERT(m_faultsPrCellAcc.notNull());
|
||||
|
||||
if (face == cvf::StructGridInterface::NO_FACE) return nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user