Changeset 1646 for XIOS/dev/dev_trunk_omp/src/node/file.cpp
- Timestamp:
- 01/31/19 12:12:52 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/src/node/file.cpp
r1601 r1646 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) ep_lib::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(); … … 517 547 if (!multifile) 518 548 { 519 info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 549 #pragma omp critical (_output) 550 { 551 info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 552 } 520 553 multifile = true; 521 554 } … … 594 627 } 595 628 } 629 CATCH_DUMP_ATTR 596 630 597 631 /*! … … 599 633 */ 600 634 void CFile::openInReadMode() 635 TRY 601 636 { 602 637 CContext* context = CContext::getCurrent(); … … 638 673 if (!multifile) 639 674 { 640 info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 675 #pragma omp critical (_output) 676 { 677 info(0) << "!!! Warning -> Using non parallel version of netcdf, switching in multiple_file mode for file : " << filename << " ..." << endl; 678 } 641 679 multifile = true; 642 680 } … … 675 713 } 676 714 } 715 CATCH_DUMP_ATTR 677 716 678 717 //! Close file 679 718 void CFile::close(void) 719 TRY 680 720 { 681 721 if (!allZoneEmpty) … … 690 730 //if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm); 691 731 } 732 CATCH_DUMP_ATTR 733 692 734 //---------------------------------------------------------------- 693 735 694 736 void CFile::readAttributesOfEnabledFieldsInReadMode() 737 TRY 695 738 { 696 739 if (enabledFields.empty()) return; … … 723 766 close(); 724 767 } 725 768 CATCH_DUMP_ATTR 726 769 727 770 /*! … … 730 773 */ 731 774 void CFile::parse(xml::CXMLNode & node) 775 TRY 732 776 { 733 777 SuperClass::parse(node); … … 742 786 node.goToParentElement(); 743 787 } 744 745 } 788 } 789 CATCH_DUMP_ATTR 790 746 791 //---------------------------------------------------------------- 747 792 … … 751 796 */ 752 797 StdString CFile::toString(void) const 798 TRY 753 799 { 754 800 StdOStringStream oss; … … 763 809 return (oss.str()); 764 810 } 811 CATCH 765 812 766 813 //---------------------------------------------------------------- … … 773 820 */ 774 821 void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent) 822 TRY 775 823 { 776 824 SuperClassAttribute::setAttributes(parent,apply); … … 778 826 this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 779 827 } 828 CATCH_DUMP_ATTR 780 829 781 830 //---------------------------------------------------------------- … … 790 839 */ 791 840 void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) 841 TRY 792 842 { 793 843 int size = this->enabledFields.size(); … … 797 847 } 798 848 } 849 CATCH_DUMP_ATTR 799 850 800 851 void CFile::checkGridOfEnabledFields() 852 TRY 801 853 { 802 854 int size = this->enabledFields.size(); … … 806 858 } 807 859 } 860 CATCH_DUMP_ATTR 808 861 809 862 void CFile::sendGridComponentOfEnabledFields() 863 TRY 810 864 { 811 865 int size = this->enabledFields.size(); … … 815 869 } 816 870 } 871 CATCH_DUMP_ATTR 817 872 818 873 /*! … … 821 876 */ 822 877 void CFile::sortEnabledFieldsForUgrid() 878 TRY 823 879 { 824 880 int size = this->enabledFields.size(); … … 869 925 } 870 926 } 927 CATCH_DUMP_ATTR 871 928 872 929 void CFile::sendGridOfEnabledFields() 930 TRY 873 931 { 874 932 int size = this->enabledFields.size(); … … 878 936 } 879 937 } 938 CATCH_DUMP_ATTR 880 939 881 940 void CFile::generateNewTransformationGridDest() 941 TRY 882 942 { 883 943 int size = this->enabledFields.size(); … … 887 947 } 888 948 } 949 CATCH_DUMP_ATTR 889 950 890 951 /*! … … 897 958 */ 898 959 void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 960 TRY 899 961 { 900 962 int size = this->enabledFields.size(); … … 904 966 } 905 967 } 968 CATCH_DUMP_ATTR 906 969 907 970 /*! … … 911 974 */ 912 975 void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc) 976 TRY 913 977 { 914 978 int size = this->enabledFields.size(); … … 918 982 } 919 983 } 984 CATCH_DUMP_ATTR 920 985 921 986 /*! … … 923 988 */ 924 989 void CFile::postProcessFilterGraph() 990 TRY 925 991 { 926 992 int size = this->enabledFields.size(); … … 930 996 } 931 997 } 998 CATCH_DUMP_ATTR 932 999 933 1000 /*! … … 935 1002 */ 936 1003 void CFile::prefetchEnabledReadModeFields(void) 1004 TRY 937 1005 { 938 1006 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 943 1011 this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 944 1012 } 1013 CATCH_DUMP_ATTR 945 1014 946 1015 /*! … … 950 1019 */ 951 1020 void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 1021 TRY 952 1022 { 953 1023 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 961 1031 } 962 1032 } 1033 CATCH_DUMP_ATTR 963 1034 964 1035 /*! … … 967 1038 */ 968 1039 void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 1040 TRY 969 1041 { 970 1042 if (mode.isEmpty() || mode.getValue() != mode_attr::read) … … 977 1049 } 978 1050 } 1051 CATCH_DUMP_ATTR 979 1052 980 1053 void CFile::solveFieldRefInheritance(bool apply) 1054 TRY 981 1055 { 982 1056 // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. … … 985 1059 allF[i]->solveRefInheritance(apply); 986 1060 } 1061 CATCH_DUMP_ATTR 987 1062 988 1063 //---------------------------------------------------------------- … … 997 1072 */ 998 1073 CField* CFile::addField(const string& id) 1074 TRY 999 1075 { 1000 1076 return vFieldGroup->createChild(id); 1001 1077 } 1078 CATCH_DUMP_ATTR 1002 1079 1003 1080 /*! … … 1009 1086 */ 1010 1087 CFieldGroup* CFile::addFieldGroup(const string& id) 1088 TRY 1011 1089 { 1012 1090 return vFieldGroup->createChildGroup(id); 1013 1091 } 1092 CATCH_DUMP_ATTR 1014 1093 1015 1094 /*! … … 1024 1103 */ 1025 1104 CVariable* CFile::addVariable(const string& id) 1105 TRY 1026 1106 { 1027 1107 return vVariableGroup->createChild(id); 1028 1108 } 1109 CATCH_DUMP_ATTR 1029 1110 1030 1111 /*! … … 1036 1117 */ 1037 1118 CVariableGroup* CFile::addVariableGroup(const string& id) 1119 TRY 1038 1120 { 1039 1121 return vVariableGroup->createChildGroup(id); 1040 1122 } 1123 CATCH_DUMP_ATTR 1041 1124 1042 1125 void CFile::setContextClient(CContextClient* newContextClient) 1126 TRY 1043 1127 { 1044 1128 client = newContextClient; … … 1049 1133 } 1050 1134 } 1135 CATCH_DUMP_ATTR 1051 1136 1052 1137 CContextClient* CFile::getContextClient() 1138 TRY 1053 1139 { 1054 1140 return client; 1055 1141 } 1142 CATCH_DUMP_ATTR 1056 1143 1057 1144 void CFile::setReadContextClient(CContextClient* readContextclient) 1145 TRY 1058 1146 { 1059 1147 read_client = readContextclient; 1060 1148 } 1149 CATCH_DUMP_ATTR 1061 1150 1062 1151 CContextClient* CFile::getReadContextClient() 1152 TRY 1063 1153 { 1064 1154 return read_client; 1065 1155 } 1156 CATCH_DUMP_ATTR 1066 1157 1067 1158 /*! … … 1070 1161 */ 1071 1162 void CFile::sendAddField(const string& id, CContextClient* client) 1163 TRY 1072 1164 { 1073 1165 sendAddItem(id, EVENT_ID_ADD_FIELD, client); 1074 1166 } 1167 CATCH_DUMP_ATTR 1075 1168 1076 1169 /*! … … 1079 1172 */ 1080 1173 void CFile::sendAddFieldGroup(const string& id, CContextClient* client) 1174 TRY 1081 1175 { 1082 1176 sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP, client); 1083 1177 } 1178 CATCH_DUMP_ATTR 1084 1179 1085 1180 /*! … … 1088 1183 */ 1089 1184 void CFile::recvAddField(CEventServer& event) 1185 TRY 1090 1186 { 1091 1187 … … 1095 1191 get(id)->recvAddField(*buffer); 1096 1192 } 1193 CATCH 1097 1194 1098 1195 /*! … … 1101 1198 */ 1102 1199 void CFile::recvAddField(CBufferIn& buffer) 1200 TRY 1103 1201 { 1104 1202 string id; … … 1106 1204 addField(id); 1107 1205 } 1206 CATCH_DUMP_ATTR 1108 1207 1109 1208 /*! … … 1112 1211 */ 1113 1212 void CFile::recvAddFieldGroup(CEventServer& event) 1213 TRY 1114 1214 { 1115 1215 … … 1119 1219 get(id)->recvAddFieldGroup(*buffer); 1120 1220 } 1221 CATCH 1121 1222 1122 1223 /*! … … 1125 1226 */ 1126 1227 void CFile::recvAddFieldGroup(CBufferIn& buffer) 1228 TRY 1127 1229 { 1128 1230 string id; … … 1130 1232 addFieldGroup(id); 1131 1233 } 1234 CATCH_DUMP_ATTR 1132 1235 1133 1236 /*! … … 1138 1241 */ 1139 1242 void CFile::sendAddAllVariables(CContextClient* client) 1243 TRY 1140 1244 { 1141 1245 std::vector<CVariable*> allVar = getAllVariables(); … … 1150 1254 } 1151 1255 } 1256 CATCH_DUMP_ATTR 1152 1257 1153 1258 /*! … … 1157 1262 */ 1158 1263 void CFile::sendAddVariableGroup(const string& id, CContextClient* client) 1264 TRY 1159 1265 { 1160 1266 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 1161 1267 } 1268 CATCH_DUMP_ATTR 1162 1269 1163 1270 /* … … 1167 1274 */ 1168 1275 void CFile::sendAddVariable(const string& id, CContextClient* client) 1276 TRY 1169 1277 { 1170 1278 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 1171 1279 } 1280 CATCH_DUMP_ATTR 1172 1281 1173 1282 /*! … … 1176 1285 */ 1177 1286 void CFile::recvAddVariable(CEventServer& event) 1178 {1179 1287 TRY 1288 { 1180 1289 CBufferIn* buffer = event.subEvents.begin()->buffer; 1181 1290 string id; … … 1183 1292 get(id)->recvAddVariable(*buffer); 1184 1293 } 1294 CATCH 1185 1295 1186 1296 /*! … … 1189 1299 */ 1190 1300 void CFile::recvAddVariable(CBufferIn& buffer) 1301 TRY 1191 1302 { 1192 1303 string id; … … 1194 1305 addVariable(id); 1195 1306 } 1307 CATCH_DUMP_ATTR 1196 1308 1197 1309 /*! … … 1200 1312 */ 1201 1313 void CFile::recvAddVariableGroup(CEventServer& event) 1314 TRY 1202 1315 { 1203 1316 … … 1207 1320 get(id)->recvAddVariableGroup(*buffer); 1208 1321 } 1322 CATCH 1209 1323 1210 1324 /*! … … 1213 1327 */ 1214 1328 void CFile::recvAddVariableGroup(CBufferIn& buffer) 1329 TRY 1215 1330 { 1216 1331 string id; … … 1218 1333 addVariableGroup(id); 1219 1334 } 1335 CATCH_DUMP_ATTR 1220 1336 1221 1337 /*! … … 1227 1343 */ 1228 1344 void CFile::sendEnabledFields(CContextClient* client) 1345 TRY 1229 1346 { 1230 1347 size_t size = this->enabledFields.size(); … … 1238 1355 } 1239 1356 } 1240 1357 CATCH_DUMP_ATTR 1241 1358 1242 1359 /*! … … 1248 1365 */ 1249 1366 bool CFile::dispatchEvent(CEventServer& event) 1367 TRY 1250 1368 { 1251 1369 if (SuperClass::dispatchEvent(event)) return true; … … 1279 1397 } 1280 1398 } 1281 1282 1283 1399 CATCH 1400 1401 ///-------------------------------------------------------------- 1402 /*! 1403 */ 1404 StdString CFile::dumpClassAttributes(void) 1405 { 1406 StdString str; 1407 CContext* context = CContext::getCurrent(); 1408 str.append("context=\""); 1409 str.append(context->getId()); 1410 str.append("\""); 1411 str.append(" enabled fields=\""); 1412 int size = this->enabledFields.size(); 1413 for (int i = 0; i < size; ++i) 1414 { 1415 str.append(this->enabledFields[i]->getId()); 1416 str.append(" "); 1417 } 1418 str.append("\""); 1419 return str; 1420 } 1284 1421 1285 1422 ///---------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.