Changeset 8478


Ignore:
Timestamp:
Jul 25, 2012, 8:36:08 PM (13 years ago)
Author:
steve
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/operators/kinematic_viscosity_operator_ext.c

    r8477 r8478  
    9595
    9696
     97int build_elliptic_matrix_not_symmetric(int n,
     98                          int tot_len,
     99                          long *geo_indices,
     100                          double *geo_values,
     101                          double *cell_data,
     102                          double *bdry_data,
     103                          double *data,
     104                          long *colind) {
     105        int i, k, edge, j[4], sorted_j[4], this_index;
     106        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
     107        for (i=0; i<n; i++) {
     108                v_i = 0.0;
     109                j[3] = i;
     110                //Get the values of each interaction, and the column index at which they occur
     111        for (edge=0; edge<3; edge++) {
     112            j[edge] = geo_indices[3*i+edge];
     113            //if (j[edge]<n) { //interior
     114            //    h_j = cell_data[j[edge]];
     115            //} else { //boundary
     116            //    h_j = bdry_data[j[edge]-n];
     117            //}
     118            v[edge] = -cell_data[i]*geo_values[3*i+edge]; //the negative of the individual interaction
     119            v_i += cell_data[i]*geo_values[3*i+edge]; //sum the three interactions
     120        }
     121        if (cell_data[i]<=0.0) {
     122            v_i  = 0.0;
     123            v[0] = 0.0;
     124            v[1] = 0.0;
     125            v[2] = 0.0;
     126        }
     127                //Organise the set of 4 values/indices into the data and colind arrays
     128                for (k=0; k<4; k++) sorted_j[k] = j[k];
     129                quicksort(sorted_j,0,3);
     130                for (k=0; k<4; k++) { //loop through the nonzero indices
     131                        this_index = sorted_j[k];
     132                        if (this_index == i) {
     133                                data[4*i+k] = v_i;
     134                                colind[4*i+k] = i;
     135                        } else if (this_index == j[0]) {
     136                                data[4*i+k] = v[0];
     137                                colind[4*i+k] = j[0];
     138                        } else if (this_index == j[1]) {
     139                                data[4*i+k] = v[1];
     140                                colind[4*i+k] = j[1];
     141                        } else { //this_index == j[2]
     142                                data[4*i+k] = v[2];
     143                                colind[4*i+k] = j[2];
     144                        }
     145                }
     146        }
     147        return 0;
     148}
     149
    97150int build_elliptic_matrix(int n,
    98151                          int tot_len,
     
    148201}
    149202
    150 int update_elliptic_matrix(int n,
     203
     204int update_elliptic_matrix_not_symmetric(int n,
    151205        int tot_len,
    152206        long *geo_indices,
     
    202256}
    203257
     258
     259
    204260/**
    205261* Python wrapper methods
Note: See TracChangeset for help on using the changeset viewer.