diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 336f32d671..cb96a1e346 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) #include "initContinuityErrs.H" - while (runTime.run()) + while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; @@ -81,8 +81,6 @@ int main(int argc, char *argv[]) #include "convergenceCheck.H" } - runTime++; - runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index ca246cc78b..ea8ffe9469 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -46,9 +46,6 @@ Usage @param -fields \n Use existing geometry decomposition and convert fields only. - @param -filterPatches \n - Remove empty patches when decomposing the geometry. - @param -force \n Remove any existing @a processor subdirectories before decomposing the geometry. @@ -99,11 +96,6 @@ int main(int argc, char *argv[]) "use existing geometry decomposition and convert fields only" ); argList::addBoolOption - ( - "filterPatches", - "remove empty patches when decomposing the geometry" - ); - argList::addBoolOption ( "force", "remove existing processor*/ subdirs before decomposing the geometry" @@ -128,7 +120,6 @@ int main(int argc, char *argv[]) bool writeCellDist = args.optionFound("cellDist"); bool copyUniform = args.optionFound("copyUniform"); bool decomposeFieldsOnly = args.optionFound("fields"); - bool filterPatches = args.optionFound("filterPatches"); bool forceOverwrite = args.optionFound("force"); bool ifRequiredDecomposition = args.optionFound("ifRequired"); @@ -249,7 +240,7 @@ int main(int argc, char *argv[]) // Decompose the mesh if (!decomposeFieldsOnly) { - mesh.decomposeMesh(filterPatches); + mesh.decomposeMesh(); mesh.writeDecomposition(); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index a286a2facf..1fc3560763 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -69,6 +69,24 @@ void Foam::domainDecomposition::mark Foam::domainDecomposition::domainDecomposition(const IOobject& io) : fvMesh(io), + facesInstancePointsPtr_ + ( + pointsInstance() != facesInstance() + ? new pointIOField + ( + IOobject + ( + "points", + facesInstance(), + polyMesh::meshSubDir, + *this, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ) + : NULL + ), decompositionDict_ ( IOobject @@ -86,7 +104,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procPointAddressing_(nProcs_), procFaceAddressing_(nProcs_), procCellAddressing_(nProcs_), - procBoundaryAddressing_(nProcs_), procPatchSize_(nProcs_), procPatchStartIndex_(nProcs_), procNeighbourProcessors_(nProcs_), @@ -263,24 +280,67 @@ bool Foam::domainDecomposition::writeDecomposition() "system", "constant" ); + processorDb.setTime(time()); - // create the mesh - polyMesh procMesh - ( - IOobject + // create the mesh. Two situations: + // - points and faces come from the same time ('instance'). The mesh + // will get constructed in the same instance. + // - points come from a different time (moving mesh cases). + // It will read the points belonging to the faces instance and + // construct the procMesh with it which then gets handled as above. + // (so with 'old' geometry). + // Only at writing time will it additionally write the current + // points. + + autoPtr procMeshPtr; + + if (facesInstancePointsPtr_.valid()) + { + // Construct mesh from facesInstance. + pointField facesInstancePoints ( - this->polyMesh::name(), // region name of undecomposed mesh - pointsInstance(), - processorDb - ), - xferMove(procPoints), - xferMove(procFaces), - xferMove(procCells) - ); + facesInstancePointsPtr_(), + curPointLabels + ); + + procMeshPtr.reset + ( + new polyMesh + ( + IOobject + ( + this->polyMesh::name(), // region of undecomposed mesh + facesInstance(), + processorDb + ), + xferMove(facesInstancePoints), + xferMove(procFaces), + xferMove(procCells) + ) + ); + } + else + { + procMeshPtr.reset + ( + new polyMesh + ( + IOobject + ( + this->polyMesh::name(), // region of undecomposed mesh + facesInstance(), + processorDb + ), + xferMove(procPoints), + xferMove(procFaces), + xferMove(procCells) + ) + ); + } + polyMesh& procMesh = procMeshPtr(); + // Create processor boundary patches - const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI]; - const labelList& curPatchSizes = procPatchSize_[procI]; const labelList& curPatchStarts = procPatchStartIndex_[procI]; @@ -309,8 +369,7 @@ bool Foam::domainDecomposition::writeDecomposition() { // Get the face labels consistent with the field mapping // (reuse the patch field mappers) - const polyPatch& meshPatch = - meshPatches[curBoundaryAddressing[patchi]]; + const polyPatch& meshPatch = meshPatches[patchi]; fvFieldDecomposer::patchFieldDecomposer patchMapper ( @@ -324,14 +383,13 @@ bool Foam::domainDecomposition::writeDecomposition() ); // Map existing patches - procPatches[nPatches] = - meshPatches[curBoundaryAddressing[patchi]].clone - ( - procMesh.boundaryMesh(), - nPatches, - patchMapper.directAddressing(), - curPatchStarts[patchi] - ).ptr(); + procPatches[nPatches] = meshPatch.clone + ( + procMesh.boundaryMesh(), + nPatches, + patchMapper.directAddressing(), + curPatchStarts[patchi] + ).ptr(); nPatches++; } @@ -589,6 +647,26 @@ bool Foam::domainDecomposition::writeDecomposition() procMesh.write(); + // Write points if pointsInstance differing from facesInstance + if (facesInstancePointsPtr_.valid()) + { + pointIOField pointsInstancePoints + ( + IOobject + ( + "points", + pointsInstance(), + polyMesh::meshSubDir, + procMesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + xferMove(procPoints) + ); + pointsInstancePoints.write(); + } + Info<< endl << "Processor " << procI << nl << " Number of cells = " << procMesh.nCells() @@ -678,6 +756,16 @@ bool Foam::domainDecomposition::writeDecomposition() ); cellProcAddressing.write(); + // Write patch map for backwards compatibility. + // (= identity map for original patches, -1 for processor patches) + label nMeshPatches = curPatchSizes.size(); + labelList procBoundaryAddressing(identity(nMeshPatches)); + procBoundaryAddressing.setSize + ( + nMeshPatches+curProcessorPatchSizes.size(), + -1 + ); + labelIOList boundaryProcAddressing ( IOobject @@ -689,7 +777,7 @@ bool Foam::domainDecomposition::writeDecomposition() IOobject::NO_READ, IOobject::NO_WRITE ), - procBoundaryAddressing_[procI] + procBoundaryAddressing ); boundaryProcAddressing.write(); } diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index c8b8d9ac3d..3c87142017 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -55,6 +55,9 @@ class domainDecomposition { // Private data + //- Optional: points at the facesInstance + autoPtr facesInstancePointsPtr_; + //- Mesh decomposition control dictionary IOdictionary decompositionDict_; @@ -83,9 +86,6 @@ class domainDecomposition //- Labels of cells for each processor labelListList procCellAddressing_; - //- Original patch index for every processor patch - labelListList procBoundaryAddressing_; - //- Sizes for processor mesh patches // Excludes inter-processor boundaries labelListList procPatchSize_; @@ -149,8 +149,8 @@ public: return distributed_; } - //- Decompose mesh. Optionally remove zero-sized patches. - void decomposeMesh(const bool filterEmptyPatches); + //- Decompose mesh. + void decomposeMesh(); //- Write decomposition bool writeDecomposition(); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index 644655f0a7..f54eb62a4a 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C @@ -40,7 +40,7 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches) +void Foam::domainDecomposition::decomposeMesh() { // Decide which cell goes to which processor distributeCells(); @@ -598,64 +598,6 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches) } } - Info<< "\nCalculating processor boundary addressing" << endl; - // For every patch of processor boundary, find the index of the original - // patch. Mis-alignment is caused by the fact that patches with zero size - // are omitted. For processor patches, set index to -1. - // At the same time, filter the procPatchSize_ and procPatchStartIndex_ - // lists to exclude zero-size patches - forAll(procPatchSize_, procI) - { - // Make a local copy of old lists - const labelList oldPatchSizes = procPatchSize_[procI]; - - const labelList oldPatchStarts = procPatchStartIndex_[procI]; - - labelList& curPatchSizes = procPatchSize_[procI]; - - labelList& curPatchStarts = procPatchStartIndex_[procI]; - - const labelList& curProcessorPatchSizes = - procProcessorPatchSize_[procI]; - - labelList& curBoundaryAddressing = procBoundaryAddressing_[procI]; - - curBoundaryAddressing.setSize - ( - oldPatchSizes.size() - + curProcessorPatchSizes.size() - ); - - label nPatches = 0; - - forAll(oldPatchSizes, patchi) - { - if (!filterEmptyPatches || oldPatchSizes[patchi] > 0) - { - curBoundaryAddressing[nPatches] = patchi; - - curPatchSizes[nPatches] = oldPatchSizes[patchi]; - - curPatchStarts[nPatches] = oldPatchStarts[patchi]; - - nPatches++; - } - } - - // reset to the size of live patches - curPatchSizes.setSize(nPatches); - curPatchStarts.setSize(nPatches); - - forAll(curProcessorPatchSizes, procPatchI) - { - curBoundaryAddressing[nPatches] = -1; - - nPatches++; - } - - curBoundaryAddressing.setSize(nPatches); - } - Info<< "\nDistributing points to processors" << endl; // For every processor, loop through the list of faces for the processor. // For every face, loop through the list of points and mark the point as diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index c58cd63e85..4e566e1376 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -35,6 +35,10 @@ License #include "IOmanip.H" #include "itoa.H" #include "ensightWriteBinary.H" +#include "globalIndex.H" +#include "PackedBoolList.H" +#include "mapDistribute.H" + #include // * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * // @@ -106,7 +110,8 @@ Foam::ensightMesh::ensightMesh { allPatchNames_ = wordList::subList ( - mesh_.boundaryMesh().names(), mesh_.boundary().size() + mesh_.boundaryMesh().names(), + mesh_.boundary().size() - mesh_.globalData().processorPatches().size() ); @@ -295,6 +300,114 @@ Foam::ensightMesh::~ensightMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::globalIndex Foam::ensightMesh::mergeMeshPoints +( + labelList& pointToGlobal, + pointField& uniquePoints +) const +{ + const globalMeshData& globalData = mesh_.globalData(); + const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch(); + const labelListList& globalPointSlaves = + globalData.globalPointSlaves(); + const mapDistribute& globalPointSlavesMap = + globalData.globalPointSlavesMap(); + + + // 1. Count number of masters on my processor. + label nCoupledMaster = 0; + PackedBoolList isMaster(mesh_.nPoints(), 1); + forAll(globalPointSlaves, pointI) + { + const labelList& slavePoints = globalPointSlaves[pointI]; + + if (slavePoints.size() > 0) + { + nCoupledMaster++; + } + else + { + isMaster[coupledPatch.meshPoints()[pointI]] = 0; + } + } + + label myUniquePoints = + mesh_.nPoints() + - coupledPatch.nPoints() + + nCoupledMaster; + + //Pout<< "Points :" << nl + // << " mesh : " << mesh_.nPoints() << nl + // << " of which coupled : " << coupledPatch.nPoints() << nl + // << " of which master : " << nCoupledMaster << nl + // << endl; + + + // 2. Create global indexing for unique points. + globalIndex globalPoints(myUniquePoints); + + + // 3. Assign global point numbers. Keep slaves unset. + pointToGlobal.setSize(mesh_.nPoints()); + pointToGlobal = -1; + uniquePoints.setSize(myUniquePoints); + label nMaster = 0; + + forAll(isMaster, meshPointI) + { + if (isMaster[meshPointI]) + { + pointToGlobal[meshPointI] = globalPoints.toGlobal(nMaster); + uniquePoints[nMaster] = mesh_.points()[meshPointI]; + nMaster++; + } + } + + + // 4. Push global index for coupled points to slaves. + { + labelList masterToGlobal(globalPointSlavesMap.constructSize(), -1); + + forAll(globalPointSlaves, pointI) + { + const labelList& slaves = globalPointSlaves[pointI]; + + if (slaves.size() > 0) + { + // Duplicate master globalpoint into slave slots + label meshPointI = coupledPatch.meshPoints()[pointI]; + masterToGlobal[pointI] = pointToGlobal[meshPointI]; + forAll(slaves, i) + { + masterToGlobal[slaves[i]] = masterToGlobal[pointI]; + } + } + } + + // Send back + globalPointSlavesMap.reverseDistribute + ( + coupledPatch.nPoints(), + masterToGlobal + ); + + // On slave copy master index into overall map. + forAll(globalPointSlaves, pointI) + { + const labelList& slaves = globalPointSlaves[pointI]; + + if (slaves.size() == 0) + { + label meshPointI = coupledPatch.meshPoints()[pointI]; + pointToGlobal[meshPointI] = masterToGlobal[pointI]; + } + } + } + + return globalPoints; +} + + void Foam::ensightMesh::writePoints ( const scalarField& pointsComponent, @@ -311,7 +424,8 @@ void Foam::ensightMesh::writePoints Foam::cellShapeList Foam::ensightMesh::map ( const cellShapeList& cellShapes, - const labelList& prims + const labelList& prims, + const labelList& pointToGlobal ) const { cellShapeList mcsl(prims.size()); @@ -319,6 +433,7 @@ Foam::cellShapeList Foam::ensightMesh::map forAll(prims, i) { mcsl[i] = cellShapes[prims[i]]; + inplaceRenumber(pointToGlobal, mcsl[i]); } return mcsl; @@ -329,7 +444,8 @@ Foam::cellShapeList Foam::ensightMesh::map ( const cellShapeList& cellShapes, const labelList& hexes, - const labelList& wedges + const labelList& wedges, + const labelList& pointToGlobal ) const { cellShapeList mcsl(hexes.size() + wedges.size()); @@ -337,6 +453,7 @@ Foam::cellShapeList Foam::ensightMesh::map forAll(hexes, i) { mcsl[i] = cellShapes[hexes[i]]; + inplaceRenumber(pointToGlobal, mcsl[i]); } label offset = hexes.size(); @@ -358,6 +475,7 @@ Foam::cellShapeList Foam::ensightMesh::map hexLabels[7] = cellPoints[5]; mcsl[i + offset] = cellShape(hex, hexLabels); + inplaceRenumber(pointToGlobal, mcsl[i + offset]); } return mcsl; @@ -367,19 +485,18 @@ Foam::cellShapeList Foam::ensightMesh::map void Foam::ensightMesh::writePrims ( const cellShapeList& cellShapes, - const label pointOffset, OFstream& ensightGeometryFile ) const { - label po = pointOffset + 1; - forAll(cellShapes, i) { const cellShape& cellPoints = cellShapes[i]; forAll(cellPoints, pointI) { - ensightGeometryFile<< setw(10) << cellPoints[pointI] + po; + ensightGeometryFile + << setw(10) + << cellPoints[pointI] + 1; } ensightGeometryFile << nl; } @@ -389,12 +506,9 @@ void Foam::ensightMesh::writePrims void Foam::ensightMesh::writePrimsBinary ( const cellShapeList& cellShapes, - const label pointOffset, std::ofstream& ensightGeometryFile ) const { - label po = pointOffset + 1; - // Create a temp int array int numElem; @@ -414,7 +528,7 @@ void Foam::ensightMesh::writePrimsBinary forAll(cellPoints, pointI) { - temp[n] = cellPoints[pointI] + po; + temp[n] = cellPoints[pointI] + 1; n++; } } @@ -435,11 +549,11 @@ void Foam::ensightMesh::writePolysNFaces OFstream& ensightGeometryFile ) const { - forAll(polys, i) - { - ensightGeometryFile - << setw(10) << cellFaces[polys[i]].size() << nl; - } + forAll(polys, i) + { + ensightGeometryFile + << setw(10) << cellFaces[polys[i]].size() << nl; + } } @@ -469,12 +583,9 @@ void Foam::ensightMesh::writePolysPoints const labelList& polys, const cellList& cellFaces, const faceList& faces, - const label pointOffset, OFstream& ensightGeometryFile ) const { - label po = pointOffset + 1; - forAll(polys, i) { const labelList& cf = cellFaces[polys[i]]; @@ -485,7 +596,7 @@ void Foam::ensightMesh::writePolysPoints forAll(f, pointI) { - ensightGeometryFile << setw(10) << f[pointI] + po; + ensightGeometryFile << setw(10) << f[pointI] + 1; } ensightGeometryFile << nl; } @@ -495,14 +606,19 @@ void Foam::ensightMesh::writePolysPoints void Foam::ensightMesh::writeAllPolys ( - const labelList& pointOffsets, + const labelList& pointToGlobal, OFstream& ensightGeometryFile ) const { if (meshCellSets_.nPolys) { const cellList& cellFaces = mesh_.cells(); - const faceList& faces = mesh_.faces(); + // Renumber faces to use global point numbers + faceList faces(mesh_.faces()); + forAll(faces, i) + { + inplaceRenumber(pointToGlobal, faces[i]); + } if (Pstream::master()) { @@ -541,6 +657,7 @@ void Foam::ensightMesh::writeAllPolys toMaster<< meshCellSets_.polys << cellFaces; } + // Number of points for each face of the above list if (Pstream::master()) { @@ -584,7 +701,6 @@ void Foam::ensightMesh::writeAllPolys meshCellSets_.polys, cellFaces, faces, - 0, ensightGeometryFile ); // Slaves @@ -600,7 +716,6 @@ void Foam::ensightMesh::writeAllPolys polys, cellFaces, faces, - pointOffsets[slave-1], ensightGeometryFile ); } @@ -661,12 +776,9 @@ void Foam::ensightMesh::writePolysPointsBinary const labelList& polys, const cellList& cellFaces, const faceList& faces, - const label pointOffset, std::ofstream& ensightGeometryFile ) const { - label po = pointOffset + 1; - forAll(polys, i) { const labelList& cf = cellFaces[polys[i]]; @@ -677,7 +789,7 @@ void Foam::ensightMesh::writePolysPointsBinary forAll(f, pointI) { - writeEnsDataBinary(f[pointI] + po,ensightGeometryFile); + writeEnsDataBinary(f[pointI] + 1,ensightGeometryFile); } } } @@ -686,14 +798,19 @@ void Foam::ensightMesh::writePolysPointsBinary void Foam::ensightMesh::writeAllPolysBinary ( - const labelList& pointOffsets, + const labelList& pointToGlobal, std::ofstream& ensightGeometryFile ) const { if (meshCellSets_.nPolys) { const cellList& cellFaces = mesh_.cells(); - const faceList& faces = mesh_.faces(); + // Renumber faces to use global point numbers + faceList faces(mesh_.faces()); + forAll(faces, i) + { + inplaceRenumber(pointToGlobal, faces[i]); + } if (Pstream::master()) { @@ -775,7 +892,6 @@ void Foam::ensightMesh::writeAllPolysBinary meshCellSets_.polys, cellFaces, faces, - 0, ensightGeometryFile ); // Slaves @@ -791,7 +907,6 @@ void Foam::ensightMesh::writeAllPolysBinary polys, cellFaces, faces, - pointOffsets[slave-1], ensightGeometryFile ); } @@ -810,7 +925,6 @@ void Foam::ensightMesh::writeAllPrims const char* key, const label nPrims, const cellShapeList& cellShapes, - const labelList& pointOffsets, OFstream& ensightGeometryFile ) const { @@ -820,19 +934,14 @@ void Foam::ensightMesh::writeAllPrims { ensightGeometryFile << key << nl << setw(10) << nPrims << nl; - writePrims(cellShapes, 0, ensightGeometryFile); + writePrims(cellShapes, ensightGeometryFile); for (int slave=1; slave(patchFaces, prims)(), 0, ensightGeometryFile ); @@ -1001,7 +1083,7 @@ void Foam::ensightMesh::writeAllFacePrims else if (&prims != NULL) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(patchFaces, prims); + toMaster<< UIndirectList(patchFaces, prims); } } } @@ -1015,8 +1097,7 @@ void Foam::ensightMesh::writeNSidedNPointsPerFace { forAll(patchFaces, i) { - ensightGeometryFile - << setw(10) << patchFaces[i].size() << nl; + ensightGeometryFile << setw(10) << patchFaces[i].size() << nl; } } @@ -1028,12 +1109,7 @@ void Foam::ensightMesh::writeNSidedPoints OFstream& ensightGeometryFile ) const { - writeFacePrims - ( - patchFaces, - pointOffset, - ensightGeometryFile - ); + writeFacePrims(patchFaces, pointOffset, ensightGeometryFile); } @@ -1062,7 +1138,7 @@ void Foam::ensightMesh::writeAllNSided { writeNSidedNPointsPerFace ( - map(patchFaces, prims), + UIndirectList(patchFaces, prims)(), ensightGeometryFile ); } @@ -1086,7 +1162,7 @@ void Foam::ensightMesh::writeAllNSided else if (&prims != NULL) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(patchFaces, prims); + toMaster<< UIndirectList(patchFaces, prims); } // List of points id for each face @@ -1096,7 +1172,7 @@ void Foam::ensightMesh::writeAllNSided { writeNSidedPoints ( - map(patchFaces, prims), + UIndirectList(patchFaces, prims)(), 0, ensightGeometryFile ); @@ -1122,7 +1198,7 @@ void Foam::ensightMesh::writeAllNSided else if (&prims != NULL) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(patchFaces, prims); + toMaster<< UIndirectList(patchFaces, prims); } } } @@ -1186,7 +1262,7 @@ void Foam::ensightMesh::writeAllNSidedBinary { writeNSidedNPointsPerFaceBinary ( - map(patchFaces, prims), + UIndirectList(patchFaces, prims)(), ensightGeometryFile ); } @@ -1210,7 +1286,7 @@ void Foam::ensightMesh::writeAllNSidedBinary else if (&prims != NULL) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(patchFaces, prims); + toMaster<< UIndirectList(patchFaces, prims); } // List of points id for each face @@ -1220,7 +1296,7 @@ void Foam::ensightMesh::writeAllNSidedBinary { writeNSidedPointsBinary ( - map(patchFaces, prims), + UIndirectList(patchFaces, prims)(), 0, ensightGeometryFile ); @@ -1246,7 +1322,7 @@ void Foam::ensightMesh::writeAllNSidedBinary else if (&prims != NULL) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(patchFaces, prims); + toMaster<< UIndirectList(patchFaces, prims); } } } @@ -1274,7 +1350,7 @@ void Foam::ensightMesh::writeAllFacePrimsBinary { writeFacePrimsBinary ( - map(patchFaces, prims), + UIndirectList(patchFaces, prims)(), 0, ensightGeometryFile ); @@ -1300,7 +1376,7 @@ void Foam::ensightMesh::writeAllFacePrimsBinary else if (&prims != NULL) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< map(patchFaces, prims); + toMaster<< UIndirectList(patchFaces, prims); } } } @@ -1334,9 +1410,22 @@ void Foam::ensightMesh::writeAscii ) const { const Time& runTime = mesh_.time(); - const pointField& points = mesh_.points(); + //const pointField& points = mesh_.points(); const cellShapeList& cellShapes = mesh_.cellShapes(); + // Find global point numbering + labelList pointToGlobal; + pointField uniquePoints; + globalIndex globalPoints + ( + mergeMeshPoints + ( + pointToGlobal, + uniquePoints + ) + ); + + word timeFile = prepend; if (timeIndex == 0) @@ -1382,12 +1471,9 @@ void Foam::ensightMesh::writeAscii << "element id assign" << nl; } - labelList pointOffsets(Pstream::nProcs(), 0); - if (patchNames_.empty()) { - label nPoints = points.size(); - Pstream::gather(nPoints, sumOp