TriangleGetElementAttributes[expr]
gets the element attributes in a Triangle expression.
TriangleGetElementAttributes
TriangleGetElementAttributes[expr]
gets the element attributes in a Triangle expression.
Details and Options
- To use TriangleGetElementAttributes, you first need to load it using Needs["TriangleLink`"].
- TriangleGetElementAttributes returns attributes that are stored in a TriangleExpression.
- TriangleGetElementAttributes needs the "A" switch to be set during the call to TriangleTriangulate.
Examples
Basic Examples (1)
Needs["TriangleLink`"]This creates an instance of a Triangle expression:
inst = TriangleCreate[]This sets up points and segments to use:
pts = {{0., 0.}, {2., 0.}, {2., 2.}, {0., 1.}};
segments = {{1, 2}, {2, 3}, {3, 4}, {4, 1}};This sets the points and facets in the Triangle instance:
TriangleSetPoints[inst, pts];
TriangleSetSegments[inst, segments];This sets up variables that specify a point within a material domain, as well as a region attribute and a region constraint:
materialDomains = {{1., 0.25}};
materialDomainsRegionAttribute = {10.};
materialDomainsRegionConstraint = {0.5};The material variables are set in the Triangle instance:
TriangleSetRegions[inst, materialDomains, materialDomainsRegionAttribute, materialDomainsRegionConstraint];This carries out the triangulation, returning a new Triangle instance:
outInst = TriangleTriangulate[ inst, "pqaA"]This extracts the points and elements from the triangulation:
coords = TriangleGetPoints[outInst];
meshElements = TriangleGetElements[outInst];With the following support function, you can visualize the triangles:
TriangleWireframe[i_] := Line[ Flatten[ i[[All, #]]& /@ {{1, 2}, {2, 3}, {3, 1}}, 1]]Graphics[GraphicsComplex[coords, TriangleWireframe[meshElements]]]Each element now carries the material attribute:
TriangleGetElementAttributes[outInst];