OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::TriangleMesherInterface Class Reference

Interface to Triangle (Delaunay mesher). More...

#include <trianglemesherinterface.h>

Public Member Functions

 TriangleMesherInterface (double minAngle, double maxArea, bool quadratic)
 Constructor. More...
 
 ~TriangleMesherInterface ()
 Destructor. More...
 
bool meshPSLG (const Triangle_PSLG &pslg, const IntArray &outside, const IntArray &inside, std::vector< FloatArray > &nodes, std::vector< IntArray > &n_markers, std::vector< IntArray > &triangles, IntArray &t_markers, std::vector< IntArray > &segments, IntArray &s_markers) const
 Constructs a mesh from a PSLG. More...
 

Static Public Member Functions

static void simplifyPSLG (Triangle_PSLG &coarse, const Triangle_PSLG &pslg, double limit, double minlen=0.0)
 Simplifies a PSLG while respecting topology, running in linear time. More...
 

Static Protected Member Functions

static void fixNodeMarkers (const std::vector< FloatArray > &nodes, std::vector< IntArray > &n_markers, const std::vector< IntArray > &triangles, const IntArray &t_markers, const std::vector< IntArray > &segments, const IntArray &s_markers)
 Adds all neighboring regions to every node region. More...
 

Protected Attributes

double minAngle
 
double maxArea
 
bool useRegions
 
bool quadratic
 

Detailed Description

Interface to Triangle (Delaunay mesher).

Todo:
{Possible reform slightly and merge this with the other meshing interfaces.}
See also
http://www.cs.cmu.edu/~quake/triangle.html
Author
Mikael Öhman

Definition at line 64 of file trianglemesherinterface.h.

Constructor & Destructor Documentation

oofem::TriangleMesherInterface::TriangleMesherInterface ( double  minAngle,
double  maxArea,
bool  quadratic 
)
inline

Constructor.

Parameters
minAngleMinimum angle. Should be less than 33 (20 is default).
maxAreaMaximum allowed area of a triangle.
quadraticTrue if generated mesh should be quadratic (6 nodes).

Definition at line 79 of file trianglemesherinterface.h.

oofem::TriangleMesherInterface::~TriangleMesherInterface ( )
inline

Destructor.

Definition at line 82 of file trianglemesherinterface.h.

Member Function Documentation

void oofem::TriangleMesherInterface::fixNodeMarkers ( const std::vector< FloatArray > &  nodes,
std::vector< IntArray > &  n_markers,
const std::vector< IntArray > &  triangles,
const IntArray t_markers,
const std::vector< IntArray > &  segments,
const IntArray s_markers 
)
staticprotected

Adds all neighboring regions to every node region.

Necessary since triangle can only store a single node number.

Definition at line 539 of file trianglemesherinterface.C.

Referenced by meshPSLG().

bool oofem::TriangleMesherInterface::meshPSLG ( const Triangle_PSLG pslg,
const IntArray outside,
const IntArray inside,
std::vector< FloatArray > &  nodes,
std::vector< IntArray > &  n_markers,
std::vector< IntArray > &  triangles,
IntArray t_markers,
std::vector< IntArray > &  segments,
IntArray s_markers 
) const

Constructs a mesh from a PSLG.

The PSLG needs to be oriented correctly, as every segment determines the bulk region number at both sides, which then spreads to surrounding elements. The length of those arrays must be at least as big as the largest segment region number. Inconsistent regions are automatically detected.

Parameters
[in]pslgInput PSLG.
[in]outsideSegment region to bulk region mapping.
[in]insideSegment region to bulk region mapping.
[out]nodesOutput nodes.
[out]n_markersNode markers.
[out]trianglesOutput triangles (3 or 6 nodes depending on option).
[out]t_markersTriangle markers
[out]segmentsOutput segments (2 or 3 nodes depending on option).
[out]s_markersSegment markers.
Returns
True if mesh generation was successful.

Definition at line 389 of file trianglemesherinterface.C.

References oofem::IntArray::at(), oofem::IntArray::findFirstIndexOf(), fixNodeMarkers(), oofem::IntArray::givePointer(), oofem::IntArray::giveSize(), oofem::FloatArray::giveSize(), maxArea, minAngle, oofem::Triangle_PSLG::nx, oofem::Triangle_PSLG::ny, OOFEM_ERROR, quadratic, oofem::IntArray::resize(), oofem::Triangle_PSLG::segment_a, oofem::Triangle_PSLG::segment_b, and oofem::Triangle_PSLG::segment_marker.

Referenced by oofem::ParticleTopologyDescription::generateMesh().

void oofem::TriangleMesherInterface::simplifyPSLG ( Triangle_PSLG coarse,
const Triangle_PSLG pslg,
double  limit,
double  minlen = 0.0 
)
static

Simplifies a PSLG while respecting topology, running in linear time.

The algorithm removes unnecessary nodes while preserving topology. This means any node with other than 2 edges are kept. The error measure is is the distance from any point to the simplified curve. A straight line will be simplified to its end points, even for zero limit value. Direction of edges is preserved.

Parameters
coarseResulting PSLG.
pslgInput PSLG.
limitMaximum difference allowed from new to old line.
minlenMinimum length of any segment (shorter segments will be forcibly removed). Will not respect the error limit.

Definition at line 557 of file trianglemesherinterface.C.

References oofem::IntArray::at(), oofem::FloatArray::at(), oofem::FloatArray::computeNorm(), oofem::IntArray::giveSize(), oofem::FloatArray::giveSize(), oofem::Triangle_PSLG::nx, oofem::Triangle_PSLG::ny, oofem::IntArray::resize(), oofem::FloatArray::resize(), oofem::Triangle_PSLG::segment_a, oofem::Triangle_PSLG::segment_b, oofem::Triangle_PSLG::segment_marker, oofem::FloatArray::subtract(), oofem::FloatArray::times(), and oofem::IntArray::zero().

Referenced by oofem::ParticleTopologyDescription::generatePSLG().

Member Data Documentation

double oofem::TriangleMesherInterface::maxArea
protected

Definition at line 68 of file trianglemesherinterface.h.

Referenced by meshPSLG().

double oofem::TriangleMesherInterface::minAngle
protected

Definition at line 67 of file trianglemesherinterface.h.

Referenced by meshPSLG().

bool oofem::TriangleMesherInterface::quadratic
protected

Definition at line 70 of file trianglemesherinterface.h.

Referenced by meshPSLG().

bool oofem::TriangleMesherInterface::useRegions
protected

Definition at line 69 of file trianglemesherinterface.h.


The documentation for this class was generated from the following files:

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:43 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011