From dbb72475e5ba67bd7b89ddaca9626f16067b0ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Mon, 26 Aug 2013 21:56:40 +0200 Subject: [PATCH] MswRollUp: Final commit: Reapplying changes and bugfixes from trunk in conflicting files. The changes are from changelist numbers: 22190, 22189, 22154, 22151, 22141, 22124, 22010 Now It is supposed to compile again. p4#: 22231 --- .../FileInterface/RifReaderEclipseOutput.cpp | 22 +++++++++++---- .../ProjectDataModel/RimReservoirView.cpp | 19 +++++++++++++ ApplicationCode/ProjectDataModel/RimWell.cpp | 14 +++++++--- .../ProjectDataModel/RimWellCollection.cpp | 28 ++++++++++++++----- 4 files changed, 66 insertions(+), 17 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 52fc8a0f8e..94aded4d9d 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -112,8 +112,6 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn { RigCell& cell = mainGrid->cells()[cellStartIndex + localCellIdx]; - bool invalid = ecl_grid_cell_invalid1(localEclGrid, localCellIdx); - cell.setInvalid(invalid); cell.setCellIndex(localCellIdx); // Active cell index @@ -164,10 +162,7 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn // Mark inactive long pyramid looking cells as invalid // Forslag //if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) ) - if (!invalid) - { - cell.setInvalid(cell.isLongPyramidCell()); - } + cell.setInvalid(cell.isLongPyramidCell()); #pragma omp atomic computedCellCount++; @@ -361,6 +356,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigCaseData* eclipseC m_filesWithSameBaseName = fileSet; // Read geometry + // Todo: Needs to check existence of file before calling ert, else it will abort ecl_grid_type * mainEclGrid = ecl_grid_alloc( fileName.toAscii().data() ); progInfo.incrementProgress(); @@ -600,6 +596,9 @@ void RifReaderEclipseOutput::buildMetaData() staticDate.push_back(m_timeSteps.front()); } + // Add ACTNUM + matrixResultNames += "ACTNUM"; + for (int i = 0; i < matrixResultNames.size(); ++i) { size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false); @@ -619,6 +618,9 @@ void RifReaderEclipseOutput::buildMetaData() staticDate.push_back(m_timeSteps.front()); } + // Add ACTNUM + fractureResultNames += "ACTNUM"; + for (int i = 0; i < fractureResultNames.size(); ++i) { size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false); @@ -663,6 +665,14 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe { CVF_ASSERT(values); + if (result.compare("ACTNUM", Qt::CaseInsensitive) == 0) + { + RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(matrixOrFracture); + values->resize(activeCellInfo->globalActiveCellCount(), 1.0); + + return true; + } + openInitFile(); if(m_ecl_init_file) diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index 4280a690c4..ac10a7559a 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -435,6 +435,9 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, } else if ( changedField == &showInactiveCells ) { + m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE); + m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE); + createDisplayModelAndRedraw(); } else if ( changedField == &showMainGrid ) @@ -675,6 +678,22 @@ void RimReservoirView::updateCurrentTimeStep() float opacity = static_cast< float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0)); m_reservoirGridPartManager->updateCellColor(RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity)); + + if (this->showInactiveCells()) + { + std::vector gridIndices; + this->indicesToVisibleGrids(&gridIndices); + + if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells()) + { + m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE, gridIndices); + } + else + { + m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::INACTIVE, gridIndices); + } + } + if (m_viewer) { cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); diff --git a/ApplicationCode/ProjectDataModel/RimWell.cpp b/ApplicationCode/ProjectDataModel/RimWell.cpp index daff321161..03c26b0566 100644 --- a/ApplicationCode/ProjectDataModel/RimWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimWell.cpp @@ -148,12 +148,18 @@ bool RimWell::calculateWellPipeVisibility(size_t frameIndex) if (m_reservoirView == NULL) return false; if (this->wellResults() == NULL) return false; - if ( this->wellResults()->firstResultTimeStep() == cvf::UNDEFINED_SIZE_T - || frameIndex < this->wellResults()->firstResultTimeStep() - || frameIndex >= this->wellResults()->m_wellCellsTimeSteps.size()) + if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) + { return false; + } - if (!m_reservoirView->wellCollection()->active()) + size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; + if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) + { + return false; + } + + if (!m_reservoirView->wellCollection()->isActive()) return false; if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_ON) diff --git a/ApplicationCode/ProjectDataModel/RimWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellCollection.cpp index 7aff321f31..daca4824c0 100644 --- a/ApplicationCode/ProjectDataModel/RimWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellCollection.cpp @@ -66,6 +66,16 @@ namespace caf } } +namespace caf +{ + template<> + void RimWellCollection::WellHeadPositionEnum::setUp() + { + addItem(RimWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "Top of active cells BB"); + addItem(RimWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Top of active cells IJ-column"); + setDefault(RimWellCollection::WELLHEAD_POS_TOP_COLUMN); + } +} CAF_PDM_SOURCE_INIT(RimWellCollection, "Wells"); @@ -76,12 +86,13 @@ RimWellCollection::RimWellCollection() { CAF_PDM_InitObject("Wells", ":/WellCollection.png", "", ""); - CAF_PDM_InitField(&active, "Active", true, "Active", "", "", ""); - active.setUiHidden(true); + CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", ""); + isActive.setUiHidden(true); CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", ""); CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", ""); CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", ""); + CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", ""); CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", ""); @@ -130,6 +141,7 @@ RimWell* RimWellCollection::findWell(QString name) //-------------------------------------------------------------------------------------------------- bool RimWellCollection::hasVisibleWellCells() { + if (!this->isActive()) return false; if (this->wellCellsToRangeFilterMode() == RANGE_ADD_NONE) return false; if (this->wells().size() == 0 ) return false; @@ -164,7 +176,7 @@ bool RimWellCollection::hasVisibleWellCells() //-------------------------------------------------------------------------------------------------- bool RimWellCollection::hasVisibleWellPipes() { - if (!this->active()) return false; + if (!this->isActive()) return false; if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false; if (this->wells().size() == 0 ) return false; if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true; @@ -178,12 +190,13 @@ bool RimWellCollection::hasVisibleWellPipes() //-------------------------------------------------------------------------------------------------- void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - if (&showWellLabel == changedField || &active == changedField) + if (&showWellLabel == changedField || &isActive == changedField) { - this->updateUiIconFromState(active); + this->updateUiIconFromState(isActive); if (m_reservoirView) { + m_reservoirView->scheduleGeometryRegen(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS); m_reservoirView->createDisplayModelAndRedraw(); } } @@ -229,7 +242,8 @@ void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField || &pipeRadiusScaleFactor == changedField || &wellHeadScaleFactor == changedField || &showWellHead == changedField - || &isAutoDetectingBranches == changedField) + || &isAutoDetectingBranches == changedField + || &wellHeadPosition == changedField) { if (m_reservoirView) { @@ -276,7 +290,7 @@ void RimWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimWellCollection::objectToggleField() { - return &active; + return &isActive; }