Index: XIOS/trunk/src/parse_expr/filter_expr_node.cpp
===================================================================
--- XIOS/trunk/src/parse_expr/filter_expr_node.cpp	(revision 1575)
+++ XIOS/trunk/src/parse_expr/filter_expr_node.cpp	(revision 1704)
@@ -12,5 +12,5 @@
 
   
-  std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
+  std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
   {
     std::shared_ptr<COutputPin> outputPin;
@@ -40,5 +40,6 @@
                 << "Use the keyword \"this\" if you want to reference the input data sent to this field.");
 
-        field->buildFilterGraph(gc, false);
+        // field->buildFilterGraph(gc, false);
+        field->buildFilterGraph(gc, false, start_graph, end_graph);
         outputPin = field->getInstantDataFilter();
       }
@@ -55,5 +56,5 @@
 
 
-  std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
+  std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
   {
     std::shared_ptr<COutputPin> outputPin;
@@ -104,8 +105,20 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch = child->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CUnaryArithmeticFilter> filter(new CUnaryArithmeticFilter(gc, opId));
-    child->reduce(gc, thisField)->connectOutput(filter, 0);
+    ch->connectOutput(filter, 0);
+
+    (filter->parent_filters).resize(1);
+    (filter->parent_filters)[0] = ch;
+
+    filter->tag = ch->tag;
+    filter->start_graph = ch->start_graph;
+    filter->end_graph = ch->end_graph;
+    filter->field = &thisField;
+
+
     return filter;
   }
@@ -121,8 +134,18 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph);
     std::shared_ptr<CScalarFieldArithmeticFilter> filter(new CScalarFieldArithmeticFilter(gc, opId, child1->reduce()));
-    child2->reduce(gc, thisField)->connectOutput(filter, 0);
+    ch2->connectOutput(filter, 0);
+    
+    (filter->parent_filters).resize(1);
+    (filter->parent_filters)[0] = ch2;
+
+    filter->tag = ch2->tag;
+    filter->start_graph = ch2->start_graph;
+    filter->end_graph = ch2->end_graph;
+    filter->field = &thisField;
+
     return filter;
   }
@@ -138,8 +161,19 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CFieldScalarArithmeticFilter> filter(new CFieldScalarArithmeticFilter(gc, opId, child2->reduce()));
-    child1->reduce(gc, thisField)->connectOutput(filter, 0);
+    ch1->connectOutput(filter, 0);
+
+    (filter->parent_filters).resize(1);
+    (filter->parent_filters)[0] = ch1;
+
+    filter->tag = ch1->tag;
+    filter->start_graph = ch1->start_graph;
+    filter->end_graph = ch1->end_graph;
+    filter->field = &thisField;
+
     return filter;
   }
@@ -155,9 +189,24 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph);
+    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CFieldFieldArithmeticFilter> filter(new CFieldFieldArithmeticFilter(gc, opId));
-    child1->reduce(gc, thisField)->connectOutput(filter, 0);
-    child2->reduce(gc, thisField)->connectOutput(filter, 1);
+    ch1->connectOutput(filter, 0);
+    ch2->connectOutput(filter, 1); 
+
+    (filter->parent_filters).resize(2);
+    (filter->parent_filters)[0] = ch1;
+    (filter->parent_filters)[1] = ch2;
+
+    filter->tag = (ch1->tag || ch2->tag);
+    filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: -1);
+    filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: -1);
+
+    filter->field = &thisField;
+
+
     return filter;
   }
@@ -177,8 +226,19 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CScalarScalarFieldArithmeticFilter> filter(new CScalarScalarFieldArithmeticFilter(gc, opId, child1->reduce(),child2->reduce()));
-    child3->reduce(gc, thisField)->connectOutput(filter, 0);
+    ch3->connectOutput(filter, 0);
+    
+    (filter->parent_filters).resize(1);
+    (filter->parent_filters)[0] = ch3;
+
+    filter->tag = ch3->tag;
+    filter->start_graph = ch3->start_graph;
+    filter->end_graph = ch3->end_graph;
+    filter->field = &thisField;
+
     return filter;
   }
