Changeset 1612 for XIOS/dev/dev_olga/src/node/file.cpp
- Timestamp:
- 11/23/18 14:48:14 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/file.cpp
r1542 r1612 53 53 54 54 const StdString CFile::getFileOutputName(void) const 55 TRY 55 56 { 56 57 return (name.isEmpty() ? getId() : name) + (name_suffix.isEmpty() ? StdString("") : name_suffix.getValue()); 57 58 } 59 CATCH 58 60 59 61 //---------------------------------------------------------------- … … 65 67 */ 66 68 std::shared_ptr<CDataOutput> CFile::getDataOutput(void) const 69 TRY 67 70 { 68 71 return data_out; 69 72 } 73 CATCH 70 74 71 75 /*! … … 76 80 */ 77 81 std::shared_ptr<CDataInput> CFile::getDataInput(void) const 82 TRY 78 83 { 79 84 return data_in; 80 85 } 86 CATCH 81 87 82 88 /*! … … 88 94 */ 89 95 CFieldGroup* CFile::getVirtualFieldGroup(void) const 96 TRY 90 97 { 91 98 return (this->vFieldGroup); 92 99 } 100 CATCH 93 101 94 102 /*! … … 100 108 */ 101 109 CVariableGroup* CFile::getVirtualVariableGroup(void) const 110 TRY 102 111 { 103 112 return (this->vVariableGroup); 104 113 } 114 CATCH 105 115 106 116 //! Get all fields of a file 107 117 std::vector<CField*> CFile::getAllFields(void) const 118 TRY 108 119 { 109 120 return (this->vFieldGroup->getAllChildren()); 110 121 } 122 CATCH 111 123 112 124 //! Get all variables of a file 113 125 std::vector<CVariable*> CFile::getAllVariables(void) const 126 TRY 114 127 { 115 128 return (this->vVariableGroup->getAllChildren()); 116 129 } 130 CATCH 117 131 118 132 //---------------------------------------------------------------- … … 129 143 int default_level, 130 144 bool default_enabled) 145 TRY 131 146 { 132 147 if (!this->enabledFields.empty()) … … 145 160 { 146 161 if (! (*it)->enabled.getValue()) continue; 147 // { it--; this->enabledFields.erase(it+1); continue; }148 162 } 149 163 else // Si l'attribut 'enabled' n'est pas dfini ... 150 164 { 151 165 if (!default_enabled) continue; 152 // { it--; this->enabledFields.erase(it+1); continue; }153 166 } 154 167 … … 156 169 { 157 170 if ((*it)->level.getValue() > _outputlevel) continue; 158 // { it--; this->enabledFields.erase(it+1); continue; }159 171 } 160 172 else // Si l'attribut 'level' n'est pas dfini ... 161 173 { 162 174 if (default_level > _outputlevel) continue; 163 // { it--; this->enabledFields.erase(it+1); continue; }164 175 } 165 176 166 // CField* field_tmp=(*it).get();167 // shared_ptr<CField> sptfield=*it;168 // field_tmp->refObject.push_back(sptfield);169 177 newEnabledFields.push_back(*it); 170 // Le champ est finalement actif, on y ajoute sa propre reference.171 // (*it)->refObject.push_back(*it);172 178 // Le champ est finalement actif, on y ajoute la rfrence au champ de base. 173 179 (*it)->setRelFile(CFile::get(this)); … … 177 183 return (this->enabledFields); 178 184 } 185 CATCH_DUMP_ATTR 179 186 180 187 //---------------------------------------------------------------- 181 188 //! Change virtual field group to a new one 182 189 void CFile::setVirtualFieldGroup(CFieldGroup* newVFieldGroup) 190 TRY 183 191 { 184 192 this->vFieldGroup = newVFieldGroup; 185 193 } 194 CATCH_DUMP_ATTR 186 195 187 196 //! Change virtual variable group to new one 188 197 void CFile::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 198 TRY 189 199 { 190 200 this->vVariableGroup = newVVariableGroup; 191 201 } 202 CATCH_DUMP_ATTR 192 203 193 204 //---------------------------------------------------------------- 194 205 bool CFile::isSyncTime(void) 206 TRY 195 207 { 196 208 CContext* context = CContext::getCurrent(); … … 206 218 return false; 207 219 } 220 CATCH_DUMP_ATTR 208 221 209 222 //! Initialize a file in order to write into it 210 223 void CFile::initWrite(void) 224 TRY 211 225 { 212 226 CContext* context = CContext::getCurrent(); … … 261 275 if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 262 276 } 277 CATCH_DUMP_ATTR 263 278 264 279 //! Initialize a file in order to write into it 265 280 void CFile::initRead(void) 281 TRY 266 282 { 267 283 if (checkRead) return; … … 269 285 checkRead = true; 270 286 } 287 CATCH_DUMP_ATTR 271 288 272 289 /*! … … 274 291 */ 275 292 void CFile::createSubComFile() 293 TRY 276 294 { 277 295 CContext* context = CContext::getCurrent(); … … 292 310 if (allZoneEmpty) MPI_Comm_free(&fileComm); 293 311 } 312 CATCH_DUMP_ATTR 294 313 295 314 /* … … 299 318 */ 300 319 void CFile::checkWriteFile(void) 320 TRY 301 321 { 302 322 CContext* context = CContext::getCurrent(); … … 315 335 } 316 336 } 337 CATCH_DUMP_ATTR 317 338 318 339 /* … … 323 344 */ 324 345 void CFile::checkReadFile(void) 346 TRY 325 347 { 326 348 CContext* context = CContext::getCurrent(); … … 340 362 } 341 363 } 364 CATCH_DUMP_ATTR 342 365 343 366 /*! … … 346 369 */ 347 370 bool CFile::isEmptyZone() 371 TRY 348 372 { 349 373 return allZoneEmpty; 350 374 } 375 CATCH_DUMP_ATTR 351 376 352 377 /*! … … 357 382 */ 358 383 bool CFile::checkSync(void) 384 TRY 359 385 { 360 386 CContext* context = CContext::getCurrent(); … … 371 397 return false; 372 398 } 399 CATCH_DUMP_ATTR 373 400 374 401 /*! … … 379 406 */ 380 407 bool CFile::checkSplit(void) 408 TRY 381 409 { 382 410 CContext* context = CContext::getCurrent(); … … 402 430 return false; 403 431 } 432 CATCH_DUMP_ATTR 404 433 405 434 /*! … … 408 437 */ 409 438 void CFile::createHeader(void) 439 TRY 410 440 { 411 441 CContext* context = CContext::getCurrent(); … … 594 624 } 595 625 } 626 CATCH_DUMP_ATTR 596 627 597 628 /*! … … 599 630 */ 600 631 void CFile::openInReadMode() 632 TRY 601 633 { 602 634 CContext* context = CContext::getCurrent(); … … 675 707 } 676 708 } 709 CATCH_DUMP_ATTR 677 710 678 711 //! Close file 679 712 void CFile::close(void) 713 TRY 680 714 { 681 715 if (!allZoneEmpty) … … 690 724 if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm); 691 725 } 726 CATCH_DUMP_ATTR 727 692 728 //---------------------------------------------------------------- 693 729 694 730 void CFile::readAttributesOfEnabledFieldsInReadMode() 731 TRY 695 732 { 696 733 if (enabledFields.empty()) return; … … 722 759 close(); 723 760 } 724 761 CATCH_DUMP_ATTR 725 762 726 763 /*! … … 729 766 */ 730 767 void CFile::parse(xml::CXMLNode & node) 768 TRY 731 769 { 732 770 SuperClass::parse(node); … … 741 779 node.goToParentElement(); 742 780 } 743 744 } 781 } 782 CATCH_DUMP_ATTR 783 745 784 //---------------------------------------------------------------- 746 785 … … 750 789 */ 751 790 StdString CFile::toString(void) const 791 TRY 752 792 { 753 793 StdOStringStream oss; … … 762 802 return (oss.str()); 763 803 } 804 CATCH 764 805 765 806 //---------------------------------------------------------------- … … 772 813 */ 773 814 void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent) 815 TRY 774 816 { 775 817 SuperClassAttribute::setAttributes(parent,apply); … … 777 819 this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 778 820 } 821 CATCH_DUMP_ATTR 779 822 780 823 //---------------------------------------------------------------- … … 789 832 */ 790 833 void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) 834 TRY 791 835 { 792 836 int size = this->enabledFields.size(); … … 796 840 } 797 841 } 842 CATCH_DUMP_ATTR 798 843 799 844 void CFile::checkGridOfEnabledFields() 845 TRY 800 846 { 801 847 int size = this->enabledFields.size(); … … 805 851 } 806 852 } 853 CATCH_DUMP_ATTR 807 854 808 855 void CFile::sendGridComponentOfEnabledFields() 856 TRY 809 857 { 810 858 int size = this->enabledFields.size(); … … 814 862 } 815 863 } 864 CATCH_DUMP_ATTR 816 865 817 866 /*! … … 820 869 */ 821 870 void CFile::sortEnabledFieldsForUgrid() 871 TRY 822 872 { 823 873 int size = this->enabledFields.size(); … … 868 918 } 869 919 } 920 CATCH_DUMP_ATTR 870 921 871 922 void CFile::sendGridOfEnabledFields() 923 TRY 872 924 { 873 925 int size = this->enabledFields.size(); … … 877 929 } 878 930 } 931 CATCH_DUMP_ATTR 879 932 880 933 void CFile::generateNewTransformationGridDest() 934 TRY 881 935 { 882 936 int size = this->enabledFields.size(); … … 886 940 } 887 941 } 942 CATCH_DUMP_ATTR 888 943 889 944 /*! … … 896 951 */ 897 952 void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 953 TRY 898 954 { 899 955 int size = this->enabledFields.size(); … … 903 959 } 904 960 } 961 CATCH_DUMP_ATTR 905 962 906 963 /*! … … 910 967 */ 911 968 void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc) 969 TRY 912 970 { 913 971 int size = this->enabledFields.size(); … … 917 975 } 918 976 } 977 CATCH_DUMP_ATTR 919 978 920 979 /*! … … 922 981 */ 923 982 void CFile::postProcessFilterGraph() 983 TRY 924 984 { 925 985 int size = this->enabledFields.size(); … … 929 989 } 930 990 } 991 CATCH_DUMP_ATTR 931 992 932 993 /*! … … 934 995 */ 935 996 void CFile::prefetchEnabledReadModeFields(void) 997 TRY 936 998 { 937 999 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 942 1004 this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 943 1005 } 1006 CATCH_DUMP_ATTR 944 1007 945 1008 /*! … … 949 1012 */ 950 1013 void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 1014 TRY 951 1015 { 952 1016 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 960 1024 } 961 1025 } 1026 CATCH_DUMP_ATTR 962 1027 963 1028 /*! … … 966 1031 */ 967 1032 void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 1033 TRY 968 1034 { 969 1035 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 976 1042 } 977 1043 } 1044 CATCH_DUMP_ATTR 978 1045 979 1046 void CFile::solveFieldRefInheritance(bool apply) 1047 TRY 980 1048 { 981 1049 // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. … … 984 1052 allF[i]->solveRefInheritance(apply); 985 1053 } 1054 CATCH_DUMP_ATTR 986 1055 987 1056 //---------------------------------------------------------------- … … 996 1065 */ 997 1066 CField* CFile::addField(const string& id) 1067 TRY 998 1068 { 999 1069 return vFieldGroup->createChild(id); 1000 1070 } 1071 CATCH_DUMP_ATTR 1001 1072 1002 1073 /*! … … 1008 1079 */ 1009 1080 CFieldGroup* CFile::addFieldGroup(const string& id) 1081 TRY 1010 1082 { 1011 1083 return vFieldGroup->createChildGroup(id); 1012 1084 } 1085 CATCH_DUMP_ATTR 1013 1086 1014 1087 /*! … … 1023 1096 */ 1024 1097 CVariable* CFile::addVariable(const string& id) 1098 TRY 1025 1099 { 1026 1100 return vVariableGroup->createChild(id); 1027 1101 } 1102 CATCH_DUMP_ATTR 1028 1103 1029 1104 /*! … … 1035 1110 */ 1036 1111 CVariableGroup* CFile::addVariableGroup(const string& id) 1112 TRY 1037 1113 { 1038 1114 return vVariableGroup->createChildGroup(id); 1039 1115 } 1116 CATCH_DUMP_ATTR 1040 1117 1041 1118 void CFile::setContextClient(CContextClient* newContextClient) 1119 TRY 1042 1120 { 1043 1121 client = newContextClient; … … 1048 1126 } 1049 1127 } 1128 CATCH_DUMP_ATTR 1050 1129 1051 1130 CContextClient* CFile::getContextClient() 1131 TRY 1052 1132 { 1053 1133 return client; 1054 1134 } 1135 CATCH_DUMP_ATTR 1055 1136 1056 1137 void CFile::setReadContextClient(CContextClient* readContextclient) 1138 TRY 1057 1139 { 1058 1140 read_client = readContextclient; 1059 1141 } 1142 CATCH_DUMP_ATTR 1060 1143 1061 1144 CContextClient* CFile::getReadContextClient() 1145 TRY 1062 1146 { 1063 1147 return read_client; 1064 1148 } 1149 CATCH_DUMP_ATTR 1065 1150 1066 1151 /*! … … 1069 1154 */ 1070 1155 void CFile::sendAddField(const string& id, CContextClient* client) 1156 TRY 1071 1157 { 1072 1158 sendAddItem(id, EVENT_ID_ADD_FIELD, client); 1073 1159 } 1160 CATCH_DUMP_ATTR 1074 1161 1075 1162 /*! … … 1078 1165 */ 1079 1166 void CFile::sendAddFieldGroup(const string& id, CContextClient* client) 1167 TRY 1080 1168 { 1081 1169 sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP, client); 1082 1170 } 1171 CATCH_DUMP_ATTR 1083 1172 1084 1173 /*! … … 1087 1176 */ 1088 1177 void CFile::recvAddField(CEventServer& event) 1178 TRY 1089 1179 { 1090 1180 … … 1094 1184 get(id)->recvAddField(*buffer); 1095 1185 } 1186 CATCH 1096 1187 1097 1188 /*! … … 1100 1191 */ 1101 1192 void CFile::recvAddField(CBufferIn& buffer) 1193 TRY 1102 1194 { 1103 1195 string id; … … 1105 1197 addField(id); 1106 1198 } 1199 CATCH_DUMP_ATTR 1107 1200 1108 1201 /*! … … 1111 1204 */ 1112 1205 void CFile::recvAddFieldGroup(CEventServer& event) 1206 TRY 1113 1207 { 1114 1208 … … 1118 1212 get(id)->recvAddFieldGroup(*buffer); 1119 1213 } 1214 CATCH 1120 1215 1121 1216 /*! … … 1124 1219 */ 1125 1220 void CFile::recvAddFieldGroup(CBufferIn& buffer) 1221 TRY 1126 1222 { 1127 1223 string id; … … 1129 1225 addFieldGroup(id); 1130 1226 } 1227 CATCH_DUMP_ATTR 1131 1228 1132 1229 /*! … … 1137 1234 */ 1138 1235 void CFile::sendAddAllVariables(CContextClient* client) 1236 TRY 1139 1237 { 1140 1238 std::vector<CVariable*> allVar = getAllVariables(); … … 1149 1247 } 1150 1248 } 1249 CATCH_DUMP_ATTR 1151 1250 1152 1251 /*! … … 1156 1255 */ 1157 1256 void CFile::sendAddVariableGroup(const string& id, CContextClient* client) 1257 TRY 1158 1258 { 1159 1259 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 1160 1260 } 1261 CATCH_DUMP_ATTR 1161 1262 1162 1263 /* … … 1166 1267 */ 1167 1268 void CFile::sendAddVariable(const string& id, CContextClient* client) 1269 TRY 1168 1270 { 1169 1271 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 1170 1272 } 1273 CATCH_DUMP_ATTR 1171 1274 1172 1275 /*! … … 1175 1278 */ 1176 1279 void CFile::recvAddVariable(CEventServer& event) 1177 {1178 1280 TRY 1281 { 1179 1282 CBufferIn* buffer = event.subEvents.begin()->buffer; 1180 1283 string id; … … 1182 1285 get(id)->recvAddVariable(*buffer); 1183 1286 } 1287 CATCH 1184 1288 1185 1289 /*! … … 1188 1292 */ 1189 1293 void CFile::recvAddVariable(CBufferIn& buffer) 1294 TRY 1190 1295 { 1191 1296 string id; … … 1193 1298 addVariable(id); 1194 1299 } 1300 CATCH_DUMP_ATTR 1195 1301 1196 1302 /*! … … 1199 1305 */ 1200 1306 void CFile::recvAddVariableGroup(CEventServer& event) 1307 TRY 1201 1308 { 1202 1309 … … 1206 1313 get(id)->recvAddVariableGroup(*buffer); 1207 1314 } 1315 CATCH 1208 1316 1209 1317 /*! … … 1212 1320 */ 1213 1321 void CFile::recvAddVariableGroup(CBufferIn& buffer) 1322 TRY 1214 1323 { 1215 1324 string id; … … 1217 1326 addVariableGroup(id); 1218 1327 } 1328 CATCH_DUMP_ATTR 1219 1329 1220 1330 /*! … … 1226 1336 */ 1227 1337 void CFile::sendEnabledFields(CContextClient* client) 1338 TRY 1228 1339 { 1229 1340 size_t size = this->enabledFields.size(); … … 1237 1348 } 1238 1349 } 1239 1350 CATCH_DUMP_ATTR 1240 1351 1241 1352 /*! … … 1247 1358 */ 1248 1359 bool CFile::dispatchEvent(CEventServer& event) 1360 TRY 1249 1361 { 1250 1362 if (SuperClass::dispatchEvent(event)) return true; … … 1278 1390 } 1279 1391 } 1280 1281 1282 1392 CATCH 1393 1394 ///-------------------------------------------------------------- 1395 /*! 1396 */ 1397 StdString CFile::dumpClassAttributes(void) 1398 { 1399 StdString str; 1400 CContext* context = CContext::getCurrent(); 1401 str.append("context=\""); 1402 str.append(context->getId()); 1403 str.append("\""); 1404 str.append(" enabled fields=\""); 1405 int size = this->enabledFields.size(); 1406 for (int i = 0; i < size; ++i) 1407 { 1408 str.append(this->enabledFields[i]->getId()); 1409 str.append(" "); 1410 } 1411 str.append("\""); 1412 return str; 1413 } 1283 1414 1284 1415 ///---------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.