mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#540) Wip: Range filter mapping alive! Needs more adjustments.
Fem to Ecl is not perfect.
This commit is contained in:
parent
8e3e3dd547
commit
58363dbcf9
@ -44,6 +44,7 @@
|
|||||||
#include "RiuViewer.h"
|
#include "RiuViewer.h"
|
||||||
|
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
|
#include "RigCaseToCaseRangeFilterMapper.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimViewController, "ViewController");
|
CAF_PDM_SOURCE_INIT(RimViewController, "ViewController");
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -714,7 +715,7 @@ bool RimViewController::isVisibleCellsOveridden()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimViewController::isRangeFilterControlPossible()
|
bool RimViewController::isRangeFilterControlPossible()
|
||||||
{
|
{
|
||||||
return !isMasterAndDepViewDifferentType();
|
return true; //!isMasterAndDepViewDifferentType();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -761,15 +762,53 @@ void RimViewController::updateRangeFilterOverrides(RimCellRangeFilter* changedRa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RimCellRangeFilterCollection* sourceFilterCollection = masterView()->rangeFilterCollection();
|
if (true)//changedRangeFilter == NULL)
|
||||||
QString xmlRangeFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
|
{
|
||||||
|
// Copy the rangeFilterCollection
|
||||||
|
|
||||||
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xmlRangeFilterCollCopy, caf::PdmDefaultObjectFactory::instance());
|
RimCellRangeFilterCollection* sourceFilterCollection = masterView()->rangeFilterCollection();
|
||||||
|
QString xmlRangeFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
|
||||||
|
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xmlRangeFilterCollCopy, caf::PdmDefaultObjectFactory::instance());
|
||||||
|
RimCellRangeFilterCollection* overrideRangeFilterColl = dynamic_cast<RimCellRangeFilterCollection*>(objectCopy);
|
||||||
|
|
||||||
RimCellRangeFilterCollection* overrideRangeFilter = dynamic_cast<RimCellRangeFilterCollection*>(objectCopy);
|
// Convert the range filter to fit in the managed view
|
||||||
managedView()->setOverrideRangeFilterCollection(overrideRangeFilter);
|
RimEclipseView* eclipseMasterView = dynamic_cast<RimEclipseView*>(masterView());
|
||||||
|
RimGeoMechView* geoMasterView = dynamic_cast<RimGeoMechView*>(masterView());
|
||||||
|
RimEclipseView* depEclView = managedEclipseView();
|
||||||
|
RimGeoMechView* depGeomView = managedGeoView();
|
||||||
|
|
||||||
// TODO: Convert ijk values in source to correct ijk values in our range filter collection
|
if (eclipseMasterView && depGeomView)
|
||||||
|
{
|
||||||
|
for (size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx)
|
||||||
|
{
|
||||||
|
RimCellRangeFilter* srcRFilter = sourceFilterCollection->rangeFilters[rfIdx];
|
||||||
|
RimCellRangeFilter* dstRFilter = overrideRangeFilterColl->rangeFilters[rfIdx];
|
||||||
|
RigMainGrid* srcEclGrid = eclipseMasterView->eclipseCase()->reservoirData()->mainGrid();
|
||||||
|
RigFemPart* dstFemPart = depGeomView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||||
|
RigCaseToCaseRangeFilterMapper::convertRangeFilterEclToFem( srcRFilter, srcEclGrid,
|
||||||
|
dstRFilter, dstFemPart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (geoMasterView && depEclView)
|
||||||
|
{
|
||||||
|
for (size_t rfIdx = 0; rfIdx < sourceFilterCollection->rangeFilters().size(); ++rfIdx)
|
||||||
|
{
|
||||||
|
RimCellRangeFilter* srcRFilter = sourceFilterCollection->rangeFilters[rfIdx];
|
||||||
|
RimCellRangeFilter* dstRFilter = overrideRangeFilterColl->rangeFilters[rfIdx];
|
||||||
|
RigFemPart* srcFemPart = geoMasterView->geoMechCase()->geoMechData()->femParts()->part(0);
|
||||||
|
RigMainGrid* dstEclGrid = depEclView->eclipseCase()->reservoirData()->mainGrid();
|
||||||
|
RigCaseToCaseRangeFilterMapper::convertRangeFilterFemToEcl( srcRFilter, srcFemPart,
|
||||||
|
dstRFilter, dstEclGrid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
managedView()->setOverrideRangeFilterCollection(overrideRangeFilterColl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// RigCaseToCaseRangeFilterMapper::convertRangeFilterEclToFem( changedRangeFilter, eclipseMasterView, overrideRangeFilterColl->rangeFilters()[rfIdx], depGeomView)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,19 +65,42 @@ void RigCaseToCaseRangeFilterMapper::convertRangeFilter(RimCellRangeFilter* srcF
|
|||||||
size_t srcStartI = srcFilter->startIndexI() - 1;
|
size_t srcStartI = srcFilter->startIndexI() - 1;
|
||||||
size_t srcStartJ = srcFilter->startIndexJ() - 1;
|
size_t srcStartJ = srcFilter->startIndexJ() - 1;
|
||||||
size_t srcStartK = srcFilter->startIndexK() - 1;
|
size_t srcStartK = srcFilter->startIndexK() - 1;
|
||||||
size_t srcEndI = srcStartI + srcFilter->cellCountI();
|
|
||||||
size_t srcEndJ = srcStartJ + srcFilter->cellCountJ();
|
// Needs to subtract one more to have the end idx beeing the last cell in the selection, not the first outside
|
||||||
size_t srcEndK = srcStartK + srcFilter->cellCountK();
|
size_t srcEndI = srcStartI + srcFilter->cellCountI() - 1;
|
||||||
|
size_t srcEndJ = srcStartJ + srcFilter->cellCountJ() - 1;
|
||||||
|
size_t srcEndK = srcStartK + srcFilter->cellCountK() - 1;
|
||||||
|
|
||||||
|
size_t maxIIndex;
|
||||||
|
size_t maxJIndex;
|
||||||
|
size_t maxKIndex;
|
||||||
|
|
||||||
|
// Clamp end
|
||||||
|
if (femIsDestination)
|
||||||
|
{
|
||||||
|
maxIIndex = eclGrid->cellCountI()- 1;
|
||||||
|
maxJIndex = eclGrid->cellCountJ()- 1;
|
||||||
|
maxKIndex = eclGrid->cellCountK()- 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxIIndex = femPart->structGrid()->cellCountI()- 1;
|
||||||
|
maxJIndex = femPart->structGrid()->cellCountJ()- 1;
|
||||||
|
maxKIndex = femPart->structGrid()->cellCountK()- 1;
|
||||||
|
}
|
||||||
|
srcEndI = CVF_MIN(srcEndI, maxIIndex);
|
||||||
|
srcEndJ = CVF_MIN(srcEndJ, maxJIndex);
|
||||||
|
srcEndK = CVF_MIN(srcEndK, maxKIndex);
|
||||||
|
|
||||||
cvf::Vec3st srcRangeCube[8];
|
cvf::Vec3st srcRangeCube[8];
|
||||||
srcRangeCube[0] = cvf::Vec3st(srcStartI, srcStartJ, srcStartK);
|
srcRangeCube[0] = cvf::Vec3st(srcStartI, srcStartJ, srcStartK);
|
||||||
srcRangeCube[1] = cvf::Vec3st(srcEndI, srcStartJ, srcStartK);
|
srcRangeCube[1] = cvf::Vec3st(srcEndI, srcStartJ, srcStartK);
|
||||||
srcRangeCube[2] = cvf::Vec3st(srcEndI, srcEndJ, srcStartK);
|
srcRangeCube[2] = cvf::Vec3st(srcEndI, srcEndJ, srcStartK);
|
||||||
srcRangeCube[3] = cvf::Vec3st(srcStartI, srcEndJ, srcStartK);
|
srcRangeCube[3] = cvf::Vec3st(srcStartI, srcEndJ, srcStartK);
|
||||||
srcRangeCube[4] = cvf::Vec3st(srcStartI, srcStartJ, srcEndK);
|
srcRangeCube[4] = cvf::Vec3st(srcStartI, srcStartJ, srcEndK);
|
||||||
srcRangeCube[5] = cvf::Vec3st(srcEndI, srcStartJ, srcEndK);
|
srcRangeCube[5] = cvf::Vec3st(srcEndI, srcStartJ, srcEndK);
|
||||||
srcRangeCube[6] = cvf::Vec3st(srcEndI, srcEndJ, srcEndK);
|
srcRangeCube[6] = cvf::Vec3st(srcEndI, srcEndJ, srcEndK);
|
||||||
srcRangeCube[7] = cvf::Vec3st(srcStartI, srcEndJ, srcEndK);
|
srcRangeCube[7] = cvf::Vec3st(srcStartI, srcEndJ, srcEndK);
|
||||||
|
|
||||||
|
|
||||||
size_t dstStartI = cvf::UNDEFINED_SIZE_T;
|
size_t dstStartI = cvf::UNDEFINED_SIZE_T;
|
||||||
@ -171,9 +194,9 @@ void RigCaseToCaseRangeFilterMapper::convertRangeFilter(RimCellRangeFilter* srcF
|
|||||||
if ((dstStartI != cvf::UNDEFINED_SIZE_T && dstStartJ != cvf::UNDEFINED_SIZE_T && dstStartK != cvf::UNDEFINED_SIZE_T)
|
if ((dstStartI != cvf::UNDEFINED_SIZE_T && dstStartJ != cvf::UNDEFINED_SIZE_T && dstStartK != cvf::UNDEFINED_SIZE_T)
|
||||||
&& (dstEndI != cvf::UNDEFINED_SIZE_T && dstEndJ != cvf::UNDEFINED_SIZE_T && dstEndK != cvf::UNDEFINED_SIZE_T))
|
&& (dstEndI != cvf::UNDEFINED_SIZE_T && dstEndJ != cvf::UNDEFINED_SIZE_T && dstEndK != cvf::UNDEFINED_SIZE_T))
|
||||||
{
|
{
|
||||||
dstFilter->startIndexJ = static_cast<int>(dstStartI + 1);
|
dstFilter->startIndexI = static_cast<int>(dstStartI + 1);
|
||||||
dstFilter->startIndexK = static_cast<int>(dstStartJ + 1);
|
dstFilter->startIndexJ = static_cast<int>(dstStartJ + 1);
|
||||||
dstFilter->startIndexI = static_cast<int>(dstStartK + 1);
|
dstFilter->startIndexK = static_cast<int>(dstStartK + 1);
|
||||||
|
|
||||||
dstFilter->cellCountI = static_cast<int>(dstEndI - (dstStartI-1));
|
dstFilter->cellCountI = static_cast<int>(dstEndI - (dstStartI-1));
|
||||||
dstFilter->cellCountJ = static_cast<int>(dstEndJ - (dstStartJ-1));
|
dstFilter->cellCountJ = static_cast<int>(dstEndJ - (dstStartJ-1));
|
||||||
@ -188,7 +211,6 @@ void RigCaseToCaseRangeFilterMapper::convertRangeFilter(RimCellRangeFilter* srcF
|
|||||||
dstFilter->cellCountI = 0;
|
dstFilter->cellCountI = 0;
|
||||||
dstFilter->cellCountJ = 0;
|
dstFilter->cellCountJ = 0;
|
||||||
dstFilter->cellCountK = 0;
|
dstFilter->cellCountK = 0;
|
||||||
dstFilter->computeAndSetValidValues();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user