45 Inf.read(reinterpret_cast<char *>(buf),12);
52 Inf.seekg(16 * _nfaces,ios::cur);
61 Inf >> _id >> _nfaces >> _ngfaces;
62 unsigned int nfaces_accum = 0;
63 nfaces_accum += _nfaces;
66 _triconn.resize(3*_nfaces);
67 unsigned int face = 0;
68 while(face < _nfaces){
69 unsigned int node1,node2,node3;
70 Inf >> node1 >> node2 >> node3;
71 _triconn[face*3] = node1;
72 _triconn[face*3+1] = node2;
73 _triconn[face*3+2] = node3;
76 Inf >> _nfaces >> _ngfaces;
77 nfaces_accum += _nfaces;
79 _quadconn.resize(4*_nfaces);
81 while(face < _nfaces){
82 unsigned int node1,node2,node3,node4;
83 Inf >> node1 >> node2 >> node3 >> node4;
84 _quadconn[face*4] = (node1);
85 _quadconn[face*4+1] = (node2);
86 _quadconn[face*4+2] = (node3);
87 _quadconn[face*4+3] = (node4);
90 _nfaces = nfaces_accum;
91 _ngfaces = _ngquad + _ngtri;
98 unsigned int nfaces = _triconn.size()/3;
99 unsigned int face = 0;
100 Ouf << setw(12) << (_id < 0 ? _id : -1*_id) << endl
101 << setw(12) << nfaces << endl
102 << setw(12) << _ngtri << endl;
103 while(face < nfaces){
104 Ouf << setw(12) << _triconn[face*3]
105 << setw(12) << _triconn[face*3+1]
106 << setw(12) << _triconn[face*3+2] << endl;
109 nfaces = _quadconn.size()/4;
111 Ouf << setw(12) << nfaces << endl
112 << setw(12) << _ngquad << endl;
113 while(face < nfaces){
114 Ouf << setw(12) << _quadconn[face*4]
115 << setw(12) << _quadconn[face*4+1]
116 << setw(12) << _quadconn[face*4+2]
117 << setw(12) << _quadconn[face*4+3] << endl;
131 Inf.read(reinterpret_cast<char *>(&nlocal_patches),4);
132 _patches.resize(nlocal_patches);
134 while(bound < nlocal_patches){
146 Inf >> nlocal_patches;
147 _patches.resize(nlocal_patches);
149 while(bound < nlocal_patches){
161 Ouf << setw(12) << _patches.size() << endl;
162 unsigned int bound = 0;
163 while(bound < _patches.size()){
175 Inf.read(reinterpret_cast<char *>(buf),16);
181 _bnodes.resize(nnodes);
182 int *nbuf =
new int [2 * nnodes];
183 Inf.read(reinterpret_cast<char *>(nbuf),8*nnodes);
186 while(node < nnodes){
187 _bnodes[node] = make_pair(nbuf[2*node],nbuf[2*node+1]);
192 Inf.read(reinterpret_cast<char *>(buf),8);
195 _btets.resize(nelem);
196 nbuf =
new int [2*nelem];
197 Inf.read(reinterpret_cast<char *>(nbuf),nelem*8);
200 _btets[elem] = make_pair(nbuf[2*elem],nbuf[2*elem+1]);
205 Inf.read(reinterpret_cast<char *>(buf),8);
209 nbuf =
new int [2*nelem];
210 Inf.read(reinterpret_cast<char *>(nbuf),nelem*8);
213 _bpyr[elem] = make_pair(nbuf[2*elem],nbuf[2*elem+1]);
218 Inf.read(reinterpret_cast<char *>(buf),8);
221 _bpris.resize(nelem);
222 nbuf =
new int [2*nelem];
223 Inf.read(reinterpret_cast<char *>(nbuf),nelem*8);
226 _bpris[elem] = make_pair(nbuf[2*elem],nbuf[2*elem+1]);
231 Inf.read(reinterpret_cast<char *>(buf),8);
235 nbuf =
new int [2*nelem];
236 Inf.read(reinterpret_cast<char *>(nbuf),nelem*8);
239 _bhex[elem] = make_pair(nbuf[2*elem],nbuf[2*elem+1]);
251 Inf >> _rpart >> _rbid >> nnodes >> _ngnodes;
253 _bnodes.resize(nnodes);
256 while(node < nnodes){
258 _bnodes[node++] = make_pair(l,r);
262 Inf >> nelem >> _ngtets;
263 _btets.resize(nelem);
267 _btets[elem++] = make_pair(l,r);
271 Inf >> nelem >> _ngpyr;
276 _bpyr[elem++] = make_pair(l,r);
280 Inf >> nelem >> _ngpris;
281 _bpris.resize(nelem);
285 _bpris[elem++] = make_pair(l,r);
289 Inf >> nelem >> _nghex;
294 _bhex[elem++] = make_pair(l,r);
303 unsigned int nelem = _bnodes.size();
304 Ouf << setw(12) << _rpart-1 << endl
305 << setw(12) << _rbid << endl
306 << setw(12) << nelem << endl
307 << setw(12) << _ngnodes << endl;
308 unsigned int node = 0;
310 Ouf << setw(12) << _bnodes[node].first
311 << setw(12) << _bnodes[node].second
315 nelem = _btets.size();
316 Ouf << setw(12) << nelem << endl
317 << setw(12) << _ngtets << endl;
318 unsigned int elem = 0;
320 Ouf << setw(12) << _btets[elem].first
321 << setw(12) << _btets[elem].second
326 nelem = _bpyr.size();
327 Ouf << setw(12) << nelem << endl
328 << setw(12) << _ngpyr << endl;
331 Ouf << setw(12) << _bpyr[elem].first
332 << setw(12) << _bpyr[elem].second
336 nelem = _bpris.size();
337 Ouf << setw(12) << nelem << endl
338 << setw(12) << _ngpris << endl;
341 Ouf << setw(12) << _bpris[elem].first
342 << setw(12) << _bpris[elem].second
346 nelem = _bhex.size();
347 Ouf << setw(12) << nelem << endl
348 << setw(12) << _nghex << endl;
351 Ouf << setw(12) << _bhex[elem].first
352 << setw(12) << _bhex[elem].second
362 int nbound = _boundaries.size();
364 while(bound < nbound){
376 int nbound = _boundaries.size();
378 while(bound < nbound){
389 int nbound = _boundaries.size();
391 while(bound < nbound){
407 Ostr << pre <<
"." <<
rank;
408 Inf.open(Ostr.str().c_str());
409 if(!Inf)
return(
false);
413 Inf.read(reinterpret_cast<char *>(&buf[0]),8);
414 this->_nnodes = buf[0];
415 cout <<
"buf[0] = " << buf[0] << endl;
416 this->_ngnodes = buf[1];
418 Inf.seekg(this->_nnodes * 3 * 4,ios::cur);
419 Inf.read(reinterpret_cast<char *>(buf),8);
420 this->_ntet = buf[0];
421 this->_ngtet = buf[1];
423 Inf.seekg(this->_ntet * 4 * 4,ios::cur);
424 Inf.read(reinterpret_cast<char *>(buf),8);
425 this->_npyr = buf[0];
426 this->_ngpyr = buf[1];
428 Inf.seekg(this->_npyr * 5 * 4,ios::cur);
429 Inf.read(reinterpret_cast<char *>(buf),8);
430 this->_npris = buf[0];
431 this->_ngpris = buf[1];
433 Inf.seekg(this->_npris * 6 * 4,ios::cur);
434 Inf.read(reinterpret_cast<char *>(buf),8);
435 this->_nhex = buf[0];
436 this->_nghex = buf[1];
438 Inf.seekg(this->_nhex * 8 * 4,ios::cur);
439 this->_nelem = this->_nhex + this->_ntet + this->_npyr + this->_npris;
441 Inf.read(reinterpret_cast<char *>(&nbound),4);
442 _boundaries.resize(nbound);
443 if(!ReadPartitionBoundaries(Inf))
445 if(!ReadPartitionPatches(Inf))
457 Ostr << pre <<
"." << rank <<
".asc";
458 Inf.open(Ostr.str().c_str());
460 cerr <<
"Cannot open " << Ostr.str() <<
"." << endl;
465 unsigned int nvfaces,nbfaces;
466 Inf >> nvfaces >> nbfaces >> _nnodes >> _ngnodes;
467 _nvface = nvfaces + nbfaces;
468 unsigned int node = 0;
469 _nc.resize(3*_nnodes);
470 while(node < _nnodes){
471 Inf >> _nc[3*node] >> _nc[3*node+1] >> _nc[3*node+2];
474 Inf >> _ntet >> _ngtet;
475 unsigned int tet = 0;
476 _tetconn.resize(4*_ntet);
478 Inf >> _tetconn[4*tet] >> _tetconn[4*tet+1] >> _tetconn[4*tet+2]
479 >> _tetconn[4*tet+3];
482 Inf >> _npyr >> _ngpyr;
483 unsigned int pyr = 0;
484 _pyrconn.resize(5*_npyr);
486 Inf >> _pyrconn[5*pyr] >> _pyrconn[5*pyr+1] >> _pyrconn[5*pyr+2]
487 >> _pyrconn[5*pyr+3] >> _pyrconn[5*pyr+4];
491 Inf >> _npris >> _ngpris;
492 unsigned int pris = 0;
493 _prisconn.resize(6*_npris);
494 while(pris < _npris){
495 Inf >> _prisconn[6*pris] >> _prisconn[6*pris+1] >> _prisconn[6*pris+2]
496 >> _prisconn[6*pris+3] >> _prisconn[6*pris+4]
497 >> _prisconn[6*pris+5];
501 Inf >> _nhex >> _nghex;
502 unsigned int hex = 0;
503 _hexconn.resize(8*_nhex);
505 Inf >> _hexconn[8*hex] >> _hexconn[8*hex+1] >> _hexconn[8*hex+2]
506 >> _hexconn[8*hex+3] >> _hexconn[8*hex+4]
507 >> _hexconn[8*hex+5] >> _hexconn[8*hex+6] >> _hexconn[8*hex+7];
510 _nelem = _nhex + _ntet + _npyr + _npris;
511 unsigned int nbound = 0;
513 _boundaries.resize(nbound);
514 if(!ReadPartitionBoundariesASCII(Inf))
516 if(!ReadPartitionPatchesASCII(Inf))
525 unsigned int index = 0;
526 unsigned int npb = Pconn[index++];
528 _boundaries.resize(npb);
531 unsigned int pb_index = 0;
532 while(pb_index < npb){
534 unsigned int pane_id = Pconn[index++];
538 unsigned int nshared = Pconn[index++];
540 unsigned int node = 0;
541 while(node < nshared)
548 while(pb_index < npb){
550 unsigned int pane_id = Pconn[index++];
551 assert(pb.
_rpart == pane_id/100);
552 unsigned int nsend = Pconn[index++];
554 unsigned int node = 0;
562 while(pb_index < npb){
564 unsigned int pane_id = Pconn[index++];
565 assert(pb.
_rpart == pane_id/100);
566 unsigned int nrecv = Pconn[index++];
568 unsigned int node = 0;
578 while(pb_index < npb){
580 unsigned int pane_id = Pconn[index++];
581 assert(pb.
_rpart == pane_id/100);
582 unsigned int nsend = Pconn[index++];
584 unsigned int node = 0;
591 unsigned int ntet = 0;
592 unsigned int npyr = 0;
593 unsigned int npris = 0;
594 unsigned int nhex = 0;
598 else if (pb.
_sendcells[node] <= (_ntet+_npyr))
600 else if (pb.
_sendcells[node] <= (_ntet+_npyr+_npris))
602 else if (pb.
_sendcells[node] <= (_ntet+_npyr+_npris+_nhex))
605 assert(pb.
_sendcells[node] <= (_ntet+_npyr+_npris+_nhex));
620 else if (pb.
_sendcells[node] <= (_ntet+_npyr))
622 else if (pb.
_sendcells[node] <= (_ntet+_npyr+_npris))
636 while(pb_index < npb){
638 unsigned int pane_id = Pconn[index++];
639 assert(pb.
_rpart == pane_id/100);
640 unsigned int nrecv = Pconn[index++];
642 unsigned int node = 0;
649 unsigned int ntet = 0;
650 unsigned int npyr = 0;
651 unsigned int npris = 0;
652 unsigned int nhex = 0;
656 else if (pb.
_recvcells[node] <= (_ntet+_npyr))
658 else if (pb.
_recvcells[node] <= (_ntet+_npyr+_npris))
660 else if (pb.
_recvcells[node] <= (_ntet+_npyr+_npris+_nhex))
663 assert(pb.
_recvcells[node] <= (_ntet+_npyr+_npris+_nhex));
678 else if (pb.
_recvcells[node] <= (_ntet+_npyr))
680 else if (pb.
_recvcells[node] <= (_ntet+_npyr+_npris))
696 Ostr << pre <<
"." << _id-1 <<
".asc";
697 Ouf.open(Ostr.str().c_str());
699 cerr <<
"Cannot open " << Ostr.str() <<
"." << endl;
704 Ouf << setw(12) << _nvface
706 << setw(12) << _nnodes
707 << setw(12) << _ngnodes
709 unsigned int node = 0;
710 while(node < _nnodes){
711 Ouf << setw(20) << _nc[3*node]
712 << setw(20) << _nc[3*node+1]
713 << setw(20) << _nc[3*node+2]
717 Ouf << setw(12) << _ntet
718 << setw(12) << _ngtet
720 unsigned int tet = 0;
722 Ouf << setw(12) << _tetconn[4*tet]
723 << setw(12) << _tetconn[4*tet+1]
724 << setw(12) << _tetconn[4*tet+2]
725 << setw(12) << _tetconn[4*tet+3]
729 Ouf << setw(12) << _npyr
730 << setw(12) << _ngpyr
732 unsigned int pyr = 0;
734 Ouf << setw(12) << _pyrconn[5*pyr]
735 << setw(12) << _pyrconn[5*pyr+1]
736 << setw(12) << _pyrconn[5*pyr+2]
737 << setw(12) << _pyrconn[5*pyr+3]
738 << setw(12) << _pyrconn[5*pyr+4]
743 Ouf << setw(12) << _npris
744 << setw(12) << _ngpris
746 unsigned int pris = 0;
747 while(pris < _npris){
748 Ouf << setw(12) << _prisconn[6*pris]
749 << setw(12) << _prisconn[6*pris+1]
750 << setw(12) << _prisconn[6*pris+2]
751 << setw(12) << _prisconn[6*pris+3]
752 << setw(12) << _prisconn[6*pris+4]
753 << setw(12) << _prisconn[6*pris+5]
758 Ouf << setw(12) << _nhex
759 << setw(12) << _nghex
761 unsigned int hex = 0;
763 Ouf << setw(12) << _hexconn[8*hex]
764 << setw(12) << _hexconn[8*hex+1]
765 << setw(12) << _hexconn[8*hex+2]
766 << setw(12) << _hexconn[8*hex+3]
767 << setw(12) << _hexconn[8*hex+4]
768 << setw(12) << _hexconn[8*hex+5]
769 << setw(12) << _hexconn[8*hex+6]
770 << setw(12) << _hexconn[8*hex+7]
774 Ouf << _boundaries.size() << endl;
775 if(!WritePartitionBoundariesASCII(Ouf))
777 if(!WritePartitionPatchesASCII(Ouf))
786 vector<pair<unsigned int,unsigned int> >::const_iterator vi =
v.begin();
787 while(vi !=
v.end()){
788 cerr << vi->first <<
" " << vi->second << endl;
799 cerr <<
"PartitionBoundary::populate_local_arrays entry" << endl;
801 unsigned int nnodes = _bnodes.size();
803 unsigned int nreal = _bnodes.size() - _ngnodes;
805 unsigned int nremote_gnodes = rpb.
_ngnodes;
807 unsigned int nshared = nreal - nremote_gnodes;
809 unsigned int nremote_rnodes = rpb.
_bnodes.size() - nremote_gnodes;
811 unsigned int nsend = nreal - nshared;
812 assert(nsend == nremote_gnodes);
813 _recvnodes.resize(_ngnodes);
814 _sharenodes.resize(nshared);
815 _sendnodes.resize(nsend);
836 vector<pair<unsigned int,unsigned int> > recv_iindex;
837 vector<pair<unsigned int,unsigned int> > shared_iindex;
838 recv_iindex.resize(_ngnodes);
839 shared_iindex.resize(nshared);
840 unsigned int node = 0;
841 unsigned int shnode = 0;
842 unsigned int snode = 0;
843 unsigned int rnode = 0;
844 while(node < nnodes){
847 recv_iindex[rnode++] = make_pair(_bnodes[node].second,
848 _bnodes[node].first);
851 if(_bnodes[node].second > nremote_rnodes)
852 _sendnodes[snode++] = _bnodes[node].first;
855 _sharenodes[shnode++] = _bnodes[node].first;
857 shared_iindex[shnode++] = make_pair(_bnodes[node].second,
858 _bnodes[node].first);
863 sort(recv_iindex.begin(),recv_iindex.end());
866 _recvnodes[node] = recv_iindex[node].second;
871 if(_mypart > _rpart){
873 sort(shared_iindex.begin(),shared_iindex.end());
874 while(node < shnode){
875 _sharenodes[node] = shared_iindex[node].second;
880 cerr <<
"PartitionBoundary::populate_local_arrays: Beginning elements."
884 unsigned int ntets = _btets.size();
885 unsigned int nhex = _bhex.size();
886 unsigned int npyr = _bpyr.size();
887 unsigned int npris = _bpris.size();
888 unsigned int nreal_tets = ntets - _ngtets;
889 unsigned int nreal_hex = nhex - _nghex;
890 unsigned int nreal_pyr = npyr - _ngpyr;
891 unsigned int nreal_pris = npris - _ngpris;
892 _belem_send[0].resize(nreal_tets);
893 _belem_send[1].resize(nreal_pyr);
894 _belem_send[2].resize(nreal_pris);
895 _belem_send[3].resize(nreal_hex);
896 _belem_recv[0].resize(_ngtets);
897 _belem_recv[1].resize(_ngpyr);
898 _belem_recv[2].resize(_ngpris);
899 _belem_recv[3].resize(_nghex);
900 _sendcells.resize(nreal_tets+nreal_pyr+nreal_pris+nreal_hex);
901 _recvcells.resize(_ngtets+_ngpyr+_ngpris+_nghex);
902 unsigned int elem = 0;
903 unsigned int selem = 0;
904 unsigned int relem = 0;
905 unsigned int scell = 0;
906 unsigned int rcell = 0;
907 recv_iindex.resize(_ngtets);
909 if(elem < nreal_tets){
910 _belem_send[0][selem++] = _btets[elem].first;
911 _sendcells[scell++] = gp.
Elem2Cell(make_pair((
unsigned int)1,
912 _btets[elem].first));
915 recv_iindex[relem++] = make_pair(_btets[elem].second,
920 sort(recv_iindex.begin(),recv_iindex.end());
922 _belem_recv[0][elem] = recv_iindex[elem].second;
923 _recvcells[rcell++] = gp.
Elem2Cell(make_pair((
unsigned int)1,
924 recv_iindex[elem].second));
927 assert((relem == _ngtets) && (selem == nreal_tets));
931 recv_iindex.resize(_ngpyr);
933 if(elem < nreal_pyr){
934 _belem_send[1][selem++] = _bpyr[elem].first;
935 _sendcells[scell++] = gp.
Elem2Cell(make_pair((
unsigned int)2,
939 recv_iindex[relem++] = make_pair(_bpyr[elem].second,
944 sort(recv_iindex.begin(),recv_iindex.end());
946 _belem_recv[1][elem] = recv_iindex[elem].second;
947 _recvcells[rcell++] = gp.
Elem2Cell(make_pair((
unsigned int)2,
948 recv_iindex[elem].second));
951 assert((relem == _ngpyr) && (selem == nreal_pyr));
955 recv_iindex.resize(_ngpris);
957 if(elem < nreal_pris){
958 _belem_send[2][selem++] = _bpris[elem].first;
959 _sendcells[scell++] = gp.
Elem2Cell(make_pair((
unsigned int)3,
960 _bpris[elem].first));
963 recv_iindex[relem++] = make_pair(_bpris[elem].second,
968 sort(recv_iindex.begin(),recv_iindex.end());
970 _belem_recv[2][elem] = recv_iindex[elem].second;
971 _recvcells[rcell++] = gp.
Elem2Cell(make_pair((
unsigned int)3,
972 recv_iindex[elem].second));
975 assert((relem == _ngpris) && (selem == nreal_pris));
979 recv_iindex.resize(_nghex);
981 if(elem < nreal_hex){
982 _belem_send[3][selem++] = _bhex[elem].first;
983 _sendcells[scell++] = gp.
Elem2Cell(make_pair((
unsigned int)4,
987 recv_iindex[relem++] = make_pair(_bhex[elem].second,
992 sort(recv_iindex.begin(),recv_iindex.end());
994 _belem_recv[3][elem] = recv_iindex[elem].second;
995 _recvcells[rcell++] = gp.
Elem2Cell(make_pair((
unsigned int)4,
996 recv_iindex[elem].second));
999 assert((relem == _nghex) && (selem == nreal_hex));
1007 unsigned int nnodes = _bnodes.size();
1009 unsigned int nreal = _bnodes.size() - _ngnodes;
1011 unsigned int nremote_gnodes = rpb.
_ngnodes;
1013 unsigned int nshared = nreal - nremote_gnodes;
1015 unsigned int nremote_rnodes = rpb.
_bnodes.size() - nremote_gnodes;
1017 unsigned int nsend = nreal - nshared;
1018 assert(nsend == nremote_gnodes);
1019 _recvnodes.resize(_ngnodes);
1020 _sharenodes.resize(nshared);
1021 _sendnodes.resize(nsend);
1042 vector<pair<unsigned int,unsigned int> > recv_iindex;
1043 vector<pair<unsigned int,unsigned int> > shared_iindex;
1044 recv_iindex.resize(_ngnodes);
1045 shared_iindex.resize(nshared);
1046 unsigned int node = 0;
1047 unsigned int shnode = 0;
1048 unsigned int snode = 0;
1049 unsigned int rnode = 0;
1050 while(node < nnodes){
1053 recv_iindex[rnode++] = make_pair(_bnodes[node].second,
1054 _bnodes[node].first);
1057 if(_bnodes[node].second > nremote_rnodes)
1058 _sendnodes[snode++] = _bnodes[node].first;
1060 if(_mypart < _rpart)
1061 _sharenodes[shnode++] = _bnodes[node].first;
1063 shared_iindex[shnode++] = make_pair(_bnodes[node].second,
1064 _bnodes[node].first);
1069 sort(recv_iindex.begin(),recv_iindex.end());
1071 while(node < rnode){
1072 _recvnodes[node] = recv_iindex[node].second;
1077 if(_mypart > _rpart){
1079 sort(shared_iindex.begin(),shared_iindex.end());
1080 while(node < shnode){
1081 _sharenodes[node] = shared_iindex[node].second;
1088 unsigned int ntets = _btets.size();
1089 unsigned int nhex = _bhex.size();
1090 unsigned int npyr = _bpyr.size();
1091 unsigned int npris = _bpris.size();
1092 unsigned int nreal_tets = ntets - _ngtets;
1093 unsigned int nreal_hex = nhex - _nghex;
1094 unsigned int nreal_pyr = npyr - _ngpyr;
1095 unsigned int nreal_pris = npris - _ngpris;
1096 _belem_send[0].resize(nreal_tets);
1097 _belem_send[1].resize(nreal_pyr);
1098 _belem_send[2].resize(nreal_pris);
1099 _belem_send[3].resize(nreal_hex);
1100 _belem_recv[0].resize(_ngtets);
1101 _belem_recv[1].resize(_ngpyr);
1102 _belem_recv[2].resize(_ngpris);
1103 _belem_recv[3].resize(_nghex);
1104 _sendcells.resize(nreal_tets+nreal_pyr+nreal_pris+nreal_hex);
1105 _recvcells.resize(_ngtets+_ngpyr+_ngpris+_nghex);
1106 unsigned int elem = 0;
1107 unsigned int selem = 0;
1108 unsigned int relem = 0;
1109 unsigned int scell = 0;
1110 unsigned int rcell = 0;
1111 recv_iindex.resize(_ngtets);
1112 while(elem < ntets){
1113 if(elem < nreal_tets){
1114 _belem_send[0][selem++] = _btets[elem].first;
1115 _sendcells[scell++] = _btets[elem].first;
1118 recv_iindex[relem++] = make_pair(_btets[elem].second,
1119 _btets[elem].first);
1123 sort(recv_iindex.begin(),recv_iindex.end());
1124 while(elem < relem){
1125 _belem_recv[0][elem] = recv_iindex[elem].second;
1126 _recvcells[rcell++] = recv_iindex[elem].second;
1129 assert((relem == _ngtets) && (selem == nreal_tets));
1133 recv_iindex.resize(_ngpyr);
1135 if(elem < nreal_pyr){
1136 _belem_send[1][selem++] = _bpyr[elem].first;
1137 _sendcells[scell++] = _bpyr[elem].first + ntets;
1140 recv_iindex[relem++] = make_pair(_bpyr[elem].second,
1145 sort(recv_iindex.begin(),recv_iindex.end());
1146 while(elem < relem){
1147 _belem_recv[1][elem] = recv_iindex[elem].second;
1148 _recvcells[rcell++] = recv_iindex[elem].second + ntets;
1151 assert((relem == _ngpyr) && (selem == nreal_pyr));
1155 recv_iindex.resize(_ngpris);
1156 while(elem < npris){
1157 if(elem < nreal_pris){
1158 _belem_send[2][selem++] = _bpris[elem].first;
1159 _sendcells[scell++] = _bpris[elem].first + ntets + npyr;
1162 recv_iindex[relem++] = make_pair(_bpris[elem].second,
1163 _bpris[elem].first);
1167 sort(recv_iindex.begin(),recv_iindex.end());
1168 while(elem < relem){
1169 _belem_recv[2][elem] = recv_iindex[elem].second;
1170 _recvcells[rcell++] = recv_iindex[elem].second + ntets + npyr;
1173 assert((relem == _ngpris) && (selem == nreal_pris));
1177 recv_iindex.resize(_nghex);
1179 if(elem < nreal_hex){
1180 _belem_send[3][selem++] = _bhex[elem].first;
1181 _sendcells[scell++] = _bhex[elem].first+ntets+npyr+npris;
1184 recv_iindex[relem++] = make_pair(_bhex[elem].second,
1189 sort(recv_iindex.begin(),recv_iindex.end());
1190 while(elem < relem){
1191 _belem_recv[3][elem] = recv_iindex[elem].second;
1192 _recvcells[rcell++] = recv_iindex[elem].second+ntets+npyr+npris;
1195 assert((relem == _nghex) && (selem == nreal_hex));
1210 _patches.resize(_com
1211 reg._domain_b.resize(part._patches.size());
1212 reg._part_b.resize(part._boundaries.size());
1222 unsigned int nbord = reg._part_b.size();
1223 unsigned int bord = 0;
1224 while(bord < nbord){
1227 reg._part_b[bord]._rpbindex = part._boundaries[bord]._rbid;
1228 reg._part_b[bord]._rpart = part._boundaries[bord]._rrank + 1;
1229 reg._part_b[bord]._sendnodes = part._boundaries[bord]._sendnodes;
1230 reg._part_b[bord]._recvnodes = part._boundaries[bord]._recvnodes;
1231 reg._part_b[bord]._sharenodes = part._boundaries[bord]._sharenodes;
1234 unsigned int nsend = 0;
1235 unsigned int nrecv = 0;
1237 unsigned int ntets = part._boundaries[bord]._btets.size();
1238 unsigned int nreal_tets = ntets - part._boundaries[bord]._ngtets;
1239 unsigned int npyrs = part._boundaries[bord]._bpyr.size();
1240 unsigned int nreal_pyrs = npyrs - part._boundaries[bord].
_ngpyr;
1241 unsigned int npriss = part._boundaries[bord]._bpris.size();
1242 unsigned int nreal_priss = npriss - part._boundaries[bord]._ngpris;
1243 unsigned int nhexs = part._boundaries[bord]._bhex.size();
1244 unsigned int nreal_hexs = nhexs - part._boundaries[bord]._nghex;
1246 nsend = nreal_tets + nreal_pyrs + nreal_priss + nreal_hexs;
1247 nrecv = ntets - nreal_tets + npyrs - nreal_pyrs + npriss - nreal_priss
1248 + nhexs - nreal_hexs;
1249 reg._part_b[bord]._sendcells.resize(nsend);
1250 reg._part_b[bord]._recvcells.resize(nrecv);
1252 vector<unsigned int> &sendv = part._boundaries[bord]._belem_send[0];
1253 vector<unsigned int> &recvv = part._boundaries[bord]._belem_recv[0];
1254 vector<unsigned int> ®send = reg._part_b[bord]._sendcells;
1255 vector<unsigned int> ®recv = reg._part_b[bord]._recvcells;
1257 unsigned int sendi = 0;
1258 unsigned int nerecv = ntets - nreal_tets;
1259 unsigned int nesend = nreal_tets;
1260 unsigned int curr_recv_pos = sendi;
1261 unsigned int curr_send_pos = sendi;
1263 while(sendi < nesend)
1264 regsend[curr_send_pos++] = sendv[sendi++];
1266 while(sendi < nerecv)
1267 regrecv[curr_recv_pos++] = recvv[sendi++];
1269 sendv = part._boundaries[bord]._belem_send[1];
1270 recvv = part._boundaries[bord]._belem_recv[1];
1272 nerecv = npyrs - nreal_pyrs;
1273 nesend = nreal_pyrs;
1274 while(sendi < nesend)
1275 regsend[curr_send_pos++] = sendv[sendi++];
1277 while(sendi < nerecv)
1278 regrecv[curr_recv_pos++] = recvv[sendi++];
1280 sendv = part._boundaries[bord]._belem_send[2];
1281 recvv = part._boundaries[bord]._belem_recv[2];
1283 nerecv = npriss - nreal_priss;
1284 nesend = nreal_priss;
1285 while(sendi < nesend)
1286 regsend[curr_send_pos++] = sendv[sendi++];
1288 while(sendi < nerecv)
1289 regrecv[curr_recv_pos++] = recvv[sendi++];
1291 sendv = part._boundaries[bord]._belem_send[3];
1292 recvv = part._boundaries[bord]._belem_recv[3];
1294 nerecv = nhexs - nreal_hexs;
1295 nesend = nreal_hexs;
1296 while(sendi < nesend)
1297 regsend[curr_send_pos++] = sendv[sendi++];
1299 while(sendi < nerecv)
1300 regrecv[curr_recv_pos++] = recvv[sendi++];
1302 assert(curr_recv_pos == regrecv.size() && curr_send_pos == regsend.size());
1307 unsigned int local_patch = 0;
1308 unsigned int nlocal_patches = reg._domain_b.size();
1309 while(local_patch < nlocal_patches){
1311 reg._domain_b[local_patch].
_id = (pp->
_id < 0 ? (-1*pp->
_id) : pp->
_id);
1312 reg._domain_b[local_patch]._ngtri = pp->
_ngtri;
1313 reg._domain_b[local_patch]._ngquad = pp->
_ngquad;
1314 reg._domain_b[local_patch]._triconn = pp->
_triconn;
1315 reg._domain_b[local_patch]._quadconn = pp->
_quadconn;
bool WritePartitionPatchASCII(ofstream &Ouf)
std::vector< unsigned int > _tetconn
bool ReadPartitionPatches(ifstream &Inf)
std::vector< unsigned int > _recvnodes
std::vector< unsigned int > _sendcells
vector< pair< unsigned int, unsigned int > > _bnodes
void report_border_array(const vector< pair< unsigned int, unsigned int > > &v)
bool WritePartitionPatchesASCII(ofstream &Ouf)
std::vector< unsigned int > _quadconn
bool WritePartitionBoundariesASCII(ofstream &Ouf)
std::vector< unsigned int > _sharenodes
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
bool ReadPartitionBoundaryASCII(ifstream &Inf)
std::vector< unsigned int > _recvcells
std::vector< unsigned int > _sendnodes
unsigned int Elem2Cell(std::pair< unsigned int, unsigned int >)
unsigned int MyRank(void) const
bool ReadPartitionPatchesASCII(ifstream &Inf)
std::vector< unsigned int > _triconn
bool BuildPartitionBoundaries(const vector< int > &Pconn)
bool ReadPartitionBoundariesASCII(ifstream &Inf)
std::vector< unsigned int > _pyrconn
bool ReadPartitionPatchASCII(ifstream &Inf)
std::vector< unsigned int > _hexconn
bool ReadPartitionBoundaries(ifstream &Inf)
bool ReadPartitionPatch(ifstream &Inf)
vector< unsigned int > _belem_recv[4]
bool ReadPartition(const string &pre, unsigned int rank)
bool WritePartitionBoundaryASCII(ofstream &Ouf)
void populate_local_arrays(const PartitionBoundary &)
bool ReadPartitionASCII(const string &pre, unsigned int rank)
vector< unsigned int > _belem_send[4]
bool WritePartitionASCII(const string &pre)
std::vector< double > _nc
std::vector< unsigned int > _prisconn
bool ReadPartitionBoundary(ifstream &Inf)