mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#401) Changed main mapping to loop over Eclipse grid
To avoid creating the geomech version of the eclipse cell many times
This commit is contained in:
@@ -102,6 +102,30 @@ void RigCaseToCaseCellMapper::storeMapping(int depCaseCellIdx, const std::vector
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseToCaseCellMapper::addMapping(int depCaseCellIdx, int masterCaseMatchingCell)
|
||||
{
|
||||
int mcOrSeriesIdx = m_masterCellOrIntervalIndex[depCaseCellIdx];
|
||||
if (mcOrSeriesIdx == cvf::UNDEFINED_INT)
|
||||
{
|
||||
m_masterCellOrIntervalIndex[depCaseCellIdx] = masterCaseMatchingCell;
|
||||
}
|
||||
else if (mcOrSeriesIdx >= 0)
|
||||
{
|
||||
int newSeriesIdx = m_masterCellIndexSeries.size();
|
||||
m_masterCellIndexSeries.push_back(std::vector<int>());
|
||||
m_masterCellIndexSeries.back().push_back(mcOrSeriesIdx);
|
||||
m_masterCellIndexSeries.back().push_back(masterCaseMatchingCell);
|
||||
}
|
||||
else if (mcOrSeriesIdx < 0)
|
||||
{
|
||||
m_masterCellIndexSeries[-mcOrSeriesIdx].push_back(masterCaseMatchingCell);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -521,7 +545,7 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, Rig
|
||||
|
||||
int elementCount = dependentFemPart->elementCount();
|
||||
cvf::Vec3d elmCorners[8];
|
||||
|
||||
#if 0
|
||||
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@@ -561,6 +585,46 @@ RigCaseToCaseCellMapper::RigCaseToCaseCellMapper(RigMainGrid* masterEclGrid, Rig
|
||||
|
||||
storeMapping(elmIdx, matchingCells);
|
||||
}
|
||||
#else
|
||||
for (size_t cellIdx = 0; cellIdx < masterEclGrid->cellCount(); ++cellIdx)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
// For debugging
|
||||
size_t i, j, k;
|
||||
masterEclGrid->ijkFromCellIndex(cellIdx, &i, &j, &k); // Will not work when LGR present
|
||||
}
|
||||
#endif
|
||||
cvf::Vec3d geoMechConvertedEclCell[8];
|
||||
estimatedFemCellFromEclCell(masterEclGrid, cellIdx, geoMechConvertedEclCell);
|
||||
|
||||
cvf::BoundingBox elmBBox;
|
||||
for (int i = 0; i < 8 ; ++i) elmBBox.add(geoMechConvertedEclCell[i]);
|
||||
|
||||
std::vector<size_t> closeElements;
|
||||
dependentFemPart->findIntersectingCells(elmBBox, &closeElements);
|
||||
|
||||
std::vector<int> matchingCells;
|
||||
|
||||
for (size_t ccIdx = 0; ccIdx < closeElements.size(); ++ccIdx)
|
||||
{
|
||||
int elmIdx = closeElements[ccIdx];
|
||||
cvf::Vec3d elmCorners[8];
|
||||
|
||||
elementCorners(dependentFemPart, elmIdx, elmCorners);
|
||||
|
||||
rotateCellTopologicallyToMatchBaseCell(geoMechConvertedEclCell, isEclFaceNormalsOutwards , elmCorners);
|
||||
|
||||
bool isMatching = isEclFemCellsMatching(geoMechConvertedEclCell, elmCorners,
|
||||
xyTolerance, zTolerance);
|
||||
|
||||
if (isMatching)
|
||||
{
|
||||
addMapping(elmIdx, static_cast<int>(cellIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
private:
|
||||
|
||||
void storeMapping(int depCaseCellIdx, const std::vector<int>& masterCaseMatchingCells);
|
||||
void addMapping(int depCaseCellIdx, int masterCaseMatchingCell);
|
||||
|
||||
std::vector<int> m_masterCellOrIntervalIndex;
|
||||
std::vector<std::vector<int> > m_masterCellIndexSeries;
|
||||
|
||||
Reference in New Issue
Block a user