- Timestamp:
- 01/14/19 10:47:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.cpp
r1612 r1634 311 311 CArray<double,2> boundsLonSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); 312 312 CArray<double,2> boundsLatSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); 313 CArray<double,1> areaSrcUnmasked(nSrcLocalUnmasked); 314 313 315 long int * globalSrcUnmasked = new long int [nSrcLocalUnmasked]; 314 316 315 317 nSrcLocalUnmasked=0 ; 318 bool hasSrcArea=domainSrc_->hasArea && !domainSrc_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true ; 319 double srcAreaFactor ; 320 if (hasSrcArea) srcAreaFactor=1./(domainSrc_->radius*domainSrc_->radius) ; 321 316 322 for (int idx=0 ; idx < nSrcLocal; idx++) 317 323 { … … 323 329 boundsLatSrcUnmasked(n,nSrcLocalUnmasked) = boundsLatSrc(n,idx) ; 324 330 } 331 if (hasSrcArea) areaSrcUnmasked(nSrcLocalUnmasked) = domainSrc_->areavalue(idx)*srcAreaFactor ; 325 332 globalSrcUnmasked[nSrcLocalUnmasked]=globalSrc[idx] ; 326 333 ++nSrcLocalUnmasked ; 327 334 } 328 335 } 329 336 330 337 331 338 int nDstLocalUnmasked = 0 ; … … 334 341 CArray<double,2> boundsLonDestUnmasked(nVertexDest,nDstLocalUnmasked); 335 342 CArray<double,2> boundsLatDestUnmasked(nVertexDest,nDstLocalUnmasked); 343 CArray<double,1> areaDstUnmasked(nDstLocalUnmasked); 344 336 345 long int * globalDstUnmasked = new long int [nDstLocalUnmasked]; 337 346 338 347 nDstLocalUnmasked=0 ; 348 bool hasDstArea=domainDest_->hasArea && !domainDest_->radius.isEmpty() && !interpDomain_->use_area.isEmpty() && interpDomain_->use_area==true ; 349 double dstAreaFactor ; 350 if (hasDstArea) dstAreaFactor=1./(domainDest_->radius*domainDest_->radius) ; 339 351 for (int idx=0 ; idx < nDstLocal; idx++) 340 352 { … … 346 358 boundsLatDestUnmasked(n,nDstLocalUnmasked) = boundsLatDest(n,idx) ; 347 359 } 360 if (hasDstArea) areaDstUnmasked(nDstLocalUnmasked) = domainDest_->areavalue(idx)*dstAreaFactor ; 348 361 globalDstUnmasked[nDstLocalUnmasked]=globalDst[idx] ; 349 362 ++nDstLocalUnmasked ; … … 351 364 } 352 365 353 mapper.setSourceMesh(boundsLonSrcUnmasked.dataFirst(), boundsLatSrcUnmasked.dataFirst(), nVertexSrc, nSrcLocalUnmasked, &srcPole[0], globalSrcUnmasked); 354 mapper.setTargetMesh(boundsLonDestUnmasked.dataFirst(), boundsLatDestUnmasked.dataFirst(), nVertexDest, nDstLocalUnmasked, &dstPole[0], globalDstUnmasked); 366 double* ptAreaSrcUnmasked = NULL ; 367 if (hasSrcArea) ptAreaSrcUnmasked=areaSrcUnmasked.dataFirst() ; 368 369 double* ptAreaDstUnmasked = NULL ; 370 if (hasDstArea) ptAreaDstUnmasked=areaDstUnmasked.dataFirst() ; 371 372 mapper.setSourceMesh(boundsLonSrcUnmasked.dataFirst(), boundsLatSrcUnmasked.dataFirst(), ptAreaSrcUnmasked, nVertexSrc, nSrcLocalUnmasked, &srcPole[0], globalSrcUnmasked); 373 mapper.setTargetMesh(boundsLonDestUnmasked.dataFirst(), boundsLatDestUnmasked.dataFirst(), ptAreaDstUnmasked, nVertexDest, nDstLocalUnmasked, &dstPole[0], globalDstUnmasked); 355 374 356 375 std::vector<double> timings = mapper.computeWeights(orderInterp,renormalize,quantity); … … 986 1005 size_t nbIndex=dataOut.numElements() ; 987 1006 988 for (int idx = 0; idx < nbIndex; ++idx) 989 { 990 if (allMissing(idx)) dataOut(idx) = defaultValue; // If all data source are nan then data destination must be nan 1007 if (allMissing.numElements()>0) 1008 { 1009 for (int idx = 0; idx < nbIndex; ++idx) 1010 { 1011 if (allMissing(idx)) dataOut(idx) = defaultValue; // If all data source are nan then data destination must be nan 1012 } 991 1013 } 992 1014
Note: See TracChangeset
for help on using the changeset viewer.