Triangle, http://www-2.cs.cmu.edu/~quake/triangle.html, is a 2D
triangular mesh generator.  Files in this directory are for creating
fea meshes with triangle.

Input to Triangle
-----------------
triangle's primary input is a .poly file which describes the perimeter of
the region to be meshed.  The .poly file format is explained here:
http://www-2.cs.cmu.edu/~quake/triangle.poly.html

Example
-------
Read a .poly [-p] file and create a quality [-q] mesh (smallest element 
interior angle is 20 degrees) where each element has a maximum area of 
0.2 [-a0.2]:
  triangle -pqa0.2 square.poly
This will create three files:  square.1.ele, square.1.node, square.1.poly

tri_mesh_gen
------------
A Perl script that reads a triangle .poly file and from it creates an input 
file suitable for fea.  The -c switch means write a comma separated value
(.csv) model file.  Table 1 shows the number of nodes and elements created
for several maximum area values; the "-a 0.2" option here produces 
  tri_mesh_gen -a 0.2  square.poly

Build an SQLite Database
------------------------
Examples:
  tri_mesh_gen -a 0.2    square.poly #   8 elements,   9 nodes
  tri_mesh_gen -a 0.2         A.poly #  62 elements,  59 nodes
  tri_mesh_gen -a 0.0002      A.poly # 647 elements, 415 nodes

Query the SQLite Database
-------------------------
SQLite comes with a command-line program named 'sqlite' which can be used
to browse and/or modify SQLite databases such as the one created by the
tri_mesh_gen script.  Bring up the database like so:
  sqlite square.db
then submit some some simple queries:
 o print the names of all the tables defined in the database:
      .tables
 o see how table 'node' was defined
      .schema node
 o how many nodes and triangular elements are there?
      select count(*) from node;
      select count(*) from tri3;
 o show the four corner nodes:
      select id,x1,x2 from node where (x1=0 or x1=1)  and (x2=0 or x2=1);
 o find the node closest to the center of the plate:
      select id,x1,x2 from node where ((0.5-x1)*(0.5-x1)+(0.5-x2)*(0.5-x2)) =
         (select min((0.5-x1)*(0.5-x1)+(0.5-x2)*(0.5-x2)) from node);
 o which elements are attached to node 70447196?
      select id from tri3 where n1=70447196 or n2=70447196 or n3=70447196;
 o list node ID's in renumbered order
      select new_id,id from node,renumbered_nid where orig_id=seq_no 
          order by new_id;
Hit control-d to exit from sqlite.

Table 1  --  square.poly model size as a function of maximum element area.

Max area     # nodes        # elements       size .csv       size .db
--------     -------        ----------       ---------       --------
 0.2              9                 8          1  kB
 0.02            41                64          7  kB
 0.002          289               501         50  kB
 0.0002        4225              8192         0.6 MB
 0.00002      33025             65536         4.7 MB 


Making Meshes with util/rectangle_mesh
--------------------------------------------------
Flat plate:
  ../util/rectangle_mesh -nx 10 -ny 10 x10y10.csv
Cylinder (x is circumferential direction, y is axial):
  ../util/rectangle_mesh -nx 20 -ny 4 -xform=cylinder -ro=2        cyl.csv
Torus:
  ../util/rectangle_mesh -nx 10 -ny 30 -xform=torus   -ro=5 -ri=4  torus.csv

Wrapped edges in cylinders and tori are not stitched together so these shapes 
have overlapping nodes and free edges where edges of the original rectangle 
were brought together.

Make a .db file with 'csv2db'.  For example,
  ../util/csv2db torus.csv

If a .off file is made from the database, its mesh can be viewed with geomview:
  ../util/db2off torus.db
  geomview torus.off
