(#166) WIP: Starting to get geomech cross sections in place

This commit is contained in:
Jacob Støren
2015-11-20 15:54:22 +01:00
parent fbfd6fd212
commit f8fa6787e9
8 changed files with 284 additions and 88 deletions

View File

@@ -1247,3 +1247,91 @@ void RivEclipseCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t corn
const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->cells()[cellIndex].cornerIndices();
memcpy(cornerIndices, cornerIndicesSource.data(), 8);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
#include "RigFemPart.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFemCrossSectionGrid::RivFemCrossSectionGrid(const RigFemPart * femPart): m_femPart(femPart)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivFemCrossSectionGrid::displayOffset() const
{
return cvf::Vec3d::ZERO;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RivFemCrossSectionGrid::boundingBox() const
{
return m_femPart->boundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemCrossSectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
{
m_femPart->findIntersectingCells(intersectingBB, intersectedCells);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RivFemCrossSectionGrid::useCell(size_t cellIndex) const
{
RigElementType elmType = m_femPart->elementType(cellIndex);
if (!(elmType == HEX8 || elmType == HEX8P)) return false;
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemCrossSectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
{
RigElementType elmType = m_femPart->elementType(cellIndex);
if (!(elmType == HEX8 || elmType == HEX8P)) return ;
const std::vector<cvf::Vec3f>& nodeCoords = m_femPart->nodes().coordinates;
const int* cornerIndices = m_femPart->connectivities(cellIndex);
cellCorners[0] = cvf::Vec3d(nodeCoords[cornerIndices[0]]);
cellCorners[1] = cvf::Vec3d(nodeCoords[cornerIndices[1]]);
cellCorners[2] = cvf::Vec3d(nodeCoords[cornerIndices[2]]);
cellCorners[3] = cvf::Vec3d(nodeCoords[cornerIndices[3]]);
cellCorners[4] = cvf::Vec3d(nodeCoords[cornerIndices[4]]);
cellCorners[5] = cvf::Vec3d(nodeCoords[cornerIndices[5]]);
cellCorners[6] = cvf::Vec3d(nodeCoords[cornerIndices[6]]);
cellCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivFemCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
{
RigElementType elmType = m_femPart->elementType(cellIndex);
if (!(elmType == HEX8 || elmType == HEX8P)) return ;
int elmIdx = static_cast<int>(cellIndex);
cornerIndices[0] = m_femPart->elementNodeResultIdx(elmIdx, 0);
cornerIndices[1] = m_femPart->elementNodeResultIdx(elmIdx, 1);
cornerIndices[2] = m_femPart->elementNodeResultIdx(elmIdx, 2);
cornerIndices[3] = m_femPart->elementNodeResultIdx(elmIdx, 3);
cornerIndices[4] = m_femPart->elementNodeResultIdx(elmIdx, 4);
cornerIndices[5] = m_femPart->elementNodeResultIdx(elmIdx, 5);
cornerIndices[6] = m_femPart->elementNodeResultIdx(elmIdx, 6);
cornerIndices[7] = m_femPart->elementNodeResultIdx(elmIdx, 7);
}