28 , isChecked(false), isDomainAxisChecked(false)
29 , vDomainGroup_(), domList_(), isDomListSet(false)
30 , vAxisGroup_(), axisList_(), isAxisListSet(false)
31 , vScalarGroup_(), scalarList_(), isScalarListSet(false)
32 , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0)
33 , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0)
34 , connectedDataSize_(), connectedServerRank_(), connectedServerRankRead_(), connectedDataSizeRead_()
35 , isDataDistributed_(true), isCompressible_(false)
36 , transformations_(0), isTransformed_(false)
37 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false)
38 , gridSrc_(), hasTransform_(false), isGenerated_(false),
order_(), globalIndexOnServer_()
39 , computedWrittenIndex_(false)
49 , isChecked(false), isDomainAxisChecked(false)
50 , vDomainGroup_(), domList_(), isDomListSet(false)
51 , vAxisGroup_(), axisList_(), isAxisListSet(false)
52 , vScalarGroup_(), scalarList_(), isScalarListSet(false)
53 , clientDistribution_(0), isIndexSent(false) , serverDistribution_(0), clientServerMap_(0)
54 , writtenDataSize_(0), numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0)
55 , connectedDataSize_(), connectedServerRank_(), connectedServerRankRead_(), connectedDataSizeRead_()
56 , isDataDistributed_(true), isCompressible_(false)
57 , transformations_(0), isTransformed_(false)
58 , axisPositionInGrid_(), hasDomainAxisBaseRef_(false)
59 , gridSrc_(), hasTransform_(false), isGenerated_(false),
order_(), globalIndexOnServer_()
60 , computedWrittenIndex_(false)
99 for (
int i = 0; i < dataNindex.size(); ++i) retvalue *= dataNindex[i];
114 std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(client);
117 std::map<int, StdSize> dataSizes = getDataBufferSize(client,
"", bufferForWriting);
118 std::map<int, StdSize>::iterator it, itE = dataSizes.end();
119 for (it = dataSizes.begin(); it != itE; ++it)
121 it->second += 2 *
sizeof(bool);
122 if (it->second > attributesSizes[it->first])
123 attributesSizes[it->first] = it->second;
127 std::vector<CAxis*> axisList = getAxis();
128 for (
size_t i = 0; i < axisList.size(); ++i)
130 std::map<int, StdSize> axisAttBuffSize = axisList[i]->getAttributesBufferSize(client, getGlobalDimension(),axisPositionInGrid_[i]);
131 for (it = axisAttBuffSize.begin(), itE = axisAttBuffSize.end(); it != itE; ++it)
133 it->second += 2 *
sizeof(bool);
134 if (it->second > attributesSizes[it->first])
135 attributesSizes[it->first] = it->second;
140 std::vector<CDomain*> domList = getDomains();
141 for (
size_t i = 0; i < domList.size(); ++i)
143 std::map<int, StdSize> domAttBuffSize = domList[i]->getAttributesBufferSize(client);
144 for (it = domAttBuffSize.begin(), itE = domAttBuffSize.end(); it != itE; ++it)
146 it->second += 2 *
sizeof(bool);
147 if (it->second > attributesSizes[it->first])
148 attributesSizes[it->first] = it->second;
152 return attributesSizes;
172 std::map<int, StdSize> dataSizes;
173 int receiverSize = client->serverSize;
174 std::map<int,size_t>& dataSizeMap = bufferForWriting ? connectedDataSize_[receiverSize]: connectedDataSizeRead_;
175 std::vector<int>& connectedServerRanks = bufferForWriting ? connectedServerRank_[receiverSize] : connectedServerRankRead_;
177 std::map<int, size_t>::const_iterator itEnd = dataSizeMap.end();
178 for (
size_t k = 0; k < connectedServerRanks.size(); ++k)
180 int rank = connectedServerRanks[k];
181 std::map<int, size_t>::const_iterator it = dataSizeMap.find(rank);
182 size_t count = (it != itEnd) ? it->second : 0;
194 std::vector<CDomain*> domainP = this->
getDomains();
195 std::vector<CAxis*> axisP = this->
getAxis();
197 size_t globalGridSize=1 ;
198 for (std::vector<CDomain*>::iterator it=domainP.begin(); it!=domainP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ;
199 for (std::vector<CAxis*>::iterator it=axisP.begin(); it!=axisP.end();++it) globalGridSize*=(*it)->getGlobalWrittenSize() ;
200 return globalGridSize ;
208 std::vector<CAxis*> axisListP = this->
getAxis();
209 if (!axisListP.empty())
213 for (
int i = 0; i < axis_domain_order.numElements(); ++i)
215 int elementDimension = axis_domain_order(i);
216 if (1 == elementDimension)
221 else if (2 == elementDimension) idx += 2;
224 for (
int i = 0; i < axisListP.size(); ++i)
231 std::vector<CDomain*> domListP = this->
getDomains();
232 if (!domListP.empty())
234 for (
int i = 0; i < domListP.size(); ++i)
236 domListP[i]->checkAttributesOnClientAfterTransformation();
261 this->relFilesCompressed.insert(filename);
268 return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end());
279 if (this->isDomainAxisChecked)
return;
281 this->solveScalarRef(areAttributesChecked);
282 this->solveAxisRef(areAttributesChecked);
283 this->solveDomainRef(areAttributesChecked);
284 this->isDomainAxisChecked = areAttributesChecked;
297 std::vector<CScalar*> scalarList =
getScalars();
298 for (
size_t i = 0; i < scalarList.size(); ++i)
300 scalarList[i]->setAttributesReference();
304 std::vector<CAxis*> axisList =
getAxis();
305 for (
size_t i = 0; i < axisList.size(); ++i)
307 axisList[i]->setAttributesReference();
312 for (
size_t i = 0; i < domList.size(); ++i)
314 domList[i]->setAttributesReference();
325 isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty();
335 for (
int p = 0; p < nbSrvPools; ++p)
337 if (context->
hasClient && this->isChecked && doSendingIndex && !isIndexSent)
340 sendIndexScalarGrid();
343 this->isIndexSent =
true;
352 if (this->isChecked)
return;
353 this->checkAttributesAfterTransformation();
357 this->computeIndex();
359 if (!(this->hasTransform() && !this->isTransformed()))
360 this->isChecked =
true;
362 if (!(this->hasTransform() && (!this->isGenerated())))
363 this->isChecked =
true;
369 return (!mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty() ||
370 !mask_4d.isEmpty() || !mask_5d.isEmpty() || !mask_6d.isEmpty() || !mask_7d.isEmpty());
381 std::vector<CDomain*> domainP = this->
getDomains();
382 std::vector<CAxis*> axisP = this->
getAxis();
383 int dim = domainP.size() * 2 + axisP.size();
385 std::vector<CArray<bool,1>* > domainMasks(domainP.size());
386 for (
int i = 0; i < domainMasks.size(); ++i) domainMasks[i] = &(domainP[i]->domainMask);
387 std::vector<CArray<bool,1>* > axisMasks(axisP.size());
388 for (
int i = 0; i < axisMasks.size(); ++i) axisMasks[i] = &(axisP[i]->mask);
392 checkGridMask(mask_1d, domainMasks, axisMasks, axis_domain_order,
true);
395 checkGridMask(mask_2d, domainMasks, axisMasks, axis_domain_order,
true);
398 checkGridMask(mask_3d, domainMasks, axisMasks, axis_domain_order,
true);
401 checkGridMask(mask_4d, domainMasks, axisMasks, axis_domain_order,
true);
404 checkGridMask(mask_5d, domainMasks, axisMasks, axis_domain_order,
true);
407 checkGridMask(mask_6d, domainMasks, axisMasks, axis_domain_order,
true);
410 checkGridMask(mask_7d, domainMasks, axisMasks, axis_domain_order,
true);
425 std::vector<CDomain*> domainP = this->
getDomains();
426 std::vector<CAxis*> axisP = this->
getAxis();
427 int dim = domainP.size() * 2 + axisP.size();
429 std::vector<CArray<bool,1>* > domainMasks(domainP.size());
430 for (
int i = 0; i < domainMasks.size(); ++i) domainMasks[i] = &(domainP[i]->domainMask);
431 std::vector<CArray<bool,1>* > axisMasks(axisP.size());
432 for (
int i = 0; i < axisMasks.size(); ++i) axisMasks[i] = &(axisP[i]->mask);
436 checkGridMask(mask_1d, domainMasks, axisMasks, axis_domain_order);
439 checkGridMask(mask_2d, domainMasks, axisMasks, axis_domain_order);
442 checkGridMask(mask_3d, domainMasks, axisMasks, axis_domain_order);
445 checkGridMask(mask_4d, domainMasks, axisMasks, axis_domain_order);
448 checkGridMask(mask_5d, domainMasks, axisMasks, axis_domain_order);
451 checkGridMask(mask_6d, domainMasks, axisMasks, axis_domain_order);
454 checkGridMask(mask_7d, domainMasks, axisMasks, axis_domain_order);
472 std::vector<CDomain*> domainP = this->
getDomains();
473 std::vector<CAxis*> axisP = this->
getAxis();
474 int dim = domainP.size() * 2 + axisP.size();
515 std::vector<CDomain*> domainP = this->
getDomains();
516 std::vector<CAxis*> axisP = this->
getAxis();
517 int dim = domainP.size() * 2 + axisP.size();
556 std::vector<CDomain*> domListP = this->
getDomains();
557 if (!domListP.empty())
559 for (
int i = 0; i < domListP.size(); ++i)
561 if (sendAtt) domListP[i]->sendCheckedAttributes();
562 else domListP[i]->checkAttributesOnClient();
574 std::vector<CAxis*> axisListP = this->
getAxis();
575 if (!axisListP.empty())
579 for (
int i = 0; i < axis_domain_order.numElements(); ++i)
581 int elementDimension = axis_domain_order(i);
582 if (1 == elementDimension)
587 else if (2 == elementDimension) idx += 2;
590 for (
int i = 0; i < axisListP.size(); ++i)
595 axisListP[i]->checkAttributesOnClient();
607 std::vector<CScalar*> scalarListP = this->
getScalars();
608 if (!scalarListP.empty())
610 for (
int i = 0; i < scalarListP.size(); ++i)
631 size_t nbWritten = 1;
632 int writtenIndex = 0;
642 size_t nbWritten = 0, indGlo;
644 CDistributionClient::GlobalLocalDataMap::const_iterator itb = globalDataIndex.begin(),
645 ite = globalDataIndex.end(), it;
647 CDistributionServer::GlobalLocalMap::const_iterator itSrvb = globalLocalIndex.begin(),
648 itSrve = globalLocalIndex.end(), itSrv;
649 for (it = itb; it != ite; ++it)
652 if (globalLocalIndex.end() != globalLocalIndex.find(indGlo)) ++nbWritten;
672 for (it = itb; it != ite; ++it)
675 itSrv = globalLocalIndex.find(indGlo);
717 CDistributionClient::GlobalLocalDataMap::const_iterator itGloe = globalDataIndex.end();
721 for (it = itb; it != ite; ++it)
723 int rank = it->first;
730 for (
size_t idx = 0; idx < globalIndex.numElements(); ++idx)
732 if (itGloe != globalDataIndex.find(globalIndex(idx)))
739 ERROR(
"void CGrid::computeClientIndex()",
740 <<
"Number of local index on client is different from number of received global index"
741 <<
"Rank of sent client " << rank <<
"."
742 <<
"Number of local index " << nbIndex <<
". "
743 <<
"Number of received global index " << localIndex.numElements() <<
".");
746 for (
size_t idx = 0; idx < globalIndex.numElements(); ++idx)
748 if (itGloe != globalDataIndex.find(globalIndex(idx)))
750 localIndex(idx) = globalDataIndex[globalIndex(idx)];
771 for (
int p = 0; p < nbSrvPools; ++p)
785 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
795 std::vector<std::unordered_map<size_t,std::vector<int> > > indexServerOnElement;
805 std::list<int> serverZeroIndexLeader;
806 std::list<int> serverZeroIndexNotLeader;
808 for (std::list<int>::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it)
809 *it = serverZeroIndex[*it];
815 CDistributionClient::GlobalLocalDataMap::const_iterator iteGlobalLocalIndexMap = globalLocalIndexSendToServer.end(), itGlobalLocalIndexMap;
816 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap;
820 for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap)
822 int serverRank = itGlobalMap->first;
823 int indexSize = itGlobalMap->second.size();
824 const std::vector<size_t>& indexVec = itGlobalMap->second;
825 for (
int idx = 0; idx < indexSize; ++idx)
827 itGlobalLocalIndexMap = globalLocalIndexSendToServer.find(indexVec[idx]);
828 if (iteGlobalLocalIndexMap != itGlobalLocalIndexMap)
839 for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) {
844 for (std::list<int>::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it)
858 MPI_Gather(&localCount, 1, MPI_INT, &counts[0], 1, MPI_INT, 0, client->
intraComm) ;
859 for (
int i = 0; i < client->
clientSize-1; ++i)
861 displs[i+1] = displs[i] + counts[i];
863 std::vector<int> allConnectedServers(displs[client->
clientSize-1]+counts[client->
clientSize-1]);
864 MPI_Gatherv(&(
connectedServerRank_[receiverSize])[0], localCount, MPI_INT, &allConnectedServers[0], &counts[0], &displs[0], MPI_INT, 0, client->
intraComm);
866 if ((allConnectedServers.size() != receiverSize) && (client->
clientRank == 0))
868 std::vector<bool> isSrvConnected (receiverSize,
false);
869 for (
int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] =
true;
870 for (
int i = 0; i < receiverSize; ++i)
933 int serverSize = client->serverSize;
936 std::vector<CAxis*> axisList =
getAxis();
939 int nbElement = axis_domain_order.numElements();
940 std::vector<CArray<size_t,1> > globalIndexElement(nbElement);
941 int domainIdx = 0, axisIdx = 0, scalarIdx = 0;
942 std::vector<size_t> elementNGlobal(nbElement);
943 elementNGlobal[0] = 1;
944 size_t globalSize = 1;
945 for (
int idx = 0; idx < nbElement; ++idx)
947 elementNGlobal[idx] = globalSize;
949 size_t elementGlobalSize = 1;
950 if (2 == axis_domain_order(idx))
952 elementSize = domList[domainIdx]->i_index.numElements();
953 globalIndexElement[idx].resize(elementSize);
954 for (
int jdx = 0; jdx < elementSize; ++jdx)
956 globalIndexElement[idx](jdx) = (domList[domainIdx]->
i_index)(jdx) + domList[domainIdx]->ni_glo * (domList[domainIdx]->j_index)(jdx);
958 elementGlobalSize = domList[domainIdx]->ni_glo.getValue() * domList[domainIdx]->nj_glo.getValue();
961 else if (1 == axis_domain_order(idx))
963 elementSize = axisList[axisIdx]->index.numElements();
964 globalIndexElement[idx].resize(elementSize);
965 for (
int jdx = 0; jdx < elementSize; ++jdx)
967 globalIndexElement[idx](jdx) = (axisList[axisIdx]->index)(jdx);
969 elementGlobalSize = axisList[axisIdx]->n_glo.getValue();
974 globalIndexElement[idx].resize(1);
975 globalIndexElement[idx](0) = 0;
976 elementGlobalSize = 1;
978 globalSize *= elementGlobalSize;
981 std::vector<std::vector<bool> > elementOnServer(nbElement, std::vector<bool>(serverSize,
false));
982 std::vector<std::unordered_map<int,std::vector<size_t> > > globalElementIndexOnServer(nbElement);
987 for (
int idx = 0; idx < nbElement; ++idx)
990 const std::unordered_map<size_t,std::vector<int> >& indexServerElement = indexServerOnElement[idx];
991 const CArray<size_t,1>& globalIndexElementOnClient = globalIndexElement[idx];
995 CClientClientDHTInt::Index2VectorInfoTypeMap::const_iterator itb = globalIndexElementOnServerMap.begin(),
996 ite = globalIndexElementOnServerMap.end(), it;
997 for (it = itb; it != ite; ++it)
999 const std::vector<int>& tmp = it->second;
1000 nbIndexOnServerTmp = 0;
1001 for (
int i = 0; i < tmp.size(); ++i)
1003 if (0 == nbIndexOnServerTmp(tmp[i])) ++nbIndexOnServerTmp(tmp[i]);
1005 nbIndexOnServer += nbIndexOnServerTmp;
1008 for (
int i = 0; i < serverSize; ++i)
1010 if (0 != nbIndexOnServer(i))
1012 globalElementIndexOnServer[idx][i].resize(nbIndexOnServer(i));
1013 elementOnServer[idx][i] =
true;
1017 nbIndexOnServer = 0;
1018 for (
size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j)
1020 it = globalIndexElementOnServerMap.find(globalIndexElementOnClient(j));
1023 const std::vector<int>& tmp = it->second;
1024 nbIndexOnServerTmp = 0;
1025 for (
int i = 0; i < tmp.size(); ++i)
1027 if (0 == nbIndexOnServerTmp(tmp[i]))
1029 globalElementIndexOnServer[idx][tmp[i]][nbIndexOnServer(tmp[i])] = it->first;
1030 ++nbIndexOnServerTmp(tmp[i]);
1033 nbIndexOnServer += nbIndexOnServerTmp;
1039 std::vector<bool> intersectedProc(serverSize,
true);
1040 for (
int idx = 0; idx < nbElement; ++idx)
1042 std::transform(elementOnServer[idx].begin(), elementOnServer[idx].end(),
1043 intersectedProc.begin(), intersectedProc.begin(),
1044 std::logical_and<bool>());
1047 std::vector<int> srcRank;
1048 for (
int idx = 0; idx < serverSize; ++idx)
1050 if (intersectedProc[idx]) srcRank.push_back(idx);
1054 for (
int i = 0; i < srcRank.size(); ++i)
1057 int rankSrc = srcRank[i];
1058 std::vector<std::vector<size_t>* > globalIndexOfElementTmp(nbElement);
1059 std::vector<size_t> currentIndex(nbElement,0);
1060 for (
int idx = 0; idx < nbElement; ++idx)
1062 ssize *= (globalElementIndexOnServer[idx][rankSrc]).size();
1063 globalIndexOfElementTmp[idx] = &(globalElementIndexOnServer[idx][rankSrc]);
1065 globalIndexOnServer[rankSrc].resize(ssize);
1067 std::vector<int> idxLoop(nbElement,0);
1068 int innnerLoopSize = (globalIndexOfElementTmp[0])->size();
1072 for (
int ind = 0;
ind < nbElement; ++
ind)
1074 if (idxLoop[
ind] == (globalIndexOfElementTmp[
ind])->size())
1080 currentIndex[
ind] = (*(globalIndexOfElementTmp[
ind]))[idxLoop[
ind]];
1083 for (
int ind = 0;
ind < innnerLoopSize; ++
ind)
1085 currentIndex[0] = (*globalIndexOfElementTmp[0])[
ind];
1086 size_t globalSrcIndex = 0;
1087 for (
int idxElement = 0; idxElement < nbElement; ++idxElement)
1089 globalSrcIndex += currentIndex[idxElement] * elementNGlobal[idxElement];
1091 globalIndexOnServer[rankSrc][idx] = globalSrcIndex;
1104 std::vector<CDomain*> vecDom(1, domain);
1105 std::vector<CAxis*> vecAxis;
1114 std::vector<CDomain*> vecDom(1, domain);
1115 std::vector<CAxis*> vecAxis(1, axis);
1125 std::vector<CScalar*> vecScalar;
1126 return createGrid(
generateId(domains, axis, vecScalar, axisDomainOrder), domains, axis, vecScalar, axisDomainOrder);
1131 const std::vector<CScalar*>& scalars,
const CArray<int,1>& axisDomainOrder)
1134 return createGrid(
generateId(domains, axis, scalars, axisDomainOrder), domains, axis, scalars, axisDomainOrder);
1139 const std::vector<CScalar*>& scalars,
const CArray<int,1>& axisDomainOrder)
1142 if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size()))
1143 ERROR(
"CGrid* CGrid::createGrid(...)",
1144 <<
"The size of axisDomainOrder (" << axisDomainOrder.numElements()
1145 <<
") is not coherent with the number of elements (" << domains.size() + axis.size() <<
").");
1147 CGrid* grid = CGridGroup::get(
"grid_definition")->createChild(
id);
1149 grid->setAxisList(axis);
1150 grid->setScalarList(scalars);
1153 if (0 == axisDomainOrder.numElements())
1155 int size = domains.size() + axis.size() + scalars.size();
1157 grid->axis_domain_order.resize(size);
1158 for (
int i = 0; i < size; ++i)
1160 if (i < domains.size()) {
1161 grid->axis_domain_order(i) = 2;
1164 else if ((scalars.size() < (size-nb)) < size) {
1165 grid->axis_domain_order(i) = 1;
1168 grid->axis_domain_order(i) = 0;
1174 grid->axis_domain_order.resize(axisDomainOrder.numElements());
1175 grid->axis_domain_order = axisDomainOrder;
1178 grid->solveDomainAxisRefInheritance(
true);
1187 std::vector<CDomain*> domainSrcTmp = gridSrc->getDomains(), domainSrc;
1188 std::vector<CAxis*> axisSrcTmp = gridSrc->getAxis(), axisSrc;
1189 std::vector<CScalar*> scalarSrcTmp = gridSrc->getScalars(), scalarSrc;
1191 for (
int idx = 0; idx < domainSrcTmp.size(); ++idx)
1196 domain->solveRefInheritance(
true);
1198 domainSrc.push_back(domain);
1201 for (
int idx = 0; idx < axisSrcTmp.size(); ++idx)
1206 axis->solveRefInheritance(
true);
1208 axisSrc.push_back(axis);
1211 for (
int idx = 0; idx < scalarSrcTmp.size(); ++idx)
1216 scalar->solveRefInheritance(
true);
1218 scalarSrc.push_back(scalar);
1228 const std::vector<CScalar*>& scalars,
const CArray<int,1>& axisDomainOrder)
1231 if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size()))
1232 ERROR(
"CGrid* CGrid::generateId(...)",
1233 <<
"The size of axisDomainOrder (" << axisDomainOrder.numElements()
1234 <<
") is not coherent with the number of elements (" << domains.size() + axis.size() <<
").");
1236 std::ostringstream
id;
1238 if (domains.empty() && axis.empty() && !scalars.empty())
1241 if (0 != (domains.size() + axis.size() + scalars.size()))
1245 if (0 == axisDomainOrder.numElements())
1247 for (
size_t i = 0; i < domains.size(); ++i)
id <<
"_" << domains[i]->
getId();
1248 for (
size_t i = 0; i < axis.size(); ++i)
id <<
"_" << axis[i]->
getId();
1249 for (
size_t i = 0; i < scalars.size(); ++i)
id <<
"_" << scalars[i]->
getId();
1253 size_t iDomain = 0, iAxis = 0, iScalar = 0;
1254 for (
size_t i = 0; i < axisDomainOrder.numElements(); ++i)
1256 if (2 == axisDomainOrder(i))
1257 id <<
"_" << domains[iDomain++]->
getId();
1258 else if (1 == axisDomainOrder(i))
1259 id <<
"_" << axis[iAxis++]->
getId();
1261 id <<
"_" << scalars[iScalar++]->getId();
1278 std::ostringstream
id;
1279 id << idSrc <<
"__" << idDest;
1364 const double nanValue = std::numeric_limits<double>::quiet_NaN();
1376 const int size = localMaskedDataIndex.size();
1377 for(
int i = 0; i < size; ++i) out(localMaskedDataIndex[i]) = data[i];
1399 for (it = itb; it != ite; ++it)
1401 int rank = it->first;
1405 if (1 != globalIndex.numElements())
1406 ERROR(
"void CGrid::computeClientIndexScalarGrid()",
1407 <<
"Something wrong happened. "
1408 <<
"Number of received global index on scalar grid should equal to 1"
1409 <<
"Number of received global index " << globalIndex.numElements() <<
".");
1411 localIndex(0) = globalIndex(0);
1427 for (
int p = 0; p < nbSrvPools; ++p)
1439 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
1451 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
1471 std::list<CContextClient*>::iterator it;
1479 list<CMessage> listMsg;
1480 list<CArray<size_t,1> > listOutIndex;
1485 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
1495 for (
int k = 0; k < nb; ++k)
1497 outGlobalIndexOnServer(k) = 0;
1498 outLocalIndexToServer(k) = 0;
1507 event.push(rank, 1, listMsg.back());
1514 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
1519 for (
int k = 0; k < nb; ++k)
1521 outLocalIndexToServer(k) = 0;
1538 std::list<CContextClient*>::iterator it;
1547 list<CMessage> listMsg;
1548 list<CArray<size_t,1> > listOutIndex;
1550 CDistributionClient::GlobalLocalDataMap::const_iterator itbIndex = globalLocalIndexSendToServer.begin(), itIndex,
1551 iteIndex = globalLocalIndexSendToServer.end();
1558 int indexSize = globalLocalIndexSendToServer.size();
1561 for (
int idx = 0; itIndex != iteIndex; ++itIndex, ++idx)
1563 outGlobalIndexOnServer(idx) = itIndex->first;
1564 outLocalIndexToServer(idx) = itIndex->second;
1568 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
1579 event.push(*itRank, 1, listMsg.back());
1585 int indexSize = globalLocalIndexSendToServer.size();
1587 for (
int idx = 0; itIndex != iteIndex; ++itIndex, ++idx)
1589 outLocalIndexToServer(idx) = itIndex->second;
1593 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)
1602 CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itGlobalMap;
1606 std::map<int,std::vector<int> >localIndexTmp;
1607 std::map<int,std::vector<size_t> > globalIndexTmp;
1608 for (; itGlobalMap != iteGlobalMap; ++itGlobalMap)
1610 int serverRank = itGlobalMap->first;
1611 int indexSize = itGlobalMap->second.size();
1612 const std::vector<size_t>& indexVec = itGlobalMap->second;
1613 for (
int idx = 0; idx < indexSize; ++idx)
1615 itIndex = globalLocalIndexSendToServer.find(indexVec[idx]);
1616 if (iteIndex != itIndex)
1618 globalIndexTmp[serverRank].push_back(itIndex->first);
1619 localIndexTmp[serverRank].push_back(itIndex->second);
1628 if (globalIndexTmp.end() != globalIndexTmp.find(rank))
1629 nb = globalIndexTmp[rank].size();
1637 for (
int k = 0; k < nb; ++k)
1639 outGlobalIndexOnServer(k) = globalIndexTmp[rank].at(k);
1640 outLocalIndexToServer(k) = localIndexTmp[rank].at(k);
1647 event.push(rank,
nbSenders[receiverSize][rank], listMsg.back());
1661 vector<CBufferIn*> buffers;
1663 list<CEventServer::SSubEvent>::iterator it;
1664 for (it = event.subEvents.begin(); it !=
event.subEvents.end(); ++it)
1666 ranks.push_back(it->rank);
1669 buffers.push_back(buffer);
1684 for (
int p = 0; p < nbSrvPools; ++p)
1689 int idx = 0,
numElement = axis_domain_order.numElements();
1695 if (2 == axis_domain_order(i))
1704 for (
int n = 0; n < ranks.size(); n++)
1706 int rank = ranks[n];
1710 size_t dataSize = 0;
1714 int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1;
1715 std::vector<CDomain*> domainList =
getDomains();
1716 std::vector<CAxis*> axisList =
getAxis();
1717 std::vector<int> nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize), nGlobElement(numElement);
1718 std::vector<CArray<int,1> > globalIndex(numElement);
1721 nGlobElement[i] = globalSize;
1722 if (2 == axis_domain_order(i))
1724 nBegin[indexMap[i]] = domainList[domainId]->ibegin;
1725 nSize[indexMap[i]] = domainList[domainId]->ni;
1726 nBeginGlobal[indexMap[i]] = 0;
1727 nGlob[indexMap[i]] = domainList[domainId]->ni_glo;
1729 nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin;
1730 nSize[indexMap[i] + 1] = domainList[domainId]->nj;
1731 nBeginGlobal[indexMap[i] + 1] = 0;
1732 nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo;
1736 globalIndex[i].resize(nSize[indexMap[i]]*nSize[indexMap[i]+1]);
1737 for (
int jdx = 0; jdx < nSize[indexMap[i]+1]; ++jdx)
1738 for (
int idx = 0; idx < nSize[indexMap[i]]; ++idx)
1740 globalIndex[i](
count) = (nBegin[indexMap[i]] + idx) + (nBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]];
1747 else if (1 == axis_domain_order(i))
1749 nBegin[indexMap[i]] = axisList[axisId]->begin;
1750 nSize[indexMap[i]] = axisList[axisId]->n;
1751 nBeginGlobal[indexMap[i]] = 0;
1752 nGlob[indexMap[i]] = axisList[axisId]->n_glo;
1753 globalIndex[i].resize(nSize[indexMap[i]]);
1754 for (
int idx = 0; idx < nSize[indexMap[i]]; ++idx)
1755 globalIndex[i](idx) = nBegin[indexMap[i]] + idx;
1761 nBegin[indexMap[i]] = 0;
1762 nSize[indexMap[i]] = 1;
1763 nBeginGlobal[indexMap[i]] = 0;
1764 nGlob[indexMap[i]] = 1;
1765 globalIndex[i].resize(1);
1766 globalIndex[i](0) = 0;
1772 for (
int i = 0; i < nSize.size(); ++i)
1773 dataSize *= nSize[i];
1775 globalIndex, axis_domain_order,
1776 nBegin, nSize, nBeginGlobal, nGlob);
1798 int axisId = 0, domainId = 0, scalarId = 0, globalSize = 1;
1799 std::vector<CDomain*> domainList =
getDomains();
1800 std::vector<CAxis*> axisList =
getAxis();
1801 int dimSize = 2 * domainList.size() + axisList.size();
1802 std::vector<int> nBegin(dimSize), nSize(dimSize), nGlob(dimSize), nBeginGlobal(dimSize);
1805 if (2 == axis_domain_order(i))
1807 nBegin[indexMap[i]] = domainList[domainId]->ibegin;
1808 nSize[indexMap[i]] = domainList[domainId]->ni;
1809 nBeginGlobal[indexMap[i]] = 0;
1810 nGlob[indexMap[i]] = domainList[domainId]->ni_glo;
1812 nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin;
1813 nSize[indexMap[i] + 1] = domainList[domainId]->nj;
1814 nBeginGlobal[indexMap[i] + 1] = 0;
1815 nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo;
1819 else if (1 == axis_domain_order(i))
1821 nBegin[indexMap[i]] = axisList[axisId]->begin;
1822 nSize[indexMap[i]] = axisList[axisId]->n;
1823 nBeginGlobal[indexMap[i]] = 0;
1824 nGlob[indexMap[i]] = axisList[axisId]->n_glo;
1834 nBegin.push_back(0);
1836 nBeginGlobal.push_back(0);
1858 const std::vector<CDomain*> domains,
1859 const std::vector<CAxis*> axis,
1860 const std::vector<CScalar*> scalars,
1865 globalDim.resize(domains.size()*2+axis.size());
1866 int positionDimensionDistributed = 1;
1867 int idx = 0, idxDomain = 0, idxAxis = 0, idxScalar = 0;
1868 for (
int i = 0; i < axisDomainOrder.numElements(); ++i)
1870 if (2 == axisDomainOrder(i))
1872 if (!(domains[idxDomain]->
type.isEmpty()) && (domains[idxDomain]->
type==CDomain::type_attr::unstructured))
1874 positionDimensionDistributed = idx;
1878 positionDimensionDistributed = idx +1;
1881 globalDim[idx] = domains[idxDomain]->ni_glo.getValue();
1882 globalDim[idx+1] = domains[idxDomain]->nj_glo.getValue();
1887 else if (1 == axisDomainOrder(i))
1889 globalDim[idx] = axis[idxAxis]->n_glo.getValue();
1901 return positionDimensionDistributed;
1909 std::vector<int> globalDim;
1920 std::vector<int> globalDim;
2008 else if (0 != client)
2010 return (
isDataDistributed_ || (1 != client->clientSize) || (1 != client->serverSize));
2053 ERROR(
"bool CDomain::dispatchEvent(CEventServer& event)",
2054 <<
"Unknown Event");
2067 axis_domain_order.resize(
order_.size());
2068 for (
int idx = 0; idx <
order_.size(); ++idx) axis_domain_order(idx)=
order_[idx];
2077 axis_domain_order.resize(
order_.size());
2078 for (
int idx = 0; idx <
order_.size(); ++idx) axis_domain_order(idx)=
order_[idx];
2087 axis_domain_order.resize(
order_.size());
2088 for (
int idx = 0; idx <
order_.size(); ++idx) axis_domain_order(idx)=
order_[idx];
2244 unsigned int vecSize, i;
2245 std::vector<StdString>::iterator it, itE;
2248 for (; it != itE; ++it)
2253 pDom->solveRefInheritance(apply);
2260 for (; it != itE; ++it)
2265 pAxis->solveRefInheritance(apply);
2272 for (; it != itE; ++it)
2277 pScalar->solveRefInheritance(apply);
2309 gridSrc_.insert(make_pair(gridSrc,make_pair(
false,
"")));
2327 if (0 != transformGridSrc)
2329 if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements())
2331 ERROR(
"CGrid::completeGrid(CGrid* transformGridSrc)",
2332 <<
"Two grids have different number of elements. " << std::endl
2333 <<
"Number of element of grid destination " << this->
getId() <<
" is " << axis_domain_order.numElements() << std::endl
2334 <<
"Number of element of grid source " << transformGridSrc->getId() <<
" is " << transformGridSrc->axis_domain_order.numElements());
2363 if (!transformGridSrc)
2364 ERROR(
"CGrid::transformGrid(CGrid* transformGridSrc)",
2365 <<
"Impossible to transform grid '" <<
getId() <<
"', the source grid is null.");
2369 if (axis_domain_order.numElements() != transformGridSrc->axis_domain_order.numElements())
2371 ERROR(
"CGrid::transformGrid(CGrid* transformGridSrc)",
2372 <<
"Two grids have different number of elements. " << std::endl
2373 <<
"Number of element of grid destination " << this->
getId() <<
" is " << axis_domain_order.numElements() << std::endl
2374 <<
"Number of element of grid source " << transformGridSrc->getId() <<
" is " << transformGridSrc->axis_domain_order.numElements());
2385 transformGridSrc->checkMaskIndex(
false);
2394 std::vector<CDomain*> domList =
getDomains();
2395 std::vector<CAxis*> axisList =
getAxis();
2396 std::vector<CScalar*> scalarList =
getScalars();
2398 for (
int idx = 0; idx < domList.size(); ++idx)
hasTransform_ |= domList[idx]->hasTransformation();
2399 for (
int idx = 0; idx < axisList.size(); ++idx)
hasTransform_ |= axisList[idx]->hasTransformation();
2400 for (
int idx = 0; idx < scalarList.size(); ++idx)
hasTransform_ |= scalarList[idx]->hasTransformation();
2413 std::vector<CDomain*> domList;
2429 std::vector<CAxis*> aList;
2444 std::vector<CScalar*> sList;
2459 std::vector<CDomain*> domainListP = this->
getDomains();
2460 if (domainListP.empty())
2462 ERROR(
"CGrid::getDomain(int domainIndex)",
2463 <<
"No domain associated to this grid. " << std::endl
2464 <<
"Grid id = " << this->
getId());
2467 if (domainIndex >= domainListP.size() || (domainIndex < 0))
2468 ERROR(
"CGrid::getDomain(int domainIndex)",
2469 <<
"Domain with the index doesn't exist " << std::endl
2470 <<
"Grid id = " << this->
getId() << std::endl
2471 <<
"Grid has only " << domainListP.size() <<
" domain but domain index required is " << domainIndex << std::endl);
2473 return domainListP[domainIndex];
2484 std::vector<CAxis*> axisListP = this->
getAxis();
2485 if (axisListP.empty())
2487 ERROR(
"CGrid::getDomain(int axisIndex)",
2488 <<
"No axis associated to this grid. " << std::endl
2489 <<
"Grid id = " << this->
getId());
2492 if (axisIndex >= axisListP.size() || (axisIndex < 0))
2493 ERROR(
"CGrid::getDomain(int axisIndex)",
2494 <<
"Domain with the index doesn't exist " << std::endl
2495 <<
"Grid id = " << this->
getId() << std::endl
2496 <<
"Grid has only " << axisListP.size() <<
" axis but axis index required is " << axisIndex << std::endl);
2498 return axisListP[axisIndex];
2509 std::vector<CScalar*> scalarListP = this->
getScalars();
2510 if (scalarListP.empty())
2512 ERROR(
"CGrid::getScalar(int scalarIndex)",
2513 <<
"No scalar associated to this grid. " << std::endl
2514 <<
"Grid id = " << this->
getId());
2517 if (scalarIndex >= scalarListP.size() || (scalarIndex < 0))
2518 ERROR(
"CGrid::getScalar(int scalarIndex)",
2519 <<
"Scalar with the index doesn't exist " << std::endl
2520 <<
"Grid id = " << this->
getId() << std::endl
2521 <<
"Grid has only " << scalarListP.size() <<
" scalar but scalar index required is " << scalarIndex << std::endl);
2523 return scalarListP[scalarIndex];
2536 if (!domains.empty() && domList.empty())
2538 for (
int i = 0; i < domains.size(); ++i)
2543 if (!domList.empty())
2545 int sizeDom = domList.size();
2547 for (
int i = 0; i < sizeDom; ++i)
2565 if (!axis.empty() && aList.empty())
2567 for (
int i = 0; i < axis.size(); ++i)
2574 int sizeAxis = aList.size();
2576 for (
int i = 0; i < sizeAxis; ++i)
2594 if (!scalars.empty() && sList.empty())
2596 for (
int i = 0; i < scalars.size(); ++i)
2603 int sizeScalar = sList.size();
2605 for (
int i = 0; i < sizeScalar; ++i)
2657 int dSize = domList.size();
2658 for (
int i = 0; i < dSize; ++i)
2661 domList[i]->sendAllAttributesToServer();
2673 int aSize = aList.size();
2675 for (
int i = 0; i < aSize; ++i)
2678 aList[i]->sendAllAttributesToServer();
2690 int sSize = sList.size();
2692 for (
int i = 0; i < sSize; ++i)
2695 sList[i]->sendAllAttributesToServer();
2705 clients.push_back(contextClient) ;
2708 for (
int i=0; i<this->
getDomains().size(); i++)
2709 this->
getDomains()[i]->setContextClient(contextClient);
2710 for (
int i=0; i<this->
getAxis().size(); i++)
2711 this->
getAxis()[i]->setContextClient(contextClient);
2723 if (node.goToChildElement())
2730 if (node.getElementName() == domainName) {
2734 if (node.getElementName() == axisName) {
2738 if (node.getElementName() == scalarName) {
2742 }
while (node.goToNextElement());
2743 node.goToParentElement();
2748 int sizeOrd =
order_.size();
2749 axis_domain_order.resize(sizeOrd);
2750 for (
int i = 0; i < sizeOrd; ++i)
2752 axis_domain_order(i) =
order_[i];
const std::vector< int > & getLocalMaskedDataIndexOnClient()
Return local mask index of client.
This class contains information that describe distribution of servers.
void setVirtualScalarGroup(CScalarGroup *newVScalarGroup)
Change virtual variable group to new one.
static const size_t headerSize
CATCH CAxisAlgorithmInterpolate::CAxisAlgorithmInterpolate(CAxis *axisDestination, CAxis *axisSource, CInterpolateAxis *interpAxis order_)
CATCH CDomainAlgorithmReorder::CDomainAlgorithmReorder(CDomain *domainDestination, CDomain *domainSource, CReorderDomain *reorderDomain if)(domainDestination->type!=CDomain::type_attr::rectilinear)
void modifyGridMask(CArray< bool, N > &gridMask, const CArray< int, 1 > &indexToModify, bool valueToModify)
static void computeLeader(int clientRank, int clientSize, int serverSize, std::list< int > &rankRecvLeader, std::list< int > &rankRecvNotLeader)
void sendEvent(CEventClient &event)
In case of attached mode, the current context must be reset to context for client.
void sendAllAxis()
Send all attributes of axis from client to server.
MPI_Comm intraComm
Communicator of client group.
CDomain * addDomain(const std::string &id=StdString())
int totalNumberWrittenIndexes_
int numberWrittenIndexes_
void setVirtualDomainGroup(CDomainGroup *newVDomainGroup)
Change virtual field group to a new one.
std::map< int, StdSize > getDataBufferSize(CContextClient *client, const std::string &id="", bool bufferForWriting=false)
Compute the minimum buffer size required to send the data.
map< int, CArray< int, 1 > > storeIndex_fromSrv
CAxisGroup * getVirtualAxisGroup() const
static void recvAddScalar(CEventServer &event)
Receive a message annoucing the creation of an scalar on server side.
void sendAllScalars()
Send all attributes of scalars from client to server.
void solveDomainAxisRef(bool areAttributesChecked)
void solveAxisRef(bool checkAtt)
void solveInheritanceTransformation()
Go through the hierarchy to find the axis from which the transformations must be inherited.
static bool dispatchEvent(CEventServer &event)
CDomain * getDomain(int domainIndex)
Get domain pointer with index.
CArray< size_t, 1 > localIndexToWriteOnServer
CScalarGroup * vScalarGroup_
virtual const std::vector< int > & getLocalDataIndexOnClient()
Return local data index of client.
std::map< int, std::map< int, int > > nbSenders
const GlobalLocalMap & getGlobalLocalIndex() const
virtual void partialClear(void)
std::map< int, std::vector< int > > connectedServerRank_
static StdString GetName(void)
Accesseurs statiques ///.
void checkEligibilityForCompressedOutput()
Traitements ///.
void setScalarList(const std::vector< CScalar * > scalars=std::vector< CScalar * >())
Set scalar(s) of a grid from a list.
void sendIndexScalarGrid()
CGridTransformation * getTransformations()
std::map< CContextClient *, map< int, CArray< int, 1 > > > storeIndex_toSrv
void sendAddItem(const string &id, int itemType)
int clientSize
Size of client group.
void storeField_arr(const double *const data, CArray< double, 1 > &stored) const
CArray< int, 1 > & i_index
std::vector< CContextClient * > clientPrimServer
static CAxis * createAxis()
std::set< CContextClient * > clientsSet
StdSize getDimension(void)
Accesseurs ///.
CContextServer * server
Concrete context server.
GlobalLocalDataMap & getGlobalLocalDataSendToServer()
Return global local data mapping of client.
void solveInheritanceTransformation()
Go through the hierarchy to find the domain from which the transformations must be inherited...
void computeConnectedClientsScalarGrid()
std::list< CContextClient * > clients
int getGridSize() const
Get the size of grid index in server (e.x: sizeGrid *= size of each dimensiion)
std::map< int, size_t > connectedDataSizeRead_
void computeGridGlobalDimension(const std::vector< CDomain * > &domains, const std::vector< CAxis * > &axis, const std::vector< CScalar * > &scalars, const CArray< int, 1 > &axisDomainOrder)
const std::list< int > & getRanksServerNotLeader(void) const
Get leading server in the group of connected server.
void completeGrid(CGrid *transformGridSrc=0)
Complete all the necessary (and lacking) attributes of a grid This function is similar to gridTransfo...
void addRelFileCompressed(const StdString &filename)
void computeConnectedClients()
Compute connected receivers and indexes to be sent to these receivers.
void modifyMask(const CArray< int, 1 > &indexToModify, bool valueToModify=false)
This class provides the similar features like.
std::map< CContextClient *, std::map< int, int > > nbReadSenders
void checkMaskIndex(bool doCalculateIndex)
std::vector< int > connectedServerRankRead_
CScalarGroup * getVirtualScalarGroup() const
static CGrid * cloneGrid(const StdString &idNewGrid, CGrid *gridSrc)
std::vector< CDomain * > getDomains()
Get the list of domain pointers.
void maskField_arr(const double *const data, CArray< double, 1 > &stored) const
const std::list< int > & getRanksServerLeader(void) const
Get leading server in the group of connected server.
void duplicateTransformation(CDomain *)
const StdString & getId(void) const
Accesseurs ///.
std::vector< CScalar * > getScalars()
Get the list of axis pointers.
int getNumberWrittenIndexes() const
Returns the number of indexes written by each server.
Description of index distribution on server(s).
std::map< int, std::map< int, size_t > > connectedDataSize_
GlobalLocalDataMap & getGlobalDataIndexOnClient()
bool doGridHaveDataToWrite()
Verify whether one server need to write data There are some cases on which one server has nodata to w...
std::vector< std::string > axisList_
void computeWrittenIndex()
Compute the index to for write data into a file.
CDistributionServer * serverDistribution_
int offsetWrittenIndexes_
void solveDomainAxisBaseRef()
bool isCompressible_
True if and only if the data defined on the grid can be outputted in a compressed way...
map< int, CArray< size_t, 1 > > outGlobalIndexFromClient
void modifyMaskSize(const std::vector< int > &newDimensionSize, bool newValue=false)
bool isWrittenCompressed(const StdString &filename) const
virtual ~CGrid(void)
Destructeur ///.
void solveDomainRef(bool checkAtt)
void uncompressField_arr(const double *const data, CArray< double, 1 > &outData) const
std::map< int, StdSize > getAttributesBufferSize(CContextClient *client, bool bufferForWriting=false)
Compute the minimum buffer size required to send the attributes to the server(s). ...
void sendAddAxis(const std::string &id="")
Send a message to create an axis on server side.
CDistributionClient * getDistributionClient()
CAxis * addAxis(const std::string &id=StdString())
StdSize getDataSize(void) const
bool hasDomainAxisBaseRef_
CDomainGroup * getVirtualDomainGroup() const
std::unordered_map< int, std::vector< size_t > > GlobalIndexMap
CATCH CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar *scalarDestination, CScalar *scalarSource, CReduceScalarToScalar *algo ERROR)("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",<< "Operation must be defined."<< "Scalar source "<< scalarSource->getId()<< std::endl<< "Scalar destination "<< scalarDestination->getId())
std::vector< int > order_
void computeClientIndex()
A context can be both on client and on server side.
std::vector< StdString > getScalarList()
Get list of id of scalar.
void solveScalarRef(bool checkAtt)
////////////////////// Déclarations ////////////////////// ///
virtual void parse(xml::CXMLNode &node)
Parse a grid, for now, it contains only domain, axis and scalar.
std::vector< int > axisPositionInGrid_
std::vector< CAxis * > getAxis()
Get the list of axis pointers.
void checkGridMask(CArray< bool, N > &gridMask, const std::vector< CArray< bool, 1 > * > &domainMasks, const std::vector< CArray< bool, 1 > * > &axisMasks, const CArray< int, 1 > &axisDomainOrder, bool createMask=false)
std::map< CGrid *, std::pair< bool, StdString > > & getTransGridSource()
size_t getWrittenDataSize() const
Return size of data which is written on each server Whatever dimension of a grid, data which are writ...
////////////////////// Déclarations ////////////////////// ///
void sendAddScalar(const std::string &id="")
Send a message to create a scalar on server side.
int getTotalNumberWrittenIndexes() const
Returns the total number of indexes written by the servers.
map< int, CArray< size_t, 1 > > outLocalIndexStoreOnClient
int clientRank
Rank of current client.
std::vector< int > getGlobalDimension()
CArray< size_t, 1 > localIndexToWriteOnClient
void modifyGridMaskSize(CArray< bool, N > &gridMask, const std::vector< int > &eachDimSize, bool newValue)
CScalar * getScalar(int scalarIndex)
Get the a scalar pointer.
static bool dispatchEvent(CEventServer &event)
Dispatch event received from client Whenever a message is received in buffer of server, it will be processed depending on its event type.
std::vector< CContextServer * > serverPrimServer
void computeClientIndexScalarGrid()
std::vector< std::string > scalarList_
int serverSize
Size of server group.
static void recvAddDomain(CEventServer &event)
Receive a message annoucing the creation of a domain on server side.
CGridTransformation * transformations_
CClientServerMapping * clientServerMap_
virtual void parse(xml::CXMLNode &node)
int getDistributedDimension()
void solveDomainAxisRefInheritance(bool apply=true)
Solve domain and axis references As field, domain and axis can refer to other domains or axis...
void solveInheritanceTransformation()
Go through the hierarchy to find the scalar from which the transformations must be inherited...
CDistributionClient * clientDistribution_
void checkAttributesAfterTransformation()
bool computedWrittenIndex_
static CGrid * createGrid(CDomain *domain)
Instanciateurs Statiques ///.
void sendAddDomain(const std::string &id="")
Send a message to create a domain on server side.
CArray< bool, 1 > storeMask_client
std::unordered_map< size_t, std::vector< InfoType > > Index2VectorInfoTypeMap
static StdString GetDefName(void)
bool isCompressible(void) const
Tests ///.
CArray< int, 1 > storeIndex_client
void duplicateTransformation(CScalar *)
Index distribution on client side.
std::map< CGrid *, std::pair< bool, StdString > > gridSrc_
static StdString generateId(const std::vector< CDomain * > &domains, const std::vector< CAxis * > &axis, const std::vector< CScalar * > &scalars, const CArray< int, 1 > &axisDomainOrder=CArray< int, 1 >())
void transformGrid(CGrid *transformGridSrc)
enum xios::_node_type ENodeType
////////////////////// Définitions ////////////////////// ///
void setVirtualAxisGroup(CAxisGroup *newVAxisGroup)
Change virtual variable group to new one.
std::unordered_map< size_t, int > GlobalLocalMap
void setContextClient(CContextClient *contextClient)
static void recvAddAxis(CEventServer &event)
Receive a message annoucing the creation of an axis on server side.
CDomainGroup * vDomainGroup_
A special transformation to generate a grid.
This class bases on the knowledge of distribution on client side (decided by users) to calculate the ...
CGrid(void)
Constructeurs ///.
void addTransGridSource(CGrid *gridSrc)
void setDomainList(const std::vector< CDomain * > domains=std::vector< CDomain * >())
Set domain(s) of a grid from a list.
static ENodeType GetType(void)
std::vector< int > getDataNIndex()
bool doGridHaveDataDistributed(CContextClient *client=0)
static std::map< int, int > computeConnectedClients(int nbServer, int nbClient, MPI_Comm &clientIntraComm, const std::vector< int > &connectedServerRank)
Compute how many clients each server will receive data from On client can send data to several server...
CDistributionServer * getDistributionServer()
const Index2VectorInfoTypeMap & getInfoIndexMap() const
void computeIndexByElement(const std::vector< std::unordered_map< size_t, std::vector< int > > > &indexServerOnElement, const CContextClient *client, CClientServerMapping::GlobalIndexMap &globalIndexOnServer)
Compute the global of (client) grid to send to server with the global index of each element of grid E...
void computeIndex(void)
Compute the global index of grid to send to server as well as the connected server of the current cli...
int getOffsetWrittenIndexes() const
Returns the offset of indexes written by each server.
CDistribution::GlobalLocalMap GlobalLocalDataMap
std::vector< int > computeServerGlobalByElement(std::vector< std::unordered_map< size_t, std::vector< int > > > &indexServerOnElement, int rank, int clientSize, const CArray< int, 1 > &axisDomainOrder, int positionDimensionDistributed=1)
Compute the global index of grid elements (domain, axis) and their associated server rank...
std::vector< StdString > getAxisList()
Get list of id of axis.
StdString id
Propriétés ///.
ENodeType getType(void) const
Accesseurs ///.
void computeIndexInfoMapping(const CArray< size_t, 1 > &indices)
Compute mapping between indices and information corresponding to these indices.
This class creates a grid from scratch, e.g: only global dimension of grid and its type are provided...
void duplicateAttributes(const CAttributeMap *const _parent)
Duplicate attribute map with a specific attribute map.
static CScalar * createScalar()
void sendAllDomains()
Send all attributes of domains from client to server.
const std::vector< bool > & getLocalMaskIndexOnClient()
Return local mask index of client.
The class, for now, plays a role of computing local index for writing data on server.
void restoreField_arr(const CArray< double, 1 > &stored, double *const data) const
std::vector< StdString > getDomainList()
Get list of id of domains.
std::map< int, CClientServerMapping::GlobalIndexMap > globalIndexOnServer_
void setAxisList(const std::vector< CAxis * > axis=std::vector< CAxis * >())
Set axis(s) of a grid from a list.
bool isScalarGrid() const
static CContext * getCurrent(void)
Get current context.
CContextClient * client
Concrete contex client.
bool isServerLeader(void) const
Check if client connects to leading server.
void duplicateTransformation(CAxis *)
static CDomain * createDomain()
CScalar * addScalar(const std::string &id=StdString())
size_t getGlobalWrittenSize(void)
static void recvIndex(CEventServer &event)
std::vector< std::string > domList_