package mesh

  1. Overview
  2. Docs

Generic mesh structure to be used with various meshers. It also defines some functions to help to display and design geometries.

General remark: The two dimensional arrays below are described for the fortran_layout. If you use a c_layout, they are transposed. Also indices, such as the indices points, triangles,..., start at 0 instead of 1 . For example mesh#point is of size n * 2 and the coordinates of point i are given by (point.{i,0}, point.{i,1}).

  • author Christophe Troestler (Christophe.Troestler\@umons.ac.be)

Mesh data format

type 'layout vec = (float, Bigarray.float64_elt, 'layout) Bigarray.Array1.t

Float vector (parametrized by the layout).

type 'layout mat = (float, Bigarray.float64_elt, 'layout) Bigarray.Array2.t

Float matrix (parametrized by the layout).

type 'layout int_vec = (int, Bigarray.int_elt, 'layout) Bigarray.Array1.t

Integer vector (parametrized by the layout).

type 'layout int_mat = (int, Bigarray.int_elt, 'layout) Bigarray.Array2.t

Integer matrix (parametrized by the layout).

class 'l pslg : 'l Bigarray.layout -> object ... end

Planar Straight Line Graph datastructure. By default, creating an object from this class results in all methods being initialized with empty arrays.

val pslg : ?hole:'l mat -> ?region:'l mat -> ?point_marker:'l int_vec -> 'l mat -> ?segment_marker:'l int_vec -> 'l int_mat -> 'l pslg

pslg point segment creates a PSLG with the proper methods. The default values for unspecified values are empty arrays.

class type 'layout t = object ... end

Object describing various characteristics of a mesh.

val create : ?hole:'l mat -> ?region:'l mat -> ?point_marker:'l int_vec -> 'l mat -> ?segment_marker:'l int_vec -> ?segment:'l int_mat -> ?neighbor:'l int_mat -> ?edge:'l int_mat -> ?edge_marker:'l int_vec -> 'l int_mat -> 'l t

create point triangle creates a mesh with the proper methods. The default values for unspecified values are empty arrays.

class type 'layout voronoi = object ... end

Voronoi diagram.

val layout : 'l pslg -> 'l Bigarray.layout

layout mesh returns the layout of mesh.

val is_c_layout : 'l pslg -> bool
  • deprecated

    is_c_layout returns true if the mesh layout is C.

val copy : 'l t -> 'l t

new copy mesh returns an identical mesh where all matrices are a fresh copy of the ones of mesh.

val sub : 'l t -> ?pos:int -> int -> 'l t

sub mesh ?pos len returns a new mesh keeping only the points with indices between pos and pos + len - 1 (included). Only triangles whose 3 vertices have been selected are kept. Beware that some sub-matrices may be shared.

  • parameter pos

    default: 1 (fortran_layout) or 0 (c_layout).

val permute_points : 'l t -> ?inv:bool -> 'l int_vec -> 'l t

permute_points mesh p returns a new mesh identical to the given mesh except that the points indices are transformed through the permutation p: the point of index i in the new mesh will be the one of index p.{i} in mesh. In other words, p lists mesh indices in the order they will have after permutation.

  • parameter inv

    consider that the inverse permutation is given. If true, the point of index i in mesh will be mapped to the point of index p.{i} in the returned mesh. Default: false.

val permute_triangles : 'l t -> ?inv:bool -> 'l int_vec -> 'l t

permute_triangles mesh p returns a new mesh identical to the given mesh except that the trangle indices are transformed through the permutation p: the triangle of index i in the new mesh will be the one of index p.{i} in mesh. In other words, p lists mesh indices in the order they will have after permutation.

  • parameter inv

    consider that the inverse permutation is given. If true, the point of index i in mesh will be mapped to the point of index p.{i} in the returned mesh. Default: false.

Band computation and reduction

val band_height_P1 : ?filter:(int -> bool) -> 'l t -> int

