Changeset 1143 for XIOS/dev/dev_olga/src/node/domain.cpp
- Timestamp:
- 05/22/17 18:11:12 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/domain.cpp
r1132 r1143 31 31 : CObjectTemplate<CDomain>(), CDomainAttributes() 32 32 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_() 33 , hasBounds(false), hasArea(false), is Distributed_(false), isCompressible_(false), isUnstructed_(false)33 , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 34 34 , isClientAfterTransformationChecked(false), hasLonLat(false) 35 35 , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) … … 42 42 : CObjectTemplate<CDomain>(id), CDomainAttributes() 43 43 , isChecked(false), relFiles(), isClientChecked(false), nbConnectedClients_(), indSrv_(), connectedServerRank_(), connectedServerZoomRank_() 44 , hasBounds(false), hasArea(false), is Distributed_(false), isCompressible_(false), isUnstructed_(false)44 , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 45 45 , isClientAfterTransformationChecked(false), hasLonLat(false) 46 46 , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) … … 235 235 bool CDomain::isDistributed(void) const 236 236 { 237 return isDistributed_; 237 return !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 238 (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 238 239 } 239 240 … … 741 742 } 742 743 checkZoom(); 743 744 isDistributed_ = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) ||745 (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo));746 744 } 747 745 … … 1835 1833 computedWrittenIndex_ = true; 1836 1834 1837 CContext* context=CContext::getCurrent() ;1838 CContext Client* client = context->client;1835 CContext* context=CContext::getCurrent(); 1836 CContextServer* server = context->server; 1839 1837 1840 1838 std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); … … 1843 1841 nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 1844 1842 nGlob[0] = ni_glo; nGlob[1] = nj_glo; 1845 CDistributionServer srvDist( client->clientSize, nBegin, nSize, nBeginGlobal, nGlob);1843 CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 1846 1844 const CArray<size_t,1>& writtenGlobalIndex = srvDist.getGlobalIndex(); 1847 1845 … … 1851 1849 CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 1852 1850 itSrve = writtenGlobalIndex.end(), itSrv; 1853 localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 1851 1852 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 1853 { 1854 indGlo = *itSrv; 1855 if (ite != globalLocalIndexMap_.find(indGlo)) 1856 { 1857 ++nbWritten; 1858 } 1859 } 1860 1861 localIndexToWriteOnServer.resize(nbWritten); 1862 1863 nbWritten = 0; 1854 1864 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 1855 1865 { … … 1861 1871 } 1862 1872 } 1873 1874 if (isCompressible()) 1875 { 1876 nbWritten = 0; 1877 boost::unordered_map<size_t,size_t> localGlobalIndexMap; 1878 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 1879 { 1880 indGlo = *itSrv; 1881 if (ite != globalLocalIndexMap_.find(indGlo)) 1882 { 1883 localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 1884 ++nbWritten; 1885 } 1886 } 1887 1888 nbWritten = 0; 1889 for (int idx = 0; idx < data_i_index.numElements(); ++idx) 1890 { 1891 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 1892 { 1893 ++nbWritten; 1894 } 1895 } 1896 1897 compressedIndexToWriteOnServer.resize(nbWritten); 1898 nbWritten = 0; 1899 for (int idx = 0; idx < data_i_index.numElements(); ++idx) 1900 { 1901 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx))) 1902 { 1903 compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)]; 1904 ++nbWritten; 1905 } 1906 } 1907 1908 numberWrittenIndexes_ = nbWritten; 1909 if (isDistributed()) 1910 { 1911 MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1912 MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 1913 offsetWrittenIndexes_ -= numberWrittenIndexes_; 1914 } 1915 else 1916 totalNumberWrittenIndexes_ = numberWrittenIndexes_; 1917 } 1863 1918 } 1864 1919 … … 2988 3043 CArray<int,1> dataIIndex(nbIndex), dataJIndex(nbIndex); 2989 3044 dataIIndex = -1; dataJIndex = -1; 2990 3045 2991 3046 nbIndex = 0; 2992 3047 for (i = 0; i < nbReceived; ++i)
Note: See TracChangeset
for help on using the changeset viewer.