Modules, Types and Methods

Modules, Types, Methods

Create and refine 2D unstructured triangular meshes. Interfaces Triangle written by J.R. Shewchuk.

source

Struct describes a planar straight-line graph (PSLG) of a polygon. It contains points, point markers, attributes, segments, segment markers and holes.

source
Polygon_pslg(n_point :: Int, n_point_marker :: Int, n_point_attribute :: Int, n_segment :: Int, n_hole :: Int)

Outer constructor that only reserves space for points, markers, attributes and holes. Input data is converted to hold C-data structures (Cint and Cdouble arrays) for internal use.

source

Struct containing triangular mesh and a Voronoi diagram. If arrays do not contain data their length is zero.

source

TriMesh(mesh :: MeshptrC, vor :: MeshptrC, mesh_info :: String)

Outer constructor for TriMesh. Read the struct returned by ccall(...) to Triangle library. Wrap a Julia arrays around mesh data if their pointer is not C_NULL.

source
create_mesh(point :: Array{Float64,2}, switches :: String; <keyword arguments>)

Creates a triangulation of a planar straight-line graph (PSLG) polygon. Options for the meshing algorithm are passed directly by command line switches for Triangle. Use only if you know what you are doing.

Keyword arguments

  • point_marker :: Array{Int,2} = Array{Int,2}(undef,0,size(point,1)): Points can have a marker.
  • point_attribute :: Array{Float64,2} = Array{Float64,2}(undef,0,size(point,1)): Points can be given a number of attributes.
  • info_str :: String = "Triangular mesh of convex hull of point cloud.": Some mesh info on the mesh
source
create_mesh(point :: Array{Float64,2}; <keyword arguments>)

Creates a triangulation of the convex hull of a point cloud.

Keyword arguments

  • point_marker :: Array{Int,2} = Array{Int,2}(undef,0,size(point,1)): Points can have a marker.
  • point_attribute :: Array{Float64,2} = Array{Float64,2}(undef,0,size(point,1)): Points can be given a number of attributes.
  • info_str :: String = "Triangular mesh of convex hull of point cloud.": Some mesh info on the mesh
  • verbose :: Bool = false: Print triangle's output
  • check_triangulation :: Bool = false: Check triangulation for Delaunay property after it is created
  • voronoi :: Bool = false: Output a Voronoi diagram
  • delaunay :: Bool = false: If true this option ensures that the mesh is Delaunay instead of only constrained Delaunay. You can also set it true if you want to ensure that all Voronoi vertices are within the triangulation.
  • output_edges :: Bool = true: If true gives an edge list.
  • output_cell_neighbors :: Bool = true: If true outputs a list of neighboring triangles for each triangle
  • quality_meshing :: Bool = true: If true avoids triangles with angles smaller that 20 degrees
  • prevent_steiner_points_boundary :: Bool = false: If true no Steiner points are added on boundary segnents.
  • prevent_steiner_points :: Bool = false: If true no Steiner points are added on boundary segments on inner segments.
  • set_max_steiner_points :: Bool = false: If true the user will be asked to enter the maximum number of Steiner points added. If the user inputs 0 this is equivalent to set_max_steiner_points = true.
  • set_area_max :: Bool = false: If true the user will be asked for the maximum triangle area.
  • set_angle_min :: Bool = false: If true the user will be asked for a lower bound for minimum angles in the triangulation.
  • add_switches :: String = "": The user can pass additional switches as described in triangle's documentation. Only set this option if you know what you are doing.
source
create_mesh(poly :: Polygon_pslg, switches :: String; info_str :: String = "Triangular mesh of polygon (PSLG)")

Creates a triangulation of a planar straight-line graph (PSLG) polygon. Options for the meshing algorithm are passed directly by command line switches for Triangle. Use only if you know what you are doing.

source
create_mesh(poly :: Polygon_pslg; <keyword arguments>)

