mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#815 Prototype of interface for RivIntersectionBoxGeometryGenerator
This commit is contained in:
parent
bb906cdbe2
commit
c08dce7167
@ -18,3 +18,100 @@
|
||||
|
||||
#include "RivIntersectionBoxGeometryGenerator.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxGeometryGenerator::RivIntersectionBoxGeometryGenerator(const RimIntersectionBox* intersectionBox, const RivCrossSectionHexGridIntf* grid)
|
||||
: m_crossSection(intersectionBox),
|
||||
m_hexGrid(grid)
|
||||
{
|
||||
m_triangleVxes = new cvf::Vec3fArray;
|
||||
m_cellBorderLineVxes = new cvf::Vec3fArray;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivIntersectionBoxGeometryGenerator::~RivIntersectionBoxGeometryGenerator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RivIntersectionBoxGeometryGenerator::isAnyGeometryPresent() const
|
||||
{
|
||||
if (m_triangleVxes->size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionBoxGeometryGenerator::generateSurface()
|
||||
{
|
||||
calculateArrays();
|
||||
|
||||
CVF_ASSERT(m_triangleVxes.notNull());
|
||||
|
||||
if (m_triangleVxes->size() == 0) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setFromTriangleVertexArray(m_triangleVxes.p());
|
||||
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RivIntersectionBoxGeometryGenerator::createMeshDrawable()
|
||||
{
|
||||
if (!(m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0)) return NULL;
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
geo->setVertexArray(m_cellBorderLineVxes.p());
|
||||
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetDirect> prim = new cvf::PrimitiveSetDirect(cvf::PT_LINES);
|
||||
prim->setIndexCount(m_cellBorderLineVxes->size());
|
||||
|
||||
geo->addPrimitiveSet(prim.p());
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RivIntersectionBoxGeometryGenerator::triangleToCellIndex() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triangleToCellIdxMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<RivVertexWeights>& RivIntersectionBoxGeometryGenerator::triangleVxToCellCornerInterpolationWeights() const
|
||||
{
|
||||
CVF_ASSERT(m_triangleVxes->size());
|
||||
return m_triVxToCellCornerWeights;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivIntersectionBoxGeometryGenerator::calculateArrays()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -18,3 +18,57 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimIntersectionBox;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ScalarMapper;
|
||||
class DrawableGeo;
|
||||
}
|
||||
|
||||
|
||||
class RivIntersectionBoxGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivIntersectionBoxGeometryGenerator(const RimIntersectionBox* intersectionBox,
|
||||
const RivCrossSectionHexGridIntf* grid);
|
||||
|
||||
~RivIntersectionBoxGeometryGenerator();
|
||||
|
||||
bool isAnyGeometryPresent() const;
|
||||
|
||||
// Generate geometry
|
||||
cvf::ref<cvf::DrawableGeo> generateSurface();
|
||||
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
|
||||
|
||||
// Mapping between cells and geometry
|
||||
const std::vector<size_t>& triangleToCellIndex() const;
|
||||
const std::vector<RivVertexWeights>& triangleVxToCellCornerInterpolationWeights() const;
|
||||
|
||||
//const RimCrossSection* crossSection() const;
|
||||
|
||||
private:
|
||||
void calculateArrays();
|
||||
|
||||
cvf::cref<RivCrossSectionHexGridIntf> m_hexGrid;
|
||||
|
||||
// Output arrays
|
||||
cvf::ref<cvf::Vec3fArray> m_triangleVxes;
|
||||
cvf::ref<cvf::Vec3fArray> m_cellBorderLineVxes;
|
||||
std::vector<size_t> m_triangleToCellIdxMap;
|
||||
std::vector<RivVertexWeights> m_triVxToCellCornerWeights;
|
||||
|
||||
const RimIntersectionBox* m_crossSection;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user