band_height mesh returns the number of nonzero super-diagonals + 1 (for the diagonal) of symmetric band matrices for P1 finite elements inner products. It is the maximum on all triangles T of max(|i1 - i2|, |i2 - i3|, |i3 - i1|) where i1, i2, and i3 are the indices of the nodes of the three corners of the triangle T.

  • parameter filter

    If provided, only perform the compuation on nodes i such that filter i is true. Default: no filter.

val cuthill_mckee : ?rev:bool -> ?perm:'l int_vec -> 'l t -> 'l t

cuthill_mckee mesh return a new mesh that is identical to mesh except that the labelling of the nodes has been changed to lower its band (as computed by band_height_P1).

  • parameter rev

    whether if true, use the Reverse CutHill-McKee algorithm. Default: true.

  • parameter perm

    if provided, the permutation will be stored in that vector. More precisely, perm.{l} = i means that l is the new label for the node initially labeled i. This permutation is needed to transfer vectors defined on the initial labeling. The length of the permutation vector must be the number of nodes.

LaTeX output

module LaTeX : sig ... end

LaTex output. It is given in terms of three macros \meshline, \meshpoint, and \meshtriangle to plot edges, points and (filled) triangles. The arguments of these macros are described by comments in the output files. If you do not provide your own implementations, default ones will be used. The LaTeX package tikz is required -- which works for PostScript as well as PDF output.

Scilab

val scilab : 'l t -> ?longitude:float -> ?azimuth:float -> ?mode:[ `Triangles | `Triangles_only | `No_triangles ] -> ?box:[ `None | `Behind | `Box_only | `Full ] -> ?edgecolor:[ `Color of int | `Grey of float ] -> 'l vec -> string -> unit

scilab mesh z file saves the mesh data and the function values z (i.e. z.{i} is the function value at the point mesh#point.{_,i} (fortran layout)) on that mesh so that when Scilab runs the created file.sci script, the graph of the function is drawn.

  • parameter longitude

    sets the longitude in degrees of the observation point.

  • parameter azimuth

    sets the azimuth in degrees of the observation point.

  • parameter mode

    `Triangles draw the triangles on the surface, `Triangles_only only draw the triangles (no surface color), `No_triangles only draw the colored surface.

  • parameter box

    `None draw no bow at all, `Behind only draw the axes behind the plot, `Box_only only draw the box and label axes, `Full draw the box, label axes, and add ticks.

Matlab

val matlab : 'l t -> ?edgecolor:[ `None | `Flat | `Interp | `Color of int ] -> ?linestyle:string -> ?facealpha:float -> 'l vec -> string -> unit

matlab mesh z file saves the mesh data and the function values z (i.e. z.{i} is the function value at the point mesh.point.{_,i} (fortran layout)) on that mesh so that when Matlab runs the created file.m script, the graph of the function is drawn.

  • parameter edgecolor

    the name of the color for the edges of the triangles. Default: `Color 0 i.e., black. `Color c use the color given as 0xRRGGBB (if c < 0, then `Color c is interpreted as `None). The value `None removes them.

  • parameter linestyle

    is a symbol representing a style of line: "-" is a solid line, "--" a dashed line, ":" a dotted line, "-." a dash-dot line and "none" means that no line is drawn. Default: "-".

  • parameter facealpha

    the transparency of faces, 0. meaning fully transparent and 1. opaque. Default: 1..

Mathematica

val mathematica : 'l t -> 'l vec -> string -> unit

mathematica mesh z file saves the mesh data and the function values z (i.e. z.{i} is the function value at the point mesh.point.{_,i} (fortran layout)) in the file file.m so that running "<<file.m" in mathematica plots the function. The variables File`xyz and File`adj (where File is the capitalized file name which is used as the context) are defined and the mathematica command TriangularSurfacePlot[File`xyz, File`adj] does the plot.

If file contains other digits than alphanumeric (e.g. underscores), they are removed for the context names File used for internal variables.

OCaml

Innovation. Community. Security.