Changeset 5241 for issm/trunk


Ignore:
Timestamp:
08/13/10 10:58:49 (15 years ago)
Author:
Eric.Larour
Message:

More comments, more robust

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/partition/AreaAverageOntoPartition.m

    r5216 r5241  
    11function partvector=AreaAverageOntoPartition(md,vector)
    22%AREAAVERAGEONTOPARTITION  compute partition values for a certain vector expressed on the vertices of the mesh. Use area weighted average.
     3%
     4%   Usage: average=AreaAverageOntoPartition(md,vector)
     5%
    36
    4 partvector=zeros(max(md.part),1);
     7%ok, first check that part is Matlab matlab indexed
     8part=md.part+1;
     9
     10%initialize output
     11partvector=zeros(max(part),1);
     12
     13%start weight average
    514weightedvector=vector.*md.vwgt;
    6 
    7 for i=1:max(md.part),
    8         pos=find(md.part==i);
     15for i=1:max(part),
     16        pos=find(part==i);
    917        partvector(i)=sum(weightedvector(pos))/sum(md.vwgt(pos));
    1018end
Note: See TracChangeset for help on using the changeset viewer.