Ignore:
Timestamp:
07/01/16 11:50:37 (5 years ago)
Author:
ymipsl
Message:

bugfix : interpolation order 2 : spurious NaN values occur sometime due to 0 / 0.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/extern/remap/src/meshutil.cpp

    r844 r877  
    7979  double area=0 ; 
    8080  int k ; 
    81  
     81  int count=0 ; 
     82   
    8283  for (int j = 0; j < elt.n; j++) 
    8384  { 
     
    108109 
    109110    area+=polygonarea(neighBaryc, 3) ; 
     111    count++ ; 
    110112 
    111113  } 
    112   grad=grad*(1./area) ; 
    113   return grad - elt.x * scalarprod(elt.x, grad); 
     114  if (count>0)  
     115  { 
     116    grad=grad*(1./area) ; 
     117    return grad - elt.x * scalarprod(elt.x, grad); 
     118  } 
     119  else return grad ; 
    114120} 
    115121 
Note: See TracChangeset for help on using the changeset viewer.