Changeset 1488


Ignore:
Timestamp:
Jun 1, 2005, 1:29:00 PM (19 years ago)
Author:
ole
Message:

Comments about gradient computation

Location:
inundation/ga/storm_surge/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/util.py

    r1486 r1488  
    951951
    952952
    953 #Redefine these to use separate_by_polygon which will put all inside indices
    954 #in the first part of the indices array and outside indices in the last
     953#These have been redefined to use separate_by_polygon which will
     954#put all inside indices in the first part of the indices array and
     955#outside indices in the last
    955956
    956957def inside_polygon(points, polygon, closed = True, verbose = False):
  • inundation/ga/storm_surge/pyvolution/util_ext.h

    r1486 r1488  
    3636              double q0, double q1, double q2,
    3737              double *a, double *b) {
     38             
     39  /*Compute gradient (a,b) based on three points (x0,y0), (x1,y1) and (x2,y2)
     40  with values q0, q1 and q2.
     41 
     42  Extrapolation formula (q0 is selected as an arbitrary origin)
     43    q(x,y) = q0 + a*(x-x0) + b*(y-y0)                    (1)
     44 
     45  Substituting the known values for q1 and q2 into (1) yield the
     46  equations for a and b
     47 
     48      q1-q0 = a*(x1-x0) + b*(y1-y0)                      (2)
     49      q2-q0 = a*(x2-x0) + b*(y2-y0)                      (3)     
     50     
     51  or in matrix form
     52 
     53  /               \  /   \   /       \ 
     54  |  x1-x0  y1-y0 |  | a |   | q1-q0 |
     55  |               |  |   | = |       |
     56  |  x2-x0  y2-y0 |  | b |   | q2-q0 |
     57  \               /  \   /   \       /
     58   
     59  which is solved using the standard determinant technique   
     60     
     61  */
     62             
    3863
    3964  double det;
Note: See TracChangeset for help on using the changeset viewer.