mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#815 : Intersection Box : Added PartManager and SourceInfo
This commit is contained in:
parent
33296e4424
commit
e789694780
@ -392,8 +392,10 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
set_source_files_properties (UnitTests/opm-parser-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
# variables at global file scope
|
||||
set_source_files_properties (ModelVisualization/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/RivIntersectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
set_source_files_properties (ModelVisualization/GridBox/RivGridBoxGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
set_source_files_properties (Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
|
||||
|
@ -10,6 +10,8 @@ ${CEE_CURRENT_LIST_DIR}RivIntersectionPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionSourceInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RivHexGridIntersectionTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxSourceInfo.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -18,6 +20,8 @@ ${CEE_CURRENT_LIST_DIR}RivIntersectionPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionSourceInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivHexGridIntersectionTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxSourceInfo.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -192,6 +192,14 @@ private:
|
||||
cvf::Vec3d m_size;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimIntersectionBox* RivIntersectionBoxGeometryGenerator::intersectionBox() const
|
||||
{
|
||||
return m_intersectionBoxDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
const std::vector<RivIntersectionVertexWeights>& triangleVxToCellCornerInterpolationWeights() const;
|
||||
|
||||
//const RimCrossSection* crossSection() const;
|
||||
const RimIntersectionBox* intersectionBox() const;
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
|
@ -0,0 +1,444 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivIntersectionBoxPartMgr.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimIntersection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfRenderState_FF.h"
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfRenderStatePoint.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxPartMgr::RivIntersectionBoxPartMgr(const RimIntersectionBox* rimCrossSection)
|
||||
: m_rimCrossSection(rimCrossSection),
|
||||
m_defaultColor(cvf::Color3::WHITE)
|
||||
{
|
||||
CVF_ASSERT(m_rimCrossSection);
|
||||
|
||||
m_crossSectionFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
computeData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::applySingleColorEffect()
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
m_defaultColor = cvf::Color3f::OLIVE;//m_rimCrossSection->CrossSectionColor();
|
||||
this->updatePartEffect();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
if (!m_crossSectionGenerator->isAnyGeometryPresent()) return;
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(eclipseView);
|
||||
|
||||
if (eclipseView)
|
||||
{
|
||||
RimEclipseCellColors* cellResultColors = eclipseView->cellResult();
|
||||
CVF_ASSERT(cellResultColors);
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
RigCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData();
|
||||
|
||||
// CrossSections
|
||||
if (m_crossSectionFaces.notNull())
|
||||
{
|
||||
if (cellResultColors->isTernarySaturationSelected())
|
||||
{
|
||||
RivTernaryTextureCoordsCreator texturer(cellResultColors, cellResultColors->ternaryLegendConfig(), timeStepIndex);
|
||||
|
||||
texturer.createTextureCoords(m_crossSectionFacesTextureCoords.p(), m_crossSectionGenerator->triangleToCellIndex());
|
||||
|
||||
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();
|
||||
cvf::ref<RigResultAccessor> resultAccessor;
|
||||
|
||||
if (RimDefines::isPerCellFaceResult(cellResultColors->resultVariable()))
|
||||
{
|
||||
resultAccessor = new RigHugeValResultAccessor;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createResultAccessor(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
|
||||
0,
|
||||
timeStepIndex,
|
||||
cellResultColors);
|
||||
}
|
||||
|
||||
RivIntersectionBoxPartMgr::calculateEclipseTextureCoordinates(m_crossSectionFacesTextureCoords.p(),
|
||||
m_crossSectionGenerator->triangleToCellIndex(),
|
||||
resultAccessor.p(),
|
||||
mapper);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
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<RivIntersectionVertexWeights> &vertexWeights = m_crossSectionGenerator->triangleVxToCellCornerInterpolationWeights();
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, 0, (int)timeStepIndex);
|
||||
bool isElementNodalResult = !(resVarAddress.resultPosType == RIG_NODAL);
|
||||
RigFemPart* femPart = caseData->femParts()->part(0);
|
||||
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
|
||||
|
||||
RivIntersectionBoxPartMgr::calculateGeoMechTextureCoords(m_crossSectionFacesTextureCoords.p(),
|
||||
vertexWeights,
|
||||
resultValues,
|
||||
isElementNodalResult,
|
||||
femPart,
|
||||
mapper);
|
||||
|
||||
RivScalarMapperUtils::applyTextureResultsToPart(m_crossSectionFaces.p(),
|
||||
m_crossSectionFacesTextureCoords.p(),
|
||||
mapper,
|
||||
1.0,
|
||||
caf::FC_NONE,
|
||||
geoView->isLightingDisabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights,
|
||||
const std::vector<float> &resultValues,
|
||||
bool isElementNodalResult,
|
||||
const RigFemPart* femPart,
|
||||
const cvf::ScalarMapper* mapper)
|
||||
{
|
||||
textureCoords->resize(vertexWeights.size());
|
||||
|
||||
if (resultValues.size() == 0)
|
||||
{
|
||||
textureCoords->setAll(cvf::Vec2f(0.0, 1.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Vec2f* rawPtr = textureCoords->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 = isElementNodalResult ? vertexWeights[triangleVxIdx].vxId(wIdx) :
|
||||
femPart->nodeIdxFromElementNodeResultIdx(vertexWeights[triangleVxIdx].vxId(wIdx));
|
||||
resValue += resultValues[resIdx] * 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Calculates the texture coordinates in a "nearly" one dimensional texture.
|
||||
/// Undefined values are coded with a y-texturecoordinate value of 1.0 instead of the normal 0.5
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<size_t>& triangleToCellIdxMap,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const cvf::ScalarMapper* mapper)
|
||||
{
|
||||
if (!resultAccessor) return;
|
||||
|
||||
size_t numVertices = triangleToCellIdxMap.size()*3;
|
||||
|
||||
textureCoords->resize(numVertices);
|
||||
cvf::Vec2f* rawPtr = textureCoords->ptr();
|
||||
|
||||
int triangleCount = static_cast<int>(triangleToCellIdxMap.size());
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int tIdx = 0; tIdx < triangleCount; tIdx++)
|
||||
{
|
||||
double cellScalarValue = resultAccessor->cellScalarGlobIdx(triangleToCellIdxMap[tIdx]);
|
||||
cvf::Vec2f texCoord = mapper->mapToTextureCoord(cellScalarValue);
|
||||
if (cellScalarValue == HUGE_VAL || cellScalarValue != cellScalarValue) // a != a is true for NAN's
|
||||
{
|
||||
texCoord[1] = 1.0f;
|
||||
}
|
||||
|
||||
size_t j;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
rawPtr[tIdx*3 + j] = texCoord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int priCrossSectionGeo = 1;
|
||||
const int priNncGeo = 2;
|
||||
const int priMesh = 3;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::generatePartGeometry()
|
||||
{
|
||||
if (m_crossSectionGenerator.isNull()) return;
|
||||
|
||||
bool useBufferObjects = true;
|
||||
// Surface geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geo = m_crossSectionGenerator->generateSurface();
|
||||
if (geo.notNull())
|
||||
{
|
||||
geo->computeNormals();
|
||||
|
||||
if (useBufferObjects)
|
||||
{
|
||||
geo->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("Cross Section");
|
||||
part->setDrawable(geo.p());
|
||||
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivIntersectionBoxSourceInfo> si = new RivIntersectionBoxSourceInfo(m_crossSectionGenerator.p());
|
||||
part->setSourceInfo(si.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(faultBit);
|
||||
part->setPriority(priCrossSectionGeo);
|
||||
|
||||
m_crossSectionFaces = part;
|
||||
}
|
||||
}
|
||||
|
||||
// Mesh geometry
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geoMesh = m_crossSectionGenerator->createMeshDrawable();
|
||||
if (geoMesh.notNull())
|
||||
{
|
||||
if (useBufferObjects)
|
||||
{
|
||||
geoMesh->setRenderMode(cvf::DrawableGeo::BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName("Cross Section mesh");
|
||||
part->setDrawable(geoMesh.p());
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask(meshFaultBit);
|
||||
part->setPriority(priMesh);
|
||||
|
||||
m_crossSectionGridLines = part;
|
||||
}
|
||||
}
|
||||
|
||||
updatePartEffect();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::updatePartEffect()
|
||||
{
|
||||
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_crossSectionFaces.notNull())
|
||||
{
|
||||
m_crossSectionFaces->setEffect(geometryOnlyEffect.p());
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
{
|
||||
m_crossSectionGridLines->setEffect(eff.p());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_crossSectionFaces.isNull())
|
||||
{
|
||||
generatePartGeometry();
|
||||
}
|
||||
|
||||
if (m_crossSectionFaces.notNull())
|
||||
{
|
||||
m_crossSectionFaces->setTransform(scaleTransform);
|
||||
model->addPart(m_crossSectionFaces.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
||||
{
|
||||
if (m_crossSectionGridLines.isNull())
|
||||
{
|
||||
generatePartGeometry();
|
||||
}
|
||||
|
||||
if (m_crossSectionGridLines.notNull())
|
||||
{
|
||||
m_crossSectionGridLines->setTransform(scaleTransform);
|
||||
model->addPart(m_crossSectionGridLines.p());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxPartMgr::computeData()
|
||||
{
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivIntersectionBoxGeometryGenerator(m_rimCrossSection, hexGrid.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RivIntersectionHexGridInterface> RivIntersectionBoxPartMgr::createHexGridInterface()
|
||||
{
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(eclipseView);
|
||||
if (eclipseView)
|
||||
{
|
||||
RigMainGrid* grid = NULL;
|
||||
grid = eclipseView->eclipseCase()->reservoirData()->mainGrid();
|
||||
|
||||
// TODO: Should flag for inactive cells be available at a centralized object?
|
||||
return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), false);
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView;
|
||||
m_rimCrossSection->firstAnchestorOrThisOfType(geoView);
|
||||
if (geoView)
|
||||
{
|
||||
RigFemPart* femPart = geoView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
return new RivFemIntersectionGrid(femPart);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor4.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Part;
|
||||
}
|
||||
|
||||
class RigMainGrid;
|
||||
class RimEclipseCellColors;
|
||||
class RimCellEdgeColors;
|
||||
class RimIntersectionBox;
|
||||
class RigResultAccessor;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RivIntersectionBoxPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionBoxPartMgr(const RimIntersectionBox* rimCrossSection);
|
||||
|
||||
void applySingleColorEffect();
|
||||
void updateCellResultColor(size_t timeStepIndex);
|
||||
|
||||
|
||||
void appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
void appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
|
||||
|
||||
private:
|
||||
void updatePartEffect();
|
||||
void generatePartGeometry();
|
||||
void computeData();
|
||||
|
||||
static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<size_t>& triangleToCellIdxMap,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
|
||||
static void calculateGeoMechTextureCoords(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<RivIntersectionVertexWeights> &vertexWeights,
|
||||
const std::vector<float> &resultValues,
|
||||
bool isElementNodalResult,
|
||||
const RigFemPart* femPart,
|
||||
const cvf::ScalarMapper* mapper);
|
||||
|
||||
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
|
||||
private:
|
||||
const RimIntersectionBox* m_rimCrossSection;
|
||||
|
||||
cvf::Color3f m_defaultColor;
|
||||
|
||||
cvf::ref<RivIntersectionBoxGeometryGenerator> m_crossSectionGenerator;
|
||||
cvf::ref<cvf::Part> m_crossSectionFaces;
|
||||
cvf::ref<cvf::Part> m_crossSectionGridLines;
|
||||
cvf::ref<cvf::Vec2fArray> m_crossSectionFacesTextureCoords;
|
||||
};
|
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
|
||||
#include "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxSourceInfo::RivIntersectionBoxSourceInfo(RivIntersectionBoxGeometryGenerator* geometryGenerator)
|
||||
: m_crossSectionGeometryGenerator(geometryGenerator)
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionGeometryGenerator.notNull());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivIntersectionBoxSourceInfo::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_crossSectionGeometryGenerator.notNull());
|
||||
|
||||
return m_crossSectionGeometryGenerator->triangleToCellIndex();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RimIntersectionBox* RivIntersectionBoxSourceInfo::crossSection() const
|
||||
{
|
||||
return m_crossSectionGeometryGenerator->intersectionBox();
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RivIntersectionBoxGeometryGenerator;
|
||||
class RimIntersectionBox;
|
||||
|
||||
class RivIntersectionBoxSourceInfo : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionBoxSourceInfo(RivIntersectionBoxGeometryGenerator* geometryGenerator);
|
||||
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
|
||||
const RimIntersectionBox* crossSection() const;
|
||||
|
||||
private:
|
||||
cvf::cref<RivIntersectionBoxGeometryGenerator> m_crossSectionGeometryGenerator;
|
||||
};
|
@ -19,6 +19,7 @@
|
||||
#include "RimIntersectionBox.h"
|
||||
|
||||
#include "RimView.h"
|
||||
#include "RivIntersectionBoxPartMgr.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
|
||||
@ -99,6 +100,16 @@ void RimIntersectionBox::setModelBoundingBox(cvf::BoundingBox& boundingBox)
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxPartMgr* RimIntersectionBox::intersectionBoxPartMgr()
|
||||
{
|
||||
if (m_intersectionBoxPartMgr.isNull()) m_intersectionBoxPartMgr = new RivIntersectionBoxPartMgr(this);
|
||||
|
||||
return m_intersectionBoxPartMgr.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -173,6 +184,8 @@ caf::PdmFieldHandle* RimIntersectionBox::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntersectionBox::rebuildGeometryAndScheduleCreateDisplayModel()
|
||||
{
|
||||
m_intersectionBoxPartMgr = nullptr;
|
||||
|
||||
RimView* rimView = NULL;
|
||||
this->firstAnchestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
class RivIntersectionBoxPartMgr;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -44,6 +45,9 @@ public:
|
||||
cvf::Mat4d boxOrigin() const;
|
||||
cvf::Vec3d boxSize() const;
|
||||
|
||||
RivIntersectionBoxPartMgr* intersectionBoxPartMgr();
|
||||
|
||||
|
||||
void setModelBoundingBox(cvf::BoundingBox& boundingBox);
|
||||
|
||||
protected:
|
||||
@ -67,5 +71,7 @@ private:
|
||||
caf::PdmField<double> maxZCoord;
|
||||
|
||||
|
||||
cvf::BoundingBox m_boundingBox;
|
||||
cvf::BoundingBox m_boundingBox;
|
||||
|
||||
cvf::ref<RivIntersectionBoxPartMgr> m_intersectionBoxPartMgr;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user