00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "globalMeshData.H"
00028 #include "Time.H"
00029 #include "Pstream.H"
00030 #include "PstreamCombineReduceOps.H"
00031 #include "processorPolyPatch.H"
00032 #include "demandDrivenData.H"
00033 #include "globalPoints.H"
00034
00035 #include "labelIOList.H"
00036 #include "PackedList.H"
00037 #include "mergePoints.H"
00038 #include "matchPoints.H"
00039 #include "OFstream.H"
00040
00041
00042
00043 defineTypeNameAndDebug(Foam::globalMeshData, 0);
00044
00045
00046 const Foam::scalar Foam::globalMeshData::matchTol_ = 1E-8;
00047
00048
00049
00050
00051
00052 void Foam::globalMeshData::initProcAddr()
00053 {
00054 processorPatchIndices_.setSize(mesh_.boundaryMesh().size());
00055 processorPatchIndices_ = -1;
00056
00057 processorPatchNeighbours_.setSize(mesh_.boundaryMesh().size());
00058 processorPatchNeighbours_ = -1;
00059
00060
00061
00062 processorPatches_.setSize(mesh_.boundaryMesh().size());
00063
00064 label nNeighbours = 0;
00065
00066 forAll (mesh_.boundaryMesh(), patchi)
00067 {
00068 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[patchi]))
00069 {
00070 processorPatches_[nNeighbours] = patchi;
00071 processorPatchIndices_[patchi] = nNeighbours++;
00072 }
00073 }
00074 processorPatches_.setSize(nNeighbours);
00075
00076
00077 if (Pstream::parRun())
00078 {
00079
00080 forAll (processorPatches_, i)
00081 {
00082 label patchi = processorPatches_[i];
00083
00084 OPstream toNeighbour
00085 (
00086 Pstream::blocking,
00087 refCast<const processorPolyPatch>
00088 (
00089 mesh_.boundaryMesh()[patchi]
00090 ).neighbProcNo()
00091 );
00092
00093 toNeighbour << processorPatchIndices_[patchi];
00094 }
00095
00096 forAll(processorPatches_, i)
00097 {
00098 label patchi = processorPatches_[i];
00099
00100 IPstream fromNeighbour
00101 (
00102 Pstream::blocking,
00103 refCast<const processorPolyPatch>
00104 (
00105 mesh_.boundaryMesh()[patchi]
00106 ).neighbProcNo()
00107 );
00108
00109 fromNeighbour >> processorPatchNeighbours_[patchi];
00110 }
00111 }
00112 }
00113
00114
00115
00116 void Foam::globalMeshData::countSharedEdges
00117 (
00118 const HashTable<labelList, edge, Hash<edge> >& procSharedEdges,
00119 HashTable<label, edge, Hash<edge> >& globalShared,
00120 label& sharedEdgeI
00121 )
00122 {
00123
00124 for
00125 (
00126 HashTable<labelList, edge, Hash<edge> >::const_iterator iter =
00127 procSharedEdges.begin();
00128 iter != procSharedEdges.end();
00129 ++iter
00130 )
00131 {
00132 const edge& e = iter.key();
00133
00134 HashTable<label, edge, Hash<edge> >::iterator globalFnd =
00135 globalShared.find(e);
00136
00137 if (globalFnd == globalShared.end())
00138 {
00139
00140 if (iter().size() == 1)
00141 {
00142
00143 globalShared.insert(e, -1);
00144 }
00145 else
00146 {
00147
00148
00149 globalShared.insert(e, sharedEdgeI++);
00150 }
00151 }
00152 else
00153 {
00154 if (globalFnd() == -1)
00155 {
00156
00157
00158 globalFnd() = sharedEdgeI++;
00159 }
00160 }
00161 }
00162 }
00163
00164
00165
00166
00167
00168
00169 void Foam::globalMeshData::calcSharedEdges() const
00170 {
00171 if (nGlobalEdges_ != -1 || sharedEdgeLabelsPtr_ || sharedEdgeAddrPtr_)
00172 {
00173 FatalErrorIn("globalMeshData::calcSharedEdges()")
00174 << "Shared edge addressing already done" << abort(FatalError);
00175 }
00176
00177
00178 const labelList& sharedPtAddr = sharedPointAddr();
00179 const labelList& sharedPtLabels = sharedPointLabels();
00180
00181
00182
00183 Map<label> meshToShared(2*sharedPtLabels.size());
00184 forAll(sharedPtLabels, i)
00185 {
00186 meshToShared.insert(sharedPtLabels[i], i);
00187 }
00188
00189
00190
00191
00192 HashTable<labelList, edge, Hash<edge> > localShared
00193 (
00194 2*sharedPtAddr.size()
00195 );
00196
00197 const edgeList& edges = mesh_.edges();
00198
00199 forAll(edges, edgeI)
00200 {
00201 const edge& e = edges[edgeI];
00202
00203 Map<label>::const_iterator e0Fnd = meshToShared.find(e[0]);
00204
00205 if (e0Fnd != meshToShared.end())
00206 {
00207 Map<label>::const_iterator e1Fnd = meshToShared.find(e[1]);
00208
00209 if (e1Fnd != meshToShared.end())
00210 {
00211
00212
00213
00214
00215 edge sharedEdge
00216 (
00217 sharedPtAddr[e0Fnd()],
00218 sharedPtAddr[e1Fnd()]
00219 );
00220
00221 HashTable<labelList, edge, Hash<edge> >::iterator iter =
00222 localShared.find(sharedEdge);
00223
00224 if (iter == localShared.end())
00225 {
00226
00227 localShared.insert(sharedEdge, labelList(1, edgeI));
00228 }
00229 else
00230 {
00231
00232 labelList& edgeLabels = iter();
00233
00234 label sz = edgeLabels.size();
00235 edgeLabels.setSize(sz+1);
00236 edgeLabels[sz] = edgeI;
00237 }
00238 }
00239 }
00240 }
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 HashTable<label, edge, Hash<edge> > globalShared(nGlobalPoints());
00253
00254 if (Pstream::master())
00255 {
00256 label sharedEdgeI = 0;
00257
00258
00259 if (debug)
00260 {
00261 Pout<< "globalMeshData::calcSharedEdges : Merging in from proc0 : "
00262 << localShared.size() << endl;
00263 }
00264 countSharedEdges(localShared, globalShared, sharedEdgeI);
00265
00266
00267 if (Pstream::parRun())
00268 {
00269 for
00270 (
00271 int slave=Pstream::firstSlave();
00272 slave<=Pstream::lastSlave();
00273 slave++
00274 )
00275 {
00276
00277 IPstream fromSlave(Pstream::blocking, slave);
00278 HashTable<labelList, edge, Hash<edge> > procSharedEdges
00279 (
00280 fromSlave
00281 );
00282
00283 if (debug)
00284 {
00285 Pout<< "globalMeshData::calcSharedEdges : "
00286 << "Merging in from proc"
00287 << Foam::name(slave) << " : " << procSharedEdges.size()
00288 << endl;
00289 }
00290 countSharedEdges(procSharedEdges, globalShared, sharedEdgeI);
00291 }
00292 }
00293
00294
00295
00296
00297 {
00298 HashTable<label, edge, Hash<edge> > oldSharedEdges(globalShared);
00299
00300 globalShared.clear();
00301
00302 for
00303 (
00304 HashTable<label, edge, Hash<edge> >::const_iterator iter =
00305 oldSharedEdges.begin();
00306 iter != oldSharedEdges.end();
00307 ++iter
00308 )
00309 {
00310 if (iter() != -1)
00311 {
00312 globalShared.insert(iter.key(), iter());
00313 }
00314 }
00315 if (debug)
00316 {
00317 Pout<< "globalMeshData::calcSharedEdges : Filtered "
00318 << oldSharedEdges.size()
00319 << " down to " << globalShared.size() << endl;
00320 }
00321 }
00322
00323
00324
00325 if (Pstream::parRun())
00326 {
00327 for
00328 (
00329 int slave=Pstream::firstSlave();
00330 slave<=Pstream::lastSlave();
00331 slave++
00332 )
00333 {
00334
00335 OPstream toSlave(Pstream::blocking, slave);
00336 toSlave << globalShared;
00337 }
00338 }
00339 }
00340 else
00341 {
00342
00343 {
00344 OPstream toMaster(Pstream::blocking, Pstream::masterNo());
00345
00346 toMaster << localShared;
00347 }
00348
00349 {
00350 IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
00351
00352 fromMaster >> globalShared;
00353 }
00354 }
00355
00356
00357
00358
00359 nGlobalEdges_ = globalShared.size();
00360
00361 DynamicList<label> dynSharedEdgeLabels(globalShared.size());
00362 DynamicList<label> dynSharedEdgeAddr(globalShared.size());
00363
00364 for
00365 (
00366 HashTable<labelList, edge, Hash<edge> >::const_iterator iter =
00367 localShared.begin();
00368 iter != localShared.end();
00369 ++iter
00370 )
00371 {
00372 const edge& e = iter.key();
00373
00374 HashTable<label, edge, Hash<edge> >::const_iterator edgeFnd =
00375 globalShared.find(e);
00376
00377 if (edgeFnd != globalShared.end())
00378 {
00379
00380
00381 const labelList& edgeLabels = iter();
00382
00383 forAll(edgeLabels, i)
00384 {
00385
00386 dynSharedEdgeLabels.append(edgeLabels[i]);
00387
00388
00389 dynSharedEdgeAddr.append(edgeFnd());
00390 }
00391 }
00392 }
00393
00394 sharedEdgeLabelsPtr_ = new labelList();
00395 labelList& sharedEdgeLabels = *sharedEdgeLabelsPtr_;
00396 sharedEdgeLabels.transfer(dynSharedEdgeLabels);
00397
00398 sharedEdgeAddrPtr_ = new labelList();
00399 labelList& sharedEdgeAddr = *sharedEdgeAddrPtr_;
00400 sharedEdgeAddr.transfer(dynSharedEdgeAddr);
00401
00402 if (debug)
00403 {
00404 Pout<< "globalMeshData : nGlobalEdges_:" << nGlobalEdges_ << nl
00405 << "globalMeshData : sharedEdgeLabels:" << sharedEdgeLabels.size()
00406 << nl
00407 << "globalMeshData : sharedEdgeAddr:" << sharedEdgeAddr.size()
00408 << endl;
00409 }
00410 }
00411
00412
00413
00414
00415
00416
00417 Foam::label Foam::globalMeshData::countCoincidentFaces
00418 (
00419 const scalar tolDim,
00420 const vectorField& separationDist
00421 )
00422 {
00423 label nCoincident = 0;
00424
00425 forAll(separationDist, faceI)
00426 {
00427 if (mag(separationDist[faceI]) < tolDim)
00428 {
00429
00430 nCoincident++;
00431 }
00432 }
00433 return nCoincident;
00434 }
00435
00436
00437
00438
00439
00440 Foam::globalMeshData::globalMeshData(const polyMesh& mesh)
00441 :
00442 processorTopology(mesh.boundaryMesh()),
00443 mesh_(mesh),
00444 bb_(vector::zero, vector::zero),
00445 nTotalPoints_(-1),
00446 nTotalFaces_(-1),
00447 nTotalCells_(-1),
00448 processorPatches_(0),
00449 processorPatchIndices_(0),
00450 processorPatchNeighbours_(0),
00451 nGlobalPoints_(-1),
00452 sharedPointLabels_(0),
00453 sharedPointAddr_(0),
00454 sharedPointGlobalLabelsPtr_(NULL),
00455 nGlobalEdges_(-1),
00456 sharedEdgeLabelsPtr_(NULL),
00457 sharedEdgeAddrPtr_(NULL)
00458 {
00459 updateMesh();
00460 }
00461
00462
00463
00464 Foam::globalMeshData::globalMeshData(const IOobject& io, const polyMesh& mesh)
00465 :
00466 processorTopology(mesh.boundaryMesh()),
00467 mesh_(mesh),
00468 bb_(mesh.points()),
00469 nTotalPoints_(-1),
00470 nTotalFaces_(-1),
00471 nTotalCells_(-1),
00472 processorPatches_(0),
00473 processorPatchIndices_(0),
00474 processorPatchNeighbours_(0),
00475 nGlobalPoints_(-1),
00476 sharedPointLabels_(0),
00477 sharedPointAddr_(0),
00478 sharedPointGlobalLabelsPtr_(NULL),
00479 nGlobalEdges_(-1),
00480 sharedEdgeLabelsPtr_(NULL),
00481 sharedEdgeAddrPtr_(NULL)
00482 {
00483 initProcAddr();
00484
00485 IOdictionary dict(io);
00486
00487 dict.lookup("nTotalPoints") >> nTotalPoints_;
00488 dict.lookup("nTotalFaces") >> nTotalFaces_;
00489 dict.lookup("nTotalCells") >> nTotalCells_;
00490 dict.lookup("nGlobalPoints") >> nGlobalPoints_;
00491 dict.lookup("sharedPointLabels") >> sharedPointLabels_;
00492 dict.lookup("sharedPointAddr") >> sharedPointAddr_;
00493 labelList sharedPointGlobalLabels(dict.lookup("sharedPointGlobalLabels"));
00494
00495 sharedPointGlobalLabelsPtr_ = new labelList(sharedPointGlobalLabels);
00496 }
00497
00498
00499
00500
00501 Foam::globalMeshData::~globalMeshData()
00502 {
00503 clearOut();
00504 }
00505
00506
00507 void Foam::globalMeshData::clearOut()
00508 {
00509 deleteDemandDrivenData(sharedPointGlobalLabelsPtr_);
00510
00511 nGlobalPoints_ = -1;
00512 deleteDemandDrivenData(sharedEdgeLabelsPtr_);
00513 deleteDemandDrivenData(sharedEdgeAddrPtr_);
00514 }
00515
00516
00517
00518
00519
00520 const Foam::labelList& Foam::globalMeshData::sharedPointGlobalLabels() const
00521 {
00522 if (!sharedPointGlobalLabelsPtr_)
00523 {
00524 sharedPointGlobalLabelsPtr_ = new labelList(sharedPointLabels_.size());
00525 labelList& sharedPointGlobalLabels = *sharedPointGlobalLabelsPtr_;
00526
00527 IOobject addrHeader
00528 (
00529 "pointProcAddressing",
00530 mesh_.facesInstance()/mesh_.meshSubDir,
00531 mesh_,
00532 IOobject::MUST_READ
00533 );
00534
00535 if (addrHeader.headerOk())
00536 {
00537
00538
00539 Pout<< "globalMeshData::sharedPointGlobalLabels : "
00540 << "Reading pointProcAddressing" << endl;
00541
00542 labelIOList pointProcAddressing(addrHeader);
00543
00544 forAll(sharedPointLabels_, i)
00545 {
00546
00547 label pointI = sharedPointLabels_[i];
00548
00549
00550 sharedPointGlobalLabels[i] = pointProcAddressing[pointI];
00551 }
00552 }
00553 else
00554 {
00555 Pout<< "globalMeshData::sharedPointGlobalLabels :"
00556 << " Setting pointProcAddressing to -1" << endl;
00557
00558 sharedPointGlobalLabels = -1;
00559 }
00560 }
00561 return *sharedPointGlobalLabelsPtr_;
00562 }
00563
00564
00565
00566 Foam::pointField Foam::globalMeshData::sharedPoints() const
00567 {
00568
00569
00570
00571 pointField sharedPoints(nGlobalPoints_);
00572
00573 if (Pstream::master())
00574 {
00575
00576
00577 forAll(sharedPointLabels_, i)
00578 {
00579 label sharedPointI = sharedPointAddr_[i];
00580
00581 sharedPoints[sharedPointI] = mesh_.points()[sharedPointLabels_[i]];
00582 }
00583
00584
00585 for
00586 (
00587 int slave=Pstream::firstSlave();
00588 slave<=Pstream::lastSlave();
00589 slave++
00590 )
00591 {
00592 IPstream fromSlave(Pstream::blocking, slave);
00593
00594 labelList nbrSharedPointAddr;
00595 pointField nbrSharedPoints;
00596 fromSlave >> nbrSharedPointAddr >> nbrSharedPoints;
00597
00598 forAll(nbrSharedPointAddr, i)
00599 {
00600 label sharedPointI = nbrSharedPointAddr[i];
00601
00602 sharedPoints[sharedPointI] = nbrSharedPoints[i];
00603 }
00604 }
00605
00606
00607 for
00608 (
00609 int slave=Pstream::firstSlave();
00610 slave<=Pstream::lastSlave();
00611 slave++
00612 )
00613 {
00614 OPstream toSlave
00615 (
00616 Pstream::blocking,
00617 slave,
00618 sharedPoints.size()*sizeof(vector::zero)
00619 );
00620 toSlave << sharedPoints;
00621 }
00622 }
00623 else
00624 {
00625
00626
00627 {
00628 OPstream toMaster(Pstream::blocking, Pstream::masterNo());
00629
00630 toMaster
00631 << sharedPointAddr_
00632 << UIndirectList<point>(mesh_.points(), sharedPointLabels_)();
00633 }
00634
00635
00636 {
00637 IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
00638 fromMaster >> sharedPoints;
00639 }
00640 }
00641
00642 return sharedPoints;
00643 }
00644
00645
00646
00647 Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
00648 {
00649
00650 pointField sharedPoints(sharedPointLabels_.size());
00651
00652 forAll(sharedPointLabels_, i)
00653 {
00654 label meshPointI = sharedPointLabels_[i];
00655
00656 sharedPoints[i] = mesh_.points()[meshPointI];
00657 }
00658
00659
00660 combineReduce(sharedPoints, plusEqOp<pointField>());
00661
00662
00663 scalar tolDim = matchTol_ * bb_.mag();
00664
00665
00666 labelList pMap;
00667 pointField mergedPoints;
00668
00669 mergePoints
00670 (
00671 sharedPoints,
00672 tolDim,
00673 false,
00674 pMap,
00675 mergedPoints
00676 );
00677
00678 return mergedPoints;
00679 }
00680
00681
00682 Foam::label Foam::globalMeshData::nGlobalEdges() const
00683 {
00684 if (nGlobalEdges_ == -1)
00685 {
00686 calcSharedEdges();
00687 }
00688 return nGlobalEdges_;
00689 }
00690
00691
00692 const Foam::labelList& Foam::globalMeshData::sharedEdgeLabels() const
00693 {
00694 if (!sharedEdgeLabelsPtr_)
00695 {
00696 calcSharedEdges();
00697 }
00698 return *sharedEdgeLabelsPtr_;
00699 }
00700
00701
00702 const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
00703 {
00704 if (!sharedEdgeAddrPtr_)
00705 {
00706 calcSharedEdges();
00707 }
00708 return *sharedEdgeAddrPtr_;
00709 }
00710
00711
00712 void Foam::globalMeshData::movePoints(const pointField& newPoints)
00713 {
00714
00715
00716 }
00717
00718
00719
00720 void Foam::globalMeshData::updateMesh()
00721 {
00722
00723 clearOut();
00724
00725
00726 initProcAddr();
00727
00728
00729 bb_ = boundBox(mesh_.points());
00730
00731 scalar tolDim = matchTol_ * bb_.mag();
00732
00733 if (debug)
00734 {
00735 Pout<< "globalMeshData : bb_:" << bb_
00736 << " merge dist:" << tolDim << endl;
00737 }
00738
00739
00740
00741 {
00742
00743 globalPoints parallelPoints(mesh_);
00744
00745
00746 nGlobalPoints_ = parallelPoints.nGlobalPoints();
00747 sharedPointLabels_ = parallelPoints.sharedPointLabels();
00748 sharedPointAddr_ = parallelPoints.sharedPointAddr();
00749 }
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767 nTotalFaces_ = mesh_.nFaces();
00768
00769
00770 forAll(processorPatches_, i)
00771 {
00772 label patchI = processorPatches_[i];
00773
00774 const processorPolyPatch& procPatch =
00775 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
00776
00777 if (Pstream::myProcNo() > procPatch.neighbProcNo())
00778 {
00779
00780
00781 if (procPatch.separated())
00782 {
00783 const vectorField& separationDist = procPatch.separation();
00784
00785 nTotalFaces_ -= countCoincidentFaces(tolDim, separationDist);
00786 }
00787 else
00788 {
00789
00790 nTotalFaces_ -= procPatch.size();
00791 }
00792 }
00793 }
00794 reduce(nTotalFaces_, sumOp<label>());
00795
00796 if (debug)
00797 {
00798 Pout<< "globalMeshData : nTotalFaces_:" << nTotalFaces_ << endl;
00799 }
00800
00801
00802 nTotalCells_ = mesh_.nCells();
00803 reduce(nTotalCells_, sumOp<label>());
00804
00805 if (debug)
00806 {
00807 Pout<< "globalMeshData : nTotalCells_:" << nTotalCells_ << endl;
00808 }
00809
00810 nTotalPoints_ = mesh_.nPoints();
00811
00812
00813
00814
00815
00816
00817
00818 if (Pstream::parRun())
00819 {
00820 const label UNSET = 0;
00821 const label SHARED = 1;
00822 const label VISITED = 2;
00823
00824
00825 PackedList<2> pointStatus(mesh_.nPoints(), UNSET);
00826
00827 forAll(sharedPointLabels_, i)
00828 {
00829 label meshPointI = sharedPointLabels_[i];
00830
00831 pointStatus.set(meshPointI, SHARED);
00832 }
00833
00834
00835 forAll(processorPatches_, i)
00836 {
00837 label patchI = processorPatches_[i];
00838
00839 const processorPolyPatch& procPatch =
00840 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
00841
00842 OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo());
00843
00844 toNeighbour << procPatch.localPoints();
00845 }
00846
00847
00848 forAll(processorPatches_, i)
00849 {
00850 label patchI = processorPatches_[i];
00851
00852 const processorPolyPatch& procPatch =
00853 refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
00854
00855 IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo());
00856
00857 pointField nbrPoints(fromNeighbour);
00858
00859 if (Pstream::myProcNo() > procPatch.neighbProcNo())
00860 {
00861 labelList pMap;
00862 matchPoints
00863 (
00864 procPatch.localPoints(),
00865 nbrPoints,
00866 scalarField(procPatch.nPoints(), tolDim),
00867 false,
00868 pMap
00869 );
00870
00871 forAll(pMap, patchPointI)
00872 {
00873 label meshPointI = procPatch.meshPoints()[patchPointI];
00874
00875 label stat = pointStatus.get(meshPointI);
00876
00877 if (stat == UNSET)
00878 {
00879
00880
00881 pointStatus.set(meshPointI, VISITED);
00882
00883 if (pMap[patchPointI] != -1)
00884 {
00885
00886 nTotalPoints_--;
00887 }
00888 }
00889 }
00890 }
00891 }
00892
00893 reduce(nTotalPoints_, sumOp<label>());
00894 }
00895
00896
00897
00898
00899 label mySharedPoints = sharedPointLabels_.size();
00900 reduce(mySharedPoints, sumOp<label>());
00901
00902
00903 pointField geomSharedPoints(geometricSharedPoints());
00904 label nGeomSharedPoints = geomSharedPoints.size();
00905
00906
00907 nTotalPoints_ -= mySharedPoints - nGeomSharedPoints;
00908
00909 if (debug)
00910 {
00911 Pout<< "globalMeshData : nTotalPoints_:" << nTotalPoints_ << endl;
00912 }
00913
00914
00915
00916
00917
00918
00919 if (debug)
00920 {
00921 if (Pstream::master())
00922 {
00923
00924
00925
00926 Pout<< "globalMeshData : writing geometrically separated shared"
00927 << " points to geomSharedPoints.obj" << endl;
00928
00929 OFstream str("geomSharedPoints.obj");
00930
00931 forAll(geomSharedPoints, i)
00932 {
00933 const point& pt = geomSharedPoints[i];
00934
00935 str << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z()
00936 << nl;
00937 }
00938 }
00939 }
00940 }
00941
00942
00943
00944 bool Foam::globalMeshData::write() const
00945 {
00946 IOdictionary dict
00947 (
00948 IOobject
00949 (
00950 "parallelData",
00951 mesh_.facesInstance(),
00952 mesh_.meshSubDir,
00953 mesh_
00954 )
00955 );
00956
00957 dict.add("nTotalPoints", nTotalPoints());
00958 dict.add("nTotalFaces", nTotalFaces());
00959 dict.add("nTotalCells", nTotalCells());
00960
00961 dict.add("nGlobalPoints", nGlobalPoints());
00962 dict.add("sharedPointLabels", sharedPointLabels());
00963 dict.add("sharedPointAddr", sharedPointAddr());
00964 dict.add("sharedPointGlobalLabels", sharedPointGlobalLabels());
00965
00966 return dict.writeObject
00967 (
00968 IOstream::ASCII,
00969 IOstream::currentVersion,
00970 IOstream::UNCOMPRESSED
00971 );
00972 }
00973
00974
00975
00976
00977 Foam::Ostream& Foam::operator<<(Ostream& os, const globalMeshData& p)
00978 {
00979 os << "nTotalPoints " << p.nTotalPoints() << token::END_STATEMENT << nl
00980 << "nTotalFaces " << p.nTotalFaces() << token::END_STATEMENT << nl
00981 << "nTotalCells " << p.nTotalCells() << token::END_STATEMENT << nl
00982 << "nGlobalPoints " << p.nGlobalPoints() << token::END_STATEMENT << nl
00983 << "sharedPointLabels " << p.sharedPointLabels()
00984 << token::END_STATEMENT << nl
00985 << "sharedPointAddr " << p.sharedPointAddr()
00986 << token::END_STATEMENT << endl;
00987
00988 return os;
00989 }
00990
00991
00992