mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2552 WIP : Add flattening code to simwell part generator
This commit is contained in:
parent
1fa898b798
commit
e52c88ff77
@ -51,16 +51,17 @@
|
|||||||
#include "cvfScalarMapperDiscreteLinear.h"
|
#include "cvfScalarMapperDiscreteLinear.h"
|
||||||
#include "cvfTransform.h"
|
#include "cvfTransform.h"
|
||||||
#include "cafDisplayCoordTransform.h"
|
#include "cafDisplayCoordTransform.h"
|
||||||
|
#include "RivSectionFlattner.h"
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimEclipseView* reservoirView, RimSimWellInView* well)
|
RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimEclipseView* reservoirView, RimSimWellInView* well, bool isFlattened)
|
||||||
|
: m_rimReservoirView(reservoirView)
|
||||||
|
, m_needsTransformUpdate(true)
|
||||||
|
, m_isFlattened(isFlattened)
|
||||||
{
|
{
|
||||||
m_rimReservoirView = reservoirView;
|
|
||||||
m_rimWell = well;
|
|
||||||
m_needsTransformUpdate = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -107,6 +108,8 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
|
|||||||
int crossSectionVertexCount = m_rimWell->pipeCrossSectionVertexCount();
|
int crossSectionVertexCount = m_rimWell->pipeCrossSectionVertexCount();
|
||||||
cvf::ref<caf::DisplayCoordTransform> displayCoordXf = m_rimReservoirView->displayCoordTransform();
|
cvf::ref<caf::DisplayCoordTransform> displayCoordXf = m_rimReservoirView->displayCoordTransform();
|
||||||
|
|
||||||
|
cvf::Vec3d flattenedStartOffset = cvf::Vec3d::ZERO;
|
||||||
|
|
||||||
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
|
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
|
||||||
{
|
{
|
||||||
cvf::ref<RivSimWellPipeSourceInfo> sourceInfo = new RivSimWellPipeSourceInfo(m_rimWell, brIdx);
|
cvf::ref<RivSimWellPipeSourceInfo> sourceInfo = new RivSimWellPipeSourceInfo(m_rimWell, brIdx);
|
||||||
@ -123,14 +126,27 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
|
|||||||
|
|
||||||
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
cvf::ref<cvf::Vec3dArray> cvfCoords = new cvf::Vec3dArray;
|
||||||
cvfCoords->assign(m_pipeBranchesCLCoords[brIdx]);
|
cvfCoords->assign(m_pipeBranchesCLCoords[brIdx]);
|
||||||
|
|
||||||
// Scale the centerline coordinates using the Z-scale transform of the grid and correct for the display offset.
|
|
||||||
|
|
||||||
for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx)
|
if (m_isFlattened)
|
||||||
{
|
{
|
||||||
(*cvfCoords)[cIdx] = displayCoordXf->transformToDisplayCoord((*cvfCoords)[cIdx]);
|
std::vector<cvf::Mat4d> flatningCSs = RivSectionFlattner::calculateFlatteningCSsForPolyline(m_pipeBranchesCLCoords[brIdx],
|
||||||
|
cvf::Vec3d(0, 0, 1),
|
||||||
|
flattenedStartOffset,
|
||||||
|
&flattenedStartOffset);
|
||||||
|
for (size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx)
|
||||||
|
{
|
||||||
|
(*cvfCoords)[cIdx] = ((*cvfCoords)[cIdx]).getTransformedPoint(flatningCSs[cIdx]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Scale the centerline coordinates using the Z-scale transform of the grid and correct for the display offset.
|
||||||
|
|
||||||
|
for ( size_t cIdx = 0; cIdx < cvfCoords->size(); ++cIdx )
|
||||||
|
{
|
||||||
|
(*cvfCoords)[cIdx] = displayCoordXf->transformToDisplayCoord((*cvfCoords)[cIdx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
|
pbd.m_pipeGeomGenerator->setPipeCenterCoords(cvfCoords.p());
|
||||||
pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
|
pbd.m_surfaceDrawable = pbd.m_pipeGeomGenerator->createPipeSurface();
|
||||||
pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine();
|
pbd.m_centerLineDrawable = pbd.m_pipeGeomGenerator->createCenterLine();
|
||||||
|
@ -44,7 +44,7 @@ class RimSimWellInView;
|
|||||||
class RivSimWellPipesPartMgr : public cvf::Object
|
class RivSimWellPipesPartMgr : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RivSimWellPipesPartMgr(RimEclipseView* reservoirView, RimSimWellInView* well);
|
RivSimWellPipesPartMgr(RimEclipseView* reservoirView, RimSimWellInView* well, bool isFlattened = false);
|
||||||
~RivSimWellPipesPartMgr();
|
~RivSimWellPipesPartMgr();
|
||||||
|
|
||||||
void setScaleTransform(cvf::Transform * scaleTransform);
|
void setScaleTransform(cvf::Transform * scaleTransform);
|
||||||
@ -60,6 +60,7 @@ private:
|
|||||||
|
|
||||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||||
bool m_needsTransformUpdate;
|
bool m_needsTransformUpdate;
|
||||||
|
bool m_isFlattened;
|
||||||
|
|
||||||
void buildWellPipeParts();
|
void buildWellPipeParts();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user