27 assert( meshList.size() == 1 );
33 vector< Mesh* >::iterator it_mesh;
45 _procID = MPI::COMM_WORLD.Get_rank();
46 _nPart = MPI::COMM_WORLD.Get_size();
53 for (
int n = 0; n <
_nmesh; n++ )
70 for (
int n = 0; n <
_nmesh; n++ ){
73 _meshList.at(n)->eraseConnectivity(cellSite, cellSite);
74 _meshList.at(n)->eraseConnectivity(cellSite, faceSite);
89 vector<int> siteGhostCount(
_nmesh,0);
90 vector<int> siteSelfCount (
_nmesh,0);
95 siteSelfCount[ color[n] ]++;
100 siteGhostCount[ color[n] ]++;
106 for (
int n = 0; n < faceSite.
getCount(); n++ ){
107 int cell1 = faceCells(n,0);
108 int cell2 = faceCells(n,1);
110 if ( color[ cell1 ] != color[ cell2 ] ){
111 siteGhostCount[ color[cell1] ]++;
112 siteGhostCount[ color[cell2] ]++;
116 for (
int id = 0;
id <
_nmesh;
id++ )
120 vector< set<int> > gatherCells(_nmesh);
121 for (
int n = 0; n < faceSite.
getCount(); n++ ){
122 int cell1 = faceCells(n,0);
123 int cell2 = faceCells(n,1);
125 if ( color[ cell1 ] != color[ cell2 ] ){
126 gatherCells[ color[cell1] ].insert(cell2);
127 gatherCells[ color[cell2] ].insert(cell1);
133 for (
int id = 0;
id <
_nmesh;
id++ ){
134 const set<int>& cells = gatherCells[id];
136 int countLevel1 =
_cellSite[id]->getCount();
138 foreach(
const set<int>::value_type& mpos, cells){
140 multimap<int,int>::const_iterator it;
141 for ( it = cellCellsGlobal.equal_range(cellID).first; it != cellCellsGlobal.equal_range(cellID).second; it++ ){
142 const int localID = globalToLocal.find(it->second)->second;
145 if ( cells.count(localID) == 0 && color[localID] !=
id && cells2.count(localID) == 0){
147 cells2.insert(localID);
164 vector<int> faceCount(
_nmesh,0);
168 for (
int n = 0; n < faceSite.
getCount(); n++ ){
169 int cell1 = faceCells(n,0);
170 int cell2 = faceCells(n,1);
172 if ( color[ cell1 ] != color[ cell2 ] ){
173 faceCount[ color[cell1] ]++;
174 faceCount[ color[cell2] ]++;
176 faceCount[ color[cell2] ]++;
180 for(
int id = 0;
id <
_nmesh;
id++ )
192 vector<int> nodeCount(
_nmesh,0);
195 vector< vector<int> > globalNodeIDs(
_nmesh);
196 for (
int id = 0;
id <
_nmesh;
id++ )
197 globalNodeIDs[
id].resize(nodeSite.
getCount(),-1);
206 int colorID = color[n];
207 for (
int i = 0; i < nnodes; i++ ){
208 int glblNodeID = cellNodes(n,i);
210 if ( globalNodeIDs[colorID][glblNodeID] == -1 ) {
211 globalNodeIDs[colorID][glblNodeID] = 1;
212 nodeCount[colorID]++;
217 for (
int id = 0;
id <
_nmesh;
id++ )
227 for (
int id = 0;
id <
_nmesh;
id++ ){
238 vector<int> localCellCount(_nmesh,0);
239 for (
int i = 0; i < cellSelfCount; i++ ){
250 vector<int> localCellID(
_nmesh,0);
251 vector<int> localFaceID(
_nmesh,0);
266 for (
int id = 0;
id <
_nmesh;
id++ )
267 localCellID[
id] =
_cellSite[
id]->getSelfCount();
270 for (
int id = 0;
id <
_nmesh;
id++ ){
277 const int cellCount = 2;
278 for (
int i = 0; i < faceSite.
getCount(); i++ )
292 for (
int i = 0; i < interiorFaceSite.
getCount(); i++ ){
293 int cell1 = faceCells(i,0);
294 int cell2 = faceCells(i,1);
297 if ( meshID1 == meshID2 ){
314 for (
int i = 0; i < interfaceCount; i++ ){
315 const StorageSite& interiorFaceSite = interfaceGroupList[i]->site;
316 int offset = interiorFaceSite.
getOffset();
318 int nEnd = nBeg + interiorFaceSite.
getCount();
321 for (
int id = 0;
id <
_nmesh;
id++ ){
323 _interfaceID [id].push_back( -interfaceGroupList[i]->
id );
326 for (
int n = nBeg; n < nEnd; n++ ){
327 int cell1 = faceCells(n,0);
328 int cell2 = faceCells(n,1);
330 if ( cell1 < cellSelfCount ){
333 _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID] );
335 localCellID[meshID]++;
340 _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID] );
342 localCellID[meshID]++;
348 for (
int id = 0;
id <
_nmesh;
id++ )
363 vector<int> countMeshInterface(
_nmesh,0);
364 for (
int i = 0; i < interiorFaceSite.
getCount(); i++ ){
365 int cell1 = faceCells(i,0);
366 int cell2 = faceCells(i,1);
369 if ( meshID1 != meshID2 ){
370 countMeshInterface[meshID1]++;
371 countMeshInterface[meshID2]++;
378 for (
int i = 0; i < interiorFaceSite.
getCount(); i++ ){
379 int cell1 = faceCells(i,0);
380 int cell2 = faceCells(i,1);
383 if ( meshID1 != meshID2 ){
390 for (
int id = 0 ;
id <
_nmesh ;
id++ ){
393 for (
int key = 0; key <
_nmesh; key++ ){
395 int nface = faceIdentifier.count(key);
402 multimap<int,int>::const_iterator it;
403 for ( it = faceIdentifier.equal_range(key).first; it != faceIdentifier.equal_range(key).second; it++ ){
404 int glblFaceID = it->second;
405 int cell1 = faceCells(glblFaceID,0);
406 int cell2 = faceCells(glblFaceID,1);
409 if (
id == meshID1 ){
411 _faceCells.at(
id)->add( faceID[
id], localCellID[
id]);
417 _faceCells.at(
id)->add( faceID[
id], localCellID[
id] );
437 for (
int i = 0; i < boundaryCount; i++ ){
438 const StorageSite& boundaryFaceSite = boundaryGroupList[i]->site;
439 int offset = boundaryFaceSite.
getOffset();
441 int nEnd = nBeg + boundaryFaceSite.
getCount();
443 const int bounID = boundaryGroupList[i]->id;
444 const string& bType = boundaryGroupList[i]->groupType;
445 for (
int id = 0;
id <
_nmesh;
id++ ){
450 for (
int n = nBeg; n < nEnd; n++ ){
451 int cell1 = faceCells(n,0);
452 int cell2 = faceCells(n,1);
454 if ( cell1 < cellSelfCount ){
457 _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID]++ );
462 _faceCells.at( meshID )->add( faceID[meshID], localCellID[meshID]++ );
467 for (
int id = 0;
id <
_nmesh;
id++ )
478 for (
int id = 0;
id <
_nmesh;
id++ )
487 vector<int> faceID(
_nmesh,0);
501 for (
int id = 0;
id <
_nmesh;
id++ ){
510 vector<int> faceIndx(_nmesh,0);
515 for (
int n = 0; n < interiorFaceSite.
getCount(); n++ ){
516 int cell1 = faceCells(n,0);
517 int cell2 = faceCells(n,1);
520 if ( meshID1 == meshID2 ){
521 const int nodeCount = faceNodes.
getCount(n);
522 _faceNodes.at( meshID1 )->addCount( faceIndx[meshID1]++, nodeCount );
530 for (
int i = 0; i < interfaceCount; i++ ){
531 const StorageSite& interiorFaceSite = interfaceGroupList[i]->site;
532 int offset = interiorFaceSite.
getOffset();
534 int nEnd = nBeg + interiorFaceSite.
getCount();
536 for (
int n = nBeg; n < nEnd; n++ ){
538 const int cell1 = faceCells(n,0);
540 const int nodeCount = faceNodes.
getCount(n);
541 _faceNodes.at( meshID )->addCount( faceIndx[meshID]++, nodeCount );
547 for (
int n = 0; n < interiorFaceSite.
getCount(); n++ ){
548 int cell1 = faceCells(n,0);
549 int cell2 = faceCells(n,1);
552 if ( meshID1 != meshID2 ){
554 const int nodeCount = faceCells.
getCount(n);
555 _faceNodes.at ( meshID1 )->addCount( faceIndx[meshID1]++, nodeCount );
557 _faceNodes.at ( meshID2 )->addCount( faceIndx[meshID2]++, nodeCount );
565 for (
int i = 0; i < boundaryCount; i++ ){
566 const StorageSite& boundaryFaceSite = boundaryGroupList[i]->site;
567 const int offset = boundaryFaceSite.
getOffset();
568 const int nBeg = offset;
569 const int nEnd = nBeg + boundaryFaceSite.
getCount();
570 for (
int n = nBeg; n < nEnd; n++ ){
571 const int cell1 = faceCells(n,0);
573 const int nodeCount = faceNodes.
getCount(n);
574 _faceNodes.at( meshID )->addCount( faceIndx[meshID]++, nodeCount );
580 for (
int id = 0;
id <
_nmesh;
id++ )
593 for (
int n = 0; n < interiorFaceSite.
getCount(); n++ ){
594 int cell1 = faceCells(n,0);
595 int cell2 = faceCells(n,1);
598 if ( meshID1 == meshID2 ){
599 const int nodeCount = faceCells.
getCount(n);
600 for (
int i = 0; i < nodeCount; i++ ){
601 int glbNodeID = faceNodes(n,i);
603 _faceNodes.at( meshID1 )->add( faceID[meshID1], lclNodeID );
619 for (
int i = 0; i < interfaceCount; i++ ){
620 const StorageSite& interiorFaceSite = interfaceGroupList[i]->site;
621 int offset = interiorFaceSite.
getOffset();
623 int nEnd = nBeg + interiorFaceSite.
getCount();
625 for (
int n = nBeg; n < nEnd; n++ ){
627 int cell1 = faceCells(n,0);
629 const int nodeCount = faceCells.
getCount(n);
630 for (
int j = 0; j < nodeCount; j++ ){
631 int glbNodeID = faceNodes(n,j);
633 _faceNodes.at( meshID )->add( faceID[meshID], lclNodeID );
650 for (
int n = 0; n < interiorFaceSite.
getCount(); n++ ){
651 int cell1 = faceCells(n,0);
652 int cell2 = faceCells(n,1);
655 if ( meshID1 != meshID2 ){
656 const int nodeCount = faceCells.
getCount(n);
658 for (
int i = 0; i < nodeCount; i++ ){
659 int glblNodeID = faceNodes(n,i);
661 _faceNodes.at ( meshID1 )->add( faceID[meshID1], lclNodeID );
664 for (
int i = nodeCount-1; i >= 0; i-- ){
665 int glblNodeID = faceNodes(n,i);
667 _faceNodes.at ( meshID2 )->add( faceID[meshID2], lclNodeID );
684 for (
int i = 0; i < boundaryCount; i++ ){
685 const StorageSite& boundaryFaceSite = boundaryGroupList[i]->site;
686 int offset = boundaryFaceSite.
getOffset();
688 int nEnd = nBeg + boundaryFaceSite.
getCount();
689 for (
int n = nBeg; n < nEnd; n++ ){
690 int cell1 = faceCells(n,0);
692 const int nodeCount = faceCells.
getCount(n);
693 for (
int j = 0; j < nodeCount; j++ ){
694 int glbNodeID = faceNodes(n,j);
696 _faceNodes.at( meshID )->add( faceID[meshID], lclNodeID );
707 for (
int id = 0;
id <
_nmesh;
id++ )
717 vector<int> nodeCount(
_nmesh,0);
722 vector< vector<int> > globalNodeIDs(
_nmesh);
723 for (
int id = 0;
id <
_nmesh;
id++ )
724 globalNodeIDs[
id].resize(nodeSite.
getCount(),-1);
732 int colorID = color[n];
733 for (
int i = 0; i < nnodes; i++ ){
734 int glblNodeID = cellNodes(n,i);
736 if ( globalNodeIDs[colorID][glblNodeID] == -1 ) {
738 nodeMap[colorID] = nodeCount[colorID];
739 globalNodeIDs[colorID][glblNodeID] = 1;
740 nodeCount[colorID]++;
754 for (
int id = 0;
id <
_nmesh;
id++ )
759 for (
int i = 0; i < nodeSiteGlbl.
getCount(); i++ ){
761 foreach(
const IntMap::value_type& mpos, colorIDToLocalNode){
762 int colorID = mpos.first;
763 int localNodeID = mpos.second;
764 (*
_coord[colorID])[localNodeID] = coordGlbl[i];
792 for (
int id = 0;
id <
_nmesh;
id++ ){
808 for (
int id = 0;
id <
_nmesh;
id++ ){
809 int nInteriorFace = 0;
812 const int cellSelfCount =
_cellSite.at(
id)->getSelfCount();
813 for (
int i = 0; i < faceSite.
getCount(); i++ ){
814 int cell1 = faceCells(i,0);
815 int cell2 = faceCells(i,1);
816 if ( (cell1 < cellSelfCount) && (cell2 < cellSelfCount) )
819 _meshList.at(
id)->createInteriorFaceGroup( nInteriorFace );
827 for (
int id = 0;
id <
_nmesh;
id++ ){
833 _meshList.at(
id)->createInterfaceGroup( size, offset, interfaceID);
841 for (
int id = 0;
id <
_nmesh;
id++ ){
848 _meshList.at(
id)->createBoundaryFaceGroup( size, offset, boundaryID, bType );
856 for (
int id = 0 ;
id <
_nmesh;
id++ )
863 for (
int id = 0;
id <
_nmesh;
id++ )
870 for (
int id = 0;
id <
_nmesh;
id++ )
894 for (
int i = 0; i < interfaceGroupCount; i++ ) {
896 int interfaceID = -faceGroupList[i]->id;
899 const StorageSite& interfaceSite = faceGroupList[i]->site;
901 const int meshID0 = 0;
905 const Array<int>& scatterArray = *scatterMap.find(ghostSite)->second;
906 const Array<int>& gatherArray = *gatherMap.find(ghostSite)->second;
913 foreach (
const EntryVecMap::value_type& pos, scatterArrayMap ){
914 const pair<int,int>& entry = pos.first;
915 const int meshID = entry.first;
916 const int otherMeshID = entry.second;
917 const int size = int(pos.second.size());
922 shared_ptr<StorageSite> siteScatterLocal(
new StorageSite(size) );
925 int scatterSize = int(scatterArrayMap[entry].size());
927 for (
int i = 0; i < scatterSize; i++ )
928 (*scatterArrayLocal)[i] = scatterArrayMap[entry][i];
930 int gatherSize = int(gatherArrayMap[entry].size());
932 for (
int i = 0; i < gatherSize; i++ )
933 (*gatherArrayLocal)[i] = gatherArrayMap[entry][i];
936 siteScatterLocal->setScatterProcID( ghostSite->getScatterProcID() );
937 siteScatterLocal->setGatherProcID ( ghostSite->getGatherProcID() );
939 int packed_info = (
std::max(meshID,otherMeshID) << 16 ) | (
std::min(meshID,otherMeshID) );
940 siteScatterLocal->setTag( packed_info );
943 _meshList.at(meshID)->createGhostCellSiteScatter( pairID, siteScatterLocal );
944 _meshList.at(meshID)->createGhostCellSiteGather ( pairID, siteScatterLocal );
945 scatterMapLocal[ siteScatterLocal.get() ] = scatterArrayLocal;
946 gatherMapLocal [ siteScatterLocal.get() ] = gatherArrayLocal;
965 for (
int i = 0; i < scatterArray.
getLength(); i++ ){
966 const int faceIndx = iBeg+i;
968 const int cell1 = faceCells(faceIndx,1);
969 const int thisMeshID = color[ scatterArray[i] ];
970 const int otherMeshID = colorOther[ cell1 ];
971 EntryIndex eIndex = make_pair<int,int>(thisMeshID, otherMeshID);
975 scatterArrayLocal[eIndex].push_back(cellID);
992 for (
int i = 0; i < gatherArray.
getLength(); i++ ){
993 const int faceIndx = iBeg+i;
995 const int cell0 = faceCells(faceIndx,0);
996 const int thisMeshID = color[ cell0 ];
997 const int otherMeshID = colorOther[ gatherArray[i] ];
998 EntryIndex eIndex = make_pair<int,int>(thisMeshID, otherMeshID);
999 const int glblFaceID = (*_cellFaces)(gatherArray[i],0);
1001 const int cellID = (*
_faceCells[thisMeshID])(localFaceID,1);
1002 gatherArrayLocal[eIndex].push_back(cellID);
1013 for (
int id = 0 ;
id <
_nmesh ;
id++ ){
1018 for (
int key = 0; key <
_nmesh; key++ ){
1020 int nface = faceIdentifier.count(key);
1026 multimap<int,int>::const_iterator it;
1028 for ( it = faceIdentifier.equal_range(key).first; it != faceIdentifier.equal_range(key).second; it++ ){
1030 const int glblFaceID = it->second;
1032 const int gatherCellID = (*
_faceCells[id])(localFaceID,1);
1033 (*gatherArrayLocal)[indx] = gatherCellID;
1036 const int scatterCellID = (*
_faceCells[key])(localFaceID,0);
1037 (*scatterArrayLocal)[indx] = scatterCellID;
1040 gatherMapLocal.insert ( make_pair(otherSite, gatherArrayLocal ) );
1041 scatterMapLocal.insert( make_pair(thisSite , scatterArrayLocal) );
1053 const int nmesh = int(
_meshList.size() );
1055 shared_ptr<MultiField> cellMultiField = shared_ptr<MultiField>(
new MultiField() );
1056 shared_ptr<Field> cellField = shared_ptr<Field> (
new Field(
"globalcellID") );
1058 for (
int id = 0;
id < nmesh;
id++ ){
1063 cellMultiField->addArray(ai,cIndex);
1068 int offset = globalOffset;
1069 for (
int id = 0;
id < nmesh;
id++ ){
1076 for (
int i = 0; i < selfCount; i++ )
1077 localCell[i] = offset + i;
1079 offset += selfCount;
1084 const int ibeg = bounGroupList[i]->site.getOffset();
1085 const int iend = ibeg + bounGroupList[i]->site.
getCount();
1087 for (
int ii = ibeg; ii < iend; ii++ ){
1088 localCell[ faceCells(ii,1)] = offset + indx;
1092 offset += iend-ibeg;
1098 cellMultiField->sync();
1101 for (
int id = 0;
id < nmesh;
id++ ){
1108 for (
int i = 0; i < localCell.getLength(); i++ ){
1109 localToGlobal[i] = localCell[i];
1110 assert( localCell[i] != -1 );
1115 for (
int i = 0; i < localCell.getLength(); i++ ){
1116 globalToLocal[ localToGlobal[i] ] = i;
1128 const int nmesh = int(
_meshList.size() );
1131 for (
int id = 0;
id < nmesh;
id++ ){
1137 bounCount += bounGroupList[i]->site.getCount();
1139 count += selfCount + bounCount;
1144 int *counts =
new int[
_nPart ];
1147 MPI::COMM_WORLD.Allgather( &count, 1, MPI::INT, counts, 1, MPI::INT);
1152 for (
int i = 0; i <
_procID; i++ )
1153 offset += counts[i];
1167 for (
int n=0; n<
_nmesh; n++ ){
1174 for (
int n=0; n<
_nmesh; n++ ){
1182 for (
int n=0; n<
_nmesh; n++ ){
1189 for (
int n=0; n<
_nmesh; n++ ){
1196 for (
int n=0; n<
_nmesh; n++ ){
1222 for (
int id = 0;
id <
_nmesh;
id++ )
1223 _debugFile <<
"meshid = " <<
id <<
" selfCount = " <<
_cellSite.at(
id)->getSelfCount() <<
" count = " <<
_cellSite.at(
id)->getCount() <<
1224 " countLevel1 = " <<
_cellSite.at(
id)->getCountLevel1() <<endl;
1232 for (
int id = 0;
id <
_nmesh;
id++ )
1241 for (
int id = 0;
id <
_nmesh;
id++ )
1265 foreach(
const IntMap::value_type& mpos, nodeMap){
1266 int colorID = mpos.first;
1267 int localNodeID = mpos.second;
1268 _debugFile <<
"glblNodeID = " << i <<
" meshID = " << colorID <<
" localNodeID = " << localNodeID << endl;
1278 for (
int id = 0;
id <
_nmesh;
id++ ){
1282 for (
int n = 0; n < faceSite.
getCount(); n++ ){
1284 for (
int i = 0; i < faceCells.
getCount(n); i++ ){
1298 for (
int id = 0;
id <
_nmesh;
id++ ){
1302 for (
int n = 0; n < faceSite.
getCount(); n++ ){
1304 for (
int i = 0; i < faceNodes.
getCount(n); i++ ){
1318 map< const StorageSite*, int > siteMeshMapper;
1319 for (
int id = 0;
id <
_nmesh;
id++ )
1320 siteMeshMapper[&
_meshList.at(
id)->getCells()] = id;
1324 vector< const StorageSite* > scatterSiteVec;
1325 map <int, int> packIDToMeshID;
1326 vector< int > scatterSiteVecID;
1328 for (
int id = 0;
id <
_nmesh;
id++ ){
1330 foreach (
const StorageSite::ScatterMap::value_type& pos, scatterMap ){
1333 int neighMeshID = siteMeshMapper[ pos.first ];
1334 const int packed_info = ( (
id << 16) | neighMeshID );
1335 orderedMeshInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1336 packIDToMeshID.insert( make_pair<int,int>(packed_info,
id) );
1342 foreach (
const IntStorageSiteMap::value_type& pos, orderedMeshInterface ){
1343 scatterSiteVec.push_back( pos.second );
1344 const int meshID = packIDToMeshID[pos.first];
1345 scatterSiteVecID.push_back( meshID );
1348 packIDToMeshID.clear();
1351 for (
int id = 0;
id <
_nmesh;
id++ ){
1353 foreach (
const StorageSite::ScatterMap::value_type& pos, scatterMap ){
1357 const int tag = scatterSite.
getTag();
1358 const int packed_info = ( (
id << 31) | (neighID << 24) | tag );
1359 orderedPartInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1360 packIDToMeshID.insert( make_pair<int,int>(packed_info,
id) );
1366 foreach (
const IntStorageSiteMap::value_type& pos, orderedPartInterface ){
1367 scatterSiteVec.push_back( pos.second );
1368 const int meshID = packIDToMeshID[pos.first];
1369 scatterSiteVecID.push_back( meshID );
1373 foreach(
const vector<const StorageSite*>::value_type& pos, scatterSiteVec){
1374 if ( pos->getGatherProcID() != -1 ){
1375 const int id = scatterSiteVecID[indx++];
1377 const Array<int>& scatterArray = *(scatterMap.find(pos)->second);
1378 const int neighID = pos->getGatherProcID();
1379 _debugFile <<
" meshID = " <<
id <<
" procID = " <<
_procID <<
" neighProcID = " << neighID <<
" Tag = " << pos->getTag() <<
" : " << endl;
1380 for (
int i = 0; i < scatterArray.
getLength(); i++ ){
1381 _debugFile <<
" scatterArray[" << i <<
"] = " << scatterArray[i] << endl;
1384 const int id = scatterSiteVecID[indx++];
1386 const Array<int>& scatterArray = *(scatterMap.find(pos)->second);
1387 int neighMeshID = siteMeshMapper[pos];
1388 _debugFile <<
" meshID = " <<
id <<
" otherside MeshID = " << neighMeshID <<
" : " << endl;
1389 for (
int i = 0; i < scatterArray.
getLength(); i++ ){
1390 _debugFile <<
" scatterArray[" << i <<
"] = " << scatterArray[i] << endl;
1403 map< const StorageSite*, int > siteMeshMapper;
1404 for (
int id = 0;
id <
_nmesh;
id++ )
1405 siteMeshMapper[&
_meshList.at(
id)->getCells()] = id;
1409 vector< const StorageSite* > gatherSiteVec;
1410 map <int, int> packIDToMeshID;
1411 vector< int > gatherSiteVecID;
1413 for (
int id = 0;
id <
_nmesh;
id++ ){
1415 foreach (
const StorageSite::GatherMap::value_type& pos, gatherMap ){
1418 int neighMeshID = siteMeshMapper[ pos.first ];
1419 const int packed_info = ( (
id << 16) | neighMeshID );
1420 orderedMeshInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1421 packIDToMeshID.insert( make_pair<int,int>(packed_info,
id) );
1427 foreach (
const IntStorageSiteMap::value_type& pos, orderedMeshInterface ){
1428 gatherSiteVec.push_back( pos.second );
1429 const int meshID = packIDToMeshID[pos.first];
1430 gatherSiteVecID.push_back( meshID );
1433 packIDToMeshID.clear();
1436 for (
int id = 0;
id <
_nmesh;
id++ ){
1438 foreach (
const StorageSite::GatherMap::value_type& pos, gatherMap ){
1442 const int tag = gatherSite.
getTag();
1443 const int packed_info = ( (
id << 31) | (neighID << 24) | tag );
1444 orderedPartInterface.insert( make_pair<int, const StorageSite*>(packed_info, pos.first) );
1445 packIDToMeshID.insert( make_pair<int,int>(packed_info,
id) );
1451 foreach (
const IntStorageSiteMap::value_type& pos, orderedPartInterface ){
1452 gatherSiteVec.push_back( pos.second );
1453 const int meshID = packIDToMeshID[pos.first];
1454 gatherSiteVecID.push_back( meshID );
1458 foreach(
const vector<const StorageSite*>::value_type& pos, gatherSiteVec){
1459 if ( pos->getGatherProcID() != -1 ){
1460 const int id = gatherSiteVecID[indx++];
1462 const Array<int>& gatherArray = *(gatherMap.find(pos)->second);
1463 const int neighID = pos->getGatherProcID();
1464 _debugFile <<
" meshID = " <<
id <<
" procID = " <<
_procID <<
" neighProcID = " << neighID <<
" Tag = " << pos->getTag() <<
" : " << endl;
1465 for (
int i = 0; i < gatherArray.
getLength(); i++ ){
1466 _debugFile <<
" gatherArray[" << i <<
"] = " << gatherArray[i] << endl;
1469 const int id = gatherSiteVecID[indx++];
1471 const Array<int>& gatherArray = *(gatherMap.find(pos)->second);
1472 int neighMeshID = siteMeshMapper[pos];
1473 _debugFile <<
" meshID = " <<
id <<
" otherside MeshID = " << neighMeshID <<
" : " << endl;
1474 for (
int i = 0; i < gatherArray.
getLength(); i++ ){
1475 _debugFile <<
" gatherArray[" << i <<
"] = " << gatherArray[i] << endl;
1489 string fname =
"MESHDISMANTLER_"+fname_+
"_proc"+ss.str()+
".dat";
int getNumOfAssembleMesh() const
const CRConnectivity & getAllFaceNodes() const
const FaceGroupList & getBoundaryFaceGroups() const
int getCount(const int i) const
const FaceGroup & getInteriorFaceGroup() const
vector< ArrayIntPtr > _localCellToGlobal
void faceCellsFinishAdd()
int getBoundaryGroupCount() const
void createInterFaceGroup()
shared_ptr< StorageSite > StorageSitePtr
void debug_file_open(const string &fname)
CRConnectivityPtr _cellFaces
void debug_gather_mappers()
map< int, vector< int > > _interfaceOffset
const StorageSite & getNodes() const
map< int, vector< string > > _boundaryType
void meshInterfaceMappers()
multiMap & getCellCellsGlobal()
void faceCellsAddPartitionInterfaces(vector< int > &faceID, vector< int > &localCellID)
void faceNodesAddBoundaryInterfaces(vector< int > &faceID)
map< EntryIndex, vector< int > > EntryVecMap
MeshDismantler(const MeshList &meshList)
double max(double x, double y)
map< int, vector< int > > _boundaryID
void faceNodesFinishAdd()
void setCount(const int selfCount, const int nGhost=0)
vector< CRConnectivityPtr > _faceNodes
map< int, int > & getGlobalToLocal()
map< int, vector< int > > _boundaryOffset
int getInterfaceGroupCount() const
vector< ArrayVecD3Ptr > _coord
shared_ptr< Array< Mesh::VecD3 > > ArrayVecD3Ptr
void recvScatterGatherCountsBufferLocal()
vector< int > _globalCellToMeshID
void debug_cells_mapper()
const StorageSite * getGhostCellSiteScatter(const PartIDMeshIDPair &id) const
Array< int > & getCellColors()
const CRConnectivity & getAllFaceCells() const
map< EntryIndex, int > EntryMap
void getGatherArrays(const Array< int > &gatherArray, EntryVecMap &gatherArrayLocal, const StorageSite &site)
void faceCellsInit(vector< int > &localCellID)
void faceCellsAddInteriorFaces(vector< int > &faceID)
void setCellCellsGhostExt()
void faceNodesAddPartitionInterfaces(vector< int > &faceID)
const Array< VecD3 > & getNodeCoordinates() const
pair< int, int > EntryIndex
Array< int > & getLocalToGlobal()
Array< int > & getCellColorsOther()
pair< const Field *, const StorageSite * > ArrayIndex
void faceNodesAddMeshInterfaces(vector< int > &faceID)
int getGatherProcID() const
vector< int > _globalCellToLocal
void createScatterGatherIndicesBuffer()
void faceCellsAddMeshInterfaces(vector< int > &faceID, vector< int > &localCellID)
vector< FaceGroupPtr > FaceGroupList
map< int, vector< int > > _interfaceID
vector< StorageSitePtr > _cellSite
pair< int, int > PartIDMeshIDPair
const StorageSite & getFaces() const
void recvScatterGatherIndicesBufferLocal()
shared_ptr< Array< int > > ArrayIntPtr
const StorageSite & getCells() const
vector< StorageSitePtr > _nodeSite
void createInteriorFaceGroup()
void createLocalGlobalArray()
void partitionInterfaceMappers()
vector< map< int, int > > _globalToLocalFaces
shared_ptr< CRConnectivity > CRConnectivityPtr
int getCountLevel1() const
vector< map< int, int > > _globalToLocalNodes
const ScatterMap & getScatterMap() const
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
void debug_scatter_mappers()
map< int, const StorageSite * > IntStorageSiteMap
void faceNodesAddInteriorFaces(vector< int > &faceID)
const GatherMap & getGatherMap() const
shared_ptr< CRConnectivity > getTranspose() const
void createScatterGatherCountsBuffer()
vector< CRConnectivityPtr > _faceCells
vector< StorageSitePtr > _faceSite
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
void faceCellsAddBoundaryInterfaces(vector< int > &faceID, vector< int > &localCellID)
const FaceGroupList & getInterfaceGroups() const
void getScatterArrays(const Array< int > &scatterArray, EntryVecMap &scatterArrayLocal, const StorageSite &site)
double min(double x, double y)
void createCellCellsGhostExt()
void debug_nodes_mapper()
void setCountLevel1(const int countLevel1)
const CRConnectivity & getCellNodes() const
vector< multimap< int, int > > _faceIdentifierList
void createBoundaryFaceGroup()
vector< Mesh * > MeshList
map< int, vector< int > > _boundarySize
map< int, vector< int > > _interfaceSize