mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Performance: Cellcount functions are used in many loops, and must be as fast as possible
cellCountIJK was computed based on the value of griPointDimensions. These converstion turned up during profiling. Change implementation to have cellcount as a member variable instead of being computed every time.
This commit is contained in:
@@ -362,30 +362,6 @@ int RigFemPartGrid::perpendicularFaceInDirection( cvf::Vec3f direction, int perp
|
||||
return bestFace;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartGrid::gridPointCountI() const
|
||||
{
|
||||
return m_elementIJKCounts[0] + 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartGrid::gridPointCountJ() const
|
||||
{
|
||||
return m_elementIJKCounts[1] + 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartGrid::gridPointCountK() const
|
||||
{
|
||||
return m_elementIJKCounts[2] + 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -491,6 +467,30 @@ cvf::Vec3d RigFemPartGrid::cellCentroid( size_t cellIndex ) const
|
||||
return centroid / 8.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartGrid::cellCountI() const
|
||||
{
|
||||
return m_elementIJKCounts[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartGrid::cellCountJ() const
|
||||
{
|
||||
return m_elementIJKCounts[1];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigFemPartGrid::cellCountK() const
|
||||
{
|
||||
return m_elementIJKCounts[2];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -31,13 +31,13 @@ public:
|
||||
|
||||
void setFemPart( const RigFemPart* femPart );
|
||||
|
||||
size_t cellCountI() const override;
|
||||
size_t cellCountJ() const override;
|
||||
size_t cellCountK() const override;
|
||||
|
||||
bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
||||
size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
||||
|
||||
size_t gridPointCountI() const override;
|
||||
size_t gridPointCountJ() const override;
|
||||
size_t gridPointCountK() const override;
|
||||
|
||||
cvf::Vec3i findMainIJKFaces( int elementIndex ) const;
|
||||
|
||||
std::pair<cvf::Vec3st, cvf::Vec3st> reservoirIJKBoundingBox() const;
|
||||
|
||||
Reference in New Issue
Block a user