Creates a triangulation of a planar straight-line graph (PSLG) polygon.

Keyword arguments

  • info_str :: String = "Triangular mesh of polygon (PSLG)": Some mesh info on the mesh
  • verbose :: Bool = false: Print triangle's output
  • check_triangulation :: Bool = false: Check triangulation for Delaunay property after it is created
  • voronoi :: Bool = false: Output a Voronoi diagram
  • delaunay :: Bool = false: If true this option ensures that the mesh is Delaunay instead of only constrained Delaunay. You can also set it true if you want to ensure that all Voronoi vertices are within the triangulation.
  • mesh_convex_hull :: Bool = false: Mesh the convex hull of a poly (useful if the polygon does not enclose a bounded area - its convex hull still does though)
  • output_edges :: Bool = true: If true gives an edge list.
  • output_cell_neighbors :: Bool = true: If true outputs a list of neighboring triangles for each triangle
  • quality_meshing :: Bool = true: If true avoids triangles with angles smaller that 20 degrees
  • prevent_steiner_points_boundary :: Bool = false: If true no Steiner points are added on boundary segnents.
  • prevent_steiner_points :: Bool = false: If true no Steiner points are added on boundary segments on inner segments.
  • set_max_steiner_points :: Bool = false: If true the user will be asked to enter the maximum number of Steiner points added. If the user inputs 0 this is equivalent to set_max_steiner_points = true.
  • set_area_max :: Bool = false: If true the user will be asked for the maximum triangle area.
  • set_angle_min :: Bool = false: If true the user will be asked for a lower bound for minimum angles in the triangulation.
  • add_switches :: String = "": The user can pass additional switches as described in triangle's documentation. Only set this option if you know what you are doing.
source
polygon_Lshape()

Create a polygon of an L-shaped domain (example code).

source
polygon_regular(n_corner :: Int)

Create a polygon of a regular polyhedron with n_corner corners (example code).

source
polygon_struct_from_points(point :: Array{Float64,2},
                                pm :: Array{Int,2},
                                pa :: Array{Float64,2})

Create a polygon from a set of points (example code). No segments or holes are set here.

Arguments

  • point :: Array{Float64,2}: point set (dimension n-by-2)
  • pm :: Array{Int,2}: each point can have a marker (dimension either n-by-0 or n-by-1)
  • pa :: Array{Float64,2}: each point can have a number of $k>=0$real attributes (dimension n-by-k)
source
polygon_unitSimplex()

Create a polygon of the unit simplex (example code).

source
polygon_unitSquare()

Create a polygon of the unit square (example code).

source
polygon_unitSquareWithHole()

Create a polygon of the unit square that has a squared hole in the middle (example code).

source
refine(m :: TriMesh, switches :: String; <keyword arguments>)

Refines a triangular mesh according to user set constraints. Command line switches are passed directly. Use this function only if you know what you are doing.

Keyword arguments

  • divide_cell_into :: Int = 4: Triangles listed in ind_cell are area constrained by 1/dividecellinto * area(triangle[ind_cell]) in refined triangulation.
  • ind_cell :: Array{Int,1} = collect(1:m.n_cell): List of triangles to be refined.
  • info_str :: String = "Refined mesh": Some info string.
source
refine(m :: TriMesh ; <keyword arguments>)

Refines a triangular mesh according to user set constraints.

Keyword arguments

  • divide_cell_into :: Int = 4: Triangles listed in ind_cell are area constrained by 1/dividecellinto * area(triangle[ind_cell]) in refined triangulation.
  • ind_cell :: Array{Int,1} = collect(1:m.n_cell): List of triangles to be refined.
  • keep_segments :: Bool = false: Retain segments of input triangulations (although they may be subdivided).
  • keep_edges :: Bool = false: Retain edges of input triangulations (although they may be subdivided).
  • verbose :: Bool = false: Output triangle's commandline info.
  • check_triangulation :: Bool = false: Check refined mesh.
  • voronoi :: Bool = false: Output Voronoi diagram.
  • output_edges :: Bool = true: Output edges.
  • output_cell_neighbors :: Bool = true: Output cell neighbors.
  • quality_meshing :: Bool = true: No angle is is smaller than 20 degrees.
  • info_str :: String = "Refined mesh": Some info string.

