Changeset 644


Ignore:
Timestamp:
07/17/15 13:58:14 (6 years ago)
Author:
rlacroix
Message:

Use the filter infrastructure to handle the spatial transformations.

Add a spatial transform filter to do so.

Location:
XIOS/trunk/src
Files:
2 added
1 edited

Legend:

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

    r643 r644  
    2222#include "lex_parser.hpp" 
    2323#include "temporal_filter.hpp" 
     24#include "spatial_transform_filter.hpp" 
    2425 
    2526namespace xios{ 
     
    629630     { 
    630631        areAllReferenceSolved = true; 
     632 
    631633        if (context->hasClient) 
    632634        { 
    633635          solveRefInheritance(true); 
    634636          solveBaseReference(); 
     637          if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 
    635638        } 
    636639 
     
    786789       else if (!field_ref.isEmpty()) 
    787790       { 
    788          boost::shared_ptr<CPassThroughFilter> passThroughFilter(new CPassThroughFilter(gc)); 
    789          instantDataFilter = passThroughFilter; 
    790791         CField* fieldRef = CField::get(field_ref); 
    791792         fieldRef->buildFilterGraph(gc, false); 
    792          fieldRef->getInstantDataFilter()->connectOutput(passThroughFilter, 0); 
     793 
     794         std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 
     795         // Check if a spatial transformation is needed 
     796         if (!grid_ref.isEmpty() && !fieldRef->grid_ref.isEmpty() && grid_ref.getValue() != fieldRef->grid_ref.getValue()) 
     797           filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid); 
     798         else 
     799           filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
     800 
     801         fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
     802         instantDataFilter = filters.second; 
    793803       } 
    794804       // Check if the data is to be read from a file 
     
    975985   void CField::solveTransformedGrid() 
    976986   { 
    977      if (!grid_ref.isEmpty() && (!field_ref.isEmpty())) 
     987     if (!grid_ref.isEmpty() && hasDirectFieldReference() && !getDirectFieldReference()->grid_ref.isEmpty() 
     988         && grid_ref.getValue() != getDirectFieldReference()->grid_ref.getValue() && !grid->isTransformed()) 
     989       grid->transformGrid(getDirectFieldReference()->grid); 
     990 
     991     /*if (!grid_ref.isEmpty() && (!field_ref.isEmpty())) 
    978992     { 
    979993       CField* fieldRef  = this; 
     
    10081022         filterSources_.push_back(fieldRef); 
    10091023       } 
    1010      } 
     1024     }*/ 
    10111025   } 
    10121026 
Note: See TracChangeset for help on using the changeset viewer.