//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimEclipseCase::removeResult(const QString& resultName) { size_t i; for (i = 0; i < reservoirViews().size(); i++) { RimEclipseView* reservoirView = reservoirViews()[i]; CVF_ASSERT(reservoirView); RimEclipseCellColors* result = reservoirView->cellResult; CVF_ASSERT(result); bool rebuildDisplayModel = false; // Set cell result variable to none if displaying if (result->resultVariable() == resultName) { result->setResultVariable(RimDefines::undefinedResultName()); result->loadResult(); rebuildDisplayModel = true; } std::list< caf::PdmPointer< RimEclipsePropertyFilter > >::iterator it; RimEclipsePropertyFilterCollection* propFilterCollection = reservoirView->propertyFilterCollection(); for (size_t filter = 0; filter < propFilterCollection->propertyFilters().size(); filter++) { RimEclipsePropertyFilter* propertyFilter = propFilterCollection->propertyFilters()[filter]; if (propertyFilter->resultDefinition->resultVariable() == resultName) { propertyFilter->resultDefinition->setResultVariable(RimDefines::undefinedResultName()); propertyFilter->resultDefinition->loadResult(); propertyFilter->setToDefaultValues(); rebuildDisplayModel = true; } } if (rebuildDisplayModel) { reservoirViews()[i]->createDisplayModelAndRedraw(); } // TODO // CellEdgeResults are not considered, as they do not support display of input properties yet } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model) { CVF_ASSERT(model != NULL); RimFaultCollection* faultCollection = m_reservoirView->faultCollection(); if (!faultCollection) return; bool isShowingGrid = faultCollection->isGridVisualizationMode(); if (!faultCollection->showFaultCollection() && !isShowingGrid) return; // Check match between model fault count and fault parts CVF_ASSERT(faultCollection->faults.size() == m_faultParts.size()); cvf::ModelBasicList parts; for (size_t i = 0; i < faultCollection->faults.size(); i++) { const RimFault* rimFault = faultCollection->faults[i]; cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i]; CVF_ASSERT(rivFaultPart.notNull()); // Parts that is overridden by the grid settings bool forceDisplayOfFault = false; if (!faultCollection->showFaultsOutsideFilters()) { forceDisplayOfFault = isShowingGrid; } if (m_forceVisibility && isShowingGrid) { forceDisplayOfFault = true; } if ( (faultCollection->showFaultCollection() && rimFault->showFault()) || forceDisplayOfFault) { if (faultCollection->showFaultFaces() || forceDisplayOfFault) { rivFaultPart->appendNativeFaultFacesToModel(&parts); } if (faultCollection->showOppositeFaultFaces() || forceDisplayOfFault) { rivFaultPart->appendOppositeFaultFacesToModel(&parts); } if (faultCollection->showFaultFaces() || faultCollection->showOppositeFaultFaces() || faultCollection->showNNCs() || forceDisplayOfFault) { rivFaultPart->appendMeshLinePartsToModel(&parts); } } // Parts that is not overridden by the grid settings RimEclipseFaultColors* faultResultColors = m_reservoirView->faultResultSettings(); RimEclipseCellColors* cellResultColors = m_reservoirView->cellResult(); if (rimFault->showFault() && faultCollection->showFaultCollection()) { if (faultCollection->showNNCs()) { bool showNncs = true; if (faultCollection->hideNncsWhenNoResultIsAvailable()) { size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; if (faultResultColors->showCustomFaultResult()) { scalarResultIndex = faultResultColors->customFaultResult()->scalarResultIndex(); } else { scalarResultIndex = cellResultColors->scalarResultIndex(); } RigMainGrid* mainGrid = m_reservoirView->eclipseCase()->reservoirData()->mainGrid(); if (!(mainGrid && mainGrid->nncData()->hasScalarValues(scalarResultIndex))) { showNncs = false; } } if (showNncs) { rivFaultPart->appendNNCFacesToModel(&parts); } } } } for (size_t i = 0; i < parts.partCount(); i++) { cvf::Part* part = parts.part(i); part->setTransform(m_scaleTransform.p()); model->addPart(part); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivCrossSectionPartMgr::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); } RivCrossSectionPartMgr::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<RivVertexWeights> &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(); RivCrossSectionPartMgr::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()); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QList<caf::PdmOptionItemInfo> RimLegendConfig::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { bool isCategoryResult = false; { RimEclipseCellColors* eclCellColors = nullptr; this->firstAncestorOrThisOfType(eclCellColors); RimGeoMechResultDefinition* gmCellColors = nullptr; this->firstAncestorOrThisOfType(gmCellColors); RimCellEdgeColors* eclCellEdgColors = nullptr; this->firstAncestorOrThisOfType(eclCellEdgColors); if ( ( eclCellColors && eclCellColors->hasCategoryResult()) || ( gmCellColors && gmCellColors->hasCategoryResult()) || ( eclCellEdgColors && eclCellEdgColors->hasCategoryResult()) ) { isCategoryResult = true; } } QList<caf::PdmOptionItemInfo> optionList; if (fieldNeedingOptions == &m_mappingMode) { // This is an app enum field, see cafInternalPdmFieldTypeSpecializations.h for the default specialization of this type std::vector<MappingType> mappingTypes; mappingTypes.push_back(LINEAR_DISCRETE); mappingTypes.push_back(LINEAR_CONTINUOUS); mappingTypes.push_back(LOG10_CONTINUOUS); mappingTypes.push_back(LOG10_DISCRETE); if (isCategoryResult) { mappingTypes.push_back(CATEGORY_INTEGER); } for(MappingType mapType: mappingTypes) { optionList.push_back(caf::PdmOptionItemInfo(MappingEnum::uiText(mapType), mapType)); } } else if (fieldNeedingOptions == &m_colorRangeMode) { // This is an app enum field, see cafInternalPdmFieldTypeSpecializations.h for the default specialization of this type std::vector<ColorRangesType> rangeTypes; rangeTypes.push_back(NORMAL); rangeTypes.push_back(OPPOSITE_NORMAL); rangeTypes.push_back(WHITE_PINK); rangeTypes.push_back(PINK_WHITE); rangeTypes.push_back(BLUE_WHITE_RED); rangeTypes.push_back(RED_WHITE_BLUE); rangeTypes.push_back(WHITE_BLACK); rangeTypes.push_back(BLACK_WHITE); rangeTypes.push_back(ANGULAR); if (isCategoryResult) { rangeTypes.push_back(CATEGORY); } for(ColorRangesType colType: rangeTypes) { optionList.push_back(caf::PdmOptionItemInfo(ColorRangeEnum::uiText(colType), colType)); } } return optionList; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &releaseResultMemory) { if (this->reservoirData()) { for (size_t i = 0; i < reservoirViews().size(); i++) { RimEclipseView* reservoirView = reservoirViews()[i]; CVF_ASSERT(reservoirView); RimEclipseCellColors* result = reservoirView->cellResult; CVF_ASSERT(result); result->setResultVariable(RimDefines::undefinedResultName()); result->loadResult(); RimCellEdgeColors* cellEdgeResult = reservoirView->cellEdgeResult; CVF_ASSERT(cellEdgeResult); cellEdgeResult->resultVariable.v() = RimDefines::undefinedResultName(); cellEdgeResult->loadResult(); reservoirView->createDisplayModelAndRedraw(); } RigCaseCellResultsData* matrixModelResults = reservoirData()->results(RifReaderInterface::MATRIX_RESULTS); if (matrixModelResults) { matrixModelResults->clearAllResults(); } RigCaseCellResultsData* fractureModelResults = reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS); if (fractureModelResults) { fractureModelResults->clearAllResults(); } } releaseResultMemory = oldValue.toBool(); } else if (changedField == &flipXAxis || changedField == &flipYAxis) { RigCaseData* rigEclipseCase = reservoirData(); if (rigEclipseCase) { rigEclipseCase->mainGrid()->setFlipAxis(flipXAxis, flipYAxis); computeCachedData(); for (size_t i = 0; i < reservoirViews().size(); i++) { RimEclipseView* reservoirView = reservoirViews()[i]; reservoirView->scheduleReservoirGridGeometryRegen(); reservoirView->schedulePipeGeometryRegen(); reservoirView->createDisplayModelAndRedraw(); } } } }