Remark

The switches keep_segments and keep_edges can not be true at the same time. If keep_segments=true area constraints on triangles listed in ind_cell are rather local constraints than hard constraints on a triangle since the original edges may not be preserved. For details see Triangle's documentation.

source
refine_rg(m :: TriMesh)

Refine triangular mesh by subdivision of each edge into 2. Only triangles listed in ind_red are refined. Very slow for large meshes.

source
refine_rg(m :: TriMesh)

Refine triangular mesh by subdivision of each edge into 2. Very slow for large meshes.

source
set_polygon_hole!(poly :: Polygon_pslg, h :: AbstractArray{Float64,2})

Set poly.hole appropriately. Input must have dimensions n_hole-by-2.

!!! Each hole must be enclosed by segments. Do not place holes on segments.

source
set_polygon_point!(poly :: Polygon_pslg, p :: AbstractArray{Float64,2})

Set poly.point appropriately. Input must have dimensions n_point-by-2.

source
set_polygon_point_attribute!(poly :: Polygon_pslg, pa :: AbstractArray{Float64,2})

Set poly.point_attribute appropriately. Input must have dimensions n_point-by-n_point_attribute.

source
set_polygon_point_marker!(poly :: Polygon_pslg, pm :: AbstractArray{Int,2})

Set poly.point_marker appropriately. Input must have dimensions n_point-by-n_point_marker. n_point_marker can be 1 or 0.

source
set_polygon_segment!(poly :: Polygon_pslg, s :: AbstractArray{Int,2})

Set poly.segment appropriately. Input must have dimensions n_segment-by-2.

source
set_polygon_segment_marker!(poly :: Polygon_pslg, sm :: AbstractArray{Int,1})

Set poly.segment_marker appropriately. Input must have dimensions n_segment-by-1. If not set every segemnt will have marker equal to 1.

source
triangulate(mesh_in :: Mesh_ptr_C, mesh_out :: Mesh_ptr_C, vor_out :: Mesh_ptr_C, switches :: String)

Direct (raw) interface to triangle library. See triangle's documentation.

source
write_mesh(m :: TriMesh, file_name :: String; <keyword arguments>)

Write mesh to disk.

Arguments

  • file_name :: String: Provide a string with path and filename

Keyword arguments

  • format :: String = "triangle": Specify mesh format. Only option for now is "triangle" (Triangle's native mesh format)
source

Julia struct for that corresponds to C struct of Triangle. Only for internal use.

source
Mesh_ptr_C(n_point :: Cint, point :: Array{Float64,2},
                n_point_marker :: Cint, point_marker :: Array{Cint,2},
                n_point_attribute :: Cint, point_attribute :: Array{Float64,2},
                n_cell :: Cint, cell :: Array{Cint,2}, cell_area_constraint :: Array{Float64,1},
                n_edge :: Cint, edge :: Array{Cint,2}, edge_marker :: Array{Cint,1},
                n_segment :: Cint, segment :: Array{Cint,2}, segment_marker :: Array{Cint,1},
                n_hole :: Cint, hole :: Array{Float64,2})

Constructor for Mesh_ptr_C from mesh data. Only for internal use.

source
Mesh_ptr_C(p :: Polygon_pslg)

Constructor for Mesh_ptr_C from polygon. Only for internal use.

source
Mesh_ptr_C()

Constructor for Mesh_ptr_C. Initialize everything as NULL. Only for internal use.

source

Struct containing Voronoi diagram. If arrays do not contain data their length is zero.

source