Changeset 1428


Ignore:
Timestamp:
02/14/18 17:38:47 (6 years ago)
Author:
oabramkina
Message:

Bugfix for reading of curvilinear and unstructured domains.

Since r1419 reading of attributes of curvilinear and unstructured domains by client processes is done locally. Processes that don't have a local domain defined will read just one value in order to avoid blocking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp

    r1419 r1428  
    283283    else if ((CDomain::type_attr::curvilinear == domain->type)) 
    284284    { 
    285       int ni = domain->ni; 
    286       int nj = domain->nj; 
     285      // Make sure that if there is no local domain defined on a process, the process still reads just one value. 
     286      int ni, nj, ibegin, jbegin; 
     287      if (domain->ni == 0) 
     288      { 
     289        ni = 1; 
     290        ibegin = 0; 
     291      } 
     292      else 
     293      { 
     294        ni = domain->ni; 
     295        ibegin = domain->ibegin; 
     296      } 
     297      if (domain->nj == 0) 
     298      { 
     299        nj = 1; 
     300        jbegin = 0; 
     301      } 
     302      else 
     303      { 
     304        nj = domain->nj; 
     305        jbegin = domain->jbegin; 
     306      } 
     307 
    287308      std::vector<StdSize> nBeginLatLon(2), nSizeLatLon(2); 
    288       nBeginLatLon[0] = domain->jbegin.getValue(); nBeginLatLon[1] = domain->ibegin.getValue(); 
    289       nSizeLatLon[0]  = domain->nj.getValue(); nSizeLatLon[1] = domain->ni.getValue(); 
     309      nBeginLatLon[0] = jbegin; nBeginLatLon[1] = ibegin; 
     310      nSizeLatLon[0]  = nj; nSizeLatLon[1] = ni; 
    290311 
    291312      StdString latName = this->getLatCoordName(fieldId); 
    292313      if (SuperClassWriter::hasVariable(latName)) 
    293314      { 
    294         domain->latvalue_curvilinear_read_from_file.resize(domain->ni,domain->nj); 
     315        domain->latvalue_curvilinear_read_from_file.resize(ni, nj); 
    295316        readFieldVariableValue(domain->latvalue_curvilinear_read_from_file, latName, nBeginLatLon, nSizeLatLon); 
    296317      } 
     
    298319      if (SuperClassWriter::hasVariable(lonName)) 
    299320      { 
    300         domain->lonvalue_curvilinear_read_from_file.resize(domain->ni,domain->nj); 
     321        domain->lonvalue_curvilinear_read_from_file.resize(ni, nj); 
    301322        readFieldVariableValue(domain->lonvalue_curvilinear_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 
    302323      } 
     
    320341 
    321342      std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 
    322       nBeginBndsLatLon[0] = domain->jbegin.getValue(); nSizeBndsLatLon[0] = domain->nj.getValue(); 
    323       nBeginBndsLatLon[1] = domain->ibegin.getValue(); nSizeBndsLatLon[1] = domain->ni.getValue(); 
     343      nBeginBndsLatLon[0] = jbegin; nSizeBndsLatLon[0] = nj; 
     344      nBeginBndsLatLon[1] = ibegin; nSizeBndsLatLon[1] = ni; 
    324345      nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 
    325346 
    326347      if (SuperClassWriter::hasVariable(boundsLatName)) 
    327348      { 
    328         domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni,domain->nj); 
     349        domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex, ni, nj); 
    329350        readFieldVariableValue(domain->bounds_latvalue_curvilinear_read_from_file, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 
    330351 
     
    332353      if (SuperClassWriter::hasVariable(boundsLonName))  
    333354      { 
    334         domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni,domain->nj); 
     355        domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex, ni, nj); 
    335356        readFieldVariableValue(domain->bounds_lonvalue_curvilinear_read_from_file, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 
    336357      }       
     
    338359    else if ((CDomain::type_attr::unstructured == domain->type))// || (this->isUnstructured(fieldId))) 
    339360    { 
     361      // Make sure that if there is no local domain defined on a process, the process still reads just one value. 
     362      int ni, ibegin; 
     363      if (domain->ni == 0) 
     364      { 
     365        ni = 1; 
     366        ibegin = 0; 
     367      } 
     368      else 
     369      { 
     370        ni = domain->ni; 
     371        ibegin = domain->ibegin; 
     372      } 
     373 
    340374      std::vector<StdSize> nBeginLatLon(1,0), nSizeLatLon(1,0); 
    341       nBeginLatLon[0] = domain->ibegin; 
    342       nSizeLatLon[0]  = domain->ni.getValue(); 
     375      nBeginLatLon[0] = ibegin; 
     376      nSizeLatLon[0]  = ni; 
    343377 
    344378      StdString latName = this->getLatCoordName(fieldId); 
    345379      if (SuperClassWriter::hasVariable(latName)) 
    346380      { 
    347         domain->latvalue_unstructured_read_from_file.resize(domain->ni); 
     381        domain->latvalue_unstructured_read_from_file.resize(ni); 
    348382        readFieldVariableValue(domain->latvalue_unstructured_read_from_file, latName, nBeginLatLon, nSizeLatLon);   
    349383      } 
     
    352386      if (SuperClassWriter::hasVariable(lonName)) //(0 != lonName.compare("")) 
    353387      { 
    354         domain->lonvalue_unstructured_read_from_file.resize(domain->ni); 
     388        domain->lonvalue_unstructured_read_from_file.resize(ni); 
    355389        readFieldVariableValue(domain->lonvalue_unstructured_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 
    356390      } 
     
    374408 
    375409      std::vector<StdSize> nBeginBndsLatLon(2), nSizeBndsLatLon(2); 
    376       nBeginBndsLatLon[0] = domain->ibegin; nSizeBndsLatLon[0] = domain->ni.getValue(); 
     410      nBeginBndsLatLon[0] = ibegin; nSizeBndsLatLon[0] = ni; 
    377411      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex; 
    378412 
Note: See TracChangeset for help on using the changeset viewer.