#3630 Implement volume calculation on grid

This commit is contained in:
Gaute Lindkvist
2018-11-06 12:47:54 +01:00
parent 8ebfe074f1
commit ef4b70d6e5
12 changed files with 261 additions and 22 deletions

View File

@@ -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