diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index c7f141a8b7..324e7cbad4 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -540,24 +540,15 @@ int main(int argc, char *argv[]) { label nbrProcI = patchToNbrProc[patchI]; - word name = - "procBoundary" - + Foam::name(Pstream::myProcNo()) - + "to" - + Foam::name(nbrProcI); - Pout<< "Adding patch " << patchI - << " name:" << name << " between " << Pstream::myProcNo() << " and " << nbrProcI << endl; - newPatches.append ( new processorPolyPatch ( - name, 0, // size mesh.nFaces(), // start patchI, // index diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 9d3bed8499..3659dcff38 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -955,13 +955,11 @@ void addCoupledPatches } else { - // Rrocessor patch - - word name = - "procBoundary" - + Foam::name(Pstream::myProcNo()) - + "to" - + Foam::name(nbrProcI); + // Processor patch + word name + ( + processorPolyPatch::newName(Pstream::myProcNo(), nbrProcI) + ); sidePatchID[edgeI] = findPatchID(newPatches, name); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 22554a57df..c563b18330 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -1631,10 +1631,7 @@ Foam::label Foam::conformalVoronoiMesh::createPatchInfo if (procUsed[pUI]) { patchNames[nNonProcPatches + procAddI] = - "procBoundary" - + name(Pstream::myProcNo()) - + "to" - + name(pUI); + processorPolyPatch::newName(Pstream::myProcNo(), pUI); patchDicts[nNonProcPatches + procAddI].set ( diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 714cb2bfe2..bc39ba6af5 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -432,7 +432,6 @@ Foam::autoPtr Foam::conformalVoronoiMesh::createDummyMesh { patches[patchI] = new processorPolyPatch ( - patchNames[patchI], 0, //patchSizes[p], 0, //patchStarts[p], patchI, diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 2293ff0044..90ebfc7d8e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -444,29 +444,12 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) label nInterProcPatches = 0; forAll(curSubPatchIDs, procPatchI) { - //Info<< "For processor " << procI - // << " have to destination processor " - // << curNeighbourProcessors[procPatchI] << endl; - // - //forAll(curSubPatchIDs[procPatchI], i) - //{ - // Info<< " from patch:" << curSubPatchIDs[procPatchI][i] - // << " starting at:" << curSubStarts[procPatchI][i] - // << endl; - //} - nInterProcPatches += curSubPatchIDs[procPatchI].size(); } - //Info<< "For processor " << procI - // << " have " << nInterProcPatches - // << " patches to neighbouring processors" << endl; - - List procPatches ( - curPatchSizes.size() - + nInterProcPatches, //curProcessorPatchSizes.size(), + curPatchSizes.size() + nInterProcPatches, reinterpret_cast(0) ); @@ -517,22 +500,12 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) : curProcessorPatchSizes[procPatchI] - subStarts[i] ); -// Info<< "From processor:" << procI << endl -// << " to processor:" << curNeighbourProcessors[procPatchI] -// << endl -// << " via patch:" << subPatchID[i] << endl -// << " start :" << curStart << endl -// << " size :" << size << endl; - if (subPatchID[i] == -1) { // From internal faces procPatches[nPatches] = new processorPolyPatch ( - word("procBoundary") + Foam::name(procI) - + "to" - + Foam::name(curNeighbourProcessors[procPatchI]), size, curStart, nPatches, @@ -549,24 +522,16 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) boundaryMesh()[subPatchID[i]] ); - // From cyclic - const word& referPatch = pcPatch.name(); - procPatches[nPatches] = new processorCyclicPolyPatch ( - word("procBoundary") + Foam::name(procI) - + "to" - + Foam::name(curNeighbourProcessors[procPatchI]) - + "through" - + referPatch, size, curStart, nPatches, procMesh.boundaryMesh(), procI, curNeighbourProcessors[procPatchI], - referPatch, + pcPatch.name(), pcPatch.transform() ); } @@ -577,16 +542,6 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } } - - //forAll(procPatches, patchI) - //{ - // Pout<< " " << patchI - // << '\t' << "name:" << procPatches[patchI]->name() - // << '\t' << "type:" << procPatches[patchI]->type() - // << '\t' << "size:" << procPatches[patchI]->size() - // << endl; - //} - // Add boundary patches procMesh.addPatches(procPatches); diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index dbe38743b2..b2fb6ca133 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -161,12 +161,9 @@ autoPtr determineCoupledFaces for (label mergedProcI = 0; mergedProcI < procI; mergedProcI++) { - const string fromProcString + const word fromProcString ( - "procBoundary" - + name(procI) - + "to" - + name(mergedProcI) + processorPolyPatch::newName(procI, mergedProcI) ); if (pp.name() == fromProcString) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 50f3ff9b49..3664ce976f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,6 +69,36 @@ Foam::processorPolyPatch::processorPolyPatch {} +Foam::processorPolyPatch::processorPolyPatch +( + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const int myProcNo, + const int neighbProcNo, + const transformType transform, + const word& patchType +) +: + coupledPolyPatch + ( + newName(myProcNo, neighbProcNo), + size, + start, + index, + bm, + patchType, + transform + ), + myProcNo_(myProcNo), + neighbProcNo_(neighbProcNo), + neighbFaceCentres_(), + neighbFaceAreas_(), + neighbFaceCellCentres_() +{} + + Foam::processorPolyPatch::processorPolyPatch ( const word& name, @@ -149,6 +179,20 @@ Foam::processorPolyPatch::~processorPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::word Foam::processorPolyPatch::newName +( + const label myProcNo, + const label neighbProcNo +) +{ + return + "procBoundary" + + Foam::name(myProcNo) + + "to" + + Foam::name(neighbProcNo); +} + + void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs) { if (Pstream::parRun()) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index dde628df7a..0876c72b5a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,6 +81,23 @@ class processorPolyPatch protected: + // Protected constructors + + //- Construct from components with specified name + processorPolyPatch + ( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const int myProcNo, + const int neighbProcNo, + const transformType transform = UNKNOWN, // transformation type + const word& patchType = typeName + ); + + // Protected Member functions //- Initialise the calculation of the patch geometry @@ -126,10 +143,9 @@ public: // Constructors - //- Construct from components + //- Construct from components with automatically generated standard name processorPolyPatch ( - const word& name, const label size, const label start, const label index, @@ -270,6 +286,14 @@ public: return !owner(); } + //- Return the name of a processorPolyPatch + // constructed from the processor IDs + static word newName + ( + const label myProcNo, + const label neighbProcNo + ); + //- Return processor-neighbbour patch face centres const vectorField& neighbFaceCentres() const { diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index 8bd031532a..ba62b7bb25 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,6 @@ namespace Foam Foam::processorCyclicPolyPatch::processorCyclicPolyPatch ( - const word& name, const label size, const label start, const label index, @@ -55,7 +54,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch : processorPolyPatch ( - name, + newName(referPatchName, myProcNo, neighbProcNo), size, start, index, @@ -157,6 +156,33 @@ Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::word Foam::processorCyclicPolyPatch::newName +( + const word& cyclicPolyPatchName, + const label myProcNo, + const label neighbProcNo +) +{ + return + processorPolyPatch::newName(myProcNo, neighbProcNo) + + "through" + + cyclicPolyPatchName; +} + + +Foam::labelList Foam::processorCyclicPolyPatch::patchIDs +( + const word& cyclicPolyPatchName, + const polyBoundaryMesh& bm +) +{ + return bm.findIndices + ( + string("procBoundary.*to.*through" + cyclicPolyPatchName) + ); +} + + int Foam::processorCyclicPolyPatch::tag() const { if (tag_ == -1) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index 1f98b30bca..ffbb9445e3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -114,7 +114,6 @@ public: //- Construct from components processorCyclicPolyPatch ( - const word& name, const label size, const label start, const label index, @@ -261,11 +260,29 @@ public: // Member functions + //- Return name of originating cyclicPolyPatch patch const word& referPatchName() const { return referPatchName_; } + //- Return the name of a processorCyclicPolyPatch + // constructed from cyclicPolyPatch name and the processor IDs + static word newName + ( + const word& cyclicPolyPatchName, + const label myProcNo, + const label neighbProcNo + ); + + //- Return the indices of a processorCyclicPolyPatchs + // constructed from the given cyclicPolyPatch + static labelList patchIDs + ( + const word& cyclicPolyPatchName, + const polyBoundaryMesh& bm + ); + //- Referring patchID. label referPatchID() const { diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 3da445b570..e38f3c6d47 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -45,7 +45,7 @@ License namespace Foam { -defineTypeNameAndDebug(fvMeshDistribute, 0); + defineTypeNameAndDebug(fvMeshDistribute, 0); } @@ -929,16 +929,8 @@ void Foam::fvMeshDistribute::addProcPatches if (referPatchID[bFaceI] == -1) { // Ordinary processor boundary - - const word patchName = - "procBoundary" - + name(Pstream::myProcNo()) - + "to" - + name(procI); - processorPolyPatch pp ( - patchName, 0, // size mesh_.nFaces(), mesh_.boundaryMesh().size(), @@ -968,27 +960,15 @@ void Foam::fvMeshDistribute::addProcPatches mesh_.boundaryMesh()[referPatchID[bFaceI]] ); - // Processor boundary originating from cyclic - const word& cycName = pcPatch.name(); - - const word patchName = - "procBoundary" - + name(Pstream::myProcNo()) - + "to" - + name(procI) - + "through" - + cycName; - processorCyclicPolyPatch pp ( - patchName, 0, // size mesh_.nFaces(), mesh_.boundaryMesh().size(), mesh_.boundaryMesh(), Pstream::myProcNo(), nbrProc[bFaceI], - cycName, + pcPatch.name(), pcPatch.transform() ); diff --git a/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C b/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C index cccc4db367..a305326fa5 100644 --- a/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C +++ b/src/fvOptions/sources/derived/meanVelocityForce/patchMeanVelocityForce/patchMeanVelocityForce.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "patchMeanVelocityForce.H" +#include "processorCyclicPolyPatch.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // @@ -92,14 +93,9 @@ Foam::scalar Foam::fv::patchMeanVelocityForce::magUbarAve if (Pstream::parRun() && isA(patches[patchi_])) { - const keyType processorCyclicPatchNames - ( - string("procBoundary.*to.*through" + patch_) - ); - labelList processorCyclicPatches ( - patches.findIndices(processorCyclicPatchNames) + processorCyclicPolyPatch::patchIDs(patch_, patches) ); forAll(processorCyclicPatches, pcpi) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 06ffb6c525..597d63fccf 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -1018,11 +1018,10 @@ void Foam::autoLayerDriver::determineSidePatches for (label patchI = nOldPatches; patchI < nPatches; patchI++) { label nbrProcI = patchToNbrProc[patchI]; - word name = - "procBoundary" - + Foam::name(Pstream::myProcNo()) - + "to" - + Foam::name(nbrProcI); + word name + ( + processorPolyPatch::newName(Pstream::myProcNo(), nbrProcI) + ); dictionary patchDict; patchDict.add("type", processorPolyPatch::typeName); @@ -1031,11 +1030,6 @@ void Foam::autoLayerDriver::determineSidePatches patchDict.add("nFaces", 0); patchDict.add("startFace", mesh.nFaces()); - //Pout<< "Adding patch " << patchI - // << " name:" << name - // << " between " << Pstream::myProcNo() - // << " and " << nbrProcI << endl; - label procPatchI = meshRefiner_.appendPatch ( mesh,