| | 88 | This initializes the compositions |
| | 89 | +latex+$C_2$ and $C_3$ |
| | 90 | -latex-C2 and C3 |
| | 91 | in an array of points filling a rectangle between (A2,A3), (B2,B3) in |
| | 92 | composition space. It also sets the |
| | 93 | +latex+{\tt efunc}, $T$ and $P$ |
| | 94 | +html+ <tt>efunc</tt>, <i>T</i> and <i>P</i> |
| | 95 | fields of each point to -1 to indicate that free energies and derivatives are |
| | 96 | not yet calculated. This is of course trivial compared with the triangle |
| | 97 | case. |
| | 98 | |
| | 99 | int init_rect_array It returns zero or an error code. |
| | 100 | |
| | 101 | int res2 Resolution of the discretization (number of intervals) in the |
| | 102 | +latex+$C_2$-direction. |
| | 103 | -latex-C2-direction. |
| | 104 | |
| | 105 | int res3 Resolution of the discretization (number of intervals) in the |
| | 106 | +latex+$C_3$-direction. |
| | 107 | -latex-C3-direction. |
| | 108 | |
| | 109 | ternary_point *points Array of ternary points of size |
| | 110 | +latex+({\tt res2}+1)$\times$({\tt res3}+1). |
| | 111 | -latex-(res2+1) * (res3+1). |
| | 112 | |
| | 113 | int efunc Energy function index indicating which energy curve this point will |
| | 114 | be on. |
| | 115 | |
| | 116 | double A2 Minimum value of |
| | 117 | +latex+$C_2$. |
| | 118 | -latex-C2. |
| | 119 | |
| | 120 | double A3 Minimum value of |
| | 121 | +latex+$C_3$. |
| | 122 | -latex-C3. |
| | 123 | |
| | 124 | double B2 Maximum value of |
| | 125 | +latex+$C_2$. |
| | 126 | -latex-C2. |
| | 127 | |
| | 128 | double B3 Maximum value of |
| | 129 | +latex+$C_3$. |
| | 130 | -latex-C3. |
| | 131 | ++++++++++++++++++++++++++++++++++++++*/ |
| | 132 | |
| | 133 | int init_rectangle_array |
| | 134 | (int res2, int res3, ternary_point *points, int efunc, |
| | 135 | double A2, double A3, double B2, double B3) |
| | 136 | { |
| | 137 | int i,j; |
| | 138 | |
| | 139 | for (i=0; i<=res2; i++) |
| | 140 | for (j=0; j<=res3; j++) |
| | 141 | { |
| | 142 | points [j*(res2+1)+i].C2 = A2 + (B2-A2) * ((double) i/res2); |
| | 143 | points [j*(res2+1)+i].C3 = A3 + (B3-A3) * ((double) j/res3); |
| | 144 | points [j*(res2+1)+i].efunc = efunc; |
| | 145 | points [j*(res2+1)+i].T = points [j*res2+i].P = -1; |
| | 146 | } |
| | 147 | |
| | 148 | return 0; |
| | 149 | } |
| | 150 | |
| | 151 | |
| | 152 | /*++++++++++++++++++++++++++++++++++++++ |
| | 193 | |
| | 194 | return 0; |
| | 195 | } |
| | 196 | |
| | 197 | |
| | 198 | /*++++++++++++++++++++++++++++++++++++++ |
| | 199 | This function fills an array with triangle vertex indices, two triangles per |
| | 200 | rectangular cell. |
| | 201 | |
| | 202 | int init_rectangle_vertices It returns zero or an error code. |
| | 203 | |
| | 204 | int res2 Resolution of the discretization (number of intervals) in the |
| | 205 | +latex+$C_2$-direction. |
| | 206 | -latex-C2-direction. |
| | 207 | |
| | 208 | int res3 Resolution of the discretization (number of intervals) in the |
| | 209 | +latex+$C_3$-direction. |
| | 210 | -latex-C3-direction. |
| | 211 | |
| | 212 | int *vertex_array Array of triangle indices of size |
| | 213 | +latex+2$\times${\tt res2$\times$res3}. |
| | 214 | -latex-2 * res2 * res3. |
| | 215 | |
| | 216 | int offset Constant to add to vertex indices, usually 0. |
| | 217 | ++++++++++++++++++++++++++++++++++++++*/ |
| | 218 | |
| | 219 | int init_rectangle_vertices (int res2, int res3, int *vertex_array, int offset) |
| | 220 | { |
| | 221 | int i,j; |
| | 222 | |
| | 223 | for (i=0; i<res2; i++) |
| | 224 | for (j=0; j<res3; j++) |
| | 225 | { |
| | 226 | vertex_array [(j*res2+i)*6] = offset + j*(res2+1)+i; |
| | 227 | vertex_array [(j*res2+i)*6+1] = offset + j*(res2+1)+i+1; |
| | 228 | vertex_array [(j*res2+i)*6+2] = offset + (j+1)*(res2+1)+i; |
| | 229 | |
| | 230 | vertex_array [(j*res2+i)*6+3] = offset + j*(res2+1)+i+1; |
| | 231 | vertex_array [(j*res2+i)*6+4] = offset + (j+1)*(res2+1)+i+1; |
| | 232 | vertex_array [(j*res2+i)*6+5] = offset + (j+1)*(res2+1)+i; |
| | 233 | } |