Ignore:
Timestamp:
11/02/15 11:46:25 (8 years ago)
Author:
mhnguyen
Message:

Implementing the reading of attributes of an axis from a file

+) 3d grid can be read directly from a file
+) Clean some redundant codes
+) Add new attribute declaration that allows to output only desired attributes

Test
+) On Curie
+) test_remap passes and result is correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/grid.cpp

    r771 r775  
    3131      , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    3232      , transformations_(0), isTransformed_(false) 
    33       , axisPositionInGrid_(), positionDimensionDistributed_(1) 
     33      , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
    3434   { 
    3535     setVirtualDomainGroup(); 
     
    4545      , globalDim_(), connectedDataSize_(), connectedServerRank_(), isDataDistributed_(true), isCompressible_(false) 
    4646      , transformations_(0), isTransformed_(false) 
    47       , axisPositionInGrid_(), positionDimensionDistributed_(1) 
     47      , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 
    4848   { 
    4949     setVirtualDomainGroup(); 
     
    203203     computeGridGlobalDimension(getDomains(), getAxis(), axis_domain_order); 
    204204     this->isDomainAxisChecked = areAttributesChecked; 
     205   } 
     206 
     207   void CGrid::solveDomainAxisBaseRef() 
     208   { 
     209     if (this->hasDomainAxisBaseRef_) return; 
     210     // Account for the axis attributes 
     211     std::vector<CAxis*> axisList = getAxis(); 
     212     for (size_t i = 0; i < axisList.size(); ++i) 
     213     { 
     214       axisList[i]->solveBaseReference(); 
     215       axisList[i]->setAttributesBaseReference(); 
     216     } 
     217 
     218     // Account for the domain attributes 
     219     std::vector<CDomain*> domList = getDomains(); 
     220     for (size_t i = 0; i < domList.size(); ++i) 
     221     { 
     222       domList[i]->solveBaseReference(); 
     223       domList[i]->setAttributesBaseReference(); 
     224     } 
     225     this->hasDomainAxisBaseRef_ = true; 
    205226   } 
    206227 
     
    12601281  void CGrid::completeGrid(CGrid* transformGridSrc) 
    12611282  { 
    1262     if (!transformGridSrc) 
    1263       ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
    1264             << "Impossible to complete grid '" << getId() << "', the source grid is null."); 
    1265  
    1266     if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
    1267     { 
    1268       ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
    1269            << "Two grids have different dimension size" 
    1270            << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
    1271            << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
    1272     } 
    1273     else 
    1274     { 
    1275       int ssize = axis_domain_order.numElements(); 
    1276       for (int i = 0; i < ssize; ++i) 
    1277         if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i)) 
    1278           ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
    1279                 << "Grids " << this->getId() << " and " << transformGridSrc->getId() 
    1280                 << " don't have elements in the same order"); 
     1283    if (0 != transformGridSrc) 
     1284    { 
     1285      if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
     1286      { 
     1287        ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
     1288             << "Two grids have different dimension size" 
     1289             << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
     1290             << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
     1291      } 
     1292      else 
     1293      { 
     1294        int ssize = axis_domain_order.numElements(); 
     1295        for (int i = 0; i < ssize; ++i) 
     1296          if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i)) 
     1297            ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
     1298                  << "Grids " << this->getId() << " and " << transformGridSrc->getId() 
     1299                  << " don't have elements in the same order"); 
     1300      } 
    12811301    } 
    12821302 
Note: See TracChangeset for help on using the changeset viewer.