mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3630 Implement volume calculation on grid
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
|
||||
#include "RigCell.h"
|
||||
#include "RigCellGeometryTools.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfRay.h"
|
||||
@@ -301,6 +302,21 @@ cvf::Vec3d RigCell::faceNormalWithAreaLenght(cvf::StructGridInterface::FaceType
|
||||
( nodeCoords[m_cornerIndices[faceVertexIndices[3]]] - nodeCoords[m_cornerIndices[faceVertexIndices[1]]]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCell::volume() const
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& nodeCoords = m_hostGrid->mainGrid()->nodes();
|
||||
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
for (size_t i = 0; i < 8; ++i)
|
||||
{
|
||||
hexCorners[i] = nodeCoords.at(m_cornerIndices[i]);
|
||||
}
|
||||
return RigCellGeometryTools::calculateCellVolume(hexCorners);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Find the intersection between the cell and the ray. The point closest to the ray origin is returned
|
||||
/// in \a intersectionPoint, while the return value is the total number of intersections with the 24 triangles
|
||||
|
||||
Reference in New Issue
Block a user