Changeset 8479
- Timestamp:
- Jul 25, 2012, 8:49:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/operators/kinematic_viscosity_operator_ext.c
r8478 r8479 224 224 h_j = bdry_data[j[edge] - n]; 225 225 } 226 v[edge] = - 0.5 * (cell_data[i] + h_j)* geo_values[3 * i + edge]; //the negative of the individual interaction227 v_i += 0.5 * (cell_data[i] + h_j)* geo_values[3 * i + edge]; //sum the three interactions226 v[edge] = - cell_data[i] * geo_values[3 * i + edge]; //the negative of the individual interaction 227 v_i += cell_data[i] * geo_values[3 * i + edge]; //sum the three interactions 228 228 } 229 229 if (cell_data[i] <= 0.0) { … … 256 256 } 257 257 258 int update_elliptic_matrix(int n, 259 int tot_len, 260 long *geo_indices, 261 double *geo_values, 262 double *cell_data, 263 double *bdry_data, 264 double *data, 265 long *colind) { 266 int i, k, edge, j[4], sorted_j[4], this_index; 267 double h_j, v[3], v_i; //v[k] = value of the interaction of edge k in a given triangle, v_i = (i,i) entry 268 for (i = 0; i < n; i++) { 269 v_i = 0.0; 270 j[3] = i; 271 272 //Get the values of each interaction, and the column index at which they occur 273 for (edge = 0; edge < 3; edge++) { 274 j[edge] = geo_indices[3 * i + edge]; 275 if (j[edge] < n) { //interior 276 h_j = cell_data[j[edge]]; 277 } else { //boundary 278 h_j = bdry_data[j[edge] - n]; 279 } 280 v[edge] = -0.5 * (cell_data[i] + h_j) * geo_values[3 * i + edge]; //the negative of the individual interaction 281 v_i += 0.5 * (cell_data[i] + h_j) * geo_values[3 * i + edge]; //sum the three interactions 282 } 283 if (cell_data[i] <= 0.0) { 284 v_i = 0.0; 285 v[0] = 0.0; 286 v[1] = 0.0; 287 v[2] = 0.0; 288 } 289 //Organise the set of 4 values/indices into the data and colind arrays 290 for (k = 0; k < 4; k++) sorted_j[k] = j[k]; 291 quicksort(sorted_j, 0, 3); 292 for (k = 0; k < 4; k++) { //loop through the nonzero indices 293 this_index = sorted_j[k]; 294 if (this_index == i) { 295 data[4 * i + k] = v_i; 296 colind[4 * i + k] = i; 297 } else if (this_index == j[0]) { 298 data[4 * i + k] = v[0]; 299 colind[4 * i + k] = j[0]; 300 } else if (this_index == j[1]) { 301 data[4 * i + k] = v[1]; 302 colind[4 * i + k] = j[1]; 303 } else { //this_index == j[2] 304 data[4 * i + k] = v[2]; 305 colind[4 * i + k] = j[2]; 306 } 307 } 308 } 309 return 0; 310 } 311 258 312 259 313
Note: See TracChangeset
for help on using the changeset viewer.