Changeset 1612 for XIOS/dev/dev_olga/src/node/field.cpp
- Timestamp:
- 11/23/18 14:48:14 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/field.cpp
r1594 r1612 71 71 72 72 void CField::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 73 TRY 73 74 { 74 75 this->vVariableGroup = newVVariableGroup; 75 76 } 77 CATCH 76 78 77 79 CVariableGroup* CField::getVirtualVariableGroup(void) const 80 TRY 78 81 { 79 82 return this->vVariableGroup; 80 83 } 84 CATCH 81 85 82 86 std::vector<CVariable*> CField::getAllVariables(void) const 87 TRY 83 88 { 84 89 return this->vVariableGroup->getAllChildren(); 85 90 } 91 CATCH 86 92 87 93 void CField::solveDescInheritance(bool apply, const CAttributeMap* const parent) 94 TRY 88 95 { 89 96 SuperClassAttribute::setAttributes(parent, apply); 90 97 this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 91 98 } 99 CATCH_DUMP_ATTR 92 100 93 101 //---------------------------------------------------------------- 94 102 95 103 bool CField::dispatchEvent(CEventServer& event) 104 TRY 96 105 { 97 106 if (SuperClass::dispatchEvent(event)) return true; … … 131 140 } 132 141 } 142 CATCH 133 143 134 144 void CField::sendUpdateData(const CArray<double,1>& data) 145 TRY 135 146 { 136 147 CTimer::get("Field : send data").resume(); … … 189 200 CTimer::get("Field : send data").suspend(); 190 201 } 202 CATCH_DUMP_ATTR 191 203 192 204 void CField::recvUpdateData(CEventServer& event) 205 TRY 193 206 { 194 207 std::map<int,CBufferIn*> rankBuffers; … … 207 220 CTimer::get("Field : recv data").suspend(); 208 221 } 222 CATCH 209 223 210 224 void CField::recvUpdateData(std::map<int,CBufferIn*>& rankBuffers) 225 TRY 211 226 { 212 227 CContext* context = CContext::getCurrent(); … … 249 264 recvDataSrv.reset() ; 250 265 } 266 CATCH_DUMP_ATTR 251 267 252 268 void CField::writeUpdateData(const CArray<double,1>& data) 269 TRY 253 270 { 254 271 CContext* context = CContext::getCurrent(); … … 277 294 } 278 295 } 296 CATCH_DUMP_ATTR 279 297 280 298 void CField::writeField(void) 299 TRY 281 300 { 282 301 if (!getRelFile()->isEmptyZone()) … … 290 309 } 291 310 } 311 CATCH_DUMP_ATTR 292 312 293 313 /* … … 299 319 */ 300 320 bool CField::sendReadDataRequest(const CDate& tsDataRequested) 321 TRY 301 322 { 302 323 CContext* context = CContext::getCurrent(); … … 330 351 return !isEOF; 331 352 } 353 CATCH_DUMP_ATTR 332 354 333 355 /*! … … 336 358 */ 337 359 bool CField::sendReadDataRequestIfNeeded(void) 360 TRY 338 361 { 339 362 const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); … … 353 376 return dataRequested; 354 377 } 378 CATCH_DUMP_ATTR 355 379 356 380 void CField::recvReadDataRequest(CEventServer& event) 381 TRY 357 382 { 358 383 CBufferIn* buffer = event.subEvents.begin()->buffer; … … 361 386 get(fieldId)->recvReadDataRequest(); 362 387 } 388 CATCH 363 389 364 390 /*! … … 369 395 */ 370 396 void CField::recvReadDataRequest(void) 397 TRY 371 398 { 372 399 CContext* context = CContext::getCurrent(); … … 449 476 } 450 477 } 478 CATCH_DUMP_ATTR 451 479 452 480 /*! … … 456 484 */ 457 485 CField::EReadField CField::readField(void) 486 TRY 458 487 { 459 488 CContext* context = CContext::getCurrent(); … … 508 537 return readState; 509 538 } 539 CATCH_DUMP_ATTR 510 540 511 541 /* … … 516 546 */ 517 547 void CField::recvReadDataReady(CEventServer& event) 548 TRY 518 549 { 519 550 string fieldId; … … 531 562 get(fieldId)->recvReadDataReady(ranks, buffers); 532 563 } 564 CATCH 533 565 534 566 /*! … … 538 570 */ 539 571 void CField::recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers) 572 TRY 540 573 { 541 574 CContext* context = CContext::getCurrent(); … … 574 607 serverSourceFilter->streamDataFromServer(lastDataReceivedFromServer, data); 575 608 } 609 CATCH_DUMP_ATTR 576 610 577 611 void CField::checkForLateDataFromServer(void) 612 TRY 578 613 { 579 614 CContext* context = CContext::getCurrent(); … … 607 642 } 608 643 } 644 CATCH_DUMP_ATTR 609 645 610 646 void CField::checkIfMustAutoTrigger(void) 647 TRY 611 648 { 612 649 mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; 613 650 } 651 CATCH_DUMP_ATTR 614 652 615 653 void CField::autoTriggerIfNeeded(void) 654 TRY 616 655 { 617 656 if (mustAutoTrigger) 618 657 serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 619 658 } 659 CATCH_DUMP_ATTR 620 660 621 661 //---------------------------------------------------------------- 622 662 623 663 void CField::setRelFile(CFile* _file) 664 TRY 624 665 { 625 666 this->file = _file; 626 667 hasOutputFile = true; 627 668 } 669 CATCH_DUMP_ATTR 628 670 629 671 //---------------------------------------------------------------- … … 636 678 637 679 CGrid* CField::getRelGrid(void) const 680 TRY 638 681 { 639 682 return this->grid; 640 683 } 684 CATCH 641 685 642 686 //---------------------------------------------------------------- 643 687 644 688 CFile* CField::getRelFile(void) const 689 TRY 645 690 { 646 691 return this->file; 647 692 } 693 CATCH 648 694 649 695 int CField::getNStep(void) const 696 TRY 650 697 { 651 698 return this->nstep; 652 699 } 700 CATCH 653 701 654 702 func::CFunctor::ETimeType CField::getOperationTimeType() const 703 TRY 655 704 { 656 705 return operationTimeType; 657 706 } 707 CATCH 658 708 659 709 //---------------------------------------------------------------- 660 710 661 711 void CField::incrementNStep(void) 712 TRY 662 713 { 663 714 this->nstep++; 664 715 } 716 CATCH_DUMP_ATTR 665 717 666 718 void CField::resetNStep(int nstep /*= 0*/) 719 TRY 667 720 { 668 721 this->nstep = nstep; 669 722 } 723 CATCH_DUMP_ATTR 670 724 671 725 void CField::resetNStepMax(void) 726 TRY 672 727 { 673 728 this->nstepMax = 0; 674 729 nstepMaxRead = false; 675 730 } 731 CATCH_DUMP_ATTR 676 732 677 733 //---------------------------------------------------------------- 678 734 679 735 bool CField::isActive(bool atCurrentTimestep /*= false*/) const 736 TRY 680 737 { 681 738 if (clientSourceFilter) … … 689 746 return false; 690 747 } 748 CATCH 691 749 692 750 //---------------------------------------------------------------- 693 751 694 752 bool CField::wasWritten() const 753 TRY 695 754 { 696 755 return written; 697 756 } 757 CATCH 698 758 699 759 void CField::setWritten() 760 TRY 700 761 { 701 762 written = true; 702 763 } 764 CATCH_DUMP_ATTR 703 765 704 766 //---------------------------------------------------------------- 705 767 706 768 bool CField::getUseCompressedOutput() const 769 TRY 707 770 { 708 771 return useCompressedOutput; 709 772 } 773 CATCH 710 774 711 775 void CField::setUseCompressedOutput() 776 TRY 712 777 { 713 778 useCompressedOutput = true; 714 779 } 780 CATCH_DUMP_ATTR 715 781 716 782 //---------------------------------------------------------------- 717 783 718 784 std::shared_ptr<COutputPin> CField::getInstantDataFilter() 785 TRY 719 786 { 720 787 return instantDataFilter; 721 788 } 789 CATCH_DUMP_ATTR 722 790 723 791 //---------------------------------------------------------------- … … 728 796 */ 729 797 void CField::buildGridTransformationGraph() 798 TRY 730 799 { 731 800 CContext* context = CContext::getCurrent(); … … 738 807 } 739 808 } 809 CATCH_DUMP_ATTR 740 810 741 811 /*! … … 743 813 */ 744 814 void CField::generateNewTransformationGridDest() 815 TRY 745 816 { 746 817 CContext* context = CContext::getCurrent(); … … 797 868 } 798 869 } 870 CATCH_DUMP_ATTR 799 871 800 872 void CField::updateRef(CGrid* grid) 873 TRY 801 874 { 802 875 if (!grid_ref.isEmpty()) grid_ref.setValue(grid->getId()); … … 820 893 } 821 894 } 895 CATCH_DUMP_ATTR 822 896 823 897 /*! … … 826 900 */ 827 901 void CField::solveAllEnabledFieldsAndTransform() 902 TRY 828 903 { 829 904 CContext* context = CContext::getCurrent(); … … 862 937 } 863 938 } 939 CATCH_DUMP_ATTR 864 940 865 941 void CField::checkGridOfEnabledFields() 942 TRY 866 943 { 867 944 if (!isGridChecked) … … 871 948 } 872 949 } 950 CATCH_DUMP_ATTR 873 951 874 952 void CField::sendGridComponentOfEnabledFields() 953 TRY 875 954 { 876 955 solveGridDomainAxisRef(true); 877 956 // solveCheckMaskIndex(true); 878 957 } 958 CATCH_DUMP_ATTR 879 959 880 960 void CField::sendGridOfEnabledFields() 961 TRY 881 962 { 882 963 // solveGridDomainAxisRef(true); 883 964 solveCheckMaskIndex(true); 884 965 } 966 CATCH_DUMP_ATTR 885 967 886 968 void CField::solveOnlyReferenceEnabledField(bool doSending2Server) 969 TRY 887 970 { 888 971 CContext* context = CContext::getCurrent(); … … 910 993 } 911 994 } 912 995 CATCH_DUMP_ATTR 996 913 997 void CField::solveAllReferenceEnabledField(bool doSending2Server) 998 TRY 914 999 { 915 1000 CContext* context = CContext::getCurrent(); … … 940 1025 solveCheckMaskIndex(doSending2Server); 941 1026 } 1027 CATCH_DUMP_ATTR 942 1028 943 1029 std::map<int, StdSize> CField::getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) 1030 TRY 944 1031 { 945 1032 return grid->getAttributesBufferSize(client, bufferForWriting); 946 1033 } 1034 CATCH_DUMP_ATTR 947 1035 948 1036 std::map<int, StdSize> CField::getGridDataBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) 1037 TRY 949 1038 { 950 1039 return grid->getDataBufferSize(client, getId(), bufferForWriting); 951 1040 } 1041 CATCH_DUMP_ATTR 952 1042 953 1043 size_t CField::getGlobalWrittenSize() 1044 TRY 954 1045 { 955 1046 return grid->getGlobalWrittenSize(); 956 1047 } 1048 CATCH_DUMP_ATTR 957 1049 958 1050 //---------------------------------------------------------------- 959 1051 960 1052 void CField::solveServerOperation(void) 1053 TRY 961 1054 { 962 1055 CContext* context = CContext::getCurrent(); … … 1001 1094 operationTimeType = functor->timeType(); 1002 1095 } 1096 CATCH_DUMP_ATTR 1003 1097 1004 1098 //---------------------------------------------------------------- … … 1013 1107 */ 1014 1108 void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 1109 TRY 1015 1110 { 1016 1111 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); … … 1118 1213 } 1119 1214 } 1215 CATCH_DUMP_ATTR 1120 1216 1121 1217 /*! … … 1127 1223 */ 1128 1224 std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 1225 TRY 1129 1226 { 1130 1227 if (instantDataFilter || field_ref.isEmpty()) … … 1150 1247 return filters.second; 1151 1248 } 1249 CATCH_DUMP_ATTR 1152 1250 1153 1251 /*! … … 1161 1259 */ 1162 1260 std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 1261 TRY 1163 1262 { 1164 1263 if (instantDataFilter || !hasExpression()) … … 1203 1302 return selfReferenceFilter; 1204 1303 } 1304 CATCH_DUMP_ATTR 1205 1305 1206 1306 /*! … … 1214 1314 */ 1215 1315 std::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 1316 TRY 1216 1317 { 1217 1318 std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); … … 1237 1338 return it->second; 1238 1339 } 1340 CATCH_DUMP_ATTR 1239 1341 1240 1342 /*! … … 1248 1350 1249 1351 std::shared_ptr<COutputPin> CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 1352 TRY 1250 1353 { 1251 1354 if (instantDataFilter || !hasExpression()) … … 1278 1381 } 1279 1382 } 1383 CATCH_DUMP_ATTR 1280 1384 1281 1385 //---------------------------------------------------------------- … … 1296 1400 1297 1401 void CField::solveGridReference(void) 1402 TRY 1298 1403 { 1299 1404 if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty() && scalar_ref.isEmpty()) … … 1379 1484 } 1380 1485 } 1486 CATCH_DUMP_ATTR 1381 1487 1382 1488 void CField::solveGridDomainAxisRef(bool checkAtt) 1489 TRY 1383 1490 { 1384 1491 grid->solveDomainAxisRef(checkAtt); 1385 1492 } 1493 CATCH_DUMP_ATTR 1386 1494 1387 1495 void CField::solveCheckMaskIndex(bool doSendingIndex) 1496 TRY 1388 1497 { 1389 1498 grid->checkMaskIndex(doSendingIndex); 1390 1499 } 1500 CATCH_DUMP_ATTR 1391 1501 1392 1502 void CField::solveTransformedGrid() 1503 TRY 1393 1504 { 1394 1505 if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) … … 1439 1550 } 1440 1551 } 1552 CATCH_DUMP_ATTR 1441 1553 1442 1554 void CField::solveGenerateGrid() 1555 TRY 1443 1556 { 1444 1557 if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) … … 1447 1560 grid->completeGrid(); 1448 1561 } 1562 CATCH_DUMP_ATTR 1449 1563 1450 1564 void CField::solveGridDomainAxisBaseRef() 1565 TRY 1451 1566 { 1452 1567 grid->solveDomainAxisRef(false); 1453 1568 grid->solveDomainAxisBaseRef(); 1454 1569 } 1570 CATCH_DUMP_ATTR 1455 1571 1456 1572 ///------------------------------------------------------------------- … … 1458 1574 template <> 1459 1575 void CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void) 1576 TRY 1460 1577 { 1461 1578 if (this->group_ref.isEmpty()) return; … … 1481 1598 } 1482 1599 } 1600 CATCH_DUMP_ATTR 1483 1601 1484 1602 void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) 1603 TRY 1485 1604 { 1486 1605 recvDataSrv = (recvDataSrv - addOffset) / scaleFactor; 1487 1606 } 1607 CATCH_DUMP_ATTR 1488 1608 1489 1609 void CField::invertScaleFactorAddOffset(double scaleFactor, double addOffset) 1610 TRY 1490 1611 { 1491 1612 recvDataSrv = recvDataSrv * scaleFactor + addOffset; 1492 1613 } 1614 CATCH_DUMP_ATTR 1493 1615 1494 1616 void CField::outputField(CArray<double,1>& fieldOut) 1617 TRY 1495 1618 { 1496 1619 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; … … 1501 1624 } 1502 1625 } 1626 CATCH_DUMP_ATTR 1503 1627 1504 1628 void CField::inputField(CArray<double,1>& fieldIn) 1629 TRY 1505 1630 { 1506 1631 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; … … 1510 1635 recvDataSrv(outIndexClient(idx)) = fieldIn(outIndexServer(idx)); 1511 1636 } 1512 1513 }1637 } 1638 CATCH_DUMP_ATTR 1514 1639 1515 1640 void CField::outputCompressedField(CArray<double,1>& fieldOut) 1641 TRY 1516 1642 { 1517 1643 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; … … 1522 1648 } 1523 1649 } 1650 CATCH_DUMP_ATTR 1524 1651 1525 1652 ///------------------------------------------------------------------- 1526 1653 1527 1654 void CField::parse(xml::CXMLNode& node) 1655 TRY 1528 1656 { 1529 1657 string newContent ; … … 1540 1668 if (node.getContent(newContent)) content=newContent ; 1541 1669 } 1670 CATCH_DUMP_ATTR 1542 1671 1543 1672 /*! … … 1547 1676 */ 1548 1677 const std::vector<StdString>& CField::getRefDomainAxisIds() 1678 TRY 1549 1679 { 1550 1680 CGrid* cgPtr = getRelGrid(); … … 1575 1705 return (domAxisScalarIds_); 1576 1706 } 1707 CATCH_DUMP_ATTR 1577 1708 1578 1709 CVariable* CField::addVariable(const string& id) 1710 TRY 1579 1711 { 1580 1712 return vVariableGroup->createChild(id); 1581 1713 } 1714 CATCH 1582 1715 1583 1716 CVariableGroup* CField::addVariableGroup(const string& id) 1717 TRY 1584 1718 { 1585 1719 return vVariableGroup->createChildGroup(id); 1586 1720 } 1721 CATCH 1587 1722 1588 1723 void CField::setContextClient(CContextClient* contextClient) 1724 TRY 1589 1725 { 1590 1726 CContext* context = CContext::getCurrent(); … … 1602 1738 } 1603 1739 } 1740 CATCH_DUMP_ATTR 1604 1741 1605 1742 CContextClient* CField::getContextClient() 1743 TRY 1606 1744 { 1607 1745 return client; 1608 1746 } 1747 CATCH 1609 1748 1610 1749 void CField::sendAddAllVariables(CContextClient* client) 1750 TRY 1611 1751 { 1612 1752 std::vector<CVariable*> allVar = getAllVariables(); … … 1621 1761 } 1622 1762 } 1623 1763 CATCH_DUMP_ATTR 1624 1764 1625 1765 /*! … … 1629 1769 1630 1770 void CField::sendAllAttributesToServer(CContextClient* client) 1771 TRY 1631 1772 { 1632 1773 if (grid_ref.isEmpty()) … … 1638 1779 else SuperClass::sendAllAttributesToServer(client) ; 1639 1780 } 1781 CATCH_DUMP_ATTR 1640 1782 1641 1783 void CField::sendAddVariable(const string& id, CContextClient* client) 1784 TRY 1642 1785 { 1643 1786 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 1644 1787 } 1788 CATCH_DUMP_ATTR 1645 1789 1646 1790 void CField::sendAddVariableGroup(const string& id, CContextClient* client) 1791 TRY 1647 1792 { 1648 1793 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 1649 1794 } 1795 CATCH_DUMP_ATTR 1650 1796 1651 1797 void CField::recvAddVariable(CEventServer& event) 1798 TRY 1652 1799 { 1653 1800 … … 1657 1804 get(id)->recvAddVariable(*buffer); 1658 1805 } 1806 CATCH 1659 1807 1660 1808 void CField::recvAddVariable(CBufferIn& buffer) 1809 TRY 1661 1810 { 1662 1811 string id; … … 1664 1813 addVariable(id); 1665 1814 } 1815 CATCH_DUMP_ATTR 1666 1816 1667 1817 void CField::recvAddVariableGroup(CEventServer& event) 1818 TRY 1668 1819 { 1669 1820 … … 1673 1824 get(id)->recvAddVariableGroup(*buffer); 1674 1825 } 1826 CATCH 1675 1827 1676 1828 void CField::recvAddVariableGroup(CBufferIn& buffer) 1829 TRY 1677 1830 { 1678 1831 string id; … … 1680 1833 addVariableGroup(id); 1681 1834 } 1835 CATCH_DUMP_ATTR 1682 1836 1683 1837 /*! … … 1685 1839 */ 1686 1840 void CField::checkTimeAttributes(CDuration* freqOp) 1841 TRY 1687 1842 { 1688 1843 bool isFieldRead = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read; … … 1706 1861 freq_offset.setValue(isFieldRead ? NoneDu : (freq_op.getValue() - TimeStep)); 1707 1862 } 1863 CATCH_DUMP_ATTR 1708 1864 1709 1865 /*! … … 1712 1868 */ 1713 1869 const string& CField::getExpression(void) 1870 TRY 1714 1871 { 1715 1872 if (!expr.isEmpty() && content.empty()) … … 1721 1878 return content; 1722 1879 } 1880 CATCH_DUMP_ATTR 1723 1881 1724 1882 bool CField::hasExpression(void) const 1883 TRY 1725 1884 { 1726 1885 return (!expr.isEmpty() || !content.empty()); 1727 1886 } 1887 CATCH 1728 1888 1729 1889 bool CField::hasGridMask(void) const 1890 TRY 1730 1891 { 1731 1892 return (this->grid->hasMask()); 1732 1893 } 1894 CATCH 1733 1895 1734 1896 DEFINE_REF_FUNC(Field,field)
Note: See TracChangeset
for help on using the changeset viewer.