@@ -196,8 +256,19 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CScalarFieldScalarArithmeticFilter> filter(new CScalarFieldScalarArithmeticFilter(gc, opId, child1->reduce(),child3->reduce()));
-    child2->reduce(gc, thisField)->connectOutput(filter, 0);
+    ch2->connectOutput(filter, 0);
+
+    (filter->parent_filters).resize(1);
+    (filter->parent_filters)[0] = ch2;
+
+    filter->tag = ch2->tag;
+    filter->start_graph = ch2->start_graph;
+    filter->end_graph = ch2->end_graph;
+    filter->field = &thisField;
+
     return filter;
   }
@@ -215,9 +286,22 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph);
+    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CScalarFieldFieldArithmeticFilter> filter(new CScalarFieldFieldArithmeticFilter(gc, opId, child1->reduce()));
-    child2->reduce(gc, thisField)->connectOutput(filter, 0);
-    child3->reduce(gc, thisField)->connectOutput(filter, 1);
+    ch2->connectOutput(filter, 0);
+    ch3->connectOutput(filter, 1);
+
+    (filter->parent_filters).resize(2);
+    (filter->parent_filters)[0] = ch2;
+    (filter->parent_filters)[1] = ch3;
+
+    filter->tag = (ch3->tag || ch2->tag);
+    filter->start_graph = ch3->tag? ch3->start_graph : (ch2->tag? ch2->start_graph: -1);
+    filter->end_graph = ch3->tag? ch3->end_graph : (ch2->tag? ch2->end_graph: -1);
+    filter->field = &thisField;
+
     return filter;
   }
@@ -236,8 +320,19 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CFieldScalarScalarArithmeticFilter> filter(new CFieldScalarScalarArithmeticFilter(gc, opId, child2->reduce(),child3->reduce()));
-    child1->reduce(gc, thisField)->connectOutput(filter, 0);
+    ch1->connectOutput(filter, 0);
+
+    (filter->parent_filters).resize(1);
+    (filter->parent_filters)[0] = ch1;
+
+    filter->tag = ch1->tag;
+    filter->start_graph = ch1->start_graph;
+    filter->end_graph = ch1->end_graph;
+    filter->field = &thisField;
+
     return filter;
   }
@@ -256,9 +351,22 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph);
+    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CFieldScalarFieldArithmeticFilter> filter(new CFieldScalarFieldArithmeticFilter(gc, opId, child2->reduce()));
-    child1->reduce(gc, thisField)->connectOutput(filter, 0);
-    child3->reduce(gc, thisField)->connectOutput(filter, 1);
+    ch1->connectOutput(filter, 0);
+    ch3->connectOutput(filter, 1);
+
+    (filter->parent_filters).resize(2);
+    (filter->parent_filters)[0] = ch1;
+    (filter->parent_filters)[1] = ch3;
+
+    filter->tag = (ch3->tag || ch1->tag);
+    filter->start_graph = ch3->tag? ch3->start_graph : (ch1->tag? ch1->start_graph: -1);
+    filter->end_graph = ch3->tag? ch3->end_graph : (ch1->tag? ch1->end_graph: -1);
+    filter->field = &thisField;
+
     return filter;
   }
@@ -277,9 +385,21 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph);
+    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CFieldFieldScalarArithmeticFilter> filter(new CFieldFieldScalarArithmeticFilter(gc, opId, child3->reduce()));
-    child1->reduce(gc, thisField)->connectOutput(filter, 0);
-    child2->reduce(gc, thisField)->connectOutput(filter, 1);
+    ch1->connectOutput(filter, 0);
+    ch2->connectOutput(filter, 1);
+
+    (filter->parent_filters).resize(2);
+    (filter->parent_filters)[0] = ch1;
+    (filter->parent_filters)[1] = ch2;
+
+    filter->tag = (ch2->tag || ch1->tag);
+    filter->start_graph = ch2->tag? ch2->start_graph : (ch1->tag? ch1->start_graph: -1);
+    filter->end_graph = ch2->tag? ch2->end_graph : (ch1->tag? ch1->end_graph: -1);
+    filter->field = &thisField;
     return filter;
   }
