Changeset 1877
- Timestamp:
- 05/13/20 16:46:00 (4 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/COMPLETE/context_atmosphere.xml
r1876 r1877 10 10 <file_definition type="one_file" par_access="collective" output_freq="6h" sync_freq="6h" output_level="10" enabled=".TRUE."> 11 11 <file id="output_atmosphere" name="output_atmosphere"> 12 <field field_ref="field_A_atm" />12 <field field_ref="field_A_atm" build_workflow_graph="true"/> 13 13 </file> 14 14 <file id="output_atmosphere_zoom" name="output_atmosphere_zoom"> 15 <field field_ref="field_A_atm_zoom" name="field_A_atm_zoom" />15 <field field_ref="field_A_atm_zoom" name="field_A_atm_zoom" build_workflow_graph="true"/> 16 16 </file> 17 17 </file_definition> -
XIOS/trunk/inputs/COMPLETE/context_surface.xml
r1876 r1877 22 22 <field field_ref="field_A_srf_K" build_workflow_graph="false" /> 23 23 <field field_ref="field_A_srf_K_2" name="field_A_srf_K_2" /> <!-- Should be identical to field_A_srf_K --> 24 <field field_ref="field_A_srf_K" name="field_A_srf_K_3" build_workflow_graph="true" > field_A_srf_K</field> <!-- Should be identical to field_A_srf_K -->24 <field field_ref="field_A_srf_K" name="field_A_srf_K_3" build_workflow_graph="true"/> <!-- Should be identical to field_A_srf_K --> 25 25 <field field_ref="field_A_srf_K_2" name="field_A_srf_K_max_mean" long_name="Maximum of hourly average over 6h" operation="maximum" freq_op="1h"> @field_A_srf_K </field> 26 26 <field field_ref="field_A_srf" name="field_A_srf_min" operation="minimum" /> -
XIOS/trunk/inputs/iodef.xml
r1876 r1877 20 20 <file_definition type="one_file" par_access="collective" output_freq="1h" output_level="10" > 21 21 22 <file id="test_output" output_freq="4h" enabled=".TRUE." >23 <field field_ref="field_A" name ="field_A" build_workflow_graph=". FALSE." enabled=".FALSE."/>24 <field field_ref="test_field_B" name ="field_B" build_workflow_graph=". FALSE." enabled=".TRUE."/>22 <file id="test_output" name = "output" output_freq="4h" enabled=".TRUE." > 23 <field field_ref="field_A" name ="field_A" build_workflow_graph=".TRUE." enabled=".TRUE."/> 24 <field field_ref="test_field_B" name ="field_B" build_workflow_graph=".TRUE." enabled=".TRUE."/> 25 25 <field id="test_field_C" field_ref="test_field_B" name ="field_C" build_workflow_graph=".TRUE." enabled=".TRUE." > 10*test_field_B </field> 26 <field id="test_field_D" field_ref="test_field_B" name ="field_D" build_workflow_graph=".TRUE." enabled=". FALSE." > 100*field_A </field>27 <field id="test_field_E" field_ref="test_field_B" name ="field_E" build_workflow_graph=".TRUE." enabled=". FALSE." > field_A+10*test_field_B-field_C </field>26 <field id="test_field_D" field_ref="test_field_B" name ="field_D" build_workflow_graph=".TRUE." enabled=".TRUE." > 100*field_A </field> 27 <field id="test_field_E" field_ref="test_field_B" name ="field_E" build_workflow_graph=".TRUE." enabled=".TRUE." > field_A+10*test_field_B-field_C </field> 28 28 </file> 29 29 -
XIOS/trunk/src/filter/file_writer_filter.cpp
r1704 r1877 30 30 namestring.erase(0, 6); 31 31 namestring.erase(namestring.length()-1, 1); 32 33 CWorkflowGraph::addNode(this->filterID, namestring + "\\n( "+this->field->file->getId()+".nc)", 6, 0, 1, data[0]);32 33 CWorkflowGraph::addNode(this->filterID, namestring + "\\n(file ID : "+this->field->file->getId()+")", 6, 0, 1, data[0]); 34 34 35 35 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); -
XIOS/trunk/src/filter/source_filter.cpp
r1876 r1877 41 41 packet->distance = 1; 42 42 43 44 43 CWorkflowGraph::allocNodeEdge(); 45 44 46 45 CWorkflowGraph::addNode(this->filterID, "Source Filter ", 1, 1, 0, packet); 47 46 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); -
XIOS/trunk/src/graphviz.cpp
r1704 r1877 55 55 56 56 boost::write_graphviz(file, g, 57 58 59 57 boost::make_label_writer(&nodes[0]), 58 boost::make_label_writer(get(edge_name, g)), 59 boost::make_graph_attributes_writer(graph_attr, vertex_attr, edge_attr)); 60 60 61 61 } … … 72 72 { 73 73 CWorkflowGraph::buildStaticWorkflow_with_info(); 74 int nbGraphContext = CWorkflowGraph::mapContext_ptr->size(); 74 75 75 76 StdString color_table[7] = {"black", "red", "blue", "green", "purple", "yellow", "gray"}; 76 77 77 std::ofstream fs_json; 78 fs_json.open ("graph_data.json", std::fstream::out); 78 std::ofstream fs_json[nbGraphContext]; 79 80 for (std::unordered_map<StdString, int>::const_iterator it = CWorkflowGraph::mapContext_ptr->begin(); it != CWorkflowGraph::mapContext_ptr->end(); ++it) 81 { 82 fs_json[it->second].open ("graph_data_"+it->first+".json", std::fstream::out); 83 fs_json[it->second] << "{\"nodes\":["<<std::endl<<" "; 84 } 79 85 80 fs_json << "{\"nodes\":["<<std::endl<<" "; 81 static bool firstnode=true; 82 static bool firstedge=true; 83 86 static bool firstnodes[5]; 87 static bool firstedges[5]; 88 89 for(int i=0; i<nbGraphContext; i++) 90 { 91 firstnodes[i]=true; 92 firstedges[i]=true; 93 } 94 84 95 for (auto it=CWorkflowGraph::mapFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFilters_ptr_with_info->end(); it++) 85 96 { 86 if(firstnode) 97 int index = (*CWorkflowGraph::mapContext_ptr)[it->second.node_context_id]; 98 if(firstnodes[index]) 87 99 { 88 fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl;89 firstnode = false;100 fs_json[index] << "{\"id\": "<<it->first +1<<", "<<std::endl; 101 firstnodes[index] = false; 90 102 } 91 103 else 92 104 { 93 fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl;105 fs_json[index] << ",{\"id\": "<<it->first +1<<", "<<std::endl; 94 106 } 95 107 if(it->second.filter_class == 1) // source filter 96 fs_json << " \"label\": \""<<it->second.filter_name<<"\\n("<<it->second.field_id<<")\", "<<std::endl;108 fs_json[index] << " \"label\": \""<<it->second.filter_name<<"\\n("<<it->second.field_id<<")\", "<<std::endl; 97 109 else 98 fs_json << " \"label\": \""<<it->second.filter_name<<"\", "<<std::endl; 99 fs_json << " \"class\": "<<it->second.filter_class<<", "<<std::endl; 100 fs_json << " \"filled\": "<<it->second.filter_filled<<", "<<std::endl; 101 fs_json << " \"type\": \""<<it->second.transform_type<<"\", "<<std::endl; 102 fs_json << " \"entry\": "<<it->second.expected_entry_nb<<", "<<std::endl; 103 fs_json << " \"inputs\": "<<it->second.inputs_complete<<", "<<std::endl; 104 fs_json << " \"tag\": "<<it->second.filter_tag<<", "<<std::endl; 105 fs_json << " \"cid\": "<<it->second.clusterID<<", "<<std::endl; 106 fs_json << " \"distance\": "<<it->second.distance<<", "<<std::endl; 107 fs_json << " \"attributes\": \""<<it->second.attributes<<"\"}"<<std::endl<<" "; 110 fs_json[index] << " \"label\": \""<<it->second.filter_name<<"\", "<<std::endl; 111 fs_json[index] << " \"class\": "<<it->second.filter_class<<", "<<std::endl; 112 fs_json[index] << " \"filled\": "<<it->second.filter_filled<<", "<<std::endl; 113 fs_json[index] << " \"type\": \""<<it->second.transform_type<<"\", "<<std::endl; 114 fs_json[index] << " \"entry\": "<<it->second.expected_entry_nb<<", "<<std::endl; 115 fs_json[index] << " \"inputs\": "<<it->second.inputs_complete<<", "<<std::endl; 116 fs_json[index] << " \"tag\": "<<it->second.filter_tag<<", "<<std::endl; 117 fs_json[index] << " \"cid\": "<<it->second.clusterID<<", "<<std::endl; 118 fs_json[index] << " \"distance\": "<<it->second.distance<<", "<<std::endl; 119 fs_json[index] << " \"context\": \""<<it->second.node_context_id<<"\", "<<std::endl; 120 fs_json[index] << " \"attributes\": \""<<it->second.attributes<<"\"}"<<std::endl<<" "; 108 121 } 109 fs_json << " ],"<<std::endl; 110 111 112 fs_json << " \"edges\" : ["<<std::endl<<" "; 122 for(int i=0; i<nbGraphContext; i++) 123 { 124 fs_json[i] << " ],"<<std::endl; 125 fs_json[i] << " \"edges\" : ["<<std::endl<<" "; 126 } 113 127 114 128 for (auto it=CWorkflowGraph::mapFieldToFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFieldToFilters_ptr_with_info->end(); it++) 115 129 { 116 if(firstedge) 130 int index = (*CWorkflowGraph::mapContext_ptr)[it->second.edge_context_id]; 131 if(firstedges[index]) 117 132 { 118 fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl;119 firstedge = false;133 fs_json[index] << "{\"id\": "<<it->first +1<<", "<<std::endl; 134 firstedges[index] = false; 120 135 } 121 136 else 122 137 { 123 fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl;138 fs_json[index] << ",{\"id\": "<<it->first +1<<", "<<std::endl; 124 139 } 125 fs_json << " \"from\": "<<it->second.from+1<<", "<<std::endl;126 fs_json << " \"to\": "<<it->second.to+1<<", "<<std::endl;127 fs_json << " \"label\": \""<<it->second.field_id<<"\\n"<<it->second.date<<"\", "<<std::endl;140 fs_json[index] << " \"from\": "<<it->second.from+1<<", "<<std::endl; 141 fs_json[index] << " \"to\": "<<it->second.to+1<<", "<<std::endl; 142 fs_json[index] << " \"label\": \""<<it->second.field_id<<"\\n"<<it->second.date<<"\", "<<std::endl; 128 143 // fs_json << " \"title\": \""<<"Show more information about this field"<<"\", "<<std::endl; 129 144 // fs_json << " \"fid\": \""<<it->second.field_id<<"\", "<<std::endl; 130 145 // fs_json << " \"fname\": \""<<it->second.field_name<<"\", "<<std::endl; 131 146 // fs_json << " \"gid\": \""<<it->second.grid_id<<"\", "<<std::endl; 132 fs_json << " \"date\": \""<<it->second.date<<"\", "<<std::endl;133 fs_json << " \"attributes\": \"id = "<<it->second.field_id<<"</br>"<<it->second.attributes<<"\"}"<<std::endl<<" ";134 147 fs_json[index] << " \"date\": \""<<it->second.date<<"\", "<<std::endl; 148 fs_json[index] << " \"context\": \""<<it->second.edge_context_id<<"\", "<<std::endl; 149 fs_json[index] << " \"attributes\": \"id = "<<it->second.field_id<<"</br>"<<it->second.attributes<<"\"}"<<std::endl<<" "; 135 150 } 136 fs_json << " ]}"<<std::endl; 137 138 fs_json.close(); 151 for(int i=0; i<nbGraphContext; i++) 152 { 153 fs_json[i] << " ]}"<<std::endl; 154 fs_json[i].close(); 155 } 139 156 } 140 157 } -
XIOS/trunk/src/workflow_graph.cpp
r1704 r1877 9 9 10 10 std::unordered_map <size_t, int> *CWorkflowGraph::mapHashFilterID_ptr = 0; 11 12 std::unordered_map <StdString, int > *CWorkflowGraph::mapContext_ptr = 0; 11 13 12 14 … … 125 127 TRY 126 128 { 129 if(!mapContext_ptr) mapContext_ptr = new std::unordered_map<StdString, int>; 130 std::string current_context_id = CContext::getCurrent()->getId(); 131 std::unordered_map<StdString,int>::const_iterator found = mapContext_ptr->find(current_context_id); 132 if (found == mapContext_ptr->end()) 133 { 134 std::pair<StdString, int> mypair (current_context_id, mapContext_ptr->size()); 135 mapContext_ptr->insert(mypair); 136 } 137 127 138 (*mapFilters_ptr_with_info)[nodeID].filter_name = filterName; 128 139 (*mapFilters_ptr_with_info)[nodeID].filter_class = filterClass; … … 131 142 (*mapFilters_ptr_with_info)[nodeID].date = packet->date; 132 143 (*mapFilters_ptr_with_info)[nodeID].timestamp = packet->timestamp; 144 (*mapFilters_ptr_with_info)[nodeID].node_context_id = CContext::getCurrent()->getId(); 133 145 } 134 146 CATCH … … 139 151 TRY 140 152 { 153 std::string current_context_id = CContext::getCurrent()->getId(); 141 154 (*mapFieldToFilters_ptr_with_info)[edgeID].from = packet->src_filterID; 142 155 (*mapFieldToFilters_ptr_with_info)[edgeID].to = toID; … … 148 161 (*mapFieldToFilters_ptr_with_info)[edgeID].field = packet->field; 149 162 (*mapFieldToFilters_ptr_with_info)[edgeID].attributes = packet->field->record4graphXiosAttributes(); 163 (*mapFieldToFilters_ptr_with_info)[edgeID].edge_context_id = CContext::getCurrent()->getId(); 150 164 } 151 165 CATCH -
XIOS/trunk/src/workflow_graph.hpp
r1704 r1877 8 8 #include "date.hpp" 9 9 #include "duration.hpp" 10 10 #include "context.hpp" 11 11 12 12 namespace xios … … 30 30 int clusterID; 31 31 int distance; 32 StdString node_context_id; 32 33 }; 33 34 … … 43 44 CField *field; 44 45 StdString attributes; 45 46 StdString edge_context_id; 46 47 }; 47 48 … … 68 69 69 70 static std::unordered_map <size_t, int> *mapHashFilterID_ptr; 71 72 static std::unordered_map <StdString, int> *mapContext_ptr; 70 73 71 74
Note: See TracChangeset
for help on using the changeset viewer.