mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use same collection type for source cases and statistics cases in RimIdenticalGridCaseGroup
p4#: 21053
This commit is contained in:
parent
d85b0d4619
commit
d1cc482355
@ -286,7 +286,7 @@ bool RIApplication::loadProject(const QString& projectFileName)
|
|||||||
{
|
{
|
||||||
if (m_project->caseGroups[cgIdx]->statisticsCaseCollection())
|
if (m_project->caseGroups[cgIdx]->statisticsCaseCollection())
|
||||||
{
|
{
|
||||||
caf::PdmPointersField<RimStatisticsCase*> & statCases = m_project->caseGroups[cgIdx]->statisticsCaseCollection()->cases();
|
caf::PdmPointersField<RimReservoir*> & statCases = m_project->caseGroups[cgIdx]->statisticsCaseCollection()->reservoirs();
|
||||||
for (size_t scIdx = 0; scIdx < statCases.size(); ++scIdx)
|
for (size_t scIdx = 0; scIdx < statCases.size(); ++scIdx)
|
||||||
{
|
{
|
||||||
casesToLoad.push_back(statCases[scIdx]);
|
casesToLoad.push_back(statCases[scIdx]);
|
||||||
|
@ -57,6 +57,7 @@ QString createResultNameMin(const QString& resultName) { return resultName + "_
|
|||||||
QString createResultNameMax(const QString& resultName) { return resultName + "_MAX"; }
|
QString createResultNameMax(const QString& resultName) { return resultName + "_MAX"; }
|
||||||
QString createResultNameMean(const QString& resultName) { return resultName + "_MEAN"; }
|
QString createResultNameMean(const QString& resultName) { return resultName + "_MEAN"; }
|
||||||
QString createResultNameDev(const QString& resultName) { return resultName + "_DEV"; }
|
QString createResultNameDev(const QString& resultName) { return resultName + "_DEV"; }
|
||||||
|
QString createResultNameRange(const QString& resultName) { return resultName + "_RANGE"; }
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -127,6 +128,7 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<QPair<RimDefines
|
|||||||
QString maxResultName = createResultNameMax(resultName);
|
QString maxResultName = createResultNameMax(resultName);
|
||||||
QString meanResultName = createResultNameMean(resultName);
|
QString meanResultName = createResultNameMean(resultName);
|
||||||
QString devResultName = createResultNameDev(resultName);
|
QString devResultName = createResultNameDev(resultName);
|
||||||
|
QString rangeResultName = createResultNameRange(resultName);
|
||||||
|
|
||||||
if (activeMatrixCellCount > 0)
|
if (activeMatrixCellCount > 0)
|
||||||
{
|
{
|
||||||
@ -134,6 +136,7 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<QPair<RimDefines
|
|||||||
addNamedResult(matrixResults, resultType, maxResultName, activeMatrixCellCount);
|
addNamedResult(matrixResults, resultType, maxResultName, activeMatrixCellCount);
|
||||||
addNamedResult(matrixResults, resultType, meanResultName, activeMatrixCellCount);
|
addNamedResult(matrixResults, resultType, meanResultName, activeMatrixCellCount);
|
||||||
addNamedResult(matrixResults, resultType, devResultName, activeMatrixCellCount);
|
addNamedResult(matrixResults, resultType, devResultName, activeMatrixCellCount);
|
||||||
|
addNamedResult(matrixResults, resultType, rangeResultName, activeMatrixCellCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,6 +189,7 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<QPair<RimDefines
|
|||||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectMax = NULL;
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectMax = NULL;
|
||||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectMean = NULL;
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectMean = NULL;
|
||||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectDev = NULL;
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectDev = NULL;
|
||||||
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectRange = NULL;
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t scalarResultIndex = matrixResults->findScalarResultIndex(resultType, createResultNameMin(resultName));
|
size_t scalarResultIndex = matrixResults->findScalarResultIndex(resultType, createResultNameMin(resultName));
|
||||||
@ -219,13 +223,21 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<QPair<RimDefines
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double min, max, mean, dev;
|
{
|
||||||
|
size_t scalarResultIndex = matrixResults->findScalarResultIndex(resultType, createResultNameRange(resultName));
|
||||||
|
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
dataAccessObjectRange = m_destinationCase->dataAccessObject(grid, RifReaderInterface::MATRIX_RESULTS, dataAccessTimeStepIndex, scalarResultIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double min, max, mean, dev, range;
|
||||||
for (size_t cellIdx = 0; cellIdx < grid->cellCount(); cellIdx++)
|
for (size_t cellIdx = 0; cellIdx < grid->cellCount(); cellIdx++)
|
||||||
{
|
{
|
||||||
std::vector<double> values(dataAccesObjectList.size(), HUGE_VAL);
|
std::vector<double> values(dataAccesObjectList.size(), HUGE_VAL);
|
||||||
|
|
||||||
size_t globalGridCellIdx = grid->globalGridCellIndex(cellIdx);
|
size_t globalGridCellIdx = grid->globalGridCellIndex(cellIdx);
|
||||||
if (m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(globalGridCellIdx))
|
if (m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(globalGridCellIdx))
|
||||||
{
|
{
|
||||||
bool foundAnyValidValues = false;
|
bool foundAnyValidValues = false;
|
||||||
for (size_t caseIdx = 0; caseIdx < dataAccesObjectList.size(); caseIdx++)
|
for (size_t caseIdx = 0; caseIdx < dataAccesObjectList.size(); caseIdx++)
|
||||||
@ -243,11 +255,12 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<QPair<RimDefines
|
|||||||
max = HUGE_VAL;
|
max = HUGE_VAL;
|
||||||
mean = HUGE_VAL;
|
mean = HUGE_VAL;
|
||||||
dev = HUGE_VAL;
|
dev = HUGE_VAL;
|
||||||
|
range = HUGE_VAL;
|
||||||
|
|
||||||
if (foundAnyValidValues)
|
if (foundAnyValidValues)
|
||||||
{
|
{
|
||||||
RimStatisticsEvaluator stat(values);
|
RimStatisticsEvaluator stat(values);
|
||||||
stat.getStatistics(min, max, mean, dev);
|
stat.getStatistics(min, max, mean, dev, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataAccessObjectMin.notNull())
|
if (dataAccessObjectMin.notNull())
|
||||||
@ -269,6 +282,11 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<QPair<RimDefines
|
|||||||
{
|
{
|
||||||
dataAccessObjectDev->setCellScalar(cellIdx, dev);
|
dataAccessObjectDev->setCellScalar(cellIdx, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dataAccessObjectRange.notNull())
|
||||||
|
{
|
||||||
|
dataAccessObjectRange->setCellScalar(cellIdx, range);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void getStatistics(double& min, double& max, double& mean, double& dev)
|
void getStatistics(double& min, double& max, double& mean, double& dev, double& range)
|
||||||
{
|
{
|
||||||
evaluate();
|
evaluate();
|
||||||
|
|
||||||
@ -55,6 +55,8 @@ public:
|
|||||||
max = m_max;
|
max = m_max;
|
||||||
mean = m_mean;
|
mean = m_mean;
|
||||||
dev = m_dev;
|
dev = m_dev;
|
||||||
|
|
||||||
|
range = m_max - m_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -47,7 +47,7 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup()
|
|||||||
CAF_PDM_InitFieldNoDefault(&caseCollection, "CaseCollection", "Cases", ":/Cases16x16.png", "", "");
|
CAF_PDM_InitFieldNoDefault(&caseCollection, "CaseCollection", "Cases", ":/Cases16x16.png", "", "");
|
||||||
|
|
||||||
caseCollection = new RimCaseCollection;
|
caseCollection = new RimCaseCollection;
|
||||||
statisticsCaseCollection = new RimStatisticsCaseCollection;
|
statisticsCaseCollection = new RimCaseCollection;
|
||||||
|
|
||||||
m_mainGrid = NULL;
|
m_mainGrid = NULL;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ void RimIdenticalGridCaseGroup::addCase(RimReservoir* reservoir)
|
|||||||
|
|
||||||
caseCollection()->reservoirs().push_back(reservoir);
|
caseCollection()->reservoirs().push_back(reservoir);
|
||||||
|
|
||||||
if (statisticsCaseCollection->cases().size() == 0)
|
if (statisticsCaseCollection->reservoirs().size() == 0)
|
||||||
{
|
{
|
||||||
createAndAppendStatisticsCase();
|
createAndAppendStatisticsCase();
|
||||||
}
|
}
|
||||||
@ -174,9 +174,9 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
|
|||||||
// Check if we need to calculate the union of the active cells
|
// Check if we need to calculate the union of the active cells
|
||||||
|
|
||||||
bool foundResultsInCache = false;
|
bool foundResultsInCache = false;
|
||||||
for (size_t i = 0; i < statisticsCaseCollection()->cases.size(); i++)
|
for (size_t i = 0; i < statisticsCaseCollection()->reservoirs.size(); i++)
|
||||||
{
|
{
|
||||||
RimStatisticsCase* rimReservoir = statisticsCaseCollection()->cases[i];
|
RimReservoir* rimReservoir = statisticsCaseCollection()->reservoirs[i];
|
||||||
|
|
||||||
// Check if any results are stored in cache
|
// Check if any results are stored in cache
|
||||||
if (rimReservoir->results(RifReaderInterface::MATRIX_RESULTS)->storedResultsCount() > 0 ||
|
if (rimReservoir->results(RifReaderInterface::MATRIX_RESULTS)->storedResultsCount() > 0 ||
|
||||||
@ -194,9 +194,9 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
|
|||||||
|
|
||||||
// "Load" the statistical cases
|
// "Load" the statistical cases
|
||||||
|
|
||||||
for (size_t i = 0; i < statisticsCaseCollection()->cases.size(); i++)
|
for (size_t i = 0; i < statisticsCaseCollection()->reservoirs.size(); i++)
|
||||||
{
|
{
|
||||||
RimStatisticsCase* rimReservoir = statisticsCaseCollection()->cases[i];
|
RimReservoir* rimReservoir = statisticsCaseCollection()->reservoirs[i];
|
||||||
|
|
||||||
rimReservoir->openEclipseGridFile();
|
rimReservoir->openEclipseGridFile();
|
||||||
|
|
||||||
@ -297,14 +297,14 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimStatisticsCase* RimIdenticalGridCaseGroup::createAndAppendStatisticsCase()
|
RimStatisticsCase* RimIdenticalGridCaseGroup::createAndAppendStatisticsCase()
|
||||||
{
|
{
|
||||||
RimStatisticsCase* newObject = new RimStatisticsCase;
|
RimStatisticsCase* newStatisticsCase = new RimStatisticsCase;
|
||||||
|
|
||||||
newObject->caseName = QString("Statistics ") + QString::number(statisticsCaseCollection()->cases.size()+1);
|
newStatisticsCase->caseName = QString("Statistics ") + QString::number(statisticsCaseCollection()->reservoirs.size()+1);
|
||||||
statisticsCaseCollection()->cases.push_back(newObject);
|
statisticsCaseCollection()->reservoirs.push_back(newStatisticsCase);
|
||||||
|
|
||||||
newObject->openEclipseGridFile();
|
newStatisticsCase->openEclipseGridFile();
|
||||||
|
|
||||||
return newObject;
|
return newStatisticsCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -312,9 +312,9 @@ RimStatisticsCase* RimIdenticalGridCaseGroup::createAndAppendStatisticsCase()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
|
void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < statisticsCaseCollection->cases().size(); i++)
|
for (size_t i = 0; i < statisticsCaseCollection->reservoirs().size(); i++)
|
||||||
{
|
{
|
||||||
RimStatisticsCase* rimStaticsCase = statisticsCaseCollection->cases[i];
|
RimReservoir* rimStaticsCase = statisticsCaseCollection->reservoirs[i];
|
||||||
|
|
||||||
rimStaticsCase->reservoirData()->setMainGrid(this->mainGrid());
|
rimStaticsCase->reservoirData()->setMainGrid(this->mainGrid());
|
||||||
|
|
||||||
@ -330,9 +330,11 @@ void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimIdenticalGridCaseGroup::clearStatisticsResults()
|
void RimIdenticalGridCaseGroup::clearStatisticsResults()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < statisticsCaseCollection->cases().size(); i++)
|
for (size_t i = 0; i < statisticsCaseCollection->reservoirs().size(); i++)
|
||||||
{
|
{
|
||||||
RimStatisticsCase* rimStaticsCase = statisticsCaseCollection->cases[i];
|
RimReservoir* rimStaticsCase = statisticsCaseCollection->reservoirs[i];
|
||||||
|
if (!rimStaticsCase) continue;
|
||||||
|
|
||||||
rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->clearAllResults();
|
rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->clearAllResults();
|
||||||
rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->clearAllResults();
|
rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->clearAllResults();
|
||||||
|
|
||||||
@ -385,3 +387,21 @@ RigActiveCellInfo* RimIdenticalGridCaseGroup::unionOfActiveCells(RifReaderInterf
|
|||||||
return m_unionOfFractureActiveCells.p();
|
return m_unionOfFractureActiveCells.p();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@ -51,8 +51,8 @@ public:
|
|||||||
|
|
||||||
RimStatisticsCase* createAndAppendStatisticsCase();
|
RimStatisticsCase* createAndAppendStatisticsCase();
|
||||||
|
|
||||||
caf::PdmField<RimCaseCollection*> caseCollection;
|
caf::PdmField<RimCaseCollection*> caseCollection;
|
||||||
caf::PdmField<RimStatisticsCaseCollection*> statisticsCaseCollection;
|
caf::PdmField<RimCaseCollection*> statisticsCaseCollection;
|
||||||
|
|
||||||
void loadMainCaseAndActiveCellInfo();
|
void loadMainCaseAndActiveCellInfo();
|
||||||
|
|
||||||
@ -61,6 +61,8 @@ public:
|
|||||||
|
|
||||||
void computeUnionOfActiveCells();
|
void computeUnionOfActiveCells();
|
||||||
|
|
||||||
|
static bool isStatisticsCaseCollection(RimCaseCollection* rimCaseCollection);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
|
|
||||||
|
@ -98,9 +98,9 @@ void RimStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimStatisticsCaseCollection* RimStatisticsCase::parentStatisticsCaseCollection()
|
RimCaseCollection* RimStatisticsCase::parentStatisticsCaseCollection()
|
||||||
{
|
{
|
||||||
std::vector<RimStatisticsCaseCollection*> parentObjects;
|
std::vector<RimCaseCollection*> parentObjects;
|
||||||
this->parentObjectsOfType(parentObjects);
|
this->parentObjectsOfType(parentObjects);
|
||||||
|
|
||||||
if (parentObjects.size() > 0)
|
if (parentObjects.size() > 0)
|
||||||
@ -210,7 +210,7 @@ void RimStatisticsCase::getSourceCases(std::vector<RimReservoir*>& sourceCases)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimIdenticalGridCaseGroup* RimStatisticsCase::caseGroup()
|
RimIdenticalGridCaseGroup* RimStatisticsCase::caseGroup()
|
||||||
{
|
{
|
||||||
RimStatisticsCaseCollection* parentCollection = parentStatisticsCaseCollection();
|
RimCaseCollection* parentCollection = parentStatisticsCaseCollection();
|
||||||
if (parentCollection)
|
if (parentCollection)
|
||||||
{
|
{
|
||||||
return parentCollection->parentCaseGroup();
|
return parentCollection->parentCaseGroup();
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
caf::PdmField<QString> m_resultName;
|
caf::PdmField<QString> m_resultName;
|
||||||
|
|
||||||
RimStatisticsCaseCollection* parentStatisticsCaseCollection();
|
RimCaseCollection* parentStatisticsCaseCollection();
|
||||||
|
|
||||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) const;
|
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) const;
|
||||||
void computeStatistics();
|
void computeStatistics();
|
||||||
|
@ -229,8 +229,18 @@ void RimUiTreeModelPdm::deleteReservoir(RimReservoir* reservoir)
|
|||||||
removeRows_special(mi.row(), 1, mi.parent());
|
removeRows_special(mi.row(), 1, mi.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
RimProject* proj = RIApplication::instance()->project();
|
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(caseCollection))
|
||||||
proj->removeCaseFromAllGroups(reservoir);
|
{
|
||||||
|
RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
|
||||||
|
CVF_ASSERT(caseGroup);
|
||||||
|
|
||||||
|
caseGroup->statisticsCaseCollection()->reservoirs.removeChildObject(reservoir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RimProject* proj = RIApplication::instance()->project();
|
||||||
|
proj->removeCaseFromAllGroups(reservoir);
|
||||||
|
}
|
||||||
|
|
||||||
delete reservoir;
|
delete reservoir;
|
||||||
|
|
||||||
@ -492,25 +502,32 @@ RimStatisticsCase* RimUiTreeModelPdm::addStatisticalCalculation(const QModelInde
|
|||||||
position = itemIndex.row();
|
position = itemIndex.row();
|
||||||
collectionIndex = itemIndex.parent();
|
collectionIndex = itemIndex.parent();
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<RimStatisticsCaseCollection*>(currentItem->dataObject().p()))
|
else if (dynamic_cast<RimCaseCollection*>(currentItem->dataObject().p()))
|
||||||
{
|
{
|
||||||
RimStatisticsCaseCollection* statColl = dynamic_cast<RimStatisticsCaseCollection*>(currentItem->dataObject().p());
|
RimCaseCollection* statColl = dynamic_cast<RimCaseCollection*>(currentItem->dataObject().p());
|
||||||
caseGroup = statColl->parentCaseGroup();
|
caseGroup = statColl->parentCaseGroup();
|
||||||
parentCollectionItem = currentItem;
|
parentCollectionItem = currentItem;
|
||||||
position = parentCollectionItem->childCount();
|
position = parentCollectionItem->childCount();
|
||||||
collectionIndex = itemIndex;
|
collectionIndex = itemIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
beginInsertRows(collectionIndex, position, position);
|
if (parentCollectionItem && caseGroup)
|
||||||
|
{
|
||||||
|
beginInsertRows(collectionIndex, position, position);
|
||||||
|
|
||||||
RimStatisticsCase* createdObject = caseGroup->createAndAppendStatisticsCase();
|
RimStatisticsCase* createdObject = caseGroup->createAndAppendStatisticsCase();
|
||||||
caf::PdmUiTreeItem* childItem = new caf::PdmUiTreeItem(parentCollectionItem, position, createdObject);
|
caf::PdmUiTreeItem* childItem = new caf::PdmUiTreeItem(parentCollectionItem, position, createdObject);
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
insertedModelIndex = index(position, 0, collectionIndex);
|
insertedModelIndex = index(position, 0, collectionIndex);
|
||||||
|
|
||||||
return createdObject;
|
return createdObject;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -196,6 +196,14 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction(m_pasteAction);
|
menu.addAction(m_pasteAction);
|
||||||
|
|
||||||
|
// Check if parent field is a StatisticsCaseCollection
|
||||||
|
RimCaseCollection* rimCaseCollection = dynamic_cast<RimCaseCollection*>(uiItem->dataObject().p());
|
||||||
|
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(rimCaseCollection))
|
||||||
|
{
|
||||||
|
menu.addAction(QString("New Statistics Case"), this, SLOT(slotNewStatisticsCase()));
|
||||||
|
}
|
||||||
|
|
||||||
menu.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -803,7 +811,7 @@ void RimUiTreeView::slotCloseCase()
|
|||||||
group.addObject(uiItem->dataObject().p());
|
group.addObject(uiItem->dataObject().p());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<caf::PdmPointer<RimResultReservoir> > typedObjects;
|
std::vector<caf::PdmPointer<RimReservoir> > typedObjects;
|
||||||
group.objectsByType(&typedObjects);
|
group.objectsByType(&typedObjects);
|
||||||
|
|
||||||
for (size_t i = 0; i < typedObjects.size(); i++)
|
for (size_t i = 0; i < typedObjects.size(); i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user