@@ -297,10 +417,28 @@
   }
 
-  std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const
-  {
+  std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const
+  {
+    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph);
+    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph);
+    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph);
+
     std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId));
-    child1->reduce(gc, thisField)->connectOutput(filter, 0);
-    child2->reduce(gc, thisField)->connectOutput(filter, 1);
-    child3->reduce(gc, thisField)->connectOutput(filter, 2);
+    std::cout<<"std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId))" <<std::endl;
+    ch1->connectOutput(filter, 0);
+    ch2->connectOutput(filter, 1);
+    ch3->connectOutput(filter, 2);
+
+    (filter->parent_filters).resize(3);
+    (filter->parent_filters)[0] = ch1;
+    (filter->parent_filters)[1] = ch2;
+    (filter->parent_filters)[2] = ch3;
+
+
+    filter->tag = (ch1->tag || ch1->tag || ch3->tag);
+    filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: (ch3->tag? ch3->start_graph: -1));
+    filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: (ch3->tag? ch3->end_graph: -1));
+    filter->field = &thisField;
+
+
     return filter;
   }
Index: XIOS/trunk/src/parse_expr/filter_expr_node.hpp
===================================================================
--- XIOS/trunk/src/parse_expr/filter_expr_node.hpp	(revision 1575)
+++ XIOS/trunk/src/parse_expr/filter_expr_node.hpp	(revision 1704)
@@ -5,4 +5,6 @@
 #include <boost/smart_ptr/scoped_ptr.hpp>
 #include "scalar_expr_node.hpp"
+
+#include "duration.hpp"
 
 namespace xios
@@ -25,5 +27,5 @@
      * \return the output pin of the filter producing the result of the expression 
      */
-    virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const = 0;
+    virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const = 0;
   };
 
@@ -42,5 +44,5 @@
       CFilterFieldExprNode(const std::string& fieldId);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -63,5 +65,5 @@
       CFilterTemporalFieldExprNode(const std::string& fieldId);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -86,5 +88,5 @@
       CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -111,5 +113,5 @@
       CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -137,5 +139,5 @@
       CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -162,5 +164,5 @@
       CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -190,5 +192,5 @@
       CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -219,5 +221,5 @@
       CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -248,5 +250,5 @@
       CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -278,5 +280,5 @@
       CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -307,5 +309,5 @@
       CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -335,5 +337,5 @@
       CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
@@ -364,5 +366,5 @@
       CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3);
 
-      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const;
+      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const;
 
     private:
Index: XIOS/trunk/src/parse_expr/yacc_parser.cpp
===================================================================
--- XIOS/trunk/src/parse_expr/yacc_parser.cpp	(revision 1575)
+++ XIOS/trunk/src/parse_expr/yacc_parser.cpp	(revision 1704)
@@ -70,4 +70,6 @@
 #include "exception.hpp"
 
+#include "yacc_var.hpp"
+
 using namespace std;
 using namespace xios;
@@ -84,6 +86,13 @@
   size_t globalReadOffset = 0;
 
+  std::string *xios::yacc_globalInputText_ptr = 0;
+
   int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead)
   {
+    yacc_globalInputText_ptr = &globalInputText;
+    //*yacc_globalInputText_ptr = globalInputText;
+
+    std::cout<<"========= yacc_globalInputText_ptr = "<<*yacc_globalInputText_ptr<<std::endl;
+    
     size_t numBytesToRead = maxBytesToRead;
     size_t bytesRemaining = globalInputText.length()-globalReadOffset;
Index: XIOS/trunk/src/parse_expr/yacc_var.hpp
===================================================================
--- XIOS/trunk/src/parse_expr/yacc_var.hpp	(revision 1704)
+++ XIOS/trunk/src/parse_expr/yacc_var.hpp	(revision 1704)
@@ -0,0 +1,10 @@
+#ifndef __YACC_VAR_HPP__
+#define __YACC_VAR_HPP__
+
+#include <string>
+namespace xios
+{
+  extern std::string *yacc_globalInputText_ptr;
+}
+
+#endif
