##########################################################################
#
##########################################################################
FileFormats:general

 Data file formats.

 The grid data file format:

  (1) A one line header (for information only).

  (2) xdim ydim zdim fdim tdim gridflag

  (3) If gridgflag != 0,

      grid point coordinates as 3*xdim*ydim*zdim single precision ieee
      floats (x coordinate runs fastest).

  (4) A one line timestep header.

  (5) xdim*ydim*zdim*fdim single precision floating point numbers.
  Repeat (4) and (5) tdim times.


 The polygon/atom/element data file format:

 (1) NofCoordinates/NofNormals NofEntries fdim tdim ascii-binary-flag(0/1).

 (2) Coordinates (x,y,z in ascii). Coordinates get an index beginning from zero.

 (3) Polygon/element/atom etc. definitions: NofEntries times a line containing:

     MaterialIndex TypeCode (CoordinateIndex/NormalIndex)'s

 (4) NofCoordinates*fdim*tdim data values (in ascii or binary).
     foreach timestep
        - if data is in ascii all the values for one node at a time
        - if data is in binary one component array at a time

 In the syntax the /NofNormals and  /NormanIndexes are optional.

 The TypeCode for finite elements is constructed as follows:

    XYY,

 where X is topology of element:

    3 for triangle,
    4 for quad,
    5 for tetra,
    7 for wedge,
    8 for brick,
 
 and YY is the number of nodes in the element.

 Thus the following codes are reserved:

 (All elements are treated as isoparametric, i.e. the same shape functions
  are used for coordinates as for data.)

 303: three node (linear) triangular surface element.


  Shape functions: N0 = 1-u-v          2 v=1
                   N1 = u             / \
                   N2 = v            /   \        
                                    /     \       
                                   0-------1 u=1


 304: four node (linear) triangular surface element.

            2 v=1
           / \
          /   \
         /  4  \        
        /       \       
       0---------1 u=1


 306: six node (parabolic) triangular surface element.

  shape functions: N0 = (1-u-v)(1-2u-2v)              2  v=1
                   N1 = u(2u-1)                     /   \
                   N2 = v(2v-1)                    /     \
                   N3 = 4u(1-u-v)                 5       4
                   N4 = 4uv                      /         \
                   N5 = 4v(1-u-v)               0-----3-----1 u=1

 
 307: seven node (parabolic) triangular surface element.

              2  v=1
            /   \
           /     \
          5   6   4
         /         \
        0-----3-----1 u=1



 309: nine node (cubic) triangular surface element.

              2  v=1
            /   \
           7     6
          /       \
         8         5
        /           \
       0----3---4----1 u=1


 310: ten node (cubic) triangular surface element.

              2  v=1
            /   \
           7     6
          /       \
         8    9    5
        /           \
       0----3---4----1 u=1


 313: thirteen node (cubic) triangular surface element.

              2  v=1
            /   \
           7     6
          /   11  \
         8 12      5
        /      10   \
       /   9         \
       0----3---4----1 u=1



 404: four node (linear) quad surface element.

 shape functions: N0 = (1-u)(1-v)/4       3--------2
                  N1 = (1+u)(1-v)/4       |        |
                  N2 = (1+u)(1+v)/4     v |        | 
                  N3 = (1-u)(1+v)/4       0--------1
                                            u



 405: five node (linear) quad surface element.


        3---------2
        |         |
        |    4    | 
      v |         | 
        0---------1
          u



 408: eight node (parabolic) quad surface element.

  shape functions: N0 = ( uv(1-u-v)+u^2+v^2-1)/4
                   N1 = (-uv(1+u-v)+u^2+v^2-1)/4
                   N2 = ( uv(1+u+v)+u^2+v^2-1)/4      3---6---2
                   N3 = (-uv(1-u+v)+u^2+v^2-1)/4      |       |
                   N4 = ((1-v)(1-u^2)/2               7       5
                   N5 = ((1+u)(1-v^2)/2             v |       |
                   N6 = ((1+v)(1-u^2)/2               0---4---1
                   N7 = ((1-u)(1-v^2)/2                 u

 
 409: nine node (parabolic) quad surface element.

         3----6----2
         |         |
         7    8    5 
       v |         | 
         0----4----1
           u

 412: twelve node (cubic) quad surface element.

         3---9---8---2
         |           |
        10           7
         |           | 
        11           6
       v |           | 
         0---4---5---1
           u

 416: sixteen node (cubic) quad surface element.

         3---9----8---2
         |            |
        10   15  14   7
         |            | 
        11   12  13   6
       v |            | 
         0---4----5---1
           u

 504: four node (linear) tetra volume element.

               3
              /|\
             / | \
            /  |  \
           /   |   \
          /    2    \
         /    / \    \
        /   /     \   \            w  v
       /  /         \  \           | /
      //              \ \          |/
      0-----------------1          ----u


 505: five node (linear) tetra volume element.

               3
              /|\
             / | \
            /  |  \
           /   |   \
          /    2    \
         /    / \    \
        /   /  5  \   \            w  v
       /  /         \  \           | /
      //              \ \          |/
      0-----------------1          ----u

   5th node inside the tetrahedron.


 510: ten node (parabolic) tetra volume element.

               3
              /|\
             / | \
            /  9  \
           /   |   \
          7    2    8
         /    / \    \
        /  6/     \5  \            w  v
       /  /         \  \           | /
      //              \ \          |/
      0-------4---------1           ----u


 511: eleven node (parabolic) tetra volume element.

               3
              /|\
             / | \
            /  9  \
           /   |   \
          7    2    8
         /    / \    \
        /  6/     \5  \            w  v
       /  /         \  \           | /
      //              \ \          |/
      0-------4---------1           ----u

   11th node inside the tetrahedron.


 514: fourteen node (parabolic) tetra volume element.

               3
              /|\
             / | \
            /  9  \
           /   |   \
          7    2    8
         /    / \    \
        /  6/     \5  \            w  v
       /  /         \  \           | /
      //              \ \          |/
      0-------4---------1           ----u


   11th node on the 0-4-1-5-2-6 (w = 0) face.
   12th node on the 0-4-1-8-3-7 (v = 0) face.
   13th node on the 1-5-2-9-3-8 face.
   14th node on the 0-6-2-9-3-7 (u = 0) face.


 515: fifteen node (parabolic) tetra volume element.

               3
              /|\
             / | \
            /  9  \
           /   |   \
          7    2    8
         /    / \    \
        /  6/     \5  \            w  v
       /  /         \  \           | /
      //              \ \          |/
      0-------4---------1           ----u

   11th node on the 0-4-1-5-2-6 (w = 0) face.
   12th node on the 0-4-1-8-3-7 (v = 0) face.
   13th node on the 1-5-2-9-3-8 face.
   14th node on the 0-6-2-9-3-7 (u = 0) face.
   15th node inside the tetrahedron.


 516: sixteen node (cubic) tetra volume element.

               3
              /|\
             / | \
            / 15  \
          13  12   14
          /    2    \
         /    / \    \
       10  8/     \7  11           w  v
       /  9         6  \           | /
      //              \ \          |/
      0-----4-----5-----1           ----u


 517: seventeen node (cubic) tetra volume element.

               3
              /|\
             / | \
            / 15  \
          13  12   14
          /    2    \
         /    / \    \
       10  8/     \7  11           w  v
       /  9         6  \           | /
      //              \ \          |/
      0-----4-----5-----1           ----u

   17th node inside the tetrahedron.


 520: twenty node (cubic) tetra volume element.

               3
              /|\
             / | \
            / 15  \
          13  12   14
          /    2    \
         /    / \    \
       10  8/     \7  11           w  v
       /  9         6  \           | /
      //              \ \          |/
      0-----4-----5-----1           ----u

   17th node on the 0-4-5-1-6-7-2-8-9     (w = 0) face.
   18th node on the 0-4-5-1-11-14-3-13-10 (v = 0) face.
   19th node on the 1-6-7-2-12-15-3-14-11 () face.
   20th node on the 0-9-8-2-12-15-3-13-10 (u = 0) face.


 521: twentyone node (cubic) tetra volume element.

               3
              /|\
             / | \
            / 15  \
          13  12   14
          /    2    \
         /    / \    \
       10  8/     \7  11           w  v
       /  9         6  \           | /
      //              \ \          |/
      0-----4-----5-----1           ----u

   17th node on the 0-4-5-1-6-7-2-8-9     (w = 0) face.
   18th node on the 0-4-5-1-11-14-3-13-10 (v = 0) face.
   19th node on the 1-6-7-2-12-15-3-14-11 () face.
   20th node on the 0-9-8-2-12-15-3-13-10 (u = 0) face.
   21st node inside the tetrahedron.

 706: six node (linear) wedge volume element.

 
                                   5
                                  ///|
                               //   /|
                            //     / | 
                         //       /  |
                      //         // /2
                    /         ///   /
                   3-----------4   /
                   |      /    |  /           w  v
                   |   /       | /            | /
                   |/          |/             |/
                   0-----------1              ---u


 715: 15 node (parabolic) wedge volume element.

 
                                   5
                                  ///|
                               //   /|
                           14/     / 11
                         //      13  |
                      //         / / 2
                    /       8 ///   /
                   3-----12----4   /
                   |      /    |  7           w  v
                   9   /      10 /            | /
                   |/          |/             |/
                   0----6------1              ---u


 808: 8 node (linear) brick volume element.

  shape functions: N0 = (1-u)(1-v)(1-w)/8       7---------6
                   N1 = (1+u)(1-v)(1-w)/8      /|        /|
                   N2 = (1+u)(1+v)(1-w)/8     4---------5 |
                   N3 = (1-u)(1+v)(1-w)/8     | |       | |
                   N4 = (1-u)(1-v)(1+w)/8     | |       | |
                   N5 = (1+u)(1-v)(1+w)/8     | 3-------|-2     w v
                   N6 = (1+u)(1+v)(1+w)/8    w|/v       |/      |/
                   N7 = (1-u)(1+v)(1+w)/8     0---------1       ---u
                                               u


 809: 9 node (linear) brick volume element.

        7---------6
       /|        /|
      4---------5 |
      | |       | |
      | |       | |
      | 3-------|-2     w v
     w|/v       |/      |/
      0---------1       ---u
       u


   9th node indside the hexahedron.


 820: 20 node (parabolic) brick volume element.

 
                              7------18-------6
                            19|             17|
                            / |             / |
                           4------16-------5  |
                           | 15            |  14
                           |  |            |  |
                          12  |           13  |
                           |  3-----10-----|--2
                           | 11            | 9        w v
                          w|/v             |/         |/
                           0-------8-------1           ---u
                            u
 
  shape functions:  N  = (1+u u)(1+v v)(1+w w)(u u+v v+w w-2)/8   i = 0..7
                     i       i      i      i    i   i   i
                    N  = (1-u^2)(1+v v)(1+w w)/4     i=8,10,16,18  (u = 0)
                     i              i      i                         i
                    N  = (1+u u)(1-v^2)(1+w w)/4     i=9,11,17,19  (v = 0)
                     i       i             i                         i
                    N  = (1+u u)(1+v v)(1-w^2)/4     i=12,13,14,15 (w = 0)
                     i       i      i                                i


 821: 21 node (parabolic) brick volume element.

 
                              7------18-------6
                            19|             17|
                            / |             / |
                           4------16-------5  |
                           | 15            |  14
                           |  |            |  |
                          12  |           13  |
                           |  3-----10-----|--2
                           | 11            | 9        w v
                          w|/v             |/         |/
                           0-------8-------1           ---u
                            u

    21st node inside the hexahedron.

 826: 26 node (parabolic) brick volume element.

 
                              7------18-------6
                            19|             17|
                            / |    (21)     / |
                           4------16-------5  |
                           | 15     (24)   |  14
                           |(25)           |(23)
                          12  |    (22)   13  |
                           |  3-----10-----|--2
                           | 11    (20)    | 9        w v
                          w|/v             |/         |/
                           0-------8-------1           ---u
                            u

    21st node on the 0-8-1-9-2-10-3-11   (w=-1) face.
    22nd node on the 4-16-5-17-6-18-7-19 (w=+1) face.
    23rd node on the 0-8-1-13-5-16-4-12  (v=-1) face.
    24th node on the 1-9-2-14-6-17-5-13  (u=+1) face.
    25th node on the 2-10-3-15-7-18-6-14 (v=+1) face.
    26th node on the 0-11-3-15-7-19-4-12 (u=-1) face.


 827: 27 node (parabolic) brick volume element.

 
                              7------18-------6
                            19|             17|
                            / |    (21)     / |
                           4------16-------5  |
                           | 15     (24)   |  14
                           |(25)           |(23)
                          12  |    (22)   13  |
                           |  3-----10-----|--2
                           | 11    (20)    | 9        w v
                          w|/v             |/         |/
                           0-------8-------1           ---u
                            u

    21st node on the 0-8-1-9-2-10-3-11   (w=-1) face.
    22nd node on the 4-16-5-17-6-18-7-19 (w=+1) face.
    23rd node on the 0-8-1-13-5-16-4-12  (v=-1) face.
    24th node on the 1-9-2-14-6-17-5-13  (u=+1) face.
    25th node on the 2-10-3-15-7-18-6-14 (v=+1) face.
    26th node on the 0-11-3-15-7-19-4-12 (u=-1) face.
    27th node inside the hexahedron.
