Ignore:
Timestamp:
11/30/18 17:37:26 (6 years ago)
Author:
yushan
Message:

branch_openmp merged and NOT tested with trunk r1618

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/transformation/domain_algorithm_interpolate.cpp

    r1601 r1619  
    305305  CArray<double,2> boundsLonSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); 
    306306  CArray<double,2> boundsLatSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); 
     307  CArray<double,1> areaSrcUnmasked(nSrcLocalUnmasked); 
     308   
    307309  long int * globalSrcUnmasked = new long int [nSrcLocalUnmasked]; 
    308310 
    309311  nSrcLocalUnmasked=0 ; 
     312  bool hasSrcArea=domainSrc_->hasArea && !domainSrc_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true  ; 
     313  double srcAreaFactor ; 
     314  if (hasSrcArea) srcAreaFactor=1./(domainSrc_->radius*domainSrc_->radius) ; 
     315   
    310316  for (int idx=0 ; idx < nSrcLocal; idx++) 
    311317  { 
     
    317323        boundsLatSrcUnmasked(n,nSrcLocalUnmasked) = boundsLatSrc(n,idx) ; 
    318324      } 
     325      if (hasSrcArea) areaSrcUnmasked(nSrcLocalUnmasked) = domainSrc_->areavalue(idx)*srcAreaFactor ; 
    319326      globalSrcUnmasked[nSrcLocalUnmasked]=globalSrc[idx] ; 
    320327      ++nSrcLocalUnmasked ; 
    321328    } 
    322329  } 
    323  
     330  
    324331 
    325332  int nDstLocalUnmasked = 0 ; 
     
    328335  CArray<double,2> boundsLonDestUnmasked(nVertexDest,nDstLocalUnmasked); 
    329336  CArray<double,2> boundsLatDestUnmasked(nVertexDest,nDstLocalUnmasked); 
     337  CArray<double,1>   areaDstUnmasked(nDstLocalUnmasked); 
     338 
    330339  long int * globalDstUnmasked = new long int [nDstLocalUnmasked]; 
    331340 
    332341  nDstLocalUnmasked=0 ; 
     342  bool hasDstArea=domainDest_->hasArea && !domainDest_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true ; 
     343  double dstAreaFactor ; 
     344  if (hasDstArea) dstAreaFactor=1./(domainDest_->radius*domainDest_->radius) ; 
    333345  for (int idx=0 ; idx < nDstLocal; idx++) 
    334346  { 
     
    340352        boundsLatDestUnmasked(n,nDstLocalUnmasked) = boundsLatDest(n,idx) ; 
    341353      } 
     354      if (hasDstArea) areaDstUnmasked(nDstLocalUnmasked) = domainDest_->areavalue(idx)*dstAreaFactor ; 
    342355      globalDstUnmasked[nDstLocalUnmasked]=globalDst[idx] ; 
    343356      ++nDstLocalUnmasked ; 
     
    345358  } 
    346359 
    347   mapper.setSourceMesh(boundsLonSrcUnmasked.dataFirst(), boundsLatSrcUnmasked.dataFirst(), nVertexSrc, nSrcLocalUnmasked, &srcPole[0], globalSrcUnmasked); 
    348   mapper.setTargetMesh(boundsLonDestUnmasked.dataFirst(), boundsLatDestUnmasked.dataFirst(), nVertexDest, nDstLocalUnmasked, &dstPole[0], globalDstUnmasked); 
     360  double* ptAreaSrcUnmasked = NULL ; 
     361  if (hasSrcArea) ptAreaSrcUnmasked=areaSrcUnmasked.dataFirst() ; 
     362 
     363  double* ptAreaDstUnmasked = NULL ; 
     364  if (hasDstArea) ptAreaDstUnmasked=areaDstUnmasked.dataFirst() ; 
     365 
     366  mapper.setSourceMesh(boundsLonSrcUnmasked.dataFirst(), boundsLatSrcUnmasked.dataFirst(), ptAreaSrcUnmasked, nVertexSrc, nSrcLocalUnmasked, &srcPole[0], globalSrcUnmasked); 
     367  mapper.setTargetMesh(boundsLonDestUnmasked.dataFirst(), boundsLatDestUnmasked.dataFirst(), ptAreaDstUnmasked, nVertexDest, nDstLocalUnmasked, &dstPole[0], globalDstUnmasked); 
    349368 
    350369  std::vector<double> timings = mapper.computeWeights(orderInterp,renormalize,quantity); 
Note: See TracChangeset for help on using the changeset viewer.