mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#815 Moved code to RivHexGridIntersectionTools
This commit is contained in:
parent
935d49dfdb
commit
bb906cdbe2
@ -8,12 +8,16 @@ set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionSourceInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RivHexGridIntersectionTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxGeometryGenerator.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivCrossSectionSourceInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivHexGridIntersectionTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivIntersectionBoxGeometryGenerator.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -385,161 +385,3 @@ bool RivCrossSectionGeometryGenerator::isAnyGeometryPresent() const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#include "RigActiveCellInfo.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivEclipseCrossSectionGrid::RivEclipseCrossSectionGrid(const RigMainGrid * mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool showInactiveCells)
|
||||
: m_mainGrid(mainGrid),
|
||||
m_activeCellInfo(activeCellInfo),
|
||||
m_showInactiveCells(showInactiveCells)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivEclipseCrossSectionGrid::displayOffset() const
|
||||
{
|
||||
return m_mainGrid->displayModelOffset();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivEclipseCrossSectionGrid::boundingBox() const
|
||||
{
|
||||
return m_mainGrid->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_mainGrid->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivEclipseCrossSectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
|
||||
if (m_showInactiveCells)
|
||||
return !(cell.isInvalid() || (cell.subGrid() != NULL));
|
||||
else
|
||||
return m_activeCellInfo->isActive(cellIndex) && (cell.subGrid() == NULL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
m_mainGrid->cellCornerVertices(cellIndex, cellCorners);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->globalCellArray()[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);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
@ -41,93 +43,6 @@ namespace cvf
|
||||
}
|
||||
|
||||
|
||||
|
||||
class RivCrossSectionHexGridIntf : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual cvf::Vec3d displayOffset() const = 0;
|
||||
virtual cvf::BoundingBox boundingBox() const = 0;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const = 0;
|
||||
virtual bool useCell(size_t cellIndex) const = 0;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const = 0;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const = 0;
|
||||
};
|
||||
|
||||
|
||||
class RivEclipseCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivEclipseCrossSectionGrid(const RigMainGrid * mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigMainGrid> m_mainGrid;
|
||||
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
|
||||
bool m_showInactiveCells;
|
||||
};
|
||||
|
||||
class RigFemPart;
|
||||
|
||||
class RivFemCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivFemCrossSectionGrid(const RigFemPart * femPart);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPart> m_femPart;
|
||||
};
|
||||
|
||||
class RivVertexWeights
|
||||
{
|
||||
public:
|
||||
explicit RivVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1,
|
||||
size_t edge2Vx1, size_t edge2Vx2, double normDistFromE2V1,
|
||||
double normDistFromE1Cut) : m_count(4)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
m_vxIds[2] = (edge2Vx1);
|
||||
m_vxIds[3] = (edge2Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1 - normDistFromE1Cut + normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[1] = ((float)(normDistFromE1V1 - normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[2] = ((float)(normDistFromE1Cut - normDistFromE2V1*normDistFromE1Cut));
|
||||
m_weights[3] = ((float)(normDistFromE2V1*normDistFromE1Cut));
|
||||
}
|
||||
|
||||
explicit RivVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1) : m_count(2)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1));
|
||||
m_weights[1] = ((float)(normDistFromE1V1));
|
||||
}
|
||||
|
||||
int size() const { return m_count;}
|
||||
size_t vxId(int idx) const { return m_vxIds[idx];}
|
||||
float weight(int idx)const { return m_weights[idx];}
|
||||
|
||||
private:
|
||||
|
||||
size_t m_vxIds[4];
|
||||
float m_weights[4];
|
||||
int m_count;
|
||||
};
|
||||
|
||||
class RivCrossSectionGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
|
@ -0,0 +1,174 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigFemPart.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivEclipseCrossSectionGrid::RivEclipseCrossSectionGrid(const RigMainGrid * mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool showInactiveCells)
|
||||
: m_mainGrid(mainGrid),
|
||||
m_activeCellInfo(activeCellInfo),
|
||||
m_showInactiveCells(showInactiveCells)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivEclipseCrossSectionGrid::displayOffset() const
|
||||
{
|
||||
return m_mainGrid->displayModelOffset();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RivEclipseCrossSectionGrid::boundingBox() const
|
||||
{
|
||||
return m_mainGrid->boundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const
|
||||
{
|
||||
m_mainGrid->findIntersectingCells(intersectingBB, intersectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivEclipseCrossSectionGrid::useCell(size_t cellIndex) const
|
||||
{
|
||||
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
|
||||
if (m_showInactiveCells)
|
||||
return !(cell.isInvalid() || (cell.subGrid() != NULL));
|
||||
else
|
||||
return m_activeCellInfo->isActive(cellIndex) && (cell.subGrid() == NULL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const
|
||||
{
|
||||
m_mainGrid->cellCornerVertices(cellIndex, cellCorners);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivEclipseCrossSectionGrid::cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const
|
||||
{
|
||||
const caf::SizeTArray8& cornerIndicesSource = m_mainGrid->globalCellArray()[cellIndex].cornerIndices();
|
||||
memcpy(cornerIndices, cornerIndicesSource.data(), 8);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
|
@ -0,0 +1,126 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigActiveCellInfo;
|
||||
class RigFemPart;
|
||||
class RigMainGrid;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Interface definition used to compute the geometry for planes intersecting a grid
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivCrossSectionHexGridIntf : public cvf::Object
|
||||
{
|
||||
public:
|
||||
virtual cvf::Vec3d displayOffset() const = 0;
|
||||
virtual cvf::BoundingBox boundingBox() const = 0;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const = 0;
|
||||
virtual bool useCell(size_t cellIndex) const = 0;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const = 0;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const = 0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivEclipseCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivEclipseCrossSectionGrid(const RigMainGrid * mainGrid, const RigActiveCellInfo* activeCellInfo, bool showInactiveCells);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigMainGrid> m_mainGrid;
|
||||
cvf::cref<RigActiveCellInfo> m_activeCellInfo;
|
||||
bool m_showInactiveCells;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivFemCrossSectionGrid : public RivCrossSectionHexGridIntf
|
||||
{
|
||||
public:
|
||||
RivFemCrossSectionGrid(const RigFemPart * femPart);
|
||||
|
||||
virtual cvf::Vec3d displayOffset() const;
|
||||
virtual cvf::BoundingBox boundingBox() const;
|
||||
virtual void findIntersectingCells(const cvf::BoundingBox& intersectingBB, std::vector<size_t>* intersectedCells) const;
|
||||
virtual bool useCell(size_t cellIndex) const;
|
||||
virtual void cellCornerVertices(size_t cellIndex, cvf::Vec3d cellCorners[8]) const;
|
||||
virtual void cellCornerIndices(size_t cellIndex, size_t cornerIndices[8]) const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigFemPart> m_femPart;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RivVertexWeights
|
||||
{
|
||||
public:
|
||||
explicit RivVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1,
|
||||
size_t edge2Vx1, size_t edge2Vx2, double normDistFromE2V1,
|
||||
double normDistFromE1Cut) : m_count(4)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
m_vxIds[2] = (edge2Vx1);
|
||||
m_vxIds[3] = (edge2Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1 - normDistFromE1Cut + normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[1] = ((float)(normDistFromE1V1 - normDistFromE1V1*normDistFromE1Cut));
|
||||
m_weights[2] = ((float)(normDistFromE1Cut - normDistFromE2V1*normDistFromE1Cut));
|
||||
m_weights[3] = ((float)(normDistFromE2V1*normDistFromE1Cut));
|
||||
}
|
||||
|
||||
explicit RivVertexWeights(size_t edge1Vx1, size_t edge1Vx2, double normDistFromE1V1) : m_count(2)
|
||||
{
|
||||
m_vxIds[0] = (edge1Vx1);
|
||||
m_vxIds[1] = (edge1Vx2);
|
||||
|
||||
m_weights[0] = ((float)(1.0 - normDistFromE1V1));
|
||||
m_weights[1] = ((float)(normDistFromE1V1));
|
||||
}
|
||||
|
||||
int size() const { return m_count; }
|
||||
size_t vxId(int idx) const { return m_vxIds[idx]; }
|
||||
float weight(int idx)const { return m_weights[idx]; }
|
||||
|
||||
private:
|
||||
|
||||
size_t m_vxIds[4];
|
||||
float m_weights[4];
|
||||
int m_count;
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
@ -0,0 +1,20 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
Loading…
Reference in New Issue
Block a user