mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
97 lines
3.3 KiB
C++
97 lines
3.3 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2017 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 "RimFracture.h"
|
|
|
|
#include "RigFracture.h"
|
|
#include "RigTesselatorTools.h"
|
|
#include "RimFractureDefinition.h"
|
|
|
|
|
|
|
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimFracture, "Fracture");
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimFracture::RimFracture(void)
|
|
{
|
|
CAF_PDM_InitObject("Fracture", "", "", "");
|
|
|
|
m_rigFracture = new RigFracture;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimFracture::~RimFracture()
|
|
{
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
const std::vector<cvf::uint>& RimFracture::polygonIndices() const
|
|
{
|
|
return m_rigFracture->polygonIndices();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
const std::vector<cvf::Vec3f>& RimFracture::nodeCoords() const
|
|
{
|
|
return m_rigFracture->nodeCoords();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimFracture::computeGeometry()
|
|
{
|
|
std::vector<cvf::Vec3f> nodeCoords;
|
|
std::vector<cvf::uint> polygonIndices;
|
|
|
|
cvf::Vec3d center = centerPointForFracture();
|
|
RimFractureDefinition* fractureDef = attachedFractureDefinition();
|
|
if (fractureDef && !center.isUndefined())
|
|
{
|
|
RigEllipsisTesselator tesselator(20);
|
|
|
|
float a = fractureDef->height / 2.0f;
|
|
float b = fractureDef->halfLength;
|
|
|
|
tesselator.tesselateEllipsis(a, b, &polygonIndices, &nodeCoords);
|
|
|
|
}
|
|
|
|
// TODO: Modify coords by fracture center and orientation
|
|
|
|
m_rigFracture->setGeometry(polygonIndices, nodeCoords);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RimFracture::hasValidGeometry() const
|
|
{
|
|
return (nodeCoords().size() > 0 && polygonIndices().size() > 0);
|
|
}
|
|
|