2013-02-14 07:30:01 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2013-02-21 08:37:51 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2013-02-14 07:30:01 -06:00
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
|
|
|
//
|
|
|
|
// 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 "RimIdenticalGridCaseGroup.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "RimCaseCollection.h"
|
|
|
|
|
2013-03-22 10:40:41 -05:00
|
|
|
#include "RimCase.h"
|
2013-02-14 07:30:01 -06:00
|
|
|
#include "RimReservoirView.h"
|
2013-03-22 10:58:44 -05:00
|
|
|
#include "RigCaseData.h"
|
|
|
|
#include "RigCaseCellResultsData.h"
|
2013-02-21 05:00:49 -06:00
|
|
|
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "RimResultSlot.h"
|
|
|
|
#include "RimCellEdgeResultSlot.h"
|
2013-03-22 08:24:41 -05:00
|
|
|
#include "RimStatisticsCase.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
|
2013-03-22 10:40:41 -05:00
|
|
|
#include "RimResultCase.h"
|
2013-03-14 03:28:49 -05:00
|
|
|
#include "cafProgressInfo.h"
|
2013-03-21 04:31:58 -05:00
|
|
|
#include "RigActiveCellInfo.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "RigActiveCellInfo.h"
|
|
|
|
|
2013-04-07 10:27:45 -05:00
|
|
|
#include "RigGridManager.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "RimReservoirCellResultsCacher.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "cafPdmFieldCvfColor.h"
|
|
|
|
#include "cafPdmFieldCvfMat4d.h"
|
|
|
|
#include "RimCellRangeFilterCollection.h"
|
|
|
|
#include "RimCellPropertyFilterCollection.h"
|
|
|
|
#include "Rim3dOverlayInfoConfig.h"
|
|
|
|
#include "RimWellCollection.h"
|
2013-02-14 07:30:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimIdenticalGridCaseGroup, "RimIdenticalGridCaseGroup");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup()
|
|
|
|
{
|
2013-03-07 09:47:42 -06:00
|
|
|
CAF_PDM_InitObject("Grid Case Group", ":/GridCaseGroup16x16.png", "", "");
|
2013-02-14 07:30:01 -06:00
|
|
|
|
2013-03-07 05:32:19 -06:00
|
|
|
CAF_PDM_InitField(&name, "UserDescription", QString("Grid Case Group"), "Name", "", "", "");
|
2013-02-21 03:38:28 -06:00
|
|
|
|
2013-05-10 08:35:33 -05:00
|
|
|
CAF_PDM_InitField(&groupId, "GroupId", -1, "Case Group ID", "", "" ,"");
|
|
|
|
groupId.setUiReadOnly(true);
|
|
|
|
|
2013-03-22 04:03:51 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&statisticsCaseCollection, "StatisticsCaseCollection", "Derived Statistics", ":/Histograms16x16.png", "", "");
|
2013-10-23 15:13:01 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&caseCollection, "CaseCollection", "Source Cases", ":/Cases16x16.png", "", "");
|
2013-03-07 05:32:19 -06:00
|
|
|
|
2013-02-21 08:37:51 -06:00
|
|
|
caseCollection = new RimCaseCollection;
|
2013-03-22 05:47:46 -05:00
|
|
|
statisticsCaseCollection = new RimCaseCollection;
|
2013-02-15 01:44:45 -06:00
|
|
|
|
2013-03-14 02:47:42 -05:00
|
|
|
m_mainGrid = NULL;
|
2013-03-21 04:31:58 -05:00
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
m_unionOfMatrixActiveCells = new RigActiveCellInfo;
|
|
|
|
m_unionOfFractureActiveCells = new RigActiveCellInfo;
|
2013-02-14 07:30:01 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimIdenticalGridCaseGroup::~RimIdenticalGridCaseGroup()
|
|
|
|
{
|
2013-03-07 02:21:29 -06:00
|
|
|
m_mainGrid = NULL;
|
2013-02-14 07:30:01 -06:00
|
|
|
|
2013-03-07 02:21:29 -06:00
|
|
|
delete caseCollection;
|
|
|
|
caseCollection = NULL;
|
|
|
|
|
2013-03-22 04:03:51 -05:00
|
|
|
delete statisticsCaseCollection;
|
|
|
|
statisticsCaseCollection = NULL;
|
2013-02-14 07:30:01 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
void RimIdenticalGridCaseGroup::addCase(RimCase* reservoir)
|
2013-02-14 07:30:01 -06:00
|
|
|
{
|
|
|
|
CVF_ASSERT(reservoir);
|
|
|
|
|
|
|
|
if (!reservoir) return;
|
|
|
|
|
2013-03-13 08:58:36 -05:00
|
|
|
if (!m_mainGrid)
|
2013-02-14 07:30:01 -06:00
|
|
|
{
|
2013-04-07 10:27:45 -05:00
|
|
|
m_mainGrid = reservoir->reservoirData()->mainGrid();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
reservoir->reservoirData()->setMainGrid(m_mainGrid);
|
2013-02-14 07:30:01 -06:00
|
|
|
}
|
|
|
|
|
2013-02-21 08:37:51 -06:00
|
|
|
caseCollection()->reservoirs().push_back(reservoir);
|
2013-03-07 03:06:31 -06:00
|
|
|
|
2013-03-21 04:31:58 -05:00
|
|
|
clearActiveCellUnions();
|
|
|
|
clearStatisticsResults();
|
|
|
|
updateMainGridAndActiveCellsForStatisticsCases();
|
2013-02-14 07:30:01 -06:00
|
|
|
}
|
|
|
|
|
2013-03-20 05:35:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
void RimIdenticalGridCaseGroup::removeCase(RimCase* reservoir)
|
2013-03-20 05:35:27 -05:00
|
|
|
{
|
2013-04-11 05:06:38 -05:00
|
|
|
if (caseCollection()->reservoirs().count(reservoir) == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-20 05:35:27 -05:00
|
|
|
caseCollection()->reservoirs().removeChildObject(reservoir);
|
|
|
|
|
|
|
|
if (caseCollection()->reservoirs().size() == 0)
|
|
|
|
{
|
|
|
|
m_mainGrid = NULL;
|
|
|
|
}
|
2013-03-21 04:31:58 -05:00
|
|
|
|
|
|
|
clearActiveCellUnions();
|
|
|
|
clearStatisticsResults();
|
|
|
|
updateMainGridAndActiveCellsForStatisticsCases();
|
2013-03-20 05:35:27 -05:00
|
|
|
}
|
|
|
|
|
2013-02-14 07:30:01 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigMainGrid* RimIdenticalGridCaseGroup::mainGrid()
|
|
|
|
{
|
2013-03-13 08:58:36 -05:00
|
|
|
if (m_mainGrid) return m_mainGrid;
|
2013-02-14 07:30:01 -06:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-02-21 03:38:28 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimIdenticalGridCaseGroup::userDescriptionField()
|
|
|
|
{
|
|
|
|
return &name;
|
|
|
|
}
|
|
|
|
|
2013-03-14 03:28:49 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 10:24:42 -05:00
|
|
|
/// Make sure changes in this functions is validated to RiaApplication::addEclipseCases()
|
2013-03-14 03:28:49 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-21 09:31:47 -05:00
|
|
|
void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
|
2013-03-14 03:28:49 -05:00
|
|
|
{
|
|
|
|
if (caseCollection()->reservoirs().size() == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
// Read the main case completely including grid.
|
|
|
|
// The mainGrid from the first case is reused directly in for the other cases.
|
2013-03-14 03:28:49 -05:00
|
|
|
// When reading active cell info, only the total cell count is tested for consistency
|
|
|
|
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* mainCase = caseCollection()->reservoirs[0];
|
2013-03-21 09:31:47 -05:00
|
|
|
mainCase->openEclipseGridFile();
|
2013-03-22 09:43:42 -05:00
|
|
|
RigCaseData* mainEclipseCase = mainCase->reservoirData();
|
2013-04-10 08:33:34 -05:00
|
|
|
if (!mainEclipseCase)
|
|
|
|
{
|
|
|
|
// Error message
|
|
|
|
return;
|
|
|
|
}
|
2013-03-14 03:28:49 -05:00
|
|
|
|
|
|
|
// Read active cell info from all source cases
|
2013-03-21 09:31:47 -05:00
|
|
|
|
|
|
|
caf::ProgressInfo info(caseCollection()->reservoirs.size(), "Case group - Reading Active Cell data");
|
|
|
|
for (size_t i = 1; i < caseCollection()->reservoirs.size(); i++)
|
2013-03-14 03:28:49 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RimResultCase* rimReservoir = dynamic_cast<RimResultCase*>(caseCollection()->reservoirs[i]);
|
2013-03-21 09:31:47 -05:00
|
|
|
if(!rimReservoir) continue; // Input reservoir
|
2013-03-14 03:28:49 -05:00
|
|
|
|
|
|
|
if (!rimReservoir->openAndReadActiveCellData(mainEclipseCase))
|
|
|
|
{
|
2013-04-10 08:33:34 -05:00
|
|
|
// Error message
|
|
|
|
continue;
|
2013-03-14 03:28:49 -05:00
|
|
|
}
|
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
info.incrementProgress();
|
2013-03-14 03:28:49 -05:00
|
|
|
}
|
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
m_mainGrid = mainEclipseCase->mainGrid();
|
|
|
|
|
|
|
|
// Check if we need to calculate the union of the active cells
|
2013-03-14 03:28:49 -05:00
|
|
|
|
2013-03-21 04:31:58 -05:00
|
|
|
bool foundResultsInCache = false;
|
2013-03-22 05:47:46 -05:00
|
|
|
for (size_t i = 0; i < statisticsCaseCollection()->reservoirs.size(); i++)
|
2013-03-14 03:28:49 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* rimReservoir = statisticsCaseCollection()->reservoirs[i];
|
2013-03-21 04:31:58 -05:00
|
|
|
|
|
|
|
// Check if any results are stored in cache
|
2013-03-21 09:31:47 -05:00
|
|
|
if (rimReservoir->results(RifReaderInterface::MATRIX_RESULTS)->storedResultsCount() > 0 ||
|
|
|
|
rimReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->storedResultsCount() > 0)
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
|
|
|
foundResultsInCache = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-03-14 03:28:49 -05:00
|
|
|
|
2013-03-21 04:31:58 -05:00
|
|
|
if (foundResultsInCache)
|
|
|
|
{
|
|
|
|
computeUnionOfActiveCells();
|
2013-03-14 03:28:49 -05:00
|
|
|
}
|
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
// "Load" the statistical cases
|
2013-03-21 04:31:58 -05:00
|
|
|
|
2013-03-22 05:47:46 -05:00
|
|
|
for (size_t i = 0; i < statisticsCaseCollection()->reservoirs.size(); i++)
|
2013-03-21 09:31:47 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* rimReservoir = statisticsCaseCollection()->reservoirs[i];
|
2013-03-21 09:31:47 -05:00
|
|
|
|
|
|
|
rimReservoir->openEclipseGridFile();
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
{
|
|
|
|
rimReservoir->reservoirData()->computeActiveCellBoundingBoxes();
|
|
|
|
}
|
|
|
|
}
|
2013-03-21 04:31:58 -05:00
|
|
|
}
|
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
|
2013-03-21 04:31:58 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
if (m_unionOfMatrixActiveCells->globalActiveCellCount() > 0)
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (caseCollection->reservoirs.size() == 0 || !m_mainGrid)
|
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
this->clearActiveCellUnions();
|
2013-03-21 04:31:58 -05:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_unionOfMatrixActiveCells->setGlobalCellCount(m_mainGrid->cells().size());
|
|
|
|
m_unionOfFractureActiveCells->setGlobalCellCount(m_mainGrid->cells().size());
|
|
|
|
m_unionOfMatrixActiveCells->setGridCount(m_mainGrid->gridCount());
|
|
|
|
m_unionOfFractureActiveCells->setGridCount(m_mainGrid->gridCount());
|
|
|
|
|
|
|
|
size_t globalActiveMatrixIndex = 0;
|
|
|
|
size_t globalActiveFractureIndex = 0;
|
|
|
|
|
|
|
|
for (size_t gridIdx = 0; gridIdx < m_mainGrid->gridCount(); gridIdx++)
|
|
|
|
{
|
|
|
|
RigGridBase* grid = m_mainGrid->gridByIndex(gridIdx);
|
|
|
|
|
|
|
|
std::vector<char> activeM(grid->cellCount(), 0);
|
|
|
|
std::vector<char> activeF(grid->cellCount(), 0);
|
|
|
|
|
|
|
|
for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++)
|
|
|
|
{
|
|
|
|
for (size_t caseIdx = 0; caseIdx < caseCollection->reservoirs.size(); caseIdx++)
|
|
|
|
{
|
|
|
|
size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx);
|
|
|
|
|
|
|
|
if (activeM[localGridCellIdx] == 0)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(globalCellIdx))
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
|
|
|
activeM[localGridCellIdx] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (activeF[localGridCellIdx] == 0)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActive(globalCellIdx))
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
|
|
|
activeF[localGridCellIdx] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t activeMatrixIndex = 0;
|
|
|
|
size_t activeFractureIndex = 0;
|
|
|
|
|
|
|
|
for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++)
|
|
|
|
{
|
|
|
|
size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx);
|
|
|
|
|
|
|
|
if (activeM[localGridCellIdx] != 0)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
m_unionOfMatrixActiveCells->setCellResultIndex(globalCellIdx, globalActiveMatrixIndex++);
|
2013-03-21 04:31:58 -05:00
|
|
|
activeMatrixIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (activeF[localGridCellIdx] != 0)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
m_unionOfFractureActiveCells->setCellResultIndex(globalCellIdx, globalActiveFractureIndex++);
|
2013-03-21 04:31:58 -05:00
|
|
|
activeFractureIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_unionOfMatrixActiveCells->setGridActiveCellCounts(gridIdx, activeMatrixIndex);
|
|
|
|
m_unionOfFractureActiveCells->setGridActiveCellCounts(gridIdx, activeFractureIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_unionOfMatrixActiveCells->computeDerivedData();
|
|
|
|
m_unionOfFractureActiveCells->computeDerivedData();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 04:03:51 -05:00
|
|
|
RimStatisticsCase* RimIdenticalGridCaseGroup::createAndAppendStatisticsCase()
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
2013-03-22 05:47:46 -05:00
|
|
|
RimStatisticsCase* newStatisticsCase = new RimStatisticsCase;
|
2013-03-21 04:31:58 -05:00
|
|
|
|
2013-04-11 05:06:38 -05:00
|
|
|
newStatisticsCase->caseUserDescription = QString("Statistics ") + QString::number(statisticsCaseCollection()->reservoirs.size()+1);
|
2013-03-22 05:47:46 -05:00
|
|
|
statisticsCaseCollection()->reservoirs.push_back(newStatisticsCase);
|
2013-03-21 04:31:58 -05:00
|
|
|
|
2013-03-22 05:47:46 -05:00
|
|
|
newStatisticsCase->openEclipseGridFile();
|
2013-03-21 09:31:47 -05:00
|
|
|
|
2013-03-22 05:47:46 -05:00
|
|
|
return newStatisticsCase;
|
2013-03-21 04:31:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
|
|
|
|
{
|
2013-03-22 05:47:46 -05:00
|
|
|
for (size_t i = 0; i < statisticsCaseCollection->reservoirs().size(); i++)
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* rimStaticsCase = statisticsCaseCollection->reservoirs[i];
|
2013-03-21 04:31:58 -05:00
|
|
|
|
2013-03-21 09:31:47 -05:00
|
|
|
rimStaticsCase->reservoirData()->setMainGrid(this->mainGrid());
|
2013-03-21 04:31:58 -05:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
rimStaticsCase->reservoirData()->computeActiveCellBoundingBoxes();
|
2013-03-21 04:31:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIdenticalGridCaseGroup::clearStatisticsResults()
|
|
|
|
{
|
2013-03-22 05:47:46 -05:00
|
|
|
for (size_t i = 0; i < statisticsCaseCollection->reservoirs().size(); i++)
|
2013-03-21 04:31:58 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* rimStaticsCase = statisticsCaseCollection->reservoirs[i];
|
2013-03-22 05:47:46 -05:00
|
|
|
if (!rimStaticsCase) continue;
|
|
|
|
|
2013-03-21 04:31:58 -05:00
|
|
|
rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->clearAllResults();
|
|
|
|
rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->clearAllResults();
|
2013-03-22 03:16:50 -05:00
|
|
|
|
|
|
|
for (size_t j = 0; j < rimStaticsCase->reservoirViews.size(); j++)
|
|
|
|
{
|
|
|
|
RimReservoirView* rimReservoirView = rimStaticsCase->reservoirViews[j];
|
2013-04-30 06:41:53 -05:00
|
|
|
rimReservoirView->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
2013-03-22 03:16:50 -05:00
|
|
|
rimReservoirView->cellEdgeResult()->resultVariable = RimDefines::undefinedResultName();
|
|
|
|
rimReservoirView->loadDataAndUpdate();
|
|
|
|
}
|
2013-03-21 04:31:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimIdenticalGridCaseGroup::clearActiveCellUnions()
|
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
m_unionOfMatrixActiveCells->clear();
|
|
|
|
m_unionOfFractureActiveCells->clear();
|
2013-03-14 03:28:49 -05:00
|
|
|
}
|
|
|
|
|
2013-03-21 07:56:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
bool RimIdenticalGridCaseGroup::contains(RimCase* reservoir) const
|
2013-03-21 07:56:50 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(reservoir);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < caseCollection()->reservoirs().size(); i++)
|
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* rimReservoir = caseCollection()->reservoirs()[i];
|
2013-04-11 05:06:38 -05:00
|
|
|
if (reservoir->gridFileName() == rimReservoir->gridFileName())
|
2013-03-21 07:56:50 -05:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-05 07:46:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-21 09:31:47 -05:00
|
|
|
RigActiveCellInfo* RimIdenticalGridCaseGroup::unionOfActiveCells(RifReaderInterface::PorosityModelResultType porosityType)
|
|
|
|
{
|
|
|
|
if (porosityType == RifReaderInterface::MATRIX_RESULTS)
|
|
|
|
{
|
|
|
|
return m_unionOfMatrixActiveCells.p();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_unionOfFractureActiveCells.p();
|
|
|
|
}
|
|
|
|
}
|
2013-03-22 05:47:46 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimIdenticalGridCaseGroup::isStatisticsCaseCollection(RimCaseCollection* rimCaseCollection)
|
|
|
|
{
|
|
|
|
std::vector<caf::PdmFieldHandle*> fields;
|
|
|
|
rimCaseCollection->parentFields(fields);
|
|
|
|
if (fields.size() == 1)
|
|
|
|
{
|
|
|
|
if (fields[0]->keyword() == "StatisticsCaseCollection")
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2013-04-02 09:59:55 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimCase* RimIdenticalGridCaseGroup::mainCase()
|
|
|
|
{
|
|
|
|
if(caseCollection()->reservoirs().size())
|
|
|
|
{
|
|
|
|
return caseCollection()->reservoirs()[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 10:27:45 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimIdenticalGridCaseGroup::canCaseBeAdded(RimCase* reservoir) const
|
|
|
|
{
|
|
|
|
CVF_ASSERT(reservoir && reservoir->reservoirData() && reservoir->reservoirData()->mainGrid());
|
|
|
|
|
|
|
|
if (!m_mainGrid)
|
|
|
|
{
|
|
|
|
// Empty case group, reservoir can be added
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
RigMainGrid* incomingMainGrid = reservoir->reservoirData()->mainGrid();
|
|
|
|
|
|
|
|
if (RigGridManager::isEqual(m_mainGrid, incomingMainGrid))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|