Changeset 1083


Ignore:
Timestamp:
04/07/17 17:30:28 (5 years ago)
Author:
mhnguyen
Message:

Correcting the bug on expanding domain by using data read from file

+) Make sure that data_dim is taken account on expanding domain

Test
+) Add a new test: test_expand_domain
+) On Ubuntu 16.04
+) Work.

Location:
XIOS/trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/bld.cfg

    r1078 r1083  
    3333bld::target generate_fortran_interface.exe  
    3434bld::target xios_server.exe  
    35 bld::target test_remap.exe 
    36 bld::target test_regular.exe 
    37 bld::target test_new_features.exe test_unstruct_complete.exe  
     35#bld::target test_remap.exe 
     36#bld::target test_regular.exe 
     37#bld::target test_expand_domain.exe 
     38#bld::target test_new_features.exe test_unstruct_complete.exe  
    3839bld::target test_client.exe test_complete.exe test_xios2_cmip6.exe 
    39 bld::target test_connectivity_expand.exe 
     40#bld::target test_connectivity_expand.exe 
    4041bld::exe_dep 
    4142 
  • XIOS/trunk/src/transformation/domain_algorithm_expand.cpp

    r1078 r1083  
    5757 
    5858  this->type_ = (ELEMENT_MODIFICATION_WITH_DATA); 
     59  // Make sure domain source have all valid attributes 
     60  // domainSource->checkAllAttributes(); 
    5961  expandDomain->checkValid(domainDestination); 
    6062  if (!expandDomain->i_periodic.isEmpty()) isXPeriodic_ = expandDomain->i_periodic; 
    6163  if (!expandDomain->j_periodic.isEmpty()) isYPeriodic_ = expandDomain->j_periodic; 
    62  
     64   
    6365  switch (expandDomain->type) 
    6466  { 
     
    164166  int niSrc = domainSource->ni, ibegin = domainSource->ibegin; 
    165167  int njSrc = domainSource->nj, jbegin = domainSource->jbegin; 
     168  int dataDimSrc = domainSource->data_dim; 
    166169  CArray<bool,1>& mask_1d_src = domainSource->mask_1d; 
    167170  CArray<int,1>& i_index_src = domainSource->i_index; 
     
    190193  int nVertex       = bounds_lon_src.shape()[0]; 
    191194  int oldNbLocal = i_index_src.numElements(); 
    192   int dataIindexBoundSrc = max(i_index_src) - min(i_index_src); 
    193   int dataJindexBoundSrc = max(j_index_src) - min(j_index_src); 
     195  // Calculate ni, nj by using i_index and j_index 
     196  int niSrcByIndex = max(i_index_src) - min(i_index_src) + 1; 
     197  int njSrcByIndex = max(j_index_src) - min(j_index_src) + 1;   
     198  int dataIindexBoundSrc = (1 == dataDimSrc) ? (niSrcByIndex * njSrcByIndex) : niSrcByIndex; 
     199  int dataJindexBoundSrc = (1 == dataDimSrc) ? (niSrcByIndex * njSrcByIndex) : njSrcByIndex; 
    194200 
    195201  // Uncompress data_i_index, data_j_index 
     
    203209    int dataIidx = data_i_index_src(idx) + data_i_begin_src; 
    204210    int dataJidx = data_j_index_src(idx) + data_j_begin_src; 
    205     if ((0 <= dataIidx) && (dataIidx <= dataIindexBoundSrc) && 
    206         (0 <= dataJidx) && (dataJidx <= dataJindexBoundSrc)) 
     211    if ((0 <= dataIidx) && (dataIidx < dataIindexBoundSrc) && 
     212        (0 <= dataJidx) && (dataJidx < dataJindexBoundSrc)) 
    207213    { 
    208214      data_i_index_src_full(nbUnMaskedPointOnLocalDomain) = dataIidx; 
     
    263269      j_index_dst(idx) = j + jbegin; 
    264270    } 
    265  
    266271  
    267272 
     
    409414   
    410415  // Finally, update data_i_index, data_j_index 
     416  int dataDstDim = domainDestination->data_dim; 
    411417  data_i_index_dst.resize(nbUnMaskedPointOnExtendedPart); 
    412418  data_j_index_dst.resize(nbUnMaskedPointOnExtendedPart);  
     
    418424    if ((0 <= dataIIndex) && (0 <= dataJIndex)) 
    419425    { 
    420       data_i_index_dst(count) = i_index_dst(idx) - i_index_dst(0); 
    421       data_j_index_dst(count) = j_index_dst(idx) - j_index_dst(0); 
     426      data_i_index_dst(count) = (1 == dataDstDim) ? idx : i_index_dst(idx) - i_index_dst(0); 
     427      data_j_index_dst(count) = (1 == dataDstDim) ? 0   : j_index_dst(idx) - j_index_dst(0); 
    422428      ++count; 
    423429    } 
     
    425431 
    426432  // Update data_ni, data_nj 
    427   domainDestination->data_ni.setValue(niDst); 
    428   domainDestination->data_nj.setValue(njDst); 
     433   
     434  domainDestination->data_ni.setValue((1==dataDstDim) ? niDst * njDst : niDst); 
     435  domainDestination->data_nj.setValue((1==dataDstDim) ? niDst * njDst : njDst);   
    429436  domainDestination->data_ibegin.setValue(0); 
    430437  domainDestination->data_jbegin.setValue(0); 
    431  
    432438 
    433439  // Update longitude and latitude  
Note: See TracChangeset for help on using the changeset viewer.