- Timestamp:
- 06/04/21 11:55:52 (3 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/node
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/field.cpp
r2130 r2144 22 22 #include "file_reader_source_filter.hpp" 23 23 #include "tracer.hpp" 24 #include "graph_package.hpp" 24 25 25 26 namespace xios … … 585 586 586 587 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 587 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 588 588 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 589 bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 590 info(100)<<"=== Workflow Graph === field id="<<this->getId()<<" build_workflow_graph="<<buildGraph_<<std::endl; 589 591 if (!inputFilter) inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc)); 590 592 … … 592 594 { 593 595 CField* fieldRef = getDirectFieldReference(); 596 info(100)<<"=== Workflow Graph === fieldRef id="<<fieldRef->getId()<<std::endl; 597 598 //------ build_workflow_graph start 599 if(buildGraph_) 600 { 601 (*fieldRef).build_workflow_graph.set(build_workflow_graph); 602 } 603 else 604 { 605 this->build_workflow_graph.set(fieldRef->build_workflow_graph); 606 buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 607 info(100)<<"=== Workflow Graph === field id="<<this->getId()<<" updated build_workflow_graph="<<buildGraph_<<std::endl; 608 } 609 610 611 if(buildGraph_) this->build_workflow_graph.set(build_workflow_graph); 612 //------ build_workflow_graph end 613 594 614 bool ret=fieldRef->buildWorkflowGraph(gc); 595 615 if (!ret) return false ; // workflow graph cannot be built at this stage 616 617 this->build_workflow_graph.set(fieldRef->build_workflow_graph); 618 buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 596 619 } 597 620 … … 624 647 { 625 648 grid->solveElementsRefInheritance() ; 626 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid->buildTransformationGraph(gc, false, gridSrc, detectMissingValues, defaultValue, newGrid ) ;649 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid->buildTransformationGraph(gc, false, gridSrc, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; 627 650 lastFilter->connectOutput(filters.first, 0); 628 651 lastFilter = filters.second; … … 636 659 // connect the input Filter to the reference 637 660 getDirectFieldReference()->getInstantDataFilter()->connectOutput(inputFilter,0); 661 if(buildGraph_) 662 { 663 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a transformation filter 2 ============== "<<getDirectFieldReference()->getInstantDataFilter()<<" _ "<<inputFilter<<std::endl; 664 inputFilter->graphEnabled=true; 665 inputFilter->graphPackage = new CGraphPackage; 666 inputFilter->graphPackage->inFields.push_back(this); 667 inputFilter->label_field_id = getDirectFieldReference()->getId(); 668 } 638 669 } 639 670 else … … 647 678 if (fileIn_->isClientSide()) fileIn_->readFieldAttributesMetaData(this); 648 679 CGrid* newGrid ; 649 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid ) ;680 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; 650 681 grid_ = newGrid ; 651 682 grid_ref=grid_->getId() ; // for server … … 668 699 grid_->solveElementsRefInheritance() ; 669 700 CGrid* newGrid ; 670 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid ) ;701 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = grid_->buildTransformationGraph(gc, true, nullptr, detectMissingValues, defaultValue, newGrid, buildGraph_, this) ; 671 702 newGrid->duplicateAttributes(grid_) ; // for grid attributes (mask) 672 703 grid_ = newGrid ; … … 701 732 // insert temporal filter before sending to files 702 733 getTemporalDataFilter(gc, fileOut_->output_freq)->connectOutput(clientToServerStoreFilter_, 0); 734 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 735 if(buildGraph_) 736 { 737 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToFileServer ============== "<<getTemporalDataFilter(gc, fileOut_->output_freq)<<" _ "<<clientToServerStoreFilter_<<std::endl; 738 clientToServerStoreFilter_->graphPackage = new CGraphPackage; 739 clientToServerStoreFilter_->graphEnabled = true; 740 clientToServerStoreFilter_->graphPackage->inFields.push_back(this); 741 } 703 742 } 704 743 … … 708 747 clientToServerStoreFilter_ = std::shared_ptr<CClientToServerStoreFilter>(new CClientToServerStoreFilter(gc, this, client)); 709 748 instantDataFilter->connectOutput(clientToServerStoreFilter_, 0); 749 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 750 if(buildGraph_) 751 { 752 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToCouplerOut ============== "<<instantDataFilter<<" _ "<<clientToServerStoreFilter_<<std::endl; 753 clientToServerStoreFilter_->graphPackage = new CGraphPackage; 754 clientToServerStoreFilter_->graphEnabled = true; 755 clientToServerStoreFilter_->graphPackage->inFields.push_back(this); 756 } 710 757 } 711 758 … … 722 769 modelToClientSourceFilter_ = std::shared_ptr<CModelToClientSourceFilter>(new CModelToClientSourceFilter(gc, grid_, detectMissingValues, defaultValue)); 723 770 modelToClientSourceFilter_ -> connectOutput(inputFilter,0) ; 771 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 772 if(buildGraph_ ) 773 { 774 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToModelInput ============== "<<modelToClientSourceFilter_<<" _ "<<inputFilter<<" ***** "<<std::endl; 775 modelToClientSourceFilter_->graphPackage = new CGraphPackage; 776 modelToClientSourceFilter_->graphEnabled = true; 777 modelToClientSourceFilter_->graphPackage->inFields.push_back(this); 778 } 724 779 } 725 780 … … 731 786 serverFromClientSourceFilter_ = std::shared_ptr<CServerFromClientSourceFilter>(new CServerFromClientSourceFilter(gc, grid_)); 732 787 serverFromClientSourceFilter_ -> connectOutput(inputFilter,0) ; 788 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 789 if(buildGraph_) 790 { 791 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToClientInput ============== "<<serverFromClientSourceFilter_ << " _ "<<inputFilter<<" ***** "<<std::endl; 792 serverFromClientSourceFilter_->graphPackage = new CGraphPackage; 793 serverFromClientSourceFilter_->graphEnabled = true; 794 serverFromClientSourceFilter_->graphPackage->inFields.push_back(this); 795 } 733 796 } 734 797 … … 742 805 clientFromServerSourceFilter_ = std::shared_ptr<CClientFromServerSourceFilter>(new CClientFromServerSourceFilter(gc,this)) ; 743 806 clientFromServerSourceFilter_ -> connectOutput(inputFilter,0) ; 807 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 808 if(buildGraph_) 809 { 810 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToServerInput ============== "<<clientFromServerSourceFilter_ << " _ "<<inputFilter<<std::endl; 811 clientFromServerSourceFilter_->graphPackage = new CGraphPackage; 812 clientFromServerSourceFilter_->graphEnabled = true; 813 clientFromServerSourceFilter_->graphPackage->inFields.push_back(this); 814 } 744 815 } 745 816 … … 755 826 clientFromClientSourceFilter_ = std::shared_ptr<CClientFromClientSourceFilter>(new CClientFromClientSourceFilter(gc, this)) ; 756 827 clientFromClientSourceFilter_ -> connectOutput(inputFilter,0) ; 757 828 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 829 if(buildGraph_) 830 { 831 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToCouplerIn ============== "<<clientFromClientSourceFilter_ << " _ "<<inputFilter<<std::endl; 832 clientFromClientSourceFilter_->graphPackage = new CGraphPackage; 833 clientFromClientSourceFilter_->graphEnabled = true; 834 clientFromClientSourceFilter_->graphPackage->inFields.push_back(this); 835 } 758 836 } 759 837 … … 765 843 fileWriterStoreFilter_ = std::shared_ptr<CFileWriterStoreFilter>(new CFileWriterStoreFilter(gc, this)); 766 844 instantDataFilter->connectOutput(fileWriterStoreFilter_, 0); 845 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 846 if(buildGraph_) 847 { 848 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToFileWriter ============== "<<instantDataFilter << " _ "<<fileWriterStoreFilter_<<std::endl; 849 fileWriterStoreFilter_->graphPackage = new CGraphPackage; 850 fileWriterStoreFilter_->graphEnabled = true; 851 fileWriterStoreFilter_->graphPackage->inFields.push_back(this); 852 } 767 853 } 768 854 … … 774 860 fileReaderSourceFilter_ = std::shared_ptr<CFileReaderSourceFilter>(new CFileReaderSourceFilter(gc, this)); 775 861 fileReaderSourceFilter_->connectOutput(inputFilter, 0); 862 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 863 if(buildGraph_) 864 { 865 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToFileReader ============== "<<fileReaderSourceFilter_ << " _ "<<inputFilter<<std::endl; 866 fileReaderSourceFilter_->graphPackage = new CGraphPackage; 867 fileReaderSourceFilter_->graphEnabled = true; 868 fileReaderSourceFilter_->graphPackage->inFields.push_back(this); 869 } 776 870 } 777 871 … … 784 878 clientToModelStoreFilter_ = std::shared_ptr<CClientToModelStoreFilter>(new CClientToModelStoreFilter(gc, this)); 785 879 instantDataFilter->connectOutput(clientToModelStoreFilter_, 0); 880 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 881 if(buildGraph_) 882 { 883 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToModelOutput ============== "<<instantDataFilter << " _ "<<clientToModelStoreFilter_<<std::endl; 884 clientToModelStoreFilter_->graphPackage = new CGraphPackage; 885 clientToModelStoreFilter_->graphEnabled = true; 886 clientToModelStoreFilter_->graphPackage->inFields.push_back(this); 887 } 786 888 } 787 889 … … 792 894 serverToClientStoreFilter_ = std::shared_ptr<CServerToClientStoreFilter>(new CServerToClientStoreFilter(gc, this, client)); 793 895 instantDataFilter->connectOutput(serverToClientStoreFilter_, 0); 896 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 897 if(buildGraph_) 898 { 899 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a connectToServerToClient ============== "<<instantDataFilter << " _ "<<serverToClientStoreFilter_<<std::endl; 900 serverToClientStoreFilter_->graphPackage = new CGraphPackage; 901 serverToClientStoreFilter_->graphEnabled = true; 902 serverToClientStoreFilter_->graphPackage->inFields.push_back(this); 903 } 794 904 } 795 905 … … 925 1035 926 1036 instantDataFilter->connectOutput(temporalFilter, 0); 1037 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 1038 if(buildGraph_) 1039 { 1040 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a getTemporalDataFilter ============== "<<instantDataFilter << " _ "<<temporalFilter<<std::endl; 1041 temporalFilter->graphPackage = new CGraphPackage; 1042 temporalFilter->graphEnabled = true; 1043 temporalFilter->graphPackage->inFields.push_back(this); 1044 } 927 1045 928 1046 it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; … … 972 1090 973 1091 inputFilter->connectOutput(selfTemporalDataFilter, 0); 1092 const bool buildGraph_ = !build_workflow_graph.isEmpty() && build_workflow_graph == true ; 1093 if(buildGraph_) 1094 { 1095 info(100)<<"=== Workflow Graph === field "<<this->getId()<<" calls a getSelfTemporalDataFilter ============== "<<inputFilter << " _ "<<selfTemporalDataFilter<<std::endl; 1096 selfTemporalDataFilter->graphPackage = new CGraphPackage; 1097 selfTemporalDataFilter->graphEnabled = true; 1098 selfTemporalDataFilter->graphPackage->inFields.push_back(this); 1099 } 974 1100 return selfTemporalDataFilter ; 975 1101 } -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2128 r2144 1640 1640 1641 1641 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > 1642 CGrid::buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid) 1643 TRY 1644 { 1642 CGrid::buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, double defaultValue, CGrid*& newGrid, bool graphEnabled, CField* field) 1643 TRY 1644 { 1645 static bool transformationGoing = false; 1645 1646 registerAlgorithmTransformation() ; // needed to enable self-registration of the transformations 1646 1647 // big mystery why it doesn't work witout that... … … 1936 1937 shared_ptr<CTransformFilter> transformFilter = shared_ptr<CTransformFilter>(gridAlgorithm->createTransformFilter(gc, detectMissingValues, defaultValue)) ; 1937 1938 outputFilter->connectOutput(transformFilter,0) ; 1939 if(graphEnabled) 1940 { 1941 transformFilter->graphEnabled=true; 1942 transformFilter->graphPackage = new CGraphPackage; 1943 transformFilter->graphPackage->inFields.push_back(field); 1944 transformFilter->graphPackage->show = !transformationGoing; 1945 } 1946 1938 1947 vector<string> auxFieldId = algo->getAuxFieldId() ; // better to do that at transformation not algo ?? 1939 1948 int i=1; … … 1950 1959 if (hasRemainTransform) 1951 1960 { 1961 transformationGoing = true; 1952 1962 gridSrc=newGrid ; 1953 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = this->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid) ; 1963 CField *field_bis = field; 1964 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = this->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid, graphEnabled, field_bis) ; 1954 1965 outputFilter->connectOutput(filters.first,0) ; 1955 1966 outputFilter=filters.second ; 1956 1967 } 1968 transformationGoing = false; 1957 1969 } 1958 1970 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp
r2127 r2144 216 216 public: 217 217 pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, 218 double defaultValue, CGrid*& newGrid ) ;218 double defaultValue, CGrid*& newGrid, bool graphEnabled=false, CField* field=0) ; 219 219 private: 220 220 CGridAlgorithm* gridAlgorithm_ = nullptr ;
Note: See TracChangeset
for help on using the changeset viewer.