Changeset 1370
- Timestamp:
- 12/12/17 14:01:50 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/io/netCdfInterface.cpp
r1158 r1370 30 30 << errormsg << std::endl 31 31 << "Unable to create file, given its name: " << fileName 32 << " and its creation mode " << creationMode2String(cMode) << std::endl;32 << " and its creation mode " << creationMode2String(cMode) << std::endl; 33 33 StdString e = sstr.str(); 34 34 throw CNetCdfException(e); -
XIOS/dev/XIOS_DEV_CMIP6/src/node/context.cpp
r1358 r1370 1484 1484 std::map<int, StdSize> attributesSize; 1485 1485 1486 // if (hasClient) 1487 { 1488 std::vector<CFile*>& fileList = bufferForWriting ? this->enabledWriteModeFiles : this->enabledReadModeFiles; 1489 // size_t numEnabledFiles = this->enabledWriteModeFiles.size(); 1490 size_t numEnabledFiles = fileList.size(); 1491 for (size_t i = 0; i < numEnabledFiles; ++i) 1492 { 1493 // CFile* file = this->enabledWriteModeFiles[i]; 1494 CFile* file = fileList[i]; 1495 // if (file->getContextClient() == contextClient) 1496 { 1497 std::vector<CField*> enabledFields = file->getEnabledFields(); 1498 size_t numEnabledFields = enabledFields.size(); 1499 for (size_t j = 0; j < numEnabledFields; ++j) 1500 { 1501 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridAttributesBufferSize(contextClient, bufferForWriting); 1502 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 1503 for (; it != itE; ++it) 1504 { 1505 // If attributesSize[it->first] does not exist, it will be zero-initialized 1506 // so we can use it safely without checking for its existence 1507 if (attributesSize[it->first] < it->second) 1508 attributesSize[it->first] = it->second; 1509 1510 if (maxEventSize[it->first] < it->second) 1511 maxEventSize[it->first] = it->second; 1512 } 1513 } 1514 } 1515 } 1516 1517 // // Not a good approach here, duplicate code 1518 // if (!hasServer) 1519 // { 1520 // size_t numEnabledFiles = this->enabledReadModeFiles.size(); 1521 // for (size_t i = 0; i < numEnabledFiles; ++i) 1522 // { 1523 // CFile* file = this->enabledReadModeFiles[i]; 1524 // { 1525 // std::vector<CField*> enabledFields = file->getEnabledFields(); 1526 // size_t numEnabledFields = enabledFields.size(); 1527 // for (size_t j = 0; j < numEnabledFields; ++j) 1528 // { 1529 // const std::map<int, StdSize> mapSize = enabledFields[j]->getGridAttributesBufferSize(contextClient); 1530 // std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 1531 // for (; it != itE; ++it) 1532 // { 1533 // // If attributesSize[it->first] does not exist, it will be zero-initialized 1534 // // so we can use it safely without checking for its existance 1535 // if (attributesSize[it->first] < it->second) 1536 // attributesSize[it->first] = it->second; 1537 // 1538 // if (maxEventSize[it->first] < it->second) 1539 // maxEventSize[it->first] = it->second; 1540 // } 1541 // } 1542 // } 1543 // } 1544 // } 1545 } 1546 1486 std::vector<CFile*>& fileList = this->enabledFiles; 1487 size_t numEnabledFiles = fileList.size(); 1488 for (size_t i = 0; i < numEnabledFiles; ++i) 1489 { 1490 // CFile* file = this->enabledWriteModeFiles[i]; 1491 CFile* file = fileList[i]; 1492 std::vector<CField*> enabledFields = file->getEnabledFields(); 1493 size_t numEnabledFields = enabledFields.size(); 1494 for (size_t j = 0; j < numEnabledFields; ++j) 1495 { 1496 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridAttributesBufferSize(contextClient, bufferForWriting); 1497 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 1498 for (; it != itE; ++it) 1499 { 1500 // If attributesSize[it->first] does not exist, it will be zero-initialized 1501 // so we can use it safely without checking for its existence 1502 if (attributesSize[it->first] < it->second) 1503 attributesSize[it->first] = it->second; 1504 1505 if (maxEventSize[it->first] < it->second) 1506 maxEventSize[it->first] = it->second; 1507 } 1508 } 1509 } 1547 1510 return attributesSize; 1548 1511 } … … 1558 1521 CContextClient* contextClient, bool bufferForWriting /*= "false"*/) 1559 1522 { 1560 // CFile::mode_attr::t_enum mode = hasClient ? CFile::mode_attr::write : CFile::mode_attr::read;1561 1562 1523 std::map<int, StdSize> dataSize; 1563 1524 … … 1565 1526 std::vector<CFile*>& fileList = bufferForWriting ? this->enabledWriteModeFiles : this->enabledReadModeFiles; 1566 1527 size_t numEnabledFiles = fileList.size(); 1567 // size_t numEnabledFiles = this->enabledFiles.size();1568 1528 for (size_t i = 0; i < numEnabledFiles; ++i) 1569 1529 { … … 1572 1532 if (file->getContextClient() == contextClient) 1573 1533 { 1574 // CFile::mode_attr::t_enum fileMode = file->mode.isEmpty() ? CFile::mode_attr::write : file->mode.getValue();1575 // if (fileMode == mode) 1576 1534 std::vector<CField*> enabledFields = file->getEnabledFields(); 1535 size_t numEnabledFields = enabledFields.size(); 1536 for (size_t j = 0; j < numEnabledFields; ++j) 1577 1537 { 1578 std::vector<CField*> enabledFields = file->getEnabledFields(); 1579 size_t numEnabledFields = enabledFields.size(); 1580 for (size_t j = 0; j < numEnabledFields; ++j) 1538 // const std::vector<std::map<int, StdSize> > mapSize = enabledFields[j]->getGridDataBufferSize(contextClient); 1539 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataBufferSize(contextClient,bufferForWriting); 1540 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 1541 for (; it != itE; ++it) 1581 1542 { 1582 // const std::vector<std::map<int, StdSize> > mapSize = enabledFields[j]->getGridDataBufferSize(contextClient); 1583 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataBufferSize(contextClient,bufferForWriting); 1584 // for (size_t c = 0; c < mapSize.size(); ++c) 1585 // { 1586 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 1587 for (; it != itE; ++it) 1588 { 1589 // If dataSize[it->first] does not exist, it will be zero-initialized 1590 // so we can use it safely without checking for its existance 1591 if (CXios::isOptPerformance) 1592 dataSize[it->first] += it->second; 1593 else if (dataSize[it->first] < it->second) 1594 dataSize[it->first] = it->second; 1595 1596 if (maxEventSize[it->first] < it->second) 1597 maxEventSize[it->first] = it->second; 1598 } 1599 // } 1543 // If dataSize[it->first] does not exist, it will be zero-initialized 1544 // so we can use it safely without checking for its existance 1545 if (CXios::isOptPerformance) 1546 dataSize[it->first] += it->second; 1547 else if (dataSize[it->first] < it->second) 1548 dataSize[it->first] = it->second; 1549 1550 if (maxEventSize[it->first] < it->second) 1551 maxEventSize[it->first] = it->second; 1600 1552 } 1601 1553 } 1602 1554 } 1603 1555 } 1604 1605 1556 return dataSize; 1606 1557 }
Note: See TracChangeset
for help on using the changeset viewer.