Changeset 1634 for XIOS


Ignore:
Timestamp:
01/14/19 10:47:44 (5 years ago)
Author:
oabramkina
Message:

Backporting r1618 to dev before merging it to trunk.

Location:
XIOS/dev/dev_olga/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/config/domain_attribute.conf

    r1553 r1634  
    5858 
    5959DECLARE_ARRAY(double, 2, area) 
     60DECLARE_ATTRIBUTE(double, radius) 
    6061 
    6162DECLARE_ENUM4(type,rectilinear,curvilinear,unstructured, gaussian) 
  • XIOS/dev/dev_olga/src/config/interpolate_domain_attribute.conf

    r1269 r1634  
    1010DECLARE_ATTRIBUTE(bool, write_weight) 
    1111DECLARE_ENUM2(read_write_convention, c, fortran) 
     12DECLARE_ATTRIBUTE(bool, use_area) 
  • XIOS/dev/dev_olga/src/context_client.cpp

    r1475 r1634  
    9595    { 
    9696      list<int> ranks = event.getRanks(); 
    97  
     97      info(100)<<"Event "<<timeLine<<" of context "<<context->getId()<<endl ; 
    9898      if (CXios::checkEventSync) 
    9999      { 
     
    124124        { 
    125125          event.send(timeLine, sizes, buffList); 
     126          info(100)<<"Event "<<timeLine<<" of context "<<context->getId()<<"  sent"<<endl ; 
    126127 
    127128          checkBuffers(ranks); 
     
    142143          info(100)<<"DEBUG : temporaly event created : timeline "<<timeLine<<endl ; 
    143144          event.send(timeLine, tmpBufferedEvent.sizes, tmpBufferedEvent.buffers); 
     145          info(100)<<"Event "<<timeLine<<" of context "<<context->getId()<<"  sent"<<endl ; 
    144146        } 
    145147      } 
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.cpp

    r1612 r1634  
    311311  CArray<double,2> boundsLonSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); 
    312312  CArray<double,2> boundsLatSrcUnmasked(nVertexSrc,nSrcLocalUnmasked); 
     313  CArray<double,1> areaSrcUnmasked(nSrcLocalUnmasked); 
     314   
    313315  long int * globalSrcUnmasked = new long int [nSrcLocalUnmasked]; 
    314316 
    315317  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   
    316322  for (int idx=0 ; idx < nSrcLocal; idx++) 
    317323  { 
     
    323329        boundsLatSrcUnmasked(n,nSrcLocalUnmasked) = boundsLatSrc(n,idx) ; 
    324330      } 
     331      if (hasSrcArea) areaSrcUnmasked(nSrcLocalUnmasked) = domainSrc_->areavalue(idx)*srcAreaFactor ; 
    325332      globalSrcUnmasked[nSrcLocalUnmasked]=globalSrc[idx] ; 
    326333      ++nSrcLocalUnmasked ; 
    327334    } 
    328335  } 
    329  
     336  
    330337 
    331338  int nDstLocalUnmasked = 0 ; 
     
    334341  CArray<double,2> boundsLonDestUnmasked(nVertexDest,nDstLocalUnmasked); 
    335342  CArray<double,2> boundsLatDestUnmasked(nVertexDest,nDstLocalUnmasked); 
     343  CArray<double,1>   areaDstUnmasked(nDstLocalUnmasked); 
     344 
    336345  long int * globalDstUnmasked = new long int [nDstLocalUnmasked]; 
    337346 
    338347  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) ; 
    339351  for (int idx=0 ; idx < nDstLocal; idx++) 
    340352  { 
     
    346358        boundsLatDestUnmasked(n,nDstLocalUnmasked) = boundsLatDest(n,idx) ; 
    347359      } 
     360      if (hasDstArea) areaDstUnmasked(nDstLocalUnmasked) = domainDest_->areavalue(idx)*dstAreaFactor ; 
    348361      globalDstUnmasked[nDstLocalUnmasked]=globalDst[idx] ; 
    349362      ++nDstLocalUnmasked ; 
     
    351364  } 
    352365 
    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); 
    355374 
    356375  std::vector<double> timings = mapper.computeWeights(orderInterp,renormalize,quantity); 
     
    9861005    size_t nbIndex=dataOut.numElements() ;  
    9871006 
    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      } 
    9911013    } 
    9921014     
Note: See TracChangeset for help on using the changeset viewer.