mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Established new PDM structure with RimProject owning RimOilFields owning RimAnalysisModels.
Moved wellPathCollection into new class RimOilFields. Moved cases (previously called reservoirs) and caseGroups from RimProject into new class RimAnalysisGroups. Added support for old project files, move cases and caseGroups from RimProject to RimAnalysisModels. (Do not handle WellPaths for old project files in a similar way, since almost no users have used this functionality yet.) p4#: 21846
This commit is contained in:
@@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimAnalysisModels.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellPropertyFilter.h
|
||||
@@ -13,6 +14,7 @@ ${CEE_CURRENT_LIST_DIR}RimCellRangeFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellRangeFilterCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimDefines.h
|
||||
${CEE_CURRENT_LIST_DIR}RimLegendConfig.h
|
||||
${CEE_CURRENT_LIST_DIR}RimOilField.h
|
||||
${CEE_CURRENT_LIST_DIR}RimProject.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCase.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIdenticalGridCaseGroup.h
|
||||
@@ -43,6 +45,7 @@ ${CEE_CURRENT_LIST_DIR}RimMimeData.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimAnalysisModels.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellPropertyFilter.cpp
|
||||
@@ -51,6 +54,7 @@ ${CEE_CURRENT_LIST_DIR}RimCellRangeFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellRangeFilterCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimDefines.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimLegendConfig.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimOilField.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimProject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCase.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIdenticalGridCaseGroup.cpp
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimAnalysisModels.h"
|
||||
|
||||
#include "RimReservoirView.h"
|
||||
|
||||
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
|
||||
@@ -53,6 +55,9 @@ CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimProject::RimProject(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&oilFields, "OilFields", "Oil Fields", "", "", "");
|
||||
oilFields.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_projectFileVersionString, "ProjectFileVersionString", "", "", "", "");
|
||||
m_projectFileVersionString.setUiHidden(true);
|
||||
|
||||
@@ -62,8 +67,12 @@ RimProject::RimProject(void)
|
||||
CAF_PDM_InitField(&nextValidCaseGroupId, "NextValidCaseGroupId", 0, "Next Valid Case Group ID", "", "" ,"");
|
||||
nextValidCaseGroupId.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&reservoirs, "Reservoirs", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&caseGroups, "CaseGroups", "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&casesObsolete, "Reservoirs", "", "", "", "");
|
||||
casesObsolete.setUiHidden(true);
|
||||
casesObsolete.setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
||||
CAF_PDM_InitFieldNoDefault(&caseGroupsObsolete, "CaseGroups", "", "", "", "");
|
||||
caseGroupsObsolete.setUiHidden(true);
|
||||
caseGroupsObsolete.setIOWritable(false); // read but not write, they will be moved into RimAnalysisGroups
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
||||
@@ -75,10 +84,6 @@ RimProject::RimProject(void)
|
||||
scriptCollection = new RimScriptCollection();
|
||||
scriptCollection->directory.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
|
||||
|
||||
m_gridCollection = new RigGridManager;
|
||||
|
||||
initScriptDirectories();
|
||||
}
|
||||
|
||||
@@ -90,9 +95,7 @@ RimProject::~RimProject(void)
|
||||
close();
|
||||
|
||||
if (scriptCollection()) delete scriptCollection();
|
||||
if (wellPathCollection()) delete wellPathCollection();
|
||||
|
||||
reservoirs.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -100,11 +103,17 @@ RimProject::~RimProject(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::close()
|
||||
{
|
||||
m_gridCollection->clear();
|
||||
size_t numOilFields = oilFields().size();
|
||||
for (size_t oilFieldsIdx = 0; oilFieldsIdx < numOilFields; oilFieldsIdx++)
|
||||
{
|
||||
RimOilField* oilField = oilFields[oilFieldsIdx];
|
||||
if (oilField == NULL) continue;
|
||||
|
||||
reservoirs.deleteAllChildObjects();
|
||||
caseGroups.deleteAllChildObjects();
|
||||
if (wellPathCollection != NULL) delete wellPathCollection;
|
||||
oilField->close();
|
||||
}
|
||||
oilFields.deleteAllChildObjects();
|
||||
casesObsolete.deleteAllChildObjects();
|
||||
caseGroupsObsolete.deleteAllChildObjects();
|
||||
|
||||
fileName = "";
|
||||
|
||||
@@ -157,12 +166,14 @@ void RimProject::initScriptDirectories()
|
||||
}
|
||||
|
||||
// Find largest used groupId read from file and make sure all groups have a valid groupId
|
||||
RimAnalysisModels* analysisModels = activeOilField() ? activeOilField()->analysisModels() : NULL;
|
||||
if (analysisModels)
|
||||
{
|
||||
int largestGroupId = -1;
|
||||
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
|
||||
for (size_t i = 0; i < analysisModels->caseGroups().size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups()[i];
|
||||
|
||||
if (cg->groupId > largestGroupId)
|
||||
{
|
||||
@@ -176,9 +187,9 @@ void RimProject::initScriptDirectories()
|
||||
}
|
||||
|
||||
// Assign group Id to groups with an invalid Id
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
for (size_t i = 0; i < analysisModels->caseGroups().size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups()[i];
|
||||
|
||||
if (cg->groupId < 0)
|
||||
{
|
||||
@@ -186,7 +197,6 @@ void RimProject::initScriptDirectories()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +207,62 @@ void RimProject::initAfterRead()
|
||||
{
|
||||
initScriptDirectories();
|
||||
|
||||
if (wellPathCollection) wellPathCollection->setProject(this);
|
||||
// Create an empty oil field in case the project did not contain one
|
||||
if (oilFields.size() < 1)
|
||||
{
|
||||
oilFields.push_back(new RimOilField);
|
||||
}
|
||||
|
||||
// Handle old project files with obsolete structure.
|
||||
// Move caseGroupsObsolete and casesObsolete to oilFields()[idx]->analysisModels()
|
||||
RimAnalysisModels* analysisModels = activeOilField() ? activeOilField()->analysisModels() : NULL;
|
||||
bool movedOneRimIdenticalGridCaseGroup = false;
|
||||
for (size_t cgIdx = 0; cgIdx < caseGroupsObsolete.size(); ++cgIdx)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* sourceCaseGroup = caseGroupsObsolete[cgIdx];
|
||||
if (analysisModels)
|
||||
{
|
||||
analysisModels->caseGroups.push_back(sourceCaseGroup);
|
||||
printf("Moved m_project->caseGroupsObsolete[%i] to first oil fields analysis models\n", cgIdx);
|
||||
movedOneRimIdenticalGridCaseGroup = true; // moved at least one so assume the others will be moved too...
|
||||
}
|
||||
}
|
||||
|
||||
if (movedOneRimIdenticalGridCaseGroup)
|
||||
{
|
||||
caseGroupsObsolete.clear();
|
||||
}
|
||||
|
||||
bool movedOneRimCase = false;
|
||||
for (size_t cIdx = 0; cIdx < casesObsolete().size(); ++cIdx)
|
||||
{
|
||||
RimCase* sourceCase = casesObsolete[cIdx];
|
||||
if (analysisModels)
|
||||
{
|
||||
analysisModels->cases.push_back(sourceCase);
|
||||
printf("Moved m_project->casesObsolete[%i] to first oil fields analysis models\n", cIdx);
|
||||
movedOneRimCase = true; // moved at least one so assume the others will be moved too...
|
||||
}
|
||||
}
|
||||
|
||||
if (movedOneRimCase)
|
||||
{
|
||||
casesObsolete.clear();
|
||||
}
|
||||
|
||||
if (casesObsolete().size() > 0 || caseGroupsObsolete.size() > 0)
|
||||
{
|
||||
printf("RimProject::initAfterRead: Was not able to move all cases (%i left) or caseGroups (%i left) from Project to analysisModels",
|
||||
casesObsolete().size(), caseGroupsObsolete.size());
|
||||
}
|
||||
|
||||
// Set project pointer to each well path
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
RimOilField* oilField = oilFields[oilFieldIdx];
|
||||
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
|
||||
oilField->wellPathCollection->setProject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,135 +308,6 @@ QString RimProject::projectFileVersionString() const
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIdenticalGridCaseGroup* RimProject::createIdenticalCaseGroupFromMainCase(RimCase* mainCase)
|
||||
{
|
||||
CVF_ASSERT(mainCase);
|
||||
|
||||
RigCaseData* rigEclipseCase = mainCase->reservoirData();
|
||||
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
|
||||
CVF_ASSERT(equalGrid);
|
||||
|
||||
RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup;
|
||||
assignIdToCaseGroup(group);
|
||||
|
||||
RimCase* createdCase = group->createAndAppendStatisticsCase();
|
||||
assignCaseIdToCase(createdCase);
|
||||
|
||||
group->addCase(mainCase);
|
||||
caseGroups().push_back(group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::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;
|
||||
assignIdToCaseGroup(group);
|
||||
|
||||
group->addCase(rimReservoir);
|
||||
|
||||
caseGroups().push_back(group);
|
||||
}
|
||||
|
||||
// Remove reservoir from main container
|
||||
reservoirs().removeChildObject(rimReservoir);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::removeCaseFromAllGroups(RimCase* reservoir)
|
||||
{
|
||||
m_gridCollection->removeCase(reservoir->reservoirData());
|
||||
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
|
||||
cg->removeCase(reservoir);
|
||||
}
|
||||
|
||||
reservoirs().removeChildObject(reservoir);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimProject::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 RimProject::insertCaseInCaseGroup(RimIdenticalGridCaseGroup* caseGroup, RimCase* rimReservoir)
|
||||
{
|
||||
CVF_ASSERT(rimReservoir);
|
||||
|
||||
RigCaseData* rigEclipseCase = rimReservoir->reservoirData();
|
||||
registerCaseInGridCollection(rigEclipseCase);
|
||||
|
||||
caseGroup->addCase(rimReservoir);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -388,7 +324,7 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
|
||||
QFileInfo fileInfoOld(oldProjectFileName);
|
||||
QString oldProjectPath = fileInfoOld.path();
|
||||
|
||||
// Loop over all reservoirs and update file path
|
||||
// Loop over all cases and update file path
|
||||
|
||||
std::vector<RimCase*> cases;
|
||||
allCases(cases);
|
||||
@@ -429,23 +365,31 @@ void RimProject::assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::allCases(std::vector<RimCase*>& cases)
|
||||
{
|
||||
for (size_t i = 0; i < reservoirs.size(); i++)
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
cases.push_back(reservoirs[i]);
|
||||
}
|
||||
RimOilField* oilField = oilFields[oilFieldIdx];
|
||||
RimAnalysisModels* analysisModels = oilField ? oilField->analysisModels() : NULL;
|
||||
if (analysisModels == NULL) continue;
|
||||
|
||||
for (size_t i = 0; i < caseGroups.size(); i++)
|
||||
{
|
||||
RimIdenticalGridCaseGroup* cg = caseGroups()[i];
|
||||
|
||||
for (size_t i = 0; i < cg->statisticsCaseCollection()->reservoirs.size(); i++)
|
||||
for (size_t caseIdx = 0; caseIdx < analysisModels->cases.size(); caseIdx++)
|
||||
{
|
||||
cases.push_back(cg->statisticsCaseCollection()->reservoirs[i]);
|
||||
cases.push_back(analysisModels->cases[caseIdx]);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < cg->caseCollection()->reservoirs.size(); i++)
|
||||
for (size_t cgIdx = 0; cgIdx < analysisModels->caseGroups.size(); cgIdx++)
|
||||
{
|
||||
cases.push_back(cg->caseCollection()->reservoirs[i]);
|
||||
// Load the Main case of each IdenticalGridCaseGroup
|
||||
RimIdenticalGridCaseGroup* cg = analysisModels->caseGroups[cgIdx];
|
||||
if (cg == NULL) continue;
|
||||
|
||||
for (size_t caseIdx = 0; caseIdx < cg->statisticsCaseCollection()->reservoirs.size(); caseIdx++)
|
||||
{
|
||||
cases.push_back(cg->statisticsCaseCollection()->reservoirs[caseIdx]);
|
||||
}
|
||||
|
||||
for (size_t caseIdx = 0; caseIdx < cg->caseCollection()->reservoirs.size(); caseIdx++)
|
||||
{
|
||||
cases.push_back(cg->caseCollection()->reservoirs[caseIdx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,9 +400,13 @@ void RimProject::allCases(std::vector<RimCase*>& cases)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::createDisplayModelAndRedrawAllViews()
|
||||
{
|
||||
for (size_t caseIdx = 0; caseIdx < reservoirs.size(); caseIdx++)
|
||||
std::vector<RimCase*> cases;
|
||||
allCases(cases);
|
||||
for (size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++)
|
||||
{
|
||||
RimCase* rimCase = reservoirs[caseIdx];
|
||||
RimCase* rimCase = cases[caseIdx];
|
||||
if (rimCase == NULL) continue;
|
||||
|
||||
for (size_t viewIdx = 0; viewIdx < rimCase->reservoirViews.size(); viewIdx++)
|
||||
{
|
||||
RimReservoirView* reservoirView = rimCase->reservoirViews[viewIdx];
|
||||
@@ -467,6 +415,27 @@ void RimProject::createDisplayModelAndRedrawAllViews()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Currently there will be only one oil field in Resinsight, so return hardcoded first oil field
|
||||
/// from the RimOilField collection.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilField* RimProject::activeOilField()
|
||||
{
|
||||
if (oilFields.size() > 1)
|
||||
{
|
||||
printf("ERROR: RimProject::activeOilField returns hardcoded first oil field, while oilFields actually contain more than one oil field! Must handle several oil fields in this method!\n");
|
||||
}
|
||||
|
||||
if (oilFields.size() > 0)
|
||||
{
|
||||
return oilFields[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "cafPdmDocument.h"
|
||||
|
||||
class RimOilField;
|
||||
class RimCase;
|
||||
class RigGridManager;
|
||||
class RimScriptCollection;
|
||||
@@ -40,37 +41,30 @@ public:
|
||||
RimProject(void);
|
||||
virtual ~RimProject(void);
|
||||
|
||||
caf::PdmPointersField<RimCase*> reservoirs;
|
||||
caf::PdmPointersField<RimIdenticalGridCaseGroup*> caseGroups;
|
||||
caf::PdmPointersField<RimOilField*> oilFields;
|
||||
caf::PdmField<RimScriptCollection*> scriptCollection;
|
||||
caf::PdmField<QString> treeViewState;
|
||||
caf::PdmField<QString> currentModelIndexPath;
|
||||
caf::PdmField<int> nextValidCaseId; // Unique case ID within a project, used to identify a case from Octave scripts
|
||||
caf::PdmField<int> nextValidCaseGroupId; // Unique case group ID within a project, used to identify a case group from Octave scripts
|
||||
caf::PdmField<RimWellPathCollection*> wellPathCollection;
|
||||
caf::PdmPointersField<RimCase*> casesObsolete; // obsolete
|
||||
caf::PdmPointersField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
|
||||
|
||||
void setScriptDirectories(const QString& scriptDirectories);
|
||||
QString projectFileVersionString() const;
|
||||
void close();
|
||||
|
||||
RimIdenticalGridCaseGroup*
|
||||
createIdenticalCaseGroupFromMainCase(RimCase* mainCase);
|
||||
void insertCaseInCaseGroup(RimIdenticalGridCaseGroup* caseGroup, RimCase* rimReservoir);
|
||||
void moveEclipseCaseIntoCaseGroup(RimCase* rimReservoir);
|
||||
void removeCaseFromAllGroups(RimCase* rimReservoir);
|
||||
|
||||
void setProjectFileNameAndUpdateDependencies(const QString& fileName);
|
||||
|
||||
void assignCaseIdToCase(RimCase* reservoirCase);
|
||||
void assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup);
|
||||
|
||||
void allCases(std::vector<RimCase*>& cases);
|
||||
void createDisplayModelAndRedrawAllViews();
|
||||
void allCases(std::vector<RimCase*>& cases); // VL endre impl
|
||||
void createDisplayModelAndRedrawAllViews(); // VL endre impl
|
||||
|
||||
void computeUtmAreaOfInterest(double* north, double* south, double* east, double* west);
|
||||
|
||||
private:
|
||||
RigMainGrid* registerCaseInGridCollection(RigCaseData* rigEclipseCase);
|
||||
RimOilField* activeOilField();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
@@ -80,5 +74,4 @@ protected:
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_projectFileVersionString;
|
||||
cvf::ref<RigGridManager> m_gridCollection;
|
||||
};
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimAnalysisModels.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RigGridBase.h"
|
||||
@@ -195,7 +197,6 @@ RimReservoirView::~RimReservoirView()
|
||||
delete rangeFilterCollection();
|
||||
delete propertyFilterCollection();
|
||||
delete wellCollection();
|
||||
// delete wellPathCollection();
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
@@ -354,7 +355,8 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
if (scaleZ < 1) scaleZ = 1;
|
||||
|
||||
// Regenerate well paths
|
||||
RimWellPathCollection* wellPathCollection = (RiaApplication::instance() && RiaApplication::instance()->project()) ? RiaApplication::instance()->project()->wellPathCollection() : NULL;
|
||||
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
|
||||
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
|
||||
if (wellPathCollection) wellPathCollection->wellPathCollectionPartMgr()->scheduleGeometryRegen();
|
||||
|
||||
if (m_viewer)
|
||||
@@ -480,6 +482,8 @@ void RimReservoirView::updateScaleTransform()
|
||||
if (m_viewer) m_viewer->updateCachedValuesInScene();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Create display model,
|
||||
/// or at least empty scenes as frames that is delivered to the viewer
|
||||
@@ -583,19 +587,6 @@ void RimReservoirView::createDisplayModel()
|
||||
{
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
|
||||
}
|
||||
|
||||
// Append static Well Paths to model
|
||||
cvf::Vec3d displayModelOffset = eclipseCase()->reservoirData()->mainGrid()->displayModelOffset();
|
||||
double characteristicCellSize = eclipseCase()->reservoirData()->mainGrid()->characteristicIJCellSize();
|
||||
cvf::BoundingBox boundingBox = currentActiveCellInfo()->geometryBoundingBox();
|
||||
RimProject* rimProject = RiaApplication::instance() ? RiaApplication::instance()->project() : NULL;
|
||||
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = (rimProject && rimProject->wellPathCollection()) ? rimProject->wellPathCollection()->wellPathCollectionPartMgr() : NULL;
|
||||
if (wellPathCollectionPartMgr)
|
||||
{
|
||||
printf("Append well paths for frame %i: ", frameIdx);
|
||||
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), displayModelOffset, m_reservoirGridPartManager->scaleTransform(), characteristicCellSize, boundingBox);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Set static colors
|
||||
@@ -603,7 +594,7 @@ void RimReservoirView::createDisplayModel()
|
||||
|
||||
m_visibleGridParts = geometryTypesToAdd;
|
||||
}
|
||||
|
||||
|
||||
// Compute triangle count, Debug only
|
||||
|
||||
if (false)
|
||||
@@ -726,35 +717,75 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
}
|
||||
}
|
||||
|
||||
// Well pipes
|
||||
// Well pipes and well paths
|
||||
if (m_viewer)
|
||||
{
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
cvf::String modelName = "WellPipeModel";
|
||||
std::vector<cvf::Model*> models;
|
||||
// Well pipes
|
||||
// ----------
|
||||
cvf::String wellPipeModelName = "WellPipeModel";
|
||||
std::vector<cvf::Model*> wellPipeModels;
|
||||
for (cvf::uint i = 0; i < frameScene->modelCount(); i++)
|
||||
{
|
||||
if (frameScene->model(i)->name() == modelName)
|
||||
if (frameScene->model(i)->name() == wellPipeModelName)
|
||||
{
|
||||
models.push_back(frameScene->model(i));
|
||||
wellPipeModels.push_back(frameScene->model(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < models.size(); i++)
|
||||
for (size_t i = 0; i < wellPipeModels.size(); i++)
|
||||
{
|
||||
frameScene->removeModel(models[i]);
|
||||
printf("updateCurrentTimeStep: Remove WellPipeModel %i from frameScene\n", i);
|
||||
frameScene->removeModel(wellPipeModels[i]);
|
||||
}
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> pipeModel = new cvf::ModelBasicList;
|
||||
pipeModel->setName(modelName);
|
||||
cvf::ref<cvf::ModelBasicList> wellPipeModelBasicList = new cvf::ModelBasicList;
|
||||
wellPipeModelBasicList->setName(wellPipeModelName);
|
||||
|
||||
m_pipesPartManager->appendDynamicGeometryPartsToModel(pipeModel.p(), m_currentTimeStep);
|
||||
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
|
||||
m_pipesPartManager->updatePipeResultColor(m_currentTimeStep);
|
||||
|
||||
pipeModel->updateBoundingBoxesRecursive();
|
||||
frameScene->addModel(pipeModel.p());
|
||||
wellPipeModelBasicList->updateBoundingBoxesRecursive();
|
||||
printf("updateCurrentTimeStep: Add WellPipeModel to frameScene\n");
|
||||
frameScene->addModel(wellPipeModelBasicList.p());
|
||||
|
||||
// Well paths
|
||||
// ----------
|
||||
cvf::String wellPathModelName = "WellPathModel";
|
||||
std::vector<cvf::Model*> wellPathModels;
|
||||
for (cvf::uint i = 0; i < frameScene->modelCount(); i++)
|
||||
{
|
||||
if (frameScene->model(i)->name() == wellPathModelName)
|
||||
{
|
||||
wellPathModels.push_back(frameScene->model(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < wellPathModels.size(); i++)
|
||||
{
|
||||
printf("updateCurrentTimeStep: Remove WellPathModel %i from frameScene\n", i);
|
||||
frameScene->removeModel(wellPathModels[i]);
|
||||
}
|
||||
|
||||
// Append static Well Paths to model
|
||||
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;
|
||||
wellPathModelBasicList->setName(wellPathModelName);
|
||||
RimOilField* oilFields = (RiaApplication::instance()->project()) ? RiaApplication::instance()->project()->activeOilField() : NULL;
|
||||
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
|
||||
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = (wellPathCollection) ? wellPathCollection->wellPathCollectionPartMgr() : NULL;
|
||||
if (wellPathCollectionPartMgr)
|
||||
{
|
||||
printf("updateCurrentTimeStep: Append well paths for frame %i: ", m_currentTimeStep);
|
||||
cvf::Vec3d displayModelOffset = eclipseCase()->reservoirData()->mainGrid()->displayModelOffset();
|
||||
double characteristicCellSize = eclipseCase()->reservoirData()->mainGrid()->characteristicIJCellSize();
|
||||
cvf::BoundingBox boundingBox = currentActiveCellInfo()->geometryBoundingBox();
|
||||
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList.p(), displayModelOffset, m_reservoirGridPartManager->scaleTransform(), characteristicCellSize, boundingBox);
|
||||
printf("\n");
|
||||
}
|
||||
wellPathModelBasicList->updateBoundingBoxesRecursive();
|
||||
frameScene->addModel(wellPathModelBasicList.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimReservoirCellResultsCacher.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimAnalysisModels.h"
|
||||
|
||||
|
||||
|
||||
@@ -236,32 +237,34 @@ void RimUiTreeModelPdm::deleteReservoir(RimCase* reservoir)
|
||||
{
|
||||
if (reservoir->parentCaseCollection())
|
||||
{
|
||||
RimCaseCollection* caseCollection = reservoir->parentCaseCollection();
|
||||
QModelIndex caseCollectionModelIndex = getModelIndexFromPdmObject(caseCollection);
|
||||
if (!caseCollectionModelIndex.isValid()) return;
|
||||
RimCaseCollection* caseCollection = reservoir->parentCaseCollection();
|
||||
QModelIndex caseCollectionModelIndex = getModelIndexFromPdmObject(caseCollection);
|
||||
if (!caseCollectionModelIndex.isValid()) return;
|
||||
|
||||
QModelIndex mi = getModelIndexFromPdmObjectRecursive(caseCollectionModelIndex, reservoir);
|
||||
if (mi.isValid())
|
||||
{
|
||||
caf::PdmUiTreeItem* uiItem = getTreeItemFromIndex(mi);
|
||||
CVF_ASSERT(uiItem);
|
||||
QModelIndex mi = getModelIndexFromPdmObjectRecursive(caseCollectionModelIndex, reservoir);
|
||||
if (mi.isValid())
|
||||
{
|
||||
caf::PdmUiTreeItem* uiItem = getTreeItemFromIndex(mi);
|
||||
CVF_ASSERT(uiItem);
|
||||
|
||||
// Remove Ui items pointing at the pdm object to delete
|
||||
removeRows_special(mi.row(), 1, mi.parent());
|
||||
}
|
||||
// Remove Ui items pointing at the pdm object to delete
|
||||
removeRows_special(mi.row(), 1, mi.parent());
|
||||
}
|
||||
|
||||
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(caseCollection))
|
||||
{
|
||||
RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
|
||||
CVF_ASSERT(caseGroup);
|
||||
if (RimIdenticalGridCaseGroup::isStatisticsCaseCollection(caseCollection))
|
||||
{
|
||||
RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
|
||||
CVF_ASSERT(caseGroup);
|
||||
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.removeChildObject(reservoir);
|
||||
}
|
||||
else
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
proj->removeCaseFromAllGroups(reservoir);
|
||||
}
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.removeChildObject(reservoir);
|
||||
}
|
||||
else
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimOilField* activeOilField = proj ? proj->activeOilField() : NULL;
|
||||
RimAnalysisModels* analysisModels = (activeOilField) ? activeOilField->analysisModels() : NULL;
|
||||
if (analysisModels) analysisModels->removeCaseFromAllGroups(reservoir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -276,7 +279,9 @@ void RimUiTreeModelPdm::deleteReservoir(RimCase* reservoir)
|
||||
removeRows_special(mi.row(), 1, mi.parent());
|
||||
}
|
||||
|
||||
proj->removeCaseFromAllGroups(reservoir);
|
||||
RimOilField* activeOilField = proj ? proj->activeOilField() : NULL;
|
||||
RimAnalysisModels* analysisModels = (activeOilField) ? activeOilField->analysisModels() : NULL;
|
||||
if (analysisModels) analysisModels->removeCaseFromAllGroups(reservoir);
|
||||
}
|
||||
|
||||
delete reservoir;
|
||||
@@ -605,7 +610,11 @@ RimIdenticalGridCaseGroup* RimUiTreeModelPdm::addCaseGroup(QModelIndex& inserted
|
||||
RimCase* createdReservoir = createdObject->createAndAppendStatisticsCase();
|
||||
proj->assignCaseIdToCase(createdReservoir);
|
||||
createdObject->name = QString("Grid Case Group %1").arg(position + 1);
|
||||
proj->caseGroups().push_back(createdObject);
|
||||
RimAnalysisModels* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL;
|
||||
if (analysisModels)
|
||||
{
|
||||
analysisModels->caseGroups().push_back(createdObject);
|
||||
}
|
||||
|
||||
caf::PdmUiTreeItem* childItem = caf::UiTreeItemBuilderPdm::buildViewItems(rootTreeItem, position, createdObject);
|
||||
endInsertRows();
|
||||
@@ -682,7 +691,9 @@ void RimUiTreeModelPdm::addObjects(const QModelIndex& itemIndex, caf::PdmObjectG
|
||||
}
|
||||
}
|
||||
|
||||
proj->insertCaseInCaseGroup(gridCaseGroup, rimResultReservoir);
|
||||
RimOilField* activeOilField = proj ? proj->activeOilField() : NULL;
|
||||
RimAnalysisModels* analysisModels = (activeOilField) ? activeOilField->analysisModels() : NULL;
|
||||
if (analysisModels) analysisModels->insertCaseInCaseGroup(gridCaseGroup, rimResultReservoir);
|
||||
|
||||
caf::PdmObjectGroup::initAfterReadTraversal(rimResultReservoir);
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellPropertyFilterCollection.h"
|
||||
#include "RimWellCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimAnalysisModels.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -63,8 +65,8 @@ RimWellPathCollection::RimWellPathCollection()
|
||||
|
||||
CAF_PDM_InitField(&wellPathVisibility, "GlobalWellPathVisibility", WellVisibilityEnum(ALL_ON), "Global well path visibility", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.5, "Well Path radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPathCrossSectionVertexCount, "WellPathVertexCount", 12, "Pipe vertex count", "", "", "");
|
||||
CAF_PDM_InitField(&wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.3, "Well Path radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPathCrossSectionVertexCount, "WellPathVertexCount", 12, "Well Path vertex count", "", "", "");
|
||||
wellPathCrossSectionVertexCount.setIOWritable(false);
|
||||
wellPathCrossSectionVertexCount.setIOReadable(false);
|
||||
wellPathCrossSectionVertexCount.setUiHidden(true);
|
||||
|
||||
Reference in New Issue
Block a user