Changeset 737 for XIOS/trunk
- Timestamp:
- 10/14/15 13:58:26 (8 years ago)
- Location:
- XIOS/trunk/src/node
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field.cpp
r731 r737 608 608 // Check if we have a reference on another field 609 609 else if (!field_ref.isEmpty()) 610 { 611 CField* fieldRef = CField::get(field_ref); 612 fieldRef->buildFilterGraph(gc, false); 613 614 std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 615 // Check if a spatial transformation is needed 616 if (!grid_ref.isEmpty() && !fieldRef->grid_ref.isEmpty() && grid_ref.getValue() != fieldRef->grid_ref.getValue()) 617 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid); 618 else 619 filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 620 621 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 622 instantDataFilter = filters.second; 623 } 610 instantDataFilter = getFieldReference(gc); 624 611 // Check if the data is to be read from a file 625 612 else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) … … 647 634 648 635 /*! 649 * Returns the source filter to handle a self reference in the field's expression. 650 * If the needed source filter does not exist, it is created, otherwise it is reused. 636 * Returns the filter needed to handle the field reference. 637 * This method should only be called when building the filter graph corresponding to the field. 638 * 639 * \param gc the garbage collector to use 640 * \return the output pin corresponding to the field reference 641 */ 642 boost::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 643 { 644 if (instantDataFilter || field_ref.isEmpty()) 645 ERROR("COutputPin* CField::getFieldReference(CGarbageCollector& gc)", 646 "Impossible to get the field reference for a field which has already been parsed or which does not have a field_ref."); 647 648 CField* fieldRef = CField::get(field_ref); 649 fieldRef->buildFilterGraph(gc, false); 650 651 std::pair<boost::shared_ptr<CFilter>, boost::shared_ptr<CFilter> > filters; 652 // Check if a spatial transformation is needed 653 if (!grid_ref.isEmpty() && !fieldRef->grid_ref.isEmpty() && grid_ref.getValue() != fieldRef->grid_ref.getValue()) 654 filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid); 655 else 656 filters.first = filters.second = boost::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 657 658 fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 659 660 return filters.second; 661 } 662 663 /*! 664 * Returns the filter needed to handle a self reference in the field's expression. 665 * If the needed filter does not exist, it is created, otherwise it is reused. 651 666 * This method should only be called when building the filter graph corresponding 652 667 * to the field's expression. … … 661 676 "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); 662 677 663 if (!clientSourceFilter) 664 clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 665 666 return clientSourceFilter; 678 if (!selfReferenceFilter) 679 { 680 if (!field_ref.isEmpty()) 681 selfReferenceFilter = getFieldReference(gc); 682 else 683 { 684 if (!clientSourceFilter) 685 clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 686 687 selfReferenceFilter = clientSourceFilter; 688 } 689 } 690 691 return selfReferenceFilter; 667 692 } 668 693 -
XIOS/trunk/src/node/field.hpp
r731 r737 116 116 117 117 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 118 boost::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc); 118 119 boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 119 120 boost::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); … … 208 209 //! The output pin of the filters providing the result of the field's temporal operation 209 210 std::map<CDuration, boost::shared_ptr<COutputPin>, DurationFakeLessComparator> temporalDataFilters; 211 //! The output pin of the filter providing the instant data for self references 212 boost::shared_ptr<COutputPin> selfReferenceFilter; 210 213 //! The source filter for data provided by the client 211 214 boost::shared_ptr<CSourceFilter> clientSourceFilter;
Note: See TracChangeset
for help on using the changeset viewer.