Refining preexisting meshes


The -r switch is used to load an existing mesh so that changes may be made to it. Usually these changes are the imposition of stronger angle or area constraints.

In order to simplify the maintenance of a sequence of successively refined meshes, all files written by Triangle have iteration numbers in their filenames; the iteration number of each mesh is one greater than that of the mesh it was created from. In the example below, the input mesh (which you saw created on the Delaunay triangulation page) has iteration number one, and consists of the files box.1.node and box.1.ele.

This mesh is refined with an area constraint of 0.2, creating a new mesh with iteration number two. Repeating the process with smaller area constraints, iterations three and four are also created.

triangle -rpa0.2 box.1
triangle -rpa.05 box.2
triangle -rpa.0125 box.3

Above, the -p switch is used to retain segment information. At each iteration, a .poly file is read and used to specify edges that are constrained and cannot be eliminated (although they can be divided into smaller edges) by the refinement process. In this example, it didn't make any difference because the mesh has no internal boundaries; however, in a mesh with internal boundaries, the -p switch is necessary to maintain these boundaries during refinement; hence, you should make a habit of using it whenever refining a mesh that was originially formed from a PSLG. If you forget, the information about internal segments will be lost for all future iterations.

Sometimes one wishes to be more selective about applying area constraints. It is possible to assign a separate area constraint to each triangle by using an .area file such as box.1.area. In this file, one triangle has been constrained to have area no greater than 0.02; all other triangles are left unconstrained (by assigning them negative areas). Specifying the -a switch without a number following causes Triangle to read and use the .area file.

triangle -rpa box.1

Note that triangle-by-triangle area constraints tend to diffuse during the meshing process; best results are obtained when the constraints vary more smoothly than in this example. When there are large variations in area constraint between adjacent triangles, you may not get the results you want.

Fixed and variable area constraints can be mixed by using the -a switch twice, once with and once without a number following.

triangle -rpaa.5 box.1

If you are refining a mesh composed of linear (three-node) elements, the output mesh will contain all the nodes present in the input mesh, in the same order, with new nodes added at the end of the .node file. However, there is no guarantee that each output element is contained in a single input element. Often, output elements will overlap two input elements, and input edges are not present in the output mesh. Hence, a sequence of refined meshes will form a hierarchy of nodes, but not a hierarchy of elements. If you are refining a mesh of higher-order elements, the hierarchical property applies only to the nodes at the corners of an element; other nodes may not be present in the refined mesh.


Return to Triangle home page.
jrs@cs.cmu.edu