mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#166) WIP: Starting to get geomech cross sections in place
This commit is contained in:
parent
fbfd6fd212
commit
f8fa6787e9
@ -218,8 +218,6 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCe
|
||||
{
|
||||
CVF_ASSERT(cellResultColors);
|
||||
|
||||
// RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
|
||||
|
||||
cvf::ref<cvf::Color3ubArray> surfaceFacesColorArray;
|
||||
|
||||
// Outer surface
|
||||
@ -295,7 +293,12 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCe
|
||||
cellResultColors->firstAnchestorOrThisOfType(view);
|
||||
CVF_ASSERT(view);
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(), m_surfaceFacesTextureCoords.p(), mapper, m_opacityLevel, caf::FC_NONE, view->isLightingDisabled());
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(),
|
||||
m_surfaceFacesTextureCoords.p(),
|
||||
mapper,
|
||||
m_opacityLevel,
|
||||
caf::FC_NONE,
|
||||
view->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1247,3 +1247,91 @@ void RivEclipseCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t corn
|
||||
const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->cells()[cellIndex].cornerIndices();
|
||||
memcpy(cornerIndices, cornerIndicesSource.data(), 8);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#include "RigFemPart.h"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFemCrossSectionGrid::RivFemCrossSectionGrid(const RigFemPart * femPart): m_femPart(femPart)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivFemCrossSectionGrid::displayOffset() const
|
||||
{
|
||||
return cvf::Vec3d::ZERO;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivFemCrossSectionGrid::boundingBox() const
|
||||
{
|
||||
return m_femPart->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemCrossSectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_femPart->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivFemCrossSectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemCrossSectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return ;
|
||||
|
||||
const std::vector<cvf::Vec3f>& nodeCoords = m_femPart->nodes().coordinates;
|
||||
const int* cornerIndices = m_femPart->connectivities(cellIndex);
|
||||
|
||||
cellCorners[0] = cvf::Vec3d(nodeCoords[cornerIndices[0]]);
|
||||
cellCorners[1] = cvf::Vec3d(nodeCoords[cornerIndices[1]]);
|
||||
cellCorners[2] = cvf::Vec3d(nodeCoords[cornerIndices[2]]);
|
||||
cellCorners[3] = cvf::Vec3d(nodeCoords[cornerIndices[3]]);
|
||||
cellCorners[4] = cvf::Vec3d(nodeCoords[cornerIndices[4]]);
|
||||
cellCorners[5] = cvf::Vec3d(nodeCoords[cornerIndices[5]]);
|
||||
cellCorners[6] = cvf::Vec3d(nodeCoords[cornerIndices[6]]);
|
||||
cellCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFemCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
RigElementType elmType = m_femPart->elementType(cellIndex);
|
||||
if (!(elmType == HEX8 || elmType == HEX8P)) return ;
|
||||
int elmIdx = static_cast<int>(cellIndex);
|
||||
cornerIndices[0] = m_femPart->elementNodeResultIdx(elmIdx, 0);
|
||||
cornerIndices[1] = m_femPart->elementNodeResultIdx(elmIdx, 1);
|
||||
cornerIndices[2] = m_femPart->elementNodeResultIdx(elmIdx, 2);
|
||||
cornerIndices[3] = m_femPart->elementNodeResultIdx(elmIdx, 3);
|
||||
cornerIndices[4] = m_femPart->elementNodeResultIdx(elmIdx, 4);
|
||||
cornerIndices[5] = m_femPart->elementNodeResultIdx(elmIdx, 5);
|
||||
cornerIndices[6] = m_femPart->elementNodeResultIdx(elmIdx, 6);
|
||||
cornerIndices[7] = m_femPart->elementNodeResultIdx(elmIdx, 7);
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,24 @@ private:
|
||||
cvf::cref<RigMainGrid> m_mainGrid;
|
||||
};
|
||||
|
||||
class RigFemPart;
|
||||
|
||||
class RivFemCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivFemCrossSectionGrid(const RigFemPart * femPart);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
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;
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPart> m_femPart;
|
||||
};
|
||||
|
||||
class RivVertexWeights
|
||||
{
|
||||
public:
|
||||
|
@ -38,6 +38,12 @@
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RigGeomechCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -49,7 +55,7 @@ RivCrossSectionPartMgr::RivCrossSectionPartMgr(const RimCrossSection* rimCrossSe
|
||||
{
|
||||
CVF_ASSERT(m_rimCrossSection);
|
||||
|
||||
m_nativeCrossSectionFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_crossSectionFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
computeData();
|
||||
}
|
||||
@ -59,7 +65,7 @@ RivCrossSectionPartMgr::RivCrossSectionPartMgr(const RimCrossSection* rimCrossSe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::applySingleColorEffect()
|
||||
{
|
||||
if (m_nativeCrossSectionGenerator.isNull()) return;
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
m_defaultColor = cvf::Color3f::OLIVE;//m_rimCrossSection->CrossSectionColor();
|
||||
this->updatePartEffect();
|
||||
@ -68,65 +74,140 @@ void RivCrossSectionPartMgr::applySingleColorEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
|
||||
void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if (m_nativeCrossSectionGenerator.isNull()) return;
|
||||
|
||||
CVF_ASSERT(cellResultColors);
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
RimEclipseView* eclipseView = cellResultColors->reservoirView();
|
||||
RigCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
|
||||
|
||||
// CrossSections
|
||||
if (m_nativeCrossSectionFaces.notNull())
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(eclipseView);
|
||||
if (eclipseView)
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
|
||||
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
CVF_ASSERT(cellResultColors);
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
RigCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
|
||||
|
||||
// CrossSections
|
||||
if (m_crossSectionFaces.notNull())
|
||||
{
|
||||
//RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
// timeStepIndex,
|
||||
// m_grid->gridIndex(),
|
||||
// m_nativeCrossSectionGenerator->quadToCellFaceMapper());
|
||||
//
|
||||
//texturer.createTextureCoords(m_nativeCrossSectionFacesTextureCoords.p());
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
//RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(),
|
||||
// timeStepIndex,
|
||||
// m_grid->gridIndex(),
|
||||
// m_nativeCrossSectionGenerator->quadToCellFaceMapper());
|
||||
//
|
||||
//texturer.createTextureCoords(m_nativeCrossSectionFacesTextureCoords.p());
|
||||
|
||||
CVF_ASSERT(false); // Todo
|
||||
CVF_ASSERT(false); // Todo
|
||||
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_nativeCrossSectionFaces.p(),
|
||||
m_nativeCrossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(m_nativeCrossSectionGenerator.notNull());
|
||||
const RivTernaryScalarMapper* mapper = cellResultColors->ternaryLegendConfig()->scalarMapper();
|
||||
RivScalarMapperUtils::applyTernaryTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionGenerator.notNull());
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
|
||||
0,
|
||||
RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()),
|
||||
timeStepIndex,
|
||||
cellResultColors->resultVariable());
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
|
||||
0,
|
||||
RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()),
|
||||
timeStepIndex,
|
||||
cellResultColors->resultVariable());
|
||||
|
||||
calculateEclipseTextureCoordinates(m_nativeCrossSectionFacesTextureCoords.p(),
|
||||
m_nativeCrossSectionGenerator->triangleToCellIndex(),
|
||||
resultAccessor.p(),
|
||||
mapper);
|
||||
calculateEclipseTextureCoordinates(m_crossSectionFacesTextureCoords.p(),
|
||||
m_crossSectionGenerator->triangleToCellIndex(),
|
||||
resultAccessor.p(),
|
||||
mapper);
|
||||
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_nativeCrossSectionFaces.p(),
|
||||
m_nativeCrossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
eclipseView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(geoView);
|
||||
|
||||
if (geoView)
|
||||
{
|
||||
RimGeoMechCellColors* cellResultColors = geoView->cellResult();
|
||||
RigGeoMechCaseData* caseData = cellResultColors->ownerCaseData();
|
||||
|
||||
if (!caseData) return;
|
||||
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
RigFemResultAddress resVarAddress = cellResultColors->resultAddress();
|
||||
|
||||
// Do a "Hack" to show elm nodal and not nodal POR results
|
||||
if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
|
||||
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, 0, (int)timeStepIndex);
|
||||
|
||||
const std::vector<RivVertexWeights> &vertexWeights = m_crossSectionGenerator->triangleVxToCellCornerInterpolationWeights();
|
||||
|
||||
bool isNodalResult = false;
|
||||
RigFemPart* femPart = NULL;
|
||||
if (resVarAddress.resultPosType == RIG_NODAL)
|
||||
{
|
||||
isNodalResult = true;
|
||||
femPart = caseData->femParts()->part(0);
|
||||
}
|
||||
|
||||
m_crossSectionFacesTextureCoords->resize(vertexWeights.size());
|
||||
|
||||
if (resultValues.size() == 0)
|
||||
{
|
||||
m_crossSectionFacesTextureCoords->setAll(cvf::Vec2f(0.0, 1.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Vec2f* rawPtr = m_crossSectionFacesTextureCoords->ptr();
|
||||
|
||||
int vxCount = static_cast<int>(vertexWeights.size());
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (int triangleVxIdx = 0; triangleVxIdx < vxCount; ++triangleVxIdx)
|
||||
{
|
||||
float resValue = 0;
|
||||
int weightCount = vertexWeights[triangleVxIdx].size();
|
||||
for (int wIdx = 0; wIdx < weightCount; ++wIdx)
|
||||
{
|
||||
size_t resIdx = isNodalResult ? vertexWeights[triangleVxIdx].vxId(wIdx): femPart->nodeIdxFromElementNodeResultIdx(vertexWeights[triangleVxIdx].vxId(wIdx));
|
||||
resValue += resultValues[vertexWeights[triangleVxIdx].vxId(wIdx)] * vertexWeights[triangleVxIdx].weight(wIdx);
|
||||
}
|
||||
|
||||
if (resValue == HUGE_VAL || resValue != resValue) // a != a is true for NAN's
|
||||
{
|
||||
rawPtr[triangleVxIdx][1] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
rawPtr[triangleVxIdx] = mapper->mapToTextureCoord(resValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
geoView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -177,12 +258,12 @@ const int priMesh = 3;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
{
|
||||
if (m_nativeCrossSectionGenerator.isNull()) return;
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
bool useBufferObjects = true;
|
||||
// Surface geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geo = m_nativeCrossSectionGenerator->generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> geo = m_crossSectionGenerator->generateSurface();
|
||||
if (geo.notNull())
|
||||
{
|
||||
geo->computeNormals();
|
||||
@ -205,13 +286,13 @@ void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
part->setEnableMask(surfaceBit);
|
||||
part->setPriority(priCrossSectionGeo);
|
||||
|
||||
m_nativeCrossSectionFaces = part;
|
||||
m_crossSectionFaces = part;
|
||||
}
|
||||
}
|
||||
|
||||
// Mesh geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geoMesh = m_nativeCrossSectionGenerator->createMeshDrawable();
|
||||
cvf::ref<cvf::DrawableGeo> geoMesh = m_crossSectionGenerator->createMeshDrawable();
|
||||
if (geoMesh.notNull())
|
||||
{
|
||||
if (useBufferObjects)
|
||||
@ -227,7 +308,7 @@ void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
part->setEnableMask(meshSurfaceBit);
|
||||
part->setPriority(priMesh);
|
||||
|
||||
m_nativeCrossSectionGridLines = part;
|
||||
m_crossSectionGridLines = part;
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,16 +321,16 @@ void RivCrossSectionPartMgr::generatePartGeometry()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::updatePartEffect()
|
||||
{
|
||||
if (m_nativeCrossSectionGenerator.isNull()) return;
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
// Set deCrossSection effect
|
||||
caf::SurfaceEffectGenerator geometryEffgen(m_defaultColor, caf::PO_1);
|
||||
|
||||
cvf::ref<cvf::Effect> geometryOnlyEffect = geometryEffgen.generateCachedEffect();
|
||||
|
||||
if (m_nativeCrossSectionFaces.notNull())
|
||||
if (m_crossSectionFaces.notNull())
|
||||
{
|
||||
m_nativeCrossSectionFaces->setEffect(geometryOnlyEffect.p());
|
||||
m_crossSectionFaces->setEffect(geometryOnlyEffect.p());
|
||||
}
|
||||
|
||||
// Update mesh colors as well, in case of change
|
||||
@ -259,9 +340,9 @@ void RivCrossSectionPartMgr::updatePartEffect()
|
||||
caf::MeshEffectGenerator CrossSectionEffGen(cvf::Color3::WHITE);//prefs->defaultCrossSectionGridLineColors());
|
||||
eff = CrossSectionEffGen.generateCachedEffect();
|
||||
|
||||
if (m_nativeCrossSectionGridLines.notNull())
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
{
|
||||
m_nativeCrossSectionGridLines->setEffect(eff.p());
|
||||
m_crossSectionGridLines->setEffect(eff.p());
|
||||
}
|
||||
|
||||
}
|
||||
@ -271,15 +352,15 @@ void RivCrossSectionPartMgr::updatePartEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_nativeCrossSectionFaces.isNull())
|
||||
if (m_crossSectionFaces.isNull())
|
||||
{
|
||||
generatePartGeometry();
|
||||
}
|
||||
|
||||
if (m_nativeCrossSectionFaces.notNull())
|
||||
if (m_crossSectionFaces.notNull())
|
||||
{
|
||||
m_nativeCrossSectionFaces->setTransform(scaleTransform);
|
||||
model->addPart(m_nativeCrossSectionFaces.p());
|
||||
m_crossSectionFaces->setTransform(scaleTransform);
|
||||
model->addPart(m_crossSectionFaces.p());
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,15 +370,15 @@ void RivCrossSectionPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_nativeCrossSectionGridLines.isNull())
|
||||
if (m_crossSectionGridLines.isNull())
|
||||
{
|
||||
generatePartGeometry();
|
||||
}
|
||||
|
||||
if (m_nativeCrossSectionGridLines.notNull())
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
{
|
||||
m_nativeCrossSectionGridLines->setTransform(scaleTransform);
|
||||
model->addPart(m_nativeCrossSectionGridLines.p());
|
||||
m_crossSectionGridLines->setTransform(scaleTransform);
|
||||
model->addPart(m_crossSectionGridLines.p());
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,33 +387,39 @@ void RivCrossSectionPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* mod
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivCrossSectionPartMgr::computeData()
|
||||
{
|
||||
RigMainGrid* m_grid = mainGrid();
|
||||
CVF_ASSERT(m_grid);
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLine = m_rimCrossSection->polyLines();
|
||||
if (polyLine.size() > 0)
|
||||
{
|
||||
cvf::Vec3d direction = extrusionDirection(polyLine[0]);
|
||||
cvf::ref<RivEclipseCrossSectionGrid> eclHexGrid = new RivEclipseCrossSectionGrid(m_grid);
|
||||
m_nativeCrossSectionGenerator = new RivCrossSectionGeometryGenerator(polyLine[0], direction, eclHexGrid.p());
|
||||
cvf::ref<RivCrossSectionHexGridIntf> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivCrossSectionGeometryGenerator(polyLine[0], direction, hexGrid.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RivCrossSectionPartMgr::mainGrid()
|
||||
cvf::ref<RivCrossSectionHexGridIntf> RivCrossSectionPartMgr::createHexGridInterface()
|
||||
{
|
||||
RigMainGrid* grid = NULL;
|
||||
|
||||
RimEclipseView* eclipseView = NULL;
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(eclipseView);
|
||||
if (eclipseView)
|
||||
{
|
||||
RigMainGrid* grid = NULL;
|
||||
grid = eclipseView->eclipseCase()->reservoirData()->mainGrid();
|
||||
return new RivEclipseCrossSectionGrid(grid);
|
||||
}
|
||||
|
||||
return grid;
|
||||
RimGeoMechView* geoView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(geoView);
|
||||
if (geoView)
|
||||
{
|
||||
RigFemPart* femPart = geoView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
return new RivFemCrossSectionGrid(femPart);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
RivCrossSectionPartMgr(const RimCrossSection* rimCrossSection);
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
|
||||
void appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
void appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
@ -60,18 +60,18 @@ private:
|
||||
void generatePartGeometry();
|
||||
void computeData();
|
||||
|
||||
RigMainGrid* mainGrid();
|
||||
cvf::Vec3d extrusionDirection(const std::vector<cvf::Vec3d>& polyline) const;
|
||||
void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords, const std::vector<size_t>& triangleToCellIdxMap, const RigResultAccessor* resultAccessor, const cvf::ScalarMapper* mapper) const;
|
||||
cvf::ref<RivCrossSectionHexGridIntf> createHexGridInterface();
|
||||
private:
|
||||
|
||||
const RimCrossSection* m_rimCrossSection;
|
||||
|
||||
cvf::Color3f m_defaultColor;
|
||||
|
||||
cvf::ref<RivCrossSectionGeometryGenerator> m_nativeCrossSectionGenerator;
|
||||
cvf::ref<cvf::Part> m_nativeCrossSectionFaces;
|
||||
cvf::ref<cvf::Part> m_nativeCrossSectionGridLines;
|
||||
cvf::ref<cvf::Vec2fArray> m_nativeCrossSectionFacesTextureCoords;
|
||||
cvf::ref<RivCrossSectionGeometryGenerator> m_crossSectionGenerator;
|
||||
cvf::ref<cvf::Part> m_crossSectionFaces;
|
||||
cvf::ref<cvf::Part> m_crossSectionGridLines;
|
||||
cvf::ref<cvf::Vec2fArray> m_crossSectionFacesTextureCoords;
|
||||
|
||||
};
|
||||
|
@ -64,12 +64,12 @@ void RimCrossSectionCollection::applySingleColorEffect()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
|
||||
void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
||||
{
|
||||
RimCrossSection* cs = m_crossSections[csIdx];
|
||||
cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex, cellResultColors);
|
||||
cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
// Visualization interface
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors);
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
void appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
protected:
|
||||
|
@ -655,7 +655,7 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
|
||||
if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
|
||||
{
|
||||
crossSectionCollection->updateCellResultColor(m_currentTimeStep, this->cellResult());
|
||||
crossSectionCollection->updateCellResultColor(m_currentTimeStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user