OOFEM 3.0
Loading...
Searching...
No Matches
oofem::TriangleMesherInterface Class Reference

#include <trianglemesherinterface.h>

Public Member Functions

 TriangleMesherInterface (double minAngle, double maxArea, bool quadratic)
 ~TriangleMesherInterface ()
 Destructor.
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

Static Public Member Functions

static void simplifyPSLG (Triangle_PSLG &coarse, const Triangle_PSLG &pslg, double limit, double minlen=0.0)

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)

Protected Attributes

double minAngle
double maxArea
bool useRegions
bool quadratic

Detailed Description

Interface to Triangle (Delaunay mesher).

Todo
See also
http://www.cs.cmu.edu/~quake/triangle.html
Author
Mikael Öhman

Definition at line 64 of file trianglemesherinterface.h.

Constructor & Destructor Documentation

◆ TriangleMesherInterface()

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.

References maxArea, minAngle, and quadratic.

◆ ~TriangleMesherInterface()

oofem::TriangleMesherInterface::~TriangleMesherInterface ( )
inline

Destructor.

Definition at line 82 of file trianglemesherinterface.h.

Member Function Documentation

◆ fixNodeMarkers()

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().

◆ 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::FloatArray::giveSize(), oofem::IntArray::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.

◆ simplifyPSLG()

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::FloatArray::at(), oofem::IntArray::at(), oofem::FloatArray::computeNorm(), oofem::FloatArray::giveSize(), oofem::IntArray::giveSize(), oofem::Triangle_PSLG::nx, oofem::Triangle_PSLG::ny, oofem::FloatArray::resize(), oofem::IntArray::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().

Member Data Documentation

◆ maxArea

double oofem::TriangleMesherInterface::maxArea
protected

Definition at line 68 of file trianglemesherinterface.h.

Referenced by meshPSLG(), and TriangleMesherInterface().

◆ minAngle

double oofem::TriangleMesherInterface::minAngle
protected

Definition at line 67 of file trianglemesherinterface.h.

Referenced by meshPSLG(), and TriangleMesherInterface().

◆ quadratic

bool oofem::TriangleMesherInterface::quadratic
protected

Definition at line 70 of file trianglemesherinterface.h.

Referenced by meshPSLG(), and TriangleMesherInterface().

◆ useRegions

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-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011