Changeset 746


Ignore:
Timestamp:
10/21/15 11:50:10 (6 years ago)
Author:
rlacroix
Message:

Restore support for spatial transformations when 'domain_ref'/'axis_ref' are used.

Location:
XIOS/trunk/src/node
Files:
2 edited

Legend:

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

    r745 r746  
    651651     std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 
    652652     // Check if a spatial transformation is needed 
    653      if (!grid_ref.isEmpty() && !fieldRef->grid_ref.isEmpty() && grid_ref.getValue() != fieldRef->grid_ref.getValue()) 
     653     if (grid && grid != fieldRef->grid) 
    654654       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid); 
    655655     else 
     
    819819   void CField::solveTransformedGrid() 
    820820   { 
    821      if (!grid_ref.isEmpty() && hasDirectFieldReference() && !getDirectFieldReference()->grid_ref.isEmpty() 
    822          && grid_ref.getValue() != getDirectFieldReference()->grid_ref.getValue() && !grid->isTransformed()) 
     821     if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
    823822       grid->transformGrid(getDirectFieldReference()->grid); 
    824823   } 
     
    826825   void CField::solveGenerateGrid() 
    827826   { 
    828      if (!grid_ref.isEmpty() && hasDirectFieldReference() && !getDirectFieldReference()->grid_ref.isEmpty() 
    829          && grid_ref.getValue() != getDirectFieldReference()->grid_ref.getValue() && !grid->isTransformed()) 
     827     if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
    830828       grid->completeGrid(getDirectFieldReference()->grid); 
    831829   } 
  • XIOS/trunk/src/node/grid.cpp

    r745 r746  
    12661266  void CGrid::completeGrid(CGrid* transformGridSrc) 
    12671267  { 
     1268    if (!transformGridSrc) 
     1269      ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
     1270            << "Impossible to complete grid '" << getId() << "', the source grid is null."); 
     1271 
     1272    if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
     1273    { 
     1274      ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
     1275           << "Two grids have different dimension size" 
     1276           << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
     1277           << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
     1278    } 
     1279    else 
     1280    { 
     1281      int ssize = axis_domain_order.numElements(); 
     1282      for (int i = 0; i < ssize; ++i) 
     1283        if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i)) 
     1284          ERROR("CGrid::completeGrid(CGrid* transformGridSrc)", 
     1285                << "Grids " << this->getId() << " and " << transformGridSrc->getId() 
     1286                << " don't have elements in the same order"); 
     1287    } 
     1288 
     1289    CGridGenerate gridGenerate(this, transformGridSrc); 
     1290    gridGenerate.completeGrid(); 
     1291  } 
     1292 
     1293  void CGrid::transformGrid(CGrid* transformGridSrc) 
     1294  { 
     1295    if (!transformGridSrc) 
     1296      ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
     1297            << "Impossible to transform grid '" << getId() << "', the source grid is null."); 
     1298 
     1299    if (isTransformed()) return; 
     1300    setTransformed(); 
    12681301    if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
    12691302    { 
     
    12831316    } 
    12841317 
    1285     CGridGenerate gridGenerate(this, transformGridSrc); 
    1286     gridGenerate.completeGrid(); 
    1287   } 
    1288  
    1289   void CGrid::transformGrid(CGrid* transformGridSrc) 
    1290   { 
    1291     if (isTransformed()) return; 
    1292     setTransformed(); 
    1293     if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements()) 
    1294     { 
    1295       ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
    1296            << "Two grids have different dimension size" 
    1297            << "Dimension of grid destination " << this->getId() << " is " << axis_domain_order.numElements() << std::endl 
    1298            << "Dimension of grid source " << transformGridSrc->getId() << " is " << transformGridSrc->axis_domain_order.numElements()); 
    1299     } 
    1300     else 
    1301     { 
    1302       int ssize = axis_domain_order.numElements(); 
    1303       for (int i = 0; i < ssize; ++i) 
    1304         if (axis_domain_order(i) != (transformGridSrc->axis_domain_order)(i)) 
    1305           ERROR("CGrid::transformGrid(CGrid* transformGridSrc)", 
    1306                 << "Grids " << this->getId() << " and " << transformGridSrc->getId() 
    1307                 << " don't have elements in the same order"); 
    1308     } 
    1309  
    13101318    transformations_ = new CGridTransformation(this, transformGridSrc); 
    13111319    transformations_->computeAll(); 
Note: See TracChangeset for help on using the changeset viewer.