mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
#3300 Fix crash when loading formation indices as part of a project file.
* Rename structGrid() to getOrCreateStructGrid() to make it obvious that it allocates internally.
This commit is contained in:
1 parent
116c61eaf8
commit
4fd9cdfda3
12 files changed
+23
-20
No files matched your search
@@ -71,7 +71,7 @@ void RigFemPart::appendElement(RigElementType elmType, int id, const int* connec
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigFemPartGrid* RigFemPart::structGrid() const
|
||||
const RigFemPartGrid* RigFemPart::getOrCreateStructGrid() const
|
||||
{
|
||||
if (m_structGrid.isNull())
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
|
||||
cvf::Vec3f faceNormal(int elmentIndex, int faceIndex) const;
|
||||
|
||||
const RigFemPartGrid* structGrid() const;
|
||||
const RigFemPartGrid* getOrCreateStructGrid() const;
|
||||
const std::vector<int>& elementIdxToId() const { return m_elementId; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -1516,7 +1516,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateCompactionValues
|
||||
part->findIntersectingCells(bb, &refElementCandidates);
|
||||
|
||||
// Also make sure the struct grid is created, as this is required before using OpenMP
|
||||
part->structGrid();
|
||||
part->getOrCreateStructGrid();
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
@@ -1832,6 +1832,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateFormationIndices
|
||||
|
||||
if (activeFormNames)
|
||||
{
|
||||
// Has to be done before the parallel loop because the first call allocates.
|
||||
const RigFemPartGrid* structGrid = femPart->getOrCreateStructGrid();
|
||||
|
||||
int elementCount = femPart->elementCount();
|
||||
|
||||
#pragma omp parallel for
|
||||
@@ -1841,7 +1844,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateFormationIndices
|
||||
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
|
||||
|
||||
size_t i, j, k;
|
||||
bool validIndex = femPart->structGrid()->ijkFromCellIndex(elmIdx, &i, &j, &k);
|
||||
bool validIndex = structGrid->ijkFromCellIndex(elmIdx, &i, &j, &k);
|
||||
if (validIndex)
|
||||
{
|
||||
int formNameIdx = activeFormNames->formationIndexFromKLayerIdx(k);
|
||||
@@ -2771,7 +2774,7 @@ void findReferenceElementForNode(const RigFemPart& part, size_t nodeIdx, size_t
|
||||
std::vector<size_t> refElementCandidates;
|
||||
part.findIntersectingCells(bb, &refElementCandidates);
|
||||
|
||||
const RigFemPartGrid* grid = part.structGrid();
|
||||
const RigFemPartGrid* grid = part.getOrCreateStructGrid();
|
||||
const std::vector<cvf::Vec3f>& nodeCoords = part.nodes().coordinates;
|
||||
|
||||
refElement->elementIdx = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
@@ -57,7 +57,7 @@ void RivFemElmVisibilityCalculator::computeRangeVisibility(cvf::UByteArray* elmV
|
||||
{
|
||||
elmVisibilities->resize(femPart->elementCount());
|
||||
|
||||
const RigFemPartGrid* grid = femPart->structGrid();
|
||||
const RigFemPartGrid* grid = femPart->getOrCreateStructGrid();
|
||||
|
||||
if (rangeFilter.hasIncludeRanges())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user