mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
(#401) WIP: CaseToCase mapper creation.
Now only the mapping generation is missing
This commit is contained in:
parent
57ff5becbc
commit
f092c4daef
@ -35,6 +35,12 @@
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RigGeomechCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigCaseToCaseCellMapper.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimViewLink, "RimViewLink");
|
||||
@ -191,7 +197,6 @@ void RimViewLink::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
|
||||
{
|
||||
RimView* rimView = dynamic_cast<RimView*>(prevValue);
|
||||
rimView->setOverrideRangeFilterCollection(NULL);
|
||||
rimView->rangeFilterCollection()->updateDisplayModeNotifyManagedViews();
|
||||
|
||||
RimEclipseView* rimEclipseView = dynamic_cast<RimEclipseView*>(rimView);
|
||||
if (rimEclipseView)
|
||||
@ -207,7 +212,7 @@ void RimViewLink::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
|
||||
|
||||
RimViewLinker* linkedViews = NULL;
|
||||
this->firstAnchestorOrThisOfType(linkedViews);
|
||||
linkedViews->configureOverrides();
|
||||
linkedViews->configureOverrides(); // Should not be neccesary? JJS
|
||||
}
|
||||
|
||||
updateOptionSensitivity();
|
||||
@ -512,3 +517,89 @@ RimViewLinker* RimViewLink::ownerViewLinker()
|
||||
return viewLinker;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigCaseToCaseCellMapper* RimViewLink::cellMapper()
|
||||
{
|
||||
RimEclipseView* masterEclipseView = dynamic_cast<RimEclipseView*>(masterView());
|
||||
RimEclipseView* dependEclipseView = managedEclipseView();
|
||||
RimGeoMechView* masterGeomechView = dynamic_cast<RimGeoMechView*>(masterView());
|
||||
RimGeoMechView* dependGeomechView = managedGeoView();
|
||||
|
||||
RigMainGrid* masterEclGrid = NULL;
|
||||
RigMainGrid* dependEclGrid = NULL;
|
||||
RigFemPart* masterFemPart = NULL;
|
||||
RigFemPart* dependFemPart = NULL;
|
||||
|
||||
if (masterEclipseView && masterEclipseView->eclipseCase()->reservoirData())
|
||||
{
|
||||
masterEclGrid = masterEclipseView->eclipseCase()->reservoirData()->mainGrid();
|
||||
}
|
||||
|
||||
if (dependEclipseView && dependEclipseView->eclipseCase()->reservoirData())
|
||||
{
|
||||
dependEclGrid = dependEclipseView->eclipseCase()->reservoirData()->mainGrid();
|
||||
}
|
||||
|
||||
if (masterGeomechView && masterGeomechView->geoMechCase()->geoMechData()
|
||||
&& masterGeomechView->geoMechCase()->geoMechData()->femParts()->partCount())
|
||||
{
|
||||
masterFemPart = masterGeomechView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
}
|
||||
|
||||
if (dependGeomechView && dependGeomechView->geoMechCase()->geoMechData()
|
||||
&& dependGeomechView->geoMechCase()->geoMechData()->femParts()->partCount())
|
||||
{
|
||||
dependFemPart = dependGeomechView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||
}
|
||||
|
||||
// If we have the correct mapping already, return it.
|
||||
if (m_caseToCaseCellMapper.notNull())
|
||||
{
|
||||
if ( masterEclGrid == m_caseToCaseCellMapper->masterGrid()
|
||||
&& dependEclGrid == m_caseToCaseCellMapper->dependentGrid()
|
||||
&& masterFemPart == m_caseToCaseCellMapper->masterFemPart()
|
||||
&& dependFemPart == m_caseToCaseCellMapper->dependentFemPart())
|
||||
{
|
||||
return m_caseToCaseCellMapper.p();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_caseToCaseCellMapper = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the mapping if needed
|
||||
|
||||
if (m_caseToCaseCellMapper.isNull())
|
||||
{
|
||||
if (masterEclGrid && dependFemPart)
|
||||
{
|
||||
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterEclGrid, dependFemPart);
|
||||
}
|
||||
else if (masterEclGrid && dependEclGrid)
|
||||
{
|
||||
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterEclGrid, dependEclGrid);
|
||||
}
|
||||
else if (masterFemPart && dependFemPart)
|
||||
{
|
||||
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterFemPart, dependFemPart);
|
||||
}
|
||||
else if (masterFemPart && dependEclGrid)
|
||||
{
|
||||
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterFemPart, dependEclGrid);
|
||||
}
|
||||
}
|
||||
|
||||
return m_caseToCaseCellMapper.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimView* RimViewLink::masterView()
|
||||
{
|
||||
return ownerViewLinker()->mainView();
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,14 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RimView;
|
||||
class RimEclipseView;
|
||||
class RimGeoMechView;
|
||||
class RimViewLinker;
|
||||
class RigCaseToCaseCellMapper;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -45,8 +49,11 @@ public:
|
||||
|
||||
RimView* managedView();
|
||||
void setManagedView(RimView* view);
|
||||
RimView* masterView();
|
||||
RimViewLinker* ownerViewLinker();
|
||||
|
||||
const RigCaseToCaseCellMapper* cellMapper();
|
||||
|
||||
// Linked (both ways) properties
|
||||
caf::PdmField<bool> syncCamera;
|
||||
caf::PdmField<bool> syncTimeStep;
|
||||
@ -83,4 +90,6 @@ private:
|
||||
|
||||
caf::PdmPtrField<RimView*> m_managedView;
|
||||
QIcon m_originalIcon;
|
||||
cvf::ref<RigCaseToCaseCellMapper> m_caseToCaseCellMapper;
|
||||
|
||||
};
|
||||
|
@ -20,22 +20,69 @@
|
||||
#include "RigCaseToCaseCellMapper.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, RigFemPart* dependentFemPart)
|
||||
: m_masterGrid(masterEclGrid),
|
||||
m_dependentGrid(NULL),
|
||||
m_masterFemPart(dependentFemPart),
|
||||
m_dependentFemPart(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigMainGrid* eclipseGrid, RigFemPart* femPart)
|
||||
RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, RigMainGrid* dependentEclGrid)
|
||||
: m_masterGrid(masterEclGrid),
|
||||
m_dependentGrid(dependentEclGrid),
|
||||
m_masterFemPart(NULL),
|
||||
m_dependentFemPart(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigMainGrid* dependentEclGrid)
|
||||
: m_masterGrid(NULL),
|
||||
m_dependentGrid(dependentEclGrid),
|
||||
m_masterFemPart(masterFemPart),
|
||||
m_dependentFemPart(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigFemPart* dependentFemPart)
|
||||
: m_masterGrid(NULL),
|
||||
m_dependentGrid(NULL),
|
||||
m_masterFemPart(masterFemPart),
|
||||
m_dependentFemPart(dependentFemPart)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const int * RigCaseToCaseCellMapper::masterCaseCellIndices(int dependentCaseReservoirCellIndex, int* masterCaseCellIndexCount)
|
||||
{
|
||||
static int a = 0;
|
||||
(*masterCaseCellIndexCount) = 1;
|
||||
return &a;
|
||||
|
||||
int seriesIndex = m_masterCellOrIntervalIndex[dependentCaseReservoirCellIndex];
|
||||
if (seriesIndex < 0)
|
||||
{
|
||||
(*masterCaseCellIndexCount) = static_cast<int>(m_masterCellIndexSeries[-seriesIndex].size());
|
||||
return &(m_masterCellIndexSeries[-seriesIndex][0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*masterCaseCellIndexCount) = 1;
|
||||
return &(m_masterCellOrIntervalIndex[dependentCaseReservoirCellIndex]);
|
||||
}
|
||||
}
|
||||
|
@ -36,11 +36,18 @@ class RigFemPart;
|
||||
class RigCaseToCaseCellMapper : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigCaseToCaseCellMapper(RigMainGrid* eclipseGrid, RigFemPart* femPart);
|
||||
|
||||
RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, RigFemPart* dependentFemPart);
|
||||
RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, RigMainGrid* dependentEclGrid);
|
||||
RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigMainGrid* dependentEclGrid);
|
||||
RigCaseToCaseCellMapper(RigFemPart* masterFemPart, RigFemPart* dependentFemPart);
|
||||
|
||||
const int * masterCaseCellIndices(int dependentCaseReservoirCellIndex, int* masterCaseCellIndexCount);
|
||||
|
||||
|
||||
const RigMainGrid* masterGrid() const { return m_masterGrid;}
|
||||
const RigMainGrid* dependentGrid() const { return m_dependentGrid;}
|
||||
const RigFemPart* masterFemPart() const { return m_masterFemPart;}
|
||||
const RigFemPart* dependentFemPart() const { return m_dependentFemPart;}
|
||||
|
||||
private:
|
||||
#if 0
|
||||
cvf::Vec3i m_ecToGmOffset;
|
||||
@ -52,4 +59,12 @@ private:
|
||||
std::vector<int> m_gmecCellOrIntervalIndex;
|
||||
std::vector<std::vector<int> > m_gmecCellIndexIntervals;
|
||||
#endif
|
||||
std::vector<int> m_masterCellOrIntervalIndex;
|
||||
std::vector<std::vector<int> > m_masterCellIndexSeries;
|
||||
|
||||
RigMainGrid* m_masterGrid;
|
||||
RigMainGrid* m_dependentGrid;
|
||||
RigFemPart* m_masterFemPart;
|
||||
RigFemPart* m_dependentFemPart;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user