Ignore:
Timestamp:
01/22/21 18:35:44 (6 months ago)
Author:
yushan
Message:

Graph intermediate commit to a tmp branch.

Location:
XIOS/dev/dev_trunk_graph/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_graph/src/filter/client_to_server_store_filter.cpp

    r2019 r2021  
    3838      this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); 
    3939      if(!data[0]->graphPackage) data[0]->graphPackage = new CGraphDataPackage; 
    40       data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
     40       
    4141      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
    4242       
    43       CWorkflowGraph::addNode("Client to Server Store filter", 5, true, 1, data[0]); 
    44        
     43      CWorkflowGraph::addNode("Client to Server Store filter", 6, true, 1, data[0]); 
     44      
    4545      CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); 
    46       data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
     46      // flux can be redirected to other filters. So don't change the 'from' parameter 
     47      //data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
     48      data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
    4749    } 
    4850  } 
  • XIOS/dev/dev_trunk_graph/src/filter/pass_through_filter.cpp

    r2019 r2021  
    1919    if(this->graphEnabled) 
    2020    { 
     21      if(data[0]->graphPackage->currentField->getId() == this->graphPackage->inFields[0]->getId()) 
     22      { 
     23        std::cout<<"PASS THROUGH FILTER OMITTED "<<this<<std::endl; 
     24        std::cout<<data[0]->graphPackage->currentField->getId()<< "-------"<< this->graphPackage->inFields[0]->getId()<<std::endl; 
     25        return; 
     26      } 
    2127      this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); 
    2228       
     
    2632        data[0]->graphPackage->fromFilter = -1; 
    2733      } 
    28            
     34       
     35      CWorkflowGraph::addNode("Pass through filter", 2, false, 1, data[0]); 
    2936      data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
    3037      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
    3138       
    32       CWorkflowGraph::addNode("Pass through filter", 2, false, 1, data[0]); 
    3339      CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); 
    3440      data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
  • XIOS/dev/dev_trunk_graph/src/filter/temporal_filter.cpp

    r2019 r2021  
    3434    if(this->graphEnabled) 
    3535    { 
    36       if(!data[0]->graphPackage) data[0]->graphPackage = new CGraphDataPackage; 
    37       data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
    38       std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
     36      if(!data[0]->graphPackage) 
     37      { 
     38        data[0]->graphPackage = new CGraphDataPackage; 
     39      } 
    3940       
    4041      if(this->graphPackage->sourceFilterIds.size()==0) 
     
    4647      CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); 
    4748      data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
    48       this->graphPackage->sourceFilterIds.push_back(data[0]->graphPackage->fromFilter);     
     49      this->graphPackage->sourceFilterIds.push_back(data[0]->graphPackage->fromFilter);  
     50      data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
     51      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
    4952    } 
    5053 
  • XIOS/dev/dev_trunk_graph/src/filter/transform_filter.cpp

    r2019 r2021  
    11#include "transform_filter.hpp" 
    22#include "grid_algorithm.hpp" 
    3  
     3#include "workflow_graph.hpp" 
    44namespace xios 
    55{ 
     
    1919    packet->timestamp = data[0]->timestamp; 
    2020    packet->status = data[0]->status; 
    21  
     21     
    2222    if (packet->status == CDataPacket::NO_ERROR)  
    2323    { 
     24      cout<<"transformeFilter = "<<this<<" and graphEnabled = "<<this->graphEnabled<<std::endl; 
     25      buildWorkflowGraph(data, packet, algorithm_); 
     26       
    2427      if (data.size()>1) 
    2528      { 
     
    3336  } 
    3437 
    35  
     38  void CTransformFilter::buildWorkflowGraph(std::vector<CDataPacketPtr> data, CDataPacketPtr packet, CGridAlgorithm* algorithm) 
     39  { 
     40    if(this->graphEnabled) 
     41    { 
     42      this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); 
     43     
     44      packet->graphPackage = new CGraphDataPackage; 
     45      if(data[0]->graphPackage) 
     46      { 
     47        packet->graphPackage->fromFilter = data[0]->graphPackage->fromFilter; 
     48      } 
     49      packet->graphPackage->toFilter = data[0]->graphPackage->toFilter; 
     50      packet->graphPackage->current_filter_name = data[0]->graphPackage->current_filter_name; 
     51      packet->graphPackage->contextId = data[0]->graphPackage->contextId;           
     52      packet->graphPackage->currentField = data[0]->graphPackage->currentField;//this->graphPackage->inFields[0]; 
     53      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
     54     
     55      CWorkflowGraph::addNode("Spatial transform filter "+algorithm->getAlgoName(), 4, false, 1, packet); 
     56      CWorkflowGraph::addEdge(packet->graphPackage->fromFilter, this->graphPackage->filterId, packet); 
     57      packet->graphPackage->fromFilter = this->graphPackage->filterId; 
     58      packet->graphPackage->currentField = this->graphPackage->inFields[0]; 
     59    } 
     60  } 
    3661 
    3762} 
  • XIOS/dev/dev_trunk_graph/src/filter/transform_filter.hpp

    r2019 r2021  
    2222      */ 
    2323      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data) ; 
     24      void buildWorkflowGraph(std::vector<CDataPacketPtr> data, CDataPacketPtr packet, CGridAlgorithm* algorithm); 
     25       
    2426//      void apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest); 
    2527      
  • XIOS/dev/dev_trunk_graph/src/graph_package.hpp

    r2019 r2021  
    2020    int distanceFromStart=-1; 
    2121    StdString contextId; 
    22      
     22 
     23    CGraphDataPackage(): fromFilter(-1) {} 
    2324  };  
    2425} // namespace xios 
  • XIOS/dev/dev_trunk_graph/src/node/field.cpp

    r2019 r2021  
    614614        // new 
    615615         
    616         std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid->buildTransformationGraph(gc, false,  gridSrc, detectMissingValues, defaultValue, newGrid, buildGraph_) ; 
     616        std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid->buildTransformationGraph(gc, false,  gridSrc, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; 
    617617        lastFilter->connectOutput(filters.first, 0); 
    618         if(buildGraph_) 
     618        /*if(buildGraph_) 
    619619        { 
    620620          std::cout<<"============== field "<<this->getId()<<" calls a transformation filter 1 ============== "<<lastFilter<<" _ "<<filters.first<<" ***** "<<CXios::isClient<<std::endl; 
     
    622622          filters.first->graphPackage = new CGraphPackage; 
    623623          filters.first->graphPackage->inFields.push_back(this); 
    624         } 
     624        }*/ 
    625625        lastFilter = filters.second; 
    626626        gridSrc = newGrid ; 
  • XIOS/dev/dev_trunk_graph/src/node/grid.cpp

    r2019 r2021  
    16911691 
    16921692  std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> >  
    1693   CGrid::buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid, bool graphEnabled) 
     1693  CGrid::buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid, bool graphEnabled, CField* field) 
    16941694  TRY 
    16951695  { 
     
    17141714    else   
    17151715    { 
    1716       cout<<"Create new grid : "<<newId<<endl ; 
     1716      StdString role = CXios::isClient? "Client ": "Server "; 
     1717      cout<<role<<"Create new grid : "<<newId<<endl ; 
    17171718      newGrid = CGrid::create(newId) ; 
    17181719      isNewGrid = true ; 
     
    19861987        shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(gridAlgorithm->createTransformFilter(gc, detectMissingValues, defaultValue)) ; 
    19871988        outputFilter->connectOutput(transformFilter,0) ; 
     1989        if(graphEnabled) 
     1990        { 
     1991          transformFilter->graphEnabled=true; 
     1992          transformFilter->graphPackage = new CGraphPackage; 
     1993          transformFilter->graphPackage->inFields.push_back(field); 
     1994        } 
     1995         
    19881996        vector<string> auxFieldId = algo->getAuxFieldId() ; // better to do that at transformation not algo ?? 
    19891997        int i=1;  
     
    19942002          auxField->getInstantDataFilter()->connectOutput(transformFilter,i) ; 
    19952003          i++ ; 
     2004           
    19962005        } 
    19972006        outputFilter = transformFilter ; 
  • XIOS/dev/dev_trunk_graph/src/node/grid.hpp

    r2019 r2021  
    215215      public: 
    216216         pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, 
    217                                                                                   double defaultValue, CGrid*& newGrid, bool graphEnabled=false) ; 
     217                                                                                  double defaultValue, CGrid*& newGrid, bool graphEnabled=false, CField* field=nullptr) ; 
    218218      private: 
    219219        CGridAlgorithm* gridAlgorithm_ = nullptr ; 
  • XIOS/dev/dev_trunk_graph/src/transformation/algorithm_transformation_transfer.hpp

    r2019 r2021  
    1717      virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); 
    1818      virtual void computeRecvElement(CLocalView* srcView, CLocalView* dstView) ; 
     19      virtual StdString getAlgoName() {return "CAlgorithm transformation Transfer";} 
    1920    
    2021    protected: 
  • XIOS/dev/dev_trunk_graph/src/transformation/domain_algorithm/domain_algorithm_extract.hpp

    r2019 r2021  
    2121 
    2222  virtual ~CDomainAlgorithmExtract() {} 
     23  virtual StdString getAlgoName() {return "\\nextract_domain";} 
    2324 
    2425  static bool registerTrans(); 
  • XIOS/dev/dev_trunk_graph/src/transformation/generic_algorithm_transformation.hpp

    r2019 r2021  
    4141    virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, const vector<CArray<double,1>>& auxData, CArray<double,1>& dataOut) { abort() ;} //=0 
    4242    virtual bool isGenerateTransformation(void) { return false ;} 
     43     
     44    virtual StdString getAlgoName() { return "Generic algorithm transformation";} 
    4345 
    4446    virtual vector<string> getAuxFieldId(void) ; 
  • XIOS/dev/dev_trunk_graph/src/transformation/grid_algorithm.cpp

    r2019 r2021  
    1313  {  
    1414    return algorithm_->isGenerateTransformation() ; 
    15   }   
     15  }  
     16 
     17 
     18  StdString CGridAlgorithm::getAlgoName() 
     19  { 
     20    return algorithm_->getAlgoName(); 
     21  }  
    1622} 
  • XIOS/dev/dev_trunk_graph/src/transformation/grid_algorithm.hpp

    r2019 r2021  
    2828    virtual CTransformFilter* createTransformFilter(CGarbageCollector& gc, bool detectMissingValues, double defaultValue) ; 
    2929    virtual bool isGenerateTranformation(void) ; 
     30    virtual StdString getAlgoName() ; 
    3031    
    3132    protected: 
Note: See TracChangeset for help on using the changeset viewer.