mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add temporary icon for Grid Models in PDM, should create proper icon later.
p4#: 21850
This commit is contained in:
213
ApplicationCode/ProjectDataModel/RimAnalysisModels.cpp
Normal file
213
ApplicationCode/ProjectDataModel/RimAnalysisModels.cpp
Normal file
@@ -0,0 +1,213 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiaStdInclude.h"
|
||||
|
||||
#include "RimAnalysisModels.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RimProject.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "RimReservoirView.h"
|
||||
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaVersionInfo.h"
|
||||
|
||||
#include "RigGridManager.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RimResultCase.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
#include "RimReservoirCellResultsCacher.h"
|
||||
#include "RimCellEdgeResultSlot.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellPropertyFilterCollection.h"
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimWellCollection.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimResultSlot.h"
|
||||
#include "RimStatisticsCase.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimScriptCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAnalysisModels, "ResInsightAnalysisModels");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisModels::RimAnalysisModels(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&cases, "Reservoirs", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&caseGroups, "CaseGroups", "", "", "", "");
|
||||
|
||||
m_gridCollection = new RigGridManager;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisModels::~RimAnalysisModels(void)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisModels::close()
|
||||
{
|
||||
m_gridCollection->clear();
|
||||
|
||||
cases.deleteAllChildObjects();
|
||||
caseGroups.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIdenticalGridCaseGroup* RimAnalysisModels::createIdenticalCaseGroupFromMainCase(RimCase* mainCase)
|
||||
{
|
||||
CVF_ASSERT(mainCase);
|
||||
|
||||
RigCaseData* rigEclipseCase = mainCase->reservoirData();
|
||||
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
|
||||
CVF_ASSERT(equalGrid);
|
||||
|
||||
RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup;
|
||||
assert(RiaApplication::instance()->project());
|
||||
RiaApplication::instance()->project()->assignIdToCaseGroup(group);
|
||||
|
||||
RimCase* createdCase = group->createAndAppendStatisticsCase();
|
||||
RiaApplication::instance()->project()->assignCaseIdToCase(createdCase);
|
||||
|
||||
group->addCase(mainCase);
|
||||
caseGroups().push_back(group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisModels::moveEclipseCaseIntoCaseGroup(RimCase* rimReservoir)
|
||||
{
|
||||
CVF_ASSERT(rimReservoir);
|
||||
|
||||
RigCaseData* rigEclipseCase = rimReservoir->reservoirData();
|
||||
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
|
||||
CVF_ASSERT(equalGrid);
|
||||
|
||||
// Insert in identical grid group
|
||||
bool foundGroup = false;
|
||||
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
|
||||
if (cg->mainGrid() == equalGrid)
|
||||
{
|
||||
cg->addCase(rimReservoir);
|
||||
foundGroup = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundGroup)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup;
|
||||
assert(RiaApplication::instance()->project());
|
||||
RiaApplication::instance()->project()->assignIdToCaseGroup(group);
|
||||
|
||||
group->addCase(rimReservoir);
|
||||
|
||||
caseGroups().push_back(group);
|
||||
}
|
||||
|
||||
// Remove reservoir from main container
|
||||
cases().removeChildObject(rimReservoir);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisModels::removeCaseFromAllGroups(RimCase* reservoir)
|
||||
{
|
||||
m_gridCollection->removeCase(reservoir->reservoirData());
|
||||
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
|
||||
cg->removeCase(reservoir);
|
||||
}
|
||||
|
||||
cases().removeChildObject(reservoir);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimAnalysisModels::registerCaseInGridCollection(RigCaseData* rigEclipseCase)
|
||||
{
|
||||
CVF_ASSERT(rigEclipseCase);
|
||||
|
||||
RigMainGrid* equalGrid = m_gridCollection->findEqualGrid(rigEclipseCase->mainGrid());
|
||||
|
||||
if (equalGrid)
|
||||
{
|
||||
// Replace the grid with an already registered grid
|
||||
rigEclipseCase->setMainGrid(equalGrid);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is the first insertion of this grid, compute cached data
|
||||
rigEclipseCase->mainGrid()->computeCachedData();
|
||||
|
||||
std::vector<RigGridBase*> grids;
|
||||
rigEclipseCase->allGrids(&grids);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < grids.size(); i++)
|
||||
{
|
||||
grids[i]->computeFaults();
|
||||
}
|
||||
|
||||
equalGrid = rigEclipseCase->mainGrid();
|
||||
}
|
||||
|
||||
m_gridCollection->addCase(rigEclipseCase);
|
||||
|
||||
return equalGrid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisModels::insertCaseInCaseGroup(RimIdenticalGridCaseGroup* caseGroup, RimCase* rimReservoir)
|
||||
{
|
||||
CVF_ASSERT(rimReservoir);
|
||||
|
||||
RigCaseData* rigEclipseCase = rimReservoir->reservoirData();
|
||||
registerCaseInGridCollection(rigEclipseCase);
|
||||
|
||||
caseGroup->addCase(rimReservoir);
|
||||
}
|
||||
|
||||
55
ApplicationCode/ProjectDataModel/RimAnalysisModels.h
Normal file
55
ApplicationCode/ProjectDataModel/RimAnalysisModels.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmDocument.h"
|
||||
|
||||
class RimCase;
|
||||
class RigGridManager;
|
||||
class RimIdenticalGridCaseGroup;
|
||||
class RigMainGrid;
|
||||
class RigCaseData;
|
||||
class RimWellPathCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnalysisModels : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimAnalysisModels(void);
|
||||
virtual ~RimAnalysisModels(void);
|
||||
|
||||
caf::PdmPointersField<RimCase*> cases;
|
||||
caf::PdmPointersField<RimIdenticalGridCaseGroup*> caseGroups;
|
||||
|
||||
void close();
|
||||
|
||||
RimIdenticalGridCaseGroup* createIdenticalCaseGroupFromMainCase(RimCase* mainCase);
|
||||
void insertCaseInCaseGroup(RimIdenticalGridCaseGroup* caseGroup, RimCase* rimReservoir);
|
||||
void moveEclipseCaseIntoCaseGroup(RimCase* rimReservoir);
|
||||
void removeCaseFromAllGroups(RimCase* rimReservoir);
|
||||
|
||||
private:
|
||||
RigMainGrid* registerCaseInGridCollection(RigCaseData* rigEclipseCase);
|
||||
cvf::ref<RigGridManager> m_gridCollection;
|
||||
};
|
||||
76
ApplicationCode/ProjectDataModel/RimOilField.cpp
Normal file
76
ApplicationCode/ProjectDataModel/RimOilField.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RiaStdInclude.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "RimReservoirView.h"
|
||||
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaVersionInfo.h"
|
||||
|
||||
#include "RigGridManager.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RimResultCase.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimAnalysisModels.h"
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
#include "RimReservoirCellResultsCacher.h"
|
||||
#include "RimCellEdgeResultSlot.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellPropertyFilterCollection.h"
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimWellCollection.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimResultSlot.h"
|
||||
#include "RimStatisticsCase.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilField::RimOilField(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "");
|
||||
|
||||
analysisModels = new RimAnalysisModels();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilField::~RimOilField(void)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOilField::close()
|
||||
{
|
||||
if (wellPathCollection()) delete wellPathCollection();
|
||||
if (analysisModels()) delete analysisModels();
|
||||
}
|
||||
47
ApplicationCode/ProjectDataModel/RimOilField.h
Normal file
47
ApplicationCode/ProjectDataModel/RimOilField.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmDocument.h"
|
||||
|
||||
class RimCase;
|
||||
class RigGridManager;
|
||||
class RimIdenticalGridCaseGroup;
|
||||
class RigMainGrid;
|
||||
class RigCaseData;
|
||||
class RimWellPathCollection;
|
||||
class RimAnalysisModels;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimOilField : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimOilField(void);
|
||||
virtual ~RimOilField(void);
|
||||
|
||||
caf::PdmField<RimAnalysisModels*> analysisModels;
|
||||
caf::PdmField<RimWellPathCollection*> wellPathCollection;
|
||||
|
||||
void close();
|
||||
};
|
||||
Reference in New Issue
Block a user