diff --git a/TODO b/TODO new file mode 100644 index 0000000000000000000000000000000000000000..39bcc4dc99efde8c05d18abe1827a88c51871e68 --- /dev/null +++ b/TODO @@ -0,0 +1,45 @@ +- allocate/free tags. +Not tested. + +OK - test blockMesh with cyclics +unitTestCases/singleCyclic/ + +OK - test cyclics sequential running. +unitTestCases/singleCyclic/ + +OK - test decomposePar + +OK - FaceCellWave + unitTestCases/twoCavityCyclicForWallDistance/ + +OK - non-parallel finite volume : channelFoam + unitTestCases/channel395-splitCyclic vs. channel395-dev + +OK - parallel finite volume with processorCyclic: channelFoam + unitTestCases/channel395-splitCyclic vs. channel395-dev + +- amg +- test createPatch pointSync +- pointFields on cyclics. volPointInterpolation. +- jumpCyclics +- fanFvPatchField +- activeBaffleVelocity +- work out overlapping communication for PstreamBuffers. + Different tag? +- fvMeshDistribute to split processor patches into ones with different +separation. +- fvMeshSubset +- kivaToFoam/readKivaGrid.H sorts cyclics (but in incorrect order?) +- grep for size()/2 +- pointEdgeWave (maybe through inversePointDistanceDiffusivity?) +- regionSplit +- scotchDecomp +- isoSurface.C +- preProcessing/foamUpgradeCyclics +- referredCellList.C +- renumberMesh +- work out scheduled communication? + +compile: + + diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index d2bdcd2d68080cf0c3072d654bfa5a29dca5713f..8484470f34476003e71dfa01a5383e46040c4582 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -296,12 +296,7 @@ label mergePatchFaces const faceZone& fZone = mesh.faceZones()[zoneID]; zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)]; } - labelPair patchIDs = polyTopoChange::whichPatch - ( - mesh.boundaryMesh(), - newMasterI - ); - + label patchID = mesh.boundaryMesh().whichPatch(newMasterI); Pout<< "Restoring new master face " << newMasterI << " to vertices " << setFaceVerts[0] << endl; @@ -316,11 +311,10 @@ label mergePatchFaces own, // owner -1, // neighbour false, // face flip - patchIDs[0], // patch for face + patchID, // patch for face false, // remove from zone zoneID, // zone for face - zoneFlip, // face flip in zone - patchIDs[1] // subPatch + zoneFlip // face flip in zone ) ); @@ -342,10 +336,9 @@ label mergePatchFaces -1, // masterEdgeID, newMasterI, // masterFaceID, false, // flipFaceFlux, - patchIDs[0], // patchID, + patchID, // patchID, zoneID, // zoneID, - zoneFlip, // zoneFlip - patchIDs[1] // subPatch + zoneFlip // zoneFlip ) ); } diff --git a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C index fb4cd62031f21ecb8fda6c93c58d030d9b351b4c..2baa102eae09c74893aca4e544f6c4cda57b9c59 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C +++ b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C @@ -45,12 +45,17 @@ defineTypeNameAndDebug(Foam::cellSplitter, 0); void Foam::cellSplitter::getFaceInfo ( const label faceI, - labelPair& patchIDs, + label& patchID, label& zoneID, label& zoneFlip ) const { - patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI); + patchID = -1; + + if (!mesh_.isInternalFace(faceI)) + { + patchID = mesh_.boundaryMesh().whichPatch(faceI); + } zoneID = mesh_.faceZones().whichZone(faceI); @@ -161,16 +166,17 @@ void Foam::cellSplitter::setRefinement label anchorPoint = mesh_.cellPoints()[cellI][0]; - label addedPointI = meshMod.setAction - ( - polyAddPoint + label addedPointI = + meshMod.setAction ( - iter(), // point - anchorPoint, // master point - -1, // zone for point - true // supports a cell - ) - ); + polyAddPoint + ( + iter(), // point + anchorPoint, // master point + -1, // zone for point + true // supports a cell + ) + ); addedPoints_.insert(cellI, addedPointI); //Pout<< "Added point " << addedPointI @@ -199,17 +205,19 @@ void Foam::cellSplitter::setRefinement // Add other pyramids for (label i = 1; i < cFaces.size(); i++) - label addedCellI = meshMod.setAction - ( - polyAddCell + { + label addedCellI = + meshMod.setAction ( - -1, // master point - -1, // master edge - -1, // master face - cellI, // master cell - -1 // zone - ) - ); + polyAddCell + ( + -1, // master point + -1, // master edge + -1, // master face + cellI, // master cell + -1 // zone + ) + ); newCells[i] = addedCellI; } @@ -296,8 +304,7 @@ void Foam::cellSplitter::setRefinement false, // flux flip -1, // patch for face -1, // zone for face - false, // face zone flip - -1 // subPatch + false // face zone flip ) ); } @@ -343,8 +350,7 @@ void Foam::cellSplitter::setRefinement false, // flux flip -1, // patch for face -1, // zone for face - false, // face zone flip - -1 // subPatch + false // face zone flip ) ); } @@ -399,8 +405,7 @@ void Foam::cellSplitter::setRefinement -1, // patch for face false, // remove from zone -1, // zone for face - false, // face zone flip - -1 // subPatch + false // face zone flip ) ); } @@ -418,8 +423,7 @@ void Foam::cellSplitter::setRefinement -1, // patch for face false, // remove from zone -1, // zone for face - false, // face zone flip - -1 // subPatch + false // face zone flip ) ); } @@ -429,9 +433,9 @@ void Foam::cellSplitter::setRefinement { label newOwn = newOwner(faceI, cellToCells); - labelPair patchIDs; - label zoneID, zoneFlip; - getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); + label patchID, zoneID, zoneFlip; + getFaceInfo(faceI, patchID, zoneID, zoneFlip); + meshMod.setAction ( polyModifyFace @@ -441,11 +445,10 @@ void Foam::cellSplitter::setRefinement newOwn, // owner -1, // neighbour false, // flux flip - patchIDs[0], // patch for face + patchID, // patch for face false, // remove from zone zoneID, // zone for face - zoneFlip, // face zone flip - patchIDs[1] + zoneFlip // face zone flip ) ); } diff --git a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.H b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.H index 14dac6397541b93e55fec33008bfb35606465de8..a931217900f974396a6557c5e68f9ebd48d44885 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.H +++ b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.H @@ -39,7 +39,6 @@ SourceFiles #include "Map.H" #include "edge.H" -#include "labelPair.H" #include "typeInfo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -74,7 +73,7 @@ class cellSplitter void getFaceInfo ( const label faceI, - labelPair& patchIDs, + label& patchID, label& zoneID, label& zoneFlip ) const; diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index 9d7eed3522a21c9c64d7ca7fac9dfef528fd1870..333188c072b7aea06a31559985bebbb674f8034c 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -1200,8 +1200,7 @@ int main(int argc, char *argv[]) false, // flipFaceFlux -1, // patchID faceZonei, // zoneID - fm[facei], // zoneFlip - -1 // subPatchID + fm[facei] // zoneFlip ); } @@ -1252,8 +1251,7 @@ int main(int argc, char *argv[]) false, // flipFaceFlux patchi, // patchID -1, // zoneID - false, // zoneFlip - -1 // subPatchID + false // zoneFlip ); // For baffles create the opposite face @@ -1270,8 +1268,7 @@ int main(int argc, char *argv[]) false, // flipFaceFlux patchi, // patchID -1, // zoneID - false, // zoneFlip - -1 + false // zoneFlip ); } } @@ -1320,8 +1317,7 @@ int main(int argc, char *argv[]) false, //flipFaceFlux -1, //patchID -1, //zoneID - false, //zoneFlip - -1 //subPatchID + false //zoneFlip ); } } diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C index 49d1dec18c38908d2602c08e280dc5588692327b..bb4196d10f8718839c169886e03cff5ebd8b1a93 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh.C @@ -136,8 +136,7 @@ void Foam::extrude2DMesh::setRefinement false, // flipFaceFlux -1, // patchID zoneID, // zoneID - zoneFlip, // zoneFlip - -1 // subPatchID + zoneFlip // zoneFlip ); } @@ -174,8 +173,7 @@ void Foam::extrude2DMesh::setRefinement false, // flipFaceFlux patchI, // patchID zoneID, // zoneID - zoneFlip, // zoneFlip - -1 //?TBD subPatchID + zoneFlip // zoneFlip ); } } @@ -238,8 +236,7 @@ void Foam::extrude2DMesh::setRefinement false, // flipFaceFlux frontPatchI, // patchID -1, // zoneID - false, // zoneFlip - -1 //?TDB subPatchID + false // zoneFlip ); // Offset to create front face. @@ -258,8 +255,7 @@ void Foam::extrude2DMesh::setRefinement false, // flipFaceFlux frontPatchI, // patchID -1, // zoneID - false, // zoneFlip - -1 //?TDB subPatchID + false // zoneFlip ); } } diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index d59f7317b9412212bce8799084fe3db66417225c..f5d0c416f74c1cad7f886c8b0006d4c91df8a87c 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -198,69 +198,55 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh) forAll(patches, patchI) { - if (isA<cyclicPolyPatch>(patches[patchI])) + if + ( + isA<cyclicPolyPatch>(patches[patchI]) + && refCast<const cyclicPolyPatch>(patches[patchI]).owner() + ) { const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>(patches[patchI]); - label halfSize = cycPatch.size()/2; - - // Dump halves + // Dump patches { - OFstream str(prefix+cycPatch.name()+"_half0.obj"); + OFstream str(prefix+cycPatch.name()+".obj"); Pout<< "Dumping " << cycPatch.name() - << " half0 faces to " << str.name() << endl; + << " faces to " << str.name() << endl; meshTools::writeOBJ ( str, - static_cast<faceList> - ( - SubList<face> - ( - cycPatch, - halfSize - ) - ), + cycPatch, cycPatch.points() ); } + + const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch(); { - OFstream str(prefix+cycPatch.name()+"_half1.obj"); - Pout<< "Dumping " << cycPatch.name() - << " half1 faces to " << str.name() << endl; + OFstream str(prefix+nbrPatch.name()+".obj"); + Pout<< "Dumping " << nbrPatch.name() + << " faces to " << str.name() << endl; meshTools::writeOBJ ( str, - static_cast<faceList> - ( - SubList<face> - ( - cycPatch, - halfSize, - halfSize - ) - ), - cycPatch.points() + nbrPatch, + nbrPatch.points() ); } // Lines between corresponding face centres - OFstream str(prefix+cycPatch.name()+"_match.obj"); + OFstream str(prefix+cycPatch.name()+nbrPatch.name()+"_match.obj"); label vertI = 0; Pout<< "Dumping cyclic match as lines between face centres to " << str.name() << endl; - for (label faceI = 0; faceI < halfSize; faceI++) + forAll(cycPatch, faceI) { const point& fc0 = mesh.faceCentres()[cycPatch.start()+faceI]; meshTools::writeOBJ(str, fc0); vertI++; - - label nbrFaceI = halfSize + faceI; - const point& fc1 = - mesh.faceCentres()[cycPatch.start()+nbrFaceI]; + const point& fc1 = mesh.faceCentres()[nbrPatch.start()+faceI]; meshTools::writeOBJ(str, fc1); vertI++; @@ -273,34 +259,13 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh) void separateList ( - const vectorField& separation, + const vector& separation, UList<vector>& field ) { - if (separation.size() == 1) + forAll(field, i) { - // Single value for all. - - forAll(field, i) - { - field[i] += separation[0]; - } - } - else if (separation.size() == field.size()) - { - forAll(field, i) - { - field[i] += separation[i]; - } - } - else - { - FatalErrorIn - ( - "separateList(const vectorField&, UList<vector>&)" - ) << "Sizes of field and transformation not equal. field:" - << field.size() << " transformation:" << separation.size() - << abort(FatalError); + field[i] += separation; } } @@ -427,13 +392,19 @@ void syncPoints { const polyPatch& pp = patches[patchI]; - if (isA<cyclicPolyPatch>(pp)) + if + ( + isA<cyclicPolyPatch>(pp) + && refCast<const cyclicPolyPatch>(pp).owner() + ) { const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>(pp); const edgeList& coupledPoints = cycPatch.coupledPoints(); const labelList& meshPts = cycPatch.meshPoints(); + const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch(); + const labelList& nbrMeshPts = nbrPatch.meshPoints(); pointField half0Values(coupledPoints.size()); @@ -452,14 +423,14 @@ void syncPoints else if (cycPatch.separated()) { hasTransformation = true; - const vectorField& v = cycPatch.coupledPolyPatch::separation(); + const vector& v = cycPatch.separation(); separateList(v, half0Values); } forAll(coupledPoints, i) { const edge& e = coupledPoints[i]; - label point1 = meshPts[e[1]]; + label point1 = nbrMeshPts[e[1]]; points[point1] = half0Values[i]; } } @@ -783,13 +754,8 @@ int main(int argc, char *argv[]) // current separation also includes the normal // ( separation_ = (nf&(Cr - Cf))*nf ). - // For processor patches: - // - disallow multiple separation/transformation. This basically - // excludes decomposed cyclics. Use the (probably 0) separation - // to align the points. // For cyclic patches: - // - for separated ones use our own recalculated offset vector - // - for rotational ones use current one. + // - for separated ones use user specified offset vector forAll(mesh.boundaryMesh(), patchI) { @@ -813,51 +779,18 @@ int main(int argc, char *argv[]) if (cycpp.transform() == cyclicPolyPatch::TRANSLATIONAL) { + // Force to wanted separation Info<< "On cyclic translation patch " << pp.name() << " forcing uniform separation of " << cycpp.separationVector() << endl; - const_cast<vectorField&>(cpp.separation()) = - pointField(1, cycpp.separationVector()); + const_cast<vector&>(cpp.separation()) = + cycpp.separationVector(); } - else - { - const_cast<vectorField&>(cpp.separation()) = - pointField - ( - 1, - pp[pp.size()/2].centre(mesh.points()) - - pp[0].centre(mesh.points()) - ); - } - } - else - { - const_cast<vectorField&>(cpp.separation()) - .setSize(1); } Info<< "On coupled patch " << pp.name() << " forcing uniform separation of " << cpp.separation() << endl; } - else if (!cpp.parallel()) - { - Info<< "On coupled patch " << pp.name() - << " forcing uniform rotation of " - << cpp.forwardT()[0] << endl; - - const_cast<tensorField&> - ( - cpp.forwardT() - ).setSize(1); - const_cast<tensorField&> - ( - cpp.reverseT() - ).setSize(1); - - Info<< "On coupled patch " << pp.name() - << " forcing uniform rotation of " - << cpp.forwardT() << endl; - } } } diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index dfa78a4f04bbbdc767d2eb41831d7ae16df4b630..725af60593b554871e69a3600bcf1470b6f35041 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -306,8 +306,6 @@ autoPtr<mapPolyMesh> reorderMesh labelList patchStarts(patches.size()); labelList oldPatchNMeshPoints(patches.size()); labelListList patchPointMap(patches.size()); - labelListList subPatches(patches.size()); - labelListList subPatchStarts(patches.size()); forAll(patches, patchI) { @@ -315,16 +313,6 @@ autoPtr<mapPolyMesh> reorderMesh patchStarts[patchI] = patches[patchI].start(); oldPatchNMeshPoints[patchI] = patches[patchI].nPoints(); patchPointMap[patchI] = identity(patches[patchI].nPoints()); - - if (isA<processorPolyPatch>(patches[patchI])) - { - const processorPolyPatch& ppp = refCast<const processorPolyPatch> - ( - patches[patchI] - ); - subPatches[patchI] = ppp.patchIDs(); - subPatchStarts[patchI] = ppp.starts(); - } } mesh.resetPrimitives @@ -335,8 +323,7 @@ autoPtr<mapPolyMesh> reorderMesh xferMove(newNeighbour), patchSizes, patchStarts, - subPatches, - subPatchStarts + true ); return autoPtr<mapPolyMesh> diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 9f378cbfe3f0440b85ab820a72bae1cf72a4073e..d54be1d3670d45042b7f0aa93a224a3140f18842 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -556,7 +556,7 @@ void getInterfaceSizes label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()]; coupledRegion[i] = cellRegion[cellI]; } - syncTools::swapBoundaryFaceList(mesh, coupledRegion, false); + syncTools::swapBoundaryFaceList(mesh, coupledRegion); forAll(coupledRegion, i) { @@ -726,7 +726,7 @@ autoPtr<mapPolyMesh> createRegionMesh label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()]; coupledRegion[i] = cellRegion[cellI]; } - syncTools::swapBoundaryFaceList(mesh, coupledRegion, false); + syncTools::swapBoundaryFaceList(mesh, coupledRegion); // Topology change container. Start off from existing mesh. @@ -1375,7 +1375,7 @@ int main(int argc, char *argv[]) { neiZoneID[i] = zoneID[mesh.faceOwner()[i+mesh.nInternalFaces()]]; } - syncTools::swapBoundaryFaceList(mesh, neiZoneID, false); + syncTools::swapBoundaryFaceList(mesh, neiZoneID); // Determine connected regions diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index c4470b4141bbb07c1bc3f0fb25cd704f1320c04a..098bf6b74fa5eb819c071fd0c9995679f38a4867 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -337,22 +337,22 @@ int main(int argc, char *argv[]) // Construct the point fields // ~~~~~~~~~~~~~~~~~~~~~~~~~~ - pointMesh pMesh(mesh); +// pointMesh pMesh(mesh); PtrList<pointScalarField> pointScalarFields; - readFields(pMesh, objects, pointScalarFields); +// readFields(pMesh, objects, pointScalarFields); PtrList<pointVectorField> pointVectorFields; - readFields(pMesh, objects, pointVectorFields); +// readFields(pMesh, objects, pointVectorFields); PtrList<pointSphericalTensorField> pointSphericalTensorFields; - readFields(pMesh, objects, pointSphericalTensorFields); +// readFields(pMesh, objects, pointSphericalTensorFields); PtrList<pointSymmTensorField> pointSymmTensorFields; - readFields(pMesh, objects, pointSymmTensorFields); +// readFields(pMesh, objects, pointSymmTensorFields); PtrList<pointTensorField> pointTensorFields; - readFields(pMesh, objects, pointTensorFields); +// readFields(pMesh, objects, pointTensorFields); // Construct the Lagrangian fields @@ -652,45 +652,45 @@ int main(int argc, char *argv[]) } - // Point fields - if - ( - pointScalarFields.size() - || pointVectorFields.size() - || pointSphericalTensorFields.size() - || pointSymmTensorFields.size() - || pointTensorFields.size() - ) - { - labelIOList pointProcAddressing - ( - IOobject - ( - "pointProcAddressing", - procMesh.facesInstance(), - procMesh.meshSubDir, - procMesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - pointMesh procPMesh(procMesh, true); - - pointFieldDecomposer fieldDecomposer - ( - pMesh, - procPMesh, - pointProcAddressing, - boundaryProcAddressing - ); - - fieldDecomposer.decomposeFields(pointScalarFields); - fieldDecomposer.decomposeFields(pointVectorFields); - fieldDecomposer.decomposeFields(pointSphericalTensorFields); - fieldDecomposer.decomposeFields(pointSymmTensorFields); - fieldDecomposer.decomposeFields(pointTensorFields); - } +// // Point fields +// if +// ( +// pointScalarFields.size() +// || pointVectorFields.size() +// || pointSphericalTensorFields.size() +// || pointSymmTensorFields.size() +// || pointTensorFields.size() +// ) +// { +// labelIOList pointProcAddressing +// ( +// IOobject +// ( +// "pointProcAddressing", +// procMesh.facesInstance(), +// procMesh.meshSubDir, +// procMesh, +// IOobject::MUST_READ, +// IOobject::NO_WRITE +// ) +// ); +// +// pointMesh procPMesh(procMesh, true); +// +// pointFieldDecomposer fieldDecomposer +// ( +// pMesh, +// procPMesh, +// pointProcAddressing, +// boundaryProcAddressing +// ); +// +// fieldDecomposer.decomposeFields(pointScalarFields); +// fieldDecomposer.decomposeFields(pointVectorFields); +// fieldDecomposer.decomposeFields(pointSphericalTensorFields); +// fieldDecomposer.decomposeFields(pointSymmTensorFields); +// fieldDecomposer.decomposeFields(pointTensorFields); +// } // If there is lagrangian data write it out diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index d0d7c612295fa378384af7f2e95397f838120d7c..ef4cdb16c16b9ed873d48513b306e2f97544d030 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -29,6 +29,7 @@ License #include "dictionary.H" #include "labelIOList.H" #include "processorPolyPatch.H" +#include "processorCyclicPolyPatch.H" #include "fvMesh.H" #include "OSspecific.H" #include "Map.H" @@ -293,10 +294,34 @@ bool Foam::domainDecomposition::writeDecomposition() const polyPatchList& meshPatches = boundaryMesh(); + + // Count the number of inter-proc patches + 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 << " to neighbouring processors" + << endl; + + List<polyPatch*> procPatches ( curPatchSizes.size() - + curProcessorPatchSizes.size(), + + nInterProcPatches, //curProcessorPatchSizes.size(), reinterpret_cast<polyPatch*>(0) ); @@ -335,23 +360,72 @@ bool Foam::domainDecomposition::writeDecomposition() forAll(curProcessorPatchSizes, procPatchI) { - procPatches[nPatches] = - new processorPolyPatch + const labelList& subPatchID = curSubPatchIDs[procPatchI]; + const labelList& subStarts = curSubStarts[procPatchI]; + + label curStart = curProcessorPatchStarts[procPatchI]; + + forAll(subPatchID, i) + { + label size = ( - word("procBoundary") + Foam::name(procI) - + word("to") - + Foam::name(curNeighbourProcessors[procPatchI]), - curProcessorPatchSizes[procPatchI], - curProcessorPatchStarts[procPatchI], - nPatches, - procMesh.boundaryMesh(), - procI, - curNeighbourProcessors[procPatchI], - curSubPatchIDs[procPatchI], - curSubStarts[procPatchI] - ); + i < subPatchID.size()-1 + ? subStarts[i+1] - subStarts[i] + : curProcessorPatchSizes[procPatchI] - subStarts[i] + ); - nPatches++; + 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, + procMesh.boundaryMesh(), + procI, + curNeighbourProcessors[procPatchI] + ); + } + else + { + // From cyclic + const word& referPatch = + boundaryMesh()[subPatchID[i]].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 + ); + } + + curStart += size; + + nPatches++; + } } diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index a9ad64dc7e7e017e6bd86fa98bb860b63ea22213..f334dbee995c008a6779d0fc6668132af0f06d2a 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C @@ -40,7 +40,7 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void domainDecomposition::append(labelList& lst, const label elem) +void Foam::domainDecomposition::append(labelList& lst, const label elem) { label sz = lst.size(); lst.setSize(sz+1); @@ -48,7 +48,7 @@ void domainDecomposition::append(labelList& lst, const label elem) } -void domainDecomposition::addInterProcFace +void Foam::domainDecomposition::addInterProcFace ( const label facei, const label ownerProc, @@ -97,7 +97,7 @@ void domainDecomposition::addInterProcFace } -void domainDecomposition::decomposeMesh(const bool filterEmptyPatches) +void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches) { // Decide which cell goes to which processor distributeCells(); @@ -230,14 +230,15 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches) facei, ownerProc, nbrProc, + procNbrToInterPatch, interPatchFaces ); } } - // Add the proper processor faces to the sub information. Since faces - // originate from internal faces this is always -1. + // Add the proper processor faces to the sub information. For faces + // originating from internal faces this is always -1. List<labelListList> subPatchIDs(nProcs_); List<labelListList> subPatchStarts(nProcs_); forAll(interPatchFaces, procI) @@ -415,7 +416,16 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches) forAll(procBoundaryAddressing_, procI) { label nNormal = procPatchSize_[procI].size(); - label nInterProc = procProcessorPatchSize_[procI].size(); + + const labelListList& curSubPatchIDs = + procProcessorPatchSubPatchIDs_[procI]; + +// label nInterProc = procProcessorPatchSize_[procI].size(); + label nInterProc = 0; + forAll(curSubPatchIDs, procPatchI) + { + nInterProc += curSubPatchIDs[procPatchI].size(); + } procBoundaryAddressing_[procI].setSize(nNormal + nInterProc); @@ -423,9 +433,14 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches) { procBoundaryAddressing_[procI][patchI] = patchI; } - for (label patchI = nNormal; patchI < nNormal+nInterProc; patchI++) + label patchI = nNormal; + forAll(curSubPatchIDs, procPatchI) { - procBoundaryAddressing_[procI][patchI] = -1; + forAll(curSubPatchIDs[procPatchI], i) + { + procBoundaryAddressing_[procI][patchI++] = + curSubPatchIDs[procPatchI][i]; + } } } diff --git a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposer.C b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposer.C index ca440ec85c210bd2574e898d4cfed06a8c4f75e7..fa3962041ec2bdfbb4e236264bffcbd868669f5f 100644 --- a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposer.C +++ b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposer.C @@ -145,7 +145,11 @@ Foam::fvFieldDecomposer::fvFieldDecomposer { forAll(boundaryAddressing_, patchi) { - if (boundaryAddressing_[patchi] >= 0) + if + ( + boundaryAddressing_[patchi] >= 0 + && !isA<processorLduInterface>(procMesh.boundary()[patchi]) + ) { patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer ( diff --git a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerDecomposeFields.C b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerDecomposeFields.C index eb2b34577ad49cce496ba93f0b66a71b9eb4b74f..51e1248f698b709f4655c093445fe742938f5bc2 100644 --- a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerDecomposeFields.C +++ b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerDecomposeFields.C @@ -27,6 +27,8 @@ License #include "fvFieldDecomposer.H" #include "processorFvPatchField.H" #include "processorFvsPatchField.H" +#include "processorCyclicFvPatchField.H" +#include "processorCyclicFvsPatchField.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -45,7 +47,7 @@ Foam::fvFieldDecomposer::decomposeField forAll(boundaryAddressing_, patchi) { - if (boundaryAddressing_[patchi] >= 0) + if (patchFieldDecomposerPtrs_[patchi]) { patchFields.set ( @@ -59,7 +61,24 @@ Foam::fvFieldDecomposer::decomposeField ) ); } - else + else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi])) + { + patchFields.set + ( + patchi, + new processorCyclicFvPatchField<Type> + ( + procMesh_.boundary()[patchi], + DimensionedField<Type, volMesh>::null(), + Field<Type> + ( + field.internalField(), + *processorVolPatchFieldDecomposerPtrs_[patchi] + ) + ) + ); + } + else if (isA<processorFvPatch>(procMesh_.boundary()[patchi])) { patchFields.set ( @@ -76,6 +95,11 @@ Foam::fvFieldDecomposer::decomposeField ) ); } + else + { + FatalErrorIn("fvFieldDecomposer::decomposeField()") + << "Unknown type." << abort(FatalError); + } } // Create the field for the processor @@ -156,7 +180,7 @@ Foam::fvFieldDecomposer::decomposeField forAll(boundaryAddressing_, patchi) { - if (boundaryAddressing_[patchi] >= 0) + if (patchFieldDecomposerPtrs_[patchi]) { patchFields.set ( @@ -170,7 +194,24 @@ Foam::fvFieldDecomposer::decomposeField ) ); } - else + else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi])) + { + patchFields.set + ( + patchi, + new processorCyclicFvsPatchField<Type> + ( + procMesh_.boundary()[patchi], + DimensionedField<Type, surfaceMesh>::null(), + Field<Type> + ( + allFaceField, + *processorSurfacePatchFieldDecomposerPtrs_[patchi] + ) + ) + ); + } + else if (isA<processorFvPatch>(procMesh_.boundary()[patchi])) { patchFields.set ( @@ -187,6 +228,11 @@ Foam::fvFieldDecomposer::decomposeField ) ); } + else + { + FatalErrorIn("fvFieldDecomposer::decomposeField()") + << "Unknown type." << abort(FatalError); + } } // Create the field for the processor diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C index 07a77fadab3a98cc4e99182f8e4fc758ebd93edb..ff6c08f8e351016c2cdb574a78725050c82c6f5c 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/channelIndex.C @@ -80,7 +80,7 @@ void Foam::channelIndex::walkOppositeFaces isFrontBndFace[faceI-mesh.nInternalFaces()] = true; } } - syncTools::swapBoundaryFaceList(mesh, isFrontBndFace, false); + syncTools::swapBoundaryFaceList(mesh, isFrontBndFace); // Add forAll(isFrontBndFace, i) diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C index 8d189dfe28b9df13ea30516a8bfbf390585268c0..b0374e8ea5e969a3e53dbe5e3e453bd3191a6634 100644 --- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C +++ b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C @@ -31,7 +31,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "cyclicPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -77,35 +76,12 @@ int main(int argc, char *argv[]) } // Give patch area - if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi])) - { - Info<< " Cyclic patch vector area: " << nl; - label nFaces = mesh.boundaryMesh()[patchi].size(); - vector sum1 = vector::zero; - vector sum2 = vector::zero; - for (label i=0; i<nFaces/2; i++) - { - sum1 += mesh.Sf().boundaryField()[patchi][i]; - sum2 += mesh.Sf().boundaryField()[patchi][i+nFaces/2]; - } - reduce(sum1, sumOp<vector>()); - reduce(sum2, sumOp<vector>()); - Info<< " - half 1 = " << sum1 << ", " << mag(sum1) << nl - << " - half 2 = " << sum2 << ", " << mag(sum2) << nl - << " - total = " << (sum1 + sum2) << ", " - << mag(sum1 + sum2) << endl; - Info<< " Cyclic patch area magnitude = " - << gSum(mesh.magSf().boundaryField()[patchi])/2.0 << endl; - } - else - { - Info<< " Area vector of patch " - << patchName << '[' << patchi << ']' << " = " - << gSum(mesh.Sf().boundaryField()[patchi]) << endl; - Info<< " Area magnitude of patch " - << patchName << '[' << patchi << ']' << " = " - << gSum(mesh.magSf().boundaryField()[patchi]) << endl; - } + Info<< " Area vector of patch " + << patchName << '[' << patchi << ']' << " = " + << gSum(mesh.Sf().boundaryField()[patchi]) << endl; + Info<< " Area magnitude of patch " + << patchName << '[' << patchi << ']' << " = " + << gSum(mesh.magSf().boundaryField()[patchi]) << endl; // Read field and calc integral if (fieldHeader.headerClassName() == volScalarField::typeName) diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/Make/files b/applications/utilities/preProcessing/foamUpgradeCyclics/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..9b58821d1704ff46dbe851360bbafb8840ef068c --- /dev/null +++ b/applications/utilities/preProcessing/foamUpgradeCyclics/Make/files @@ -0,0 +1,3 @@ +foamUpgradeCyclics.C + +EXE = $(FOAM_APPBIN)/foamUpgradeCyclics diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/Make/options b/applications/utilities/preProcessing/foamUpgradeCyclics/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C new file mode 100644 index 0000000000000000000000000000000000000000..35d26fe6a77fde31fd91363df4a368ff0c18e4ce --- /dev/null +++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C @@ -0,0 +1,281 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + foamUpgradeCyclics + +Description + Simple tool to upgrade mesh and fields for split cyclics + +Usage + + - foamUpgradeCyclics [OPTION] + + @param -test \n + Suppress writing the updated files with split cyclics + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "IOdictionary.H" +#include "polyMesh.H" +#include "entry.H" +#include "IOPtrList.H" +#include "cyclicPolyPatch.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameAndDebug(IOPtrList<entry>, 0); +} + +// Main program: + +int main(int argc, char *argv[]) +{ + argList::addBoolOption("test"); + #include "addRegionOption.H" + +# include "setRootCase.H" +# include "createTime.H" + + Foam::word regionName = polyMesh::defaultRegion; + args.optionReadIfPresent("region", regionName); + + fileName regionPrefix = ""; + if (regionName != polyMesh::defaultRegion) + { + regionPrefix = regionName; + } + + + // Per cyclic patch the new name for this side and the other side + HashTable<word> thisNames; + HashTable<word> nbrNames; + + // Read boundary file without reading mesh + { + IOobject io + ( + "boundary", + runTime.findInstance + ( + regionPrefix/polyMesh::meshSubDir, + "boundary" + ), + polyMesh::meshSubDir, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + + Info<< "Reading boundary from " << io.filePath() << endl; + + + // Read PtrList of dictionary. + const word oldTypeName = IOPtrList<entry>::typeName; + const_cast<word&>(IOPtrList<entry>::typeName) = word::null; + IOPtrList<entry> patches(io); + const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName; + // Fake type back to what was in field + const_cast<word&>(patches.type()) = patches.headerClassName(); + + // Temporary convert to dictionary + dictionary patchDict; + forAll(patches, i) + { + patchDict.add(patches[i].keyword(), patches[i].dict()); + } + + // Replace any 'cyclic' + label nOldCyclics = 0; + forAll(patches, patchI) + { + const dictionary& patchDict = patches[patchI].dict(); + + if (word(patchDict["type"]) == cyclicPolyPatch::typeName) + { + if (patchDict.found("neighbourPatch")) + { + Info<< "Patch " << patches[patchI].keyword() + << " already has 'neighbourPatch' entry; assuming it" + << " is already converted." << endl; + } + else + { + Info<< "Patch " << patches[patchI].keyword() + << " does not have 'neighbourPatch' entry; assuming it" + << " is of the old type." << endl; + nOldCyclics++; + } + } + } + + Info<< "Detected " << nOldCyclics << " old cyclics." << nl << endl; + + + // edo the + + + + PtrList<entry> oldPatches(patches); + +Pout<< "oldPatches:" << oldPatches << endl; + + // Extend + label nOldPatches = patches.size(); + patches.setSize(nOldPatches+nOldCyclics); + + + // Add new entries + label newPatchI = 0; + forAll(oldPatches, patchI) + { + const dictionary& patchDict = oldPatches[patchI].dict(); + + if + ( + word(patchDict["type"]) == cyclicPolyPatch::typeName + && !patchDict.found("neighbourPatch") + ) + { + const word& name = oldPatches[patchI].keyword(); + label nFaces = readLabel(patchDict["nFaces"]); + label startFace = readLabel(patchDict["startFace"]); + + word thisName = name + "_half0"; + word nbrName = name + "_half1"; + + thisNames.insert(name, thisName); + nbrNames.insert(name, nbrName); + + // Change entry on this side + patches.set(newPatchI, oldPatches(patchI)); + dictionary& thisPatchDict = patches[newPatchI].dict(); + thisPatchDict.add("neighbourPatch", nbrName); + thisPatchDict.set("nFaces", nFaces/2); + patches[newPatchI].keyword() = thisName; + newPatchI++; + + // Add entry on other side + patches.set(newPatchI, oldPatches(patchI)); + dictionary& nbrPatchDict = patches[newPatchI].dict(); + nbrPatchDict.add("neighbourPatch", nbrName); + nbrPatchDict.set("nFaces", nFaces/2); + nbrPatchDict.set("startFace", startFace+nFaces/2); + patches[newPatchI].keyword() = nbrName; + newPatchI++; + } + else + { + patches.set(newPatchI++, oldPatches(patchI)); + } + } + + Info<< "boundary:" << patches << endl; + + if (returnReduce(nOldCyclics, sumOp<label>()) >= 0) + { + if (args.optionFound("test")) + { + Info<< "-test option: no changes made" << nl << endl; + } + else + { + if (mvBak(patches.objectPath(), "old")) + { + Info<< "Backup to " + << (patches.objectPath() + ".old") << nl; + } + + Info<< "Write to " + << patches.objectPath() << nl << endl; + patches.write(); + } + } + } + + +// { +// // Read dictionary. (disable class type checking so we can load +// // field) +// Info<< "Loading dictionary " << fieldName << endl; +// const word oldTypeName = IOdictionary::typeName; +// const_cast<word&>(IOdictionary::typeName) = word::null; +// +// IOdictionary fieldDict +// ( +// IOobject +// ( +// "p", +// instance, +// mesh, +// IOobject::MUST_READ, +// IOobject::NO_WRITE, +// false +// ) +// ); +// const_cast<word&>(IOdictionary::typeName) = oldTypeName; +// // Fake type back to what was in field +// const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName(); +// +// Info<< "Loaded dictionary " << fieldName +// << " with entries " << fieldDict.toc() << endl; +// +// dictionary& boundaryField = fieldDict.subDict("boundaryField"); +// +// forAllConstIter(HashTable<word>, thisNames, iter) +// { +// const word& patchName = iter.key(); +// const word& newName = iter(); +// +// Info<< "Looking for entry for patch " << patchName << endl; +// +// if (boundaryField.found(patchName) && !boundaryField.found(iter())) +// { +// const dictionary& patchDict = boundaryField[patchName]; +// +// Field<scalar> fld(patchDict.lookup("value")); +// +// +// } +// +// +// forAllIter(IDLList<entry>, boundaryField, patchIter) +// { +// +// } + + + return 0; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C index ccf93d95614e40e4756d9e05af9d7ca3c2238c95..47d2cd1a29a55d9ce3ffe86bdeb8bc3625519cc6 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C +++ b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C @@ -252,12 +252,13 @@ bool Foam::FaceCellWave<Type>::updateFace template <class Type> void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const { - label cycOffset = patch.size()/2; + const cyclicPolyPatch& nbrPatch = + refCast<const cyclicPolyPatch>(patch).neighbPatch(); - for (label patchFaceI = 0; patchFaceI < cycOffset; patchFaceI++) + forAll(patch, patchFaceI) { label i1 = patch.start() + patchFaceI; - label i2 = i1 + cycOffset; + label i2 = nbrPatch.start() + patchFaceI; if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_)) { @@ -335,8 +336,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo const polyPatch& patch, const label nFaces, const labelList& changedFaces, - const List<Type>& changedFacesInfo, - const bool + const List<Type>& changedFacesInfo ) { for (label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++) @@ -454,40 +454,6 @@ void Foam::FaceCellWave<Type>::transform } -// Send face info to neighbour. -template <class Type> -void Foam::FaceCellWave<Type>::sendPatchInfo -( - const label neighbour, - const label nFaces, - const labelList& faceLabels, - const List<Type>& faceInfo -) const -{ - OPstream toNeighbour(Pstream::blocking, neighbour); - - writeFaces(nFaces, faceLabels, faceInfo, toNeighbour); -} - - -// Receive face info from neighbour -template <class Type> -Foam::label Foam::FaceCellWave<Type>::receivePatchInfo -( - const label neighbour, - labelList& faceLabels, - List<Type>& faceInfo -) const -{ - IPstream fromNeighbour(Pstream::blocking, neighbour); - - label nFaces = 0; - readFaces(nFaces, faceLabels, faceInfo, fromNeighbour); - - return nFaces; -} - - // Offset mesh face. Used for transferring from one cyclic half to the other. template <class Type> void Foam::FaceCellWave<Type>::offset @@ -511,6 +477,8 @@ void Foam::FaceCellWave<Type>::handleProcPatches() { // Send all + PstreamBuffers pBufs(Pstream::nonBlocking); + forAll(mesh_.boundaryMesh(), patchI) { const polyPatch& patch = mesh_.boundaryMesh()[patchI]; @@ -552,16 +520,13 @@ void Foam::FaceCellWave<Type>::handleProcPatches() << endl; } - sendPatchInfo - ( - procPatch.neighbProcNo(), - nSendFaces, - sendFaces, - sendFacesInfo - ); + UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); + writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); } } + pBufs.finishedSends(); + // Receive all forAll(mesh_.boundaryMesh(), patchI) @@ -574,16 +539,20 @@ void Foam::FaceCellWave<Type>::handleProcPatches() refCast<const processorPolyPatch>(patch); // Allocate buffers - label nReceiveFaces; + label nReceiveFaces = 0; labelList receiveFaces(patch.size()); List<Type> receiveFacesInfo(patch.size()); - nReceiveFaces = receivePatchInfo - ( - procPatch.neighbProcNo(), - receiveFaces, - receiveFacesInfo - ); + { + UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs); + readFaces + ( + nReceiveFaces, + receiveFaces, + receiveFacesInfo, + fromNeighbour + ); + } if (debug) { @@ -619,8 +588,7 @@ void Foam::FaceCellWave<Type>::handleProcPatches() patch, nReceiveFaces, receiveFaces, - receiveFacesInfo, - procPatch.parallel() + receiveFacesInfo ); } } @@ -639,87 +607,42 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches() if (isA<cyclicPolyPatch>(patch)) { - label halfSize = patch.size()/2; + const cyclicPolyPatch& nbrPatch = + refCast<const cyclicPolyPatch>(patch).neighbPatch(); // Allocate buffers - label nSendFaces; - labelList sendFaces(halfSize); - List<Type> sendFacesInfo(halfSize); - label nReceiveFaces; - labelList receiveFaces(halfSize); - List<Type> receiveFacesInfo(halfSize); - - // Half1: Determine which faces changed. Use sendFaces for storage - nSendFaces = getChangedPatchFaces - ( - patch, - 0, - halfSize, - sendFaces, - sendFacesInfo - ); + labelList receiveFaces(patch.size()); + List<Type> receiveFacesInfo(patch.size()); - // Half2: Determine which faces changed. Use receiveFaces_ ,, + // Determine which faces changed nReceiveFaces = getChangedPatchFaces ( - patch, - halfSize, - halfSize, + nbrPatch, + 0, + nbrPatch.size(), receiveFaces, receiveFacesInfo ); - //Info<< "Half1:" << endl; - //writeFaces(nSendFaces, sendFaces, sendFacesInfo, Info); - //Info<< endl; - // - //Info<< "Half2:" << endl; - //writeFaces(nReceiveFaces, receiveFaces, receiveFacesInfo, Info); - //Info<< endl; - - - // Half1: Adapt wallInfo for leaving domain - leaveDomain - ( - patch, - nSendFaces, - sendFaces, - sendFacesInfo - ); - // Half2: Adapt wallInfo for leaving domain + // Adapt wallInfo for leaving domain leaveDomain ( - patch, + nbrPatch, nReceiveFaces, receiveFaces, receiveFacesInfo ); - // Half1: 'transfer' to other side by offsetting patchFaceI - offset(patch, halfSize, nSendFaces, sendFaces); - - // Half2: 'transfer' to other side - offset(patch, -halfSize, nReceiveFaces, receiveFaces); - - // Apply rotation for non-parallel planes const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>(patch); if (!cycPatch.parallel()) { - // sendFaces = received data from half1 + // received data from other half transform ( cycPatch.forwardT(), - nSendFaces, - sendFacesInfo - ); - - // receiveFaces = received data from half2 - transform - ( - cycPatch.reverseT(), nReceiveFaces, receiveFacesInfo ); @@ -727,25 +650,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches() if (debug) { - Pout<< " Cyclic patch " << patchI << ' ' << patch.name() - << " Changed on first half : " << nSendFaces - << " Changed on second half : " << nReceiveFaces + Pout<< " Cyclic patch " << patchI << ' ' << cycPatch.name() + << " Changed : " << nReceiveFaces << endl; } - // Half1: Adapt wallInfo for entering domain - enterDomain - ( - patch, - nSendFaces, - sendFaces, - sendFacesInfo - ); - // Half2: Adapt wallInfo for entering domain enterDomain ( - patch, + cycPatch, nReceiveFaces, receiveFaces, receiveFacesInfo @@ -754,25 +667,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches() // Merge into global storage mergeFaceInfo ( - patch, - nSendFaces, - sendFaces, - sendFacesInfo, - cycPatch.parallel() - ); - // Merge into global storage - mergeFaceInfo - ( - patch, + cycPatch, nReceiveFaces, receiveFaces, - receiveFacesInfo, - cycPatch.parallel() + receiveFacesInfo ); if (debug) { - checkCyclic(patch); + checkCyclic(cycPatch); } } } diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H index 1cddaef3ad4263945f570ca3145cd18c06fd8c57..44c7eb65425cc7d2b285ecac40401f5ca3f4db29 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H +++ b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H @@ -193,8 +193,7 @@ class FaceCellWave const polyPatch& patch, const label nFaces, const labelList&, - const List<Type>&, - const bool isParallel + const List<Type>& ); //- Extract info for single patch only @@ -225,23 +224,6 @@ class FaceCellWave List<Type>& faceInfo ) const; - //- Send info to neighbour - void sendPatchInfo - ( - const label neighbour, - const label nFaces, - const labelList&, - const List<Type>& - ) const; - - //- Receive info from neighbour. Returns number of faces received. - label receivePatchInfo - ( - const label neighbour, - labelList&, - List<Type>& - ) const; - //- Offset face labels by constant value static void offset ( diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 492d6a9e0f4ce6d206e6486955f027fea4684e43..67b6944e1336befd5ea64ba76a31a3d07f673ddd 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -109,7 +109,6 @@ struct HashTableCore { return iteratorEnd(); } - }; @@ -139,6 +138,7 @@ class HashTable //- Construct from key, next pointer and object inline hashedEntry(const Key&, hashedEntry* next, const T&); + private: //- Disallow default bitwise copy construct hashedEntry(const hashedEntry&); @@ -209,9 +209,8 @@ public: HashTable(const Xfer<HashTable<T, Key, Hash> >&); - // Destructor - - ~HashTable(); + //- Destructor + ~HashTable(); // Member Functions @@ -247,6 +246,7 @@ public: //- Print information Ostream& printInfo(Ostream&) const; + // Edit //- Insert a new hashedEntry @@ -291,7 +291,7 @@ public: void transfer(HashTable<T, Key, Hash>&); //- Transfer contents to the Xfer container - inline Xfer< HashTable<T, Key, Hash> > xfer(); + inline Xfer<HashTable<T, Key, Hash> > xfer(); // Member Operators @@ -356,9 +356,8 @@ public: //- Current hash index label hashIndex_; - protected: - // Protected Member Functions + protected: // Constructors @@ -380,6 +379,8 @@ public: ); + // Protected Member Functions + //- Increment to the next position inline void increment(); @@ -392,6 +393,7 @@ public: //- Return const access to referenced object inline const T& cobject() const; + public: // Member operators @@ -434,6 +436,7 @@ public: const label hashIndex ); + public: // Constructors @@ -444,13 +447,12 @@ public: //- Construct end iterator inline iterator(const iteratorEnd& unused); + // Member operators //- Conversion to a const_iterator inline operator const_iterator() const; - // Access - //- Return referenced hash value inline T& operator*(); inline T& operator()(); @@ -492,6 +494,7 @@ public: const label hashIndex ); + public: // Constructors @@ -502,9 +505,8 @@ public: //- Construct end iterator inline const_iterator(const iteratorEnd& unused); - // Member operators - // Access + // Member operators //- Return referenced hash value inline const T& operator*() const; @@ -536,7 +538,6 @@ public: Ostream&, const HashTable<T, Key, Hash>& ); - }; diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C index 1d0ab2c786046e5d661220779abbd2e0d81ae1e9..9cbe3154d618eca019fd490ee3d05129fd76e7ed 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C @@ -97,11 +97,10 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable {} - template<class T, class Key, class Hash> Foam::StaticHashTable<T, Key, Hash>::StaticHashTable ( - const Xfer< StaticHashTable<T, Key, Hash> >& ht + const Xfer<StaticHashTable<T, Key, Hash> >& ht ) : StaticHashTableCore(), @@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage() } - template<class T, class Key, class Hash> void Foam::StaticHashTable<T, Key, Hash>::transfer ( diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H index 9806a138e00bdb60762d740651b32af853a8ee41..3a2911432cb70f993cf4b182a3cf84a7bc901035 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H @@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<< ); -/*---------------------------------------------------------------------------*\ - Class StaticHashTableName Declaration -\*---------------------------------------------------------------------------*/ - /*---------------------------------------------------------------------------*\ Class StaticHashTableCore Declaration \*---------------------------------------------------------------------------*/ @@ -100,7 +96,6 @@ struct StaticHashTableCore iteratorEnd() {} }; - }; @@ -135,6 +130,7 @@ class StaticHashTable //- Assign a new hashed entry to a possibly already existing key bool set(const Key&, const T& newElmt, bool protect); + public: @@ -183,11 +179,11 @@ public: StaticHashTable(const StaticHashTable<T, Key, Hash>&); //- Construct by transferring the parameter contents - StaticHashTable(const Xfer< StaticHashTable<T, Key, Hash> >&); + StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&); - // Destructor - ~StaticHashTable(); + //- Destructor + ~StaticHashTable(); // Member Functions @@ -251,7 +247,7 @@ public: void transfer(StaticHashTable<T, Key, Hash>&); //- Transfer contents to the Xfer container - inline Xfer< StaticHashTable<T, Key, Hash> > xfer(); + inline Xfer<StaticHashTable<T, Key, Hash> > xfer(); // Member Operators @@ -275,6 +271,7 @@ public: //- The opposite of the equality operation. bool operator!=(const StaticHashTable<T, Key, Hash>&) const; + // STL type definitions //- Type of values the StaticHashTable contains. @@ -317,6 +314,7 @@ public: //- Index of current element at hashIndex label elemIndex_; + public: // Constructors diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H index bd031708e947365fa0ac464834043865907582fa..8d951f6c1ceb05ee0a987877eace602be0fdefe3 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H @@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set template<class T, class Key, class Hash> -inline Foam::Xfer< Foam::StaticHashTable<T, Key, Hash> > +inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> > Foam::StaticHashTable<T, Key, Hash>::xfer() { return xferMove(*this); @@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H index 1f761d9caf903a3d5bb50eba16130b01652baac3..d52369c60676c9dbfb2e9278dbc68d8d98183dd5 100644 --- a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H +++ b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectList.H @@ -74,7 +74,7 @@ public: ( const UList<T>& posList, const UList<T>& negList, - const Xfer< List<label> >& + const Xfer<List<label> >& ); @@ -102,7 +102,7 @@ public: //- Reset addressing inline void resetAddressing(const UList<label>&); - inline void resetAddressing(const Xfer< List<label> >&); + inline void resetAddressing(const Xfer<List<label> >&); // Member Operators diff --git a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectListI.H b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectListI.H index e6f33f709e51889259d53fc03d1eabe964897b1d..3aa8fc6814dc237e59931730929744635711f29e 100644 --- a/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectListI.H +++ b/src/OpenFOAM/containers/Lists/BiIndirectList/BiIndirectListI.H @@ -45,7 +45,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList ( const UList<T>& posList, const UList<T>& negList, - const Xfer< List<label> >& addr + const Xfer<List<label> >& addr ) : posList_(const_cast<UList<T>&>(posList)), @@ -105,7 +105,7 @@ inline void Foam::BiIndirectList<T>::resetAddressing template<class T> inline void Foam::BiIndirectList<T>::resetAddressing ( - const Xfer< List<label> >& addr + const Xfer<List<label> >& addr ) { addressing_.transfer(addr()); diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H index 59a2ba8ddd75fad08ef0ccedf66c0a25a0970169..905db6a24c3e3ed5cdd2a1723e79c7cd26e89636 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H @@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[] ) { label start = offsets_[i]; - return UList<T>(&m_[start], offsets_[i+1] - start); + return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start); } @@ -238,7 +238,7 @@ Foam::CompactListList<T, Container>::operator[] label start = offsets_[i]; return UList<T> ( - const_cast<T*>(&m_[start]), + (m_.size() ? const_cast<T*>(&m_[start]) : NULL), offsets_[i+1] - start ); } diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H index daccd7af3d11c1f358ff7aeb3397018cd9d545c9..d80e7ddad58754b84d8076aebe018585aec0bb6e 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H @@ -84,7 +84,6 @@ class DynamicList //- The capacity (allocated size) of the underlying list. label capacity_; - // Private Member Functions public: @@ -93,6 +92,7 @@ public: //- Declare friendship with the List class friend class List<T>; + // Constructors //- Construct null @@ -115,7 +115,7 @@ public: explicit inline DynamicList(const UIndirectList<T>&); //- Construct by transferring the parameter contents - explicit inline DynamicList(const Xfer< List<T> >&); + explicit inline DynamicList(const Xfer<List<T> >&); //- Construct from Istream. Size set to size of read list. explicit DynamicList(Istream&); @@ -125,103 +125,105 @@ public: // Access - //- Size of the underlying storage. - inline label capacity() const; + //- Size of the underlying storage. + inline label capacity() const; // Edit - //- Alter the size of the underlying storage. - // The addressed size will be truncated if needed to fit, but will - // remain otherwise untouched. - // Use this or reserve() in combination with append(). - inline void setCapacity(const label); + //- Alter the size of the underlying storage. + // The addressed size will be truncated if needed to fit, but will + // remain otherwise untouched. + // Use this or reserve() in combination with append(). + inline void setCapacity(const label); - //- Alter the addressed list size. - // New space will be allocated if required. - // Use this to resize the list prior to using the operator[] for - // setting values (as per List usage). - inline void setSize(const label); + //- Alter the addressed list size. + // New space will be allocated if required. + // Use this to resize the list prior to using the operator[] for + // setting values (as per List usage). + inline void setSize(const label); - //- Alter the addressed list size and fill new space with a constant. - inline void setSize(const label, const T&); + //- Alter the addressed list size and fill new space with a constant. + inline void setSize(const label, const T&); - //- Alter the addressed list size. - // New space will be allocated if required. - // Use this to resize the list prior to using the operator[] for - // setting values (as per List usage). - inline void resize(const label); + //- Alter the addressed list size. + // New space will be allocated if required. + // Use this to resize the list prior to using the operator[] for + // setting values (as per List usage). + inline void resize(const label); - //- Alter the addressed list size and fill new space with a constant. - inline void resize(const label, const T&); + //- Alter the addressed list size and fill new space with a constant. + inline void resize(const label, const T&); - //- Reserve allocation space for at least this size. - // Never shrinks the allocated size, use setCapacity() for that. - inline void reserve(const label); + //- Reserve allocation space for at least this size. + // Never shrinks the allocated size, use setCapacity() for that. + inline void reserve(const label); - //- Clear the addressed list, i.e. set the size to zero. - // Allocated size does not change - inline void clear(); + //- Clear the addressed list, i.e. set the size to zero. + // Allocated size does not change + inline void clear(); - //- Clear the list and delete storage. - inline void clearStorage(); + //- Clear the list and delete storage. + inline void clearStorage(); - //- Shrink the allocated space to the number of elements used. - // Returns a reference to the DynamicList. - inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink(); + //- Shrink the allocated space to the number of elements used. + // Returns a reference to the DynamicList. + inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink(); - //- Transfer contents of the argument List into this DynamicList - inline void transfer(List<T>&); + //- Transfer contents of the argument List into this DynamicList + inline void transfer(List<T>&); - //- Transfer contents of the argument DynamicList into this DynamicList - inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); + //- Transfer contents of the argument DynamicList into this DynamicList + inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); - //- Transfer contents to the Xfer container as a plain List - inline Xfer< List<T> > xfer(); + //- Transfer contents to the Xfer container as a plain List + inline Xfer<List<T> > xfer(); - // Member Operators - //- Append an element at the end of the list - inline void append(const T&); + // Member Operators - //- Append a List at the end of this list - inline void append(const UList<T>&); + //- Append an element at the end of the list + inline void append(const T&); - //- Append a UIndirectList at the end of this list - inline void append(const UIndirectList<T>&); + //- Append a List at the end of this list + inline void append(const UList<T>&); - //- Remove and return the top element - inline T remove(); + //- Append a UIndirectList at the end of this list + inline void append(const UIndirectList<T>&); - //- Return non-const access to an element, resizing list if necessary - inline T& operator()(const label); + //- Remove and return the top element + inline T remove(); - //- Assignment of all addressed entries to the given value - inline void operator=(const T&); + //- Return non-const access to an element, resizing list if necessary + inline T& operator()(const label); - //- Assignment from DynamicList - inline void operator= - ( - const DynamicList<T, SizeInc, SizeMult, SizeDiv>& - ); + //- Assignment of all addressed entries to the given value + inline void operator=(const T&); - //- Assignment from UList - inline void operator=(const UList<T>&); + //- Assignment from DynamicList + inline void operator= + ( + const DynamicList<T, SizeInc, SizeMult, SizeDiv>& + ); - // IOstream operators + //- Assignment from UList + inline void operator=(const UList<T>&); - // Write DynamicList to Ostream. - friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv> - ( - Ostream&, - const DynamicList<T, SizeInc, SizeMult, SizeDiv>& - ); - //- Read from Istream, discarding contents of existing DynamicList. - friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv> - ( - Istream&, - DynamicList<T, SizeInc, SizeMult, SizeDiv>& - ); + // IOstream operators + + // Write DynamicList to Ostream. + friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv> + ( + Ostream&, + const DynamicList<T, SizeInc, SizeMult, SizeDiv>& + ); + + //- Read from Istream, discarding contents of existing DynamicList. + friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv> + ( + Istream&, + DynamicList<T, SizeInc, SizeMult, SizeDiv>& + ); }; diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H index 4e0ffbd1fdeaa30382a39c1e260d8cbf7a8da86b..aa88e184f1cf783f8b9ce7a791c8da0009aa4261 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H @@ -298,7 +298,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> -inline Foam::Xfer< Foam::List<T> > +inline Foam::Xfer<Foam::List<T> > Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer() { return xferMoveTo< List<T> >(*this); diff --git a/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H b/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H index a0d97af48ee42e49a22f9f7b5a1f360be07eed0a..91a0adb520677dab63998fee250fdceeba21e836 100644 --- a/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H +++ b/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H @@ -64,7 +64,8 @@ public: inline IndirectList(const UList<T>&, const UList<label>&); //- Construct given the complete list and by transferring addressing - inline IndirectList(const UList<T>&, const Xfer< List<label> >&); + inline IndirectList(const UList<T>&, const Xfer<List<label> >&); + // Member Functions @@ -94,11 +95,12 @@ public: //- Return the list addressing inline const List<label>& addressing() const; + // Edit //- Reset addressing inline void resetAddressing(const UList<label>&); - inline void resetAddressing(const Xfer< List<label> >&); + inline void resetAddressing(const Xfer<List<label> >&); // Member Operators diff --git a/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H b/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H index 47eedb733d1115cf0aba6d91830df8440090770a..6bee37cea3c85b3e0eb4c911b06068f21590afa7 100644 --- a/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H +++ b/src/OpenFOAM/containers/Lists/IndirectList/IndirectListI.H @@ -42,7 +42,7 @@ template<class T> inline Foam::IndirectList<T>::IndirectList ( const UList<T>& completeList, - const Xfer< List<label> >& addr + const Xfer<List<label> >& addr ) : completeList_(const_cast<UList<T>&>(completeList)), @@ -121,7 +121,7 @@ inline void Foam::IndirectList<T>::resetAddressing template<class T> inline void Foam::IndirectList<T>::resetAddressing ( - const Xfer< List<label> >& addr + const Xfer<List<label> >& addr ) { addressing_.transfer(addr()); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C index a970d6104cef67f4fd68e867bbdb73b8b839f97f..884276809857d563b8be24f4cfe984f47bd1da9a 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C @@ -38,7 +38,8 @@ Foam::IPstream::IPstream ) : Pstream(commsType, bufSize), - UIPstream(commsType, fromProcNo, buf_) + UIPstream(commsType, fromProcNo, buf_, externalBufPosition_), + externalBufPosition_(0) {} diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H index acc59de87bf045db5171eec073e39c8030f5c83f..201e1b7f1d324e9926a1d4eb10cd49125d5aedde 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H @@ -55,6 +55,9 @@ class IPstream public UIPstream { + //- Receive index + label externalBufPosition_; + public: // Constructors diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C index 41cb1c4f110bc75c61dfdcd904812cc77d13eac3..b2e4d8df06dd8be31eeaef26c4fa37e9ee88901e 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C @@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers version_(version), sendBuf_(UPstream::nProcs()), recvBuf_(UPstream::nProcs()), + recvBufPos_(UPstream::nProcs(), 0), finishedSendsCalled_(false) {} +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::PstreamBuffers::~PstreamBuffers() +{ + // Check that all data has been consumed. + forAll(recvBufPos_, procI) + { + if (recvBufPos_[procI] < recvBuf_[procI].size()) + { + FatalErrorIn("PstreamBuffers::~PstreamBuffers()") + << "Message from processor " << procI + << " not fully consumed. messageSize:" << recvBuf_[procI].size() + << " bytes of which only " << recvBufPos_[procI] + << " consumed." + << Foam::abort(FatalError); + } + } +} + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::PstreamBuffers::finishedSends(const bool block) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H index 75f26f1d6a9468d6caba8174921895dbf84fe1b2..c2dc745beac925af1a48362787dd740036a76ca6 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H @@ -106,6 +106,9 @@ class PstreamBuffers //- receive buffer List<DynamicList<char> > recvBuf_; + //- read position in recvBuf_ + labelList recvBufPos_; + bool finishedSendsCalled_; // Private member functions @@ -129,6 +132,10 @@ public: IOstream::versionNumber version=IOstream::currentVersion ); + // Destructor + + ~PstreamBuffers(); + // Member functions diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C index 4c38db6c692cb0598618a85b5496519fdc7f7d9d..f4c37633f352cde9c57fed2b48d1a6e31ec9a449 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.C @@ -77,20 +77,6 @@ inline void Foam::UIPstream::readFromBuffer } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::UIPstream::~UIPstream() -{ - if (externalBufPosition_ < messageSize_) - { - FatalErrorIn("UIPstream::~UIPstream()") - << "Message not fully consumed. messageSize:" << messageSize_ - << " bytes of which only " << externalBufPosition_ - << " consumed." << Foam::abort(FatalError); - } -} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::Istream& Foam::UIPstream::read(token& t) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H index aebef123b1586d5855ac301feda4779c60fef8ef..30e4e9611976bad7c21b42fe5186b30a8d5c396b 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UIPstream.H @@ -63,7 +63,7 @@ class UIPstream DynamicList<char>& externalBuf_; - label externalBufPosition_; + label& externalBufPosition_; const int tag_; @@ -94,6 +94,7 @@ public: const commsTypes commsType, const int fromProcNo, DynamicList<char>& externalBuf, + label& externalBufPosition, const int tag = UPstream::msgType(), streamFormat format=BINARY, versionNumber version=currentVersion @@ -103,11 +104,6 @@ public: UIPstream(const int fromProcNo, PstreamBuffers&); - // Destructor - - ~UIPstream(); - - // Member functions // Inquiry diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index 45cab4130a438114394ff360aaacc23b5badf227..db4bd704a908981d2c55451639aa3a8c82651dc3 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -220,6 +220,30 @@ Foam::List<int> Foam::UPstream::procIDs_(1, 0); // Standard transfer message type int Foam::UPstream::msgType_(1); +// New message type +int Foam::UPstream::freeTag_(msgType()+1); + +// Free'd message types +Foam::LIFOStack<int> Foam::UPstream::freedTags_; + +int Foam::UPstream::allocateTag() +{ + if (freedTags_.empty()) + { + return freeTag_++; + } + else + { + return freedTags_.pop(); + } +} + +void Foam::UPstream::freeTag(const int tag) +{ + freedTags_.push(tag); +} + + // Linear communication schedule Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::linearCommunication_(0); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H index fcfe9dd0c9410766183aabc182dd809a4d9ccd86..2142266889da2bcc4eb9f6cedb3fe031246edd50 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H @@ -46,6 +46,7 @@ SourceFiles #include "HashTable.H" #include "string.H" #include "NamedEnum.H" +#include "LIFOStack.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -191,6 +192,14 @@ private: static List<commsStruct> treeCommunication_; + //- Current free tag + static int freeTag_; + + //- Freed tags + static LIFOStack<int> freedTags_; + + + // Private member functions //- Set data for parallel running @@ -340,6 +349,11 @@ public: { return msgType_; } + //- Allocate new tag + static int allocateTag(); + + //- Release allocated tag + static void freeTag(const int tag); //- Get the communications type of the stream diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index b2aa0d93e3095b0e504dfb4fb91f5fa984e5fca3..b1a34e8241a388f92e08ffe9c9586095064eff72 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -298,7 +298,11 @@ evaluate() } // Block for any outstanding requests - if (Pstream::defaultCommsType == Pstream::nonBlocking) + if + ( + Pstream::parRun() + && Pstream::defaultCommsType == Pstream::nonBlocking + ) { Pstream::waitRequests(); } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C index 4a822d9de092d16c7df982c323362276dad98a39..3999f646f8c7cc1384335ba87b6ad245886a8293 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C @@ -108,7 +108,8 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const Pstream::blocking, procPatch_.neighbProcNo(), reinterpret_cast<const char*>(pf.begin()), - pf.byteSize() + pf.byteSize(), + procPatch_.tag() ); } } @@ -126,7 +127,8 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const Pstream::blocking, procPatch_.neighbProcNo(), reinterpret_cast<char*>(pnf.begin()), - pnf.byteSize() + pnf.byteSize(), + procPatch_.tag() ); if (doTransform()) diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C index 67839a23ccf7e053956a0c9164ce8805b6ad9370..3034a595f1f37ab1ff87cef5e494ee741aa8f039 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C @@ -109,7 +109,8 @@ const Pstream::blocking, procPatch_.neighbProcNo(), reinterpret_cast<const char*>(pf.begin()), - pf.byteSize() + pf.byteSize(), + procPatch_.tag() ); } } @@ -127,7 +128,8 @@ void processorCyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const Pstream::blocking, procPatch_.neighbProcNo(), reinterpret_cast<char*>(pnf.begin()), - pnf.byteSize() + pnf.byteSize(), + procPatch_.tag() ); if (doTransform()) diff --git a/src/OpenFOAM/global/argList/parRun.H b/src/OpenFOAM/global/argList/parRun.H index c1e5b544bc54001b640931781b24ee76b71d8f04..8cb4c433a87b2db7408e7ee0bd1b2466cb3de93c 100644 --- a/src/OpenFOAM/global/argList/parRun.H +++ b/src/OpenFOAM/global/argList/parRun.H @@ -33,8 +33,7 @@ Description #ifndef parRun_H #define parRun_H -#include "OPstream.H" -#include "IPstream.H" +#include "Pstream.H" #include "IOstreams.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H index ed40c9ccd8e786bd3caa7791e0adbd2308c03c3f..352c886c75c7a4d077054f51c45440da850f1a78 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H @@ -95,6 +95,9 @@ public: //- Return face transformation tensor virtual const tensor& forwardT() const = 0; + //- Return message tag used for sending + virtual int tag() const = 0; + // //- Set send buffer to sufficient size to hold List<Type>(nElems). // // Returns reference to buffer (note:buffer.size() is number // // of characters, not nElems) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C index 98ca57342c43a459e4369098065f266a09b6f32b..fa0b9b641c08ededa112c75856fb2a1227654864 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C @@ -87,7 +87,8 @@ void Foam::processorLduInterface::send commsType, neighbProcNo(), reinterpret_cast<const char*>(f.begin()), - f.byteSize() + f.byteSize(), + tag() ); } else if (commsType == Pstream::nonBlocking) @@ -100,7 +101,8 @@ void Foam::processorLduInterface::send commsType, neighbProcNo(), receiveBuf_.begin(), - receiveBuf_.size() + receiveBuf_.size(), + tag() ); //setSendBuf<Type>(f.size()); @@ -112,7 +114,8 @@ void Foam::processorLduInterface::send commsType, neighbProcNo(), sendBuf_.begin(), - f.byteSize() + f.byteSize(), + tag() ); } else @@ -138,7 +141,8 @@ void Foam::processorLduInterface::receive commsType, neighbProcNo(), reinterpret_cast<char*>(f.begin()), - f.byteSize() + f.byteSize(), + tag() ); } else if (commsType == Pstream::nonBlocking) @@ -202,7 +206,8 @@ void Foam::processorLduInterface::compressedSend commsType, neighbProcNo(), sendBuf_.begin(), - nBytes + nBytes, + tag() ); } else if (commsType == Pstream::nonBlocking) @@ -215,7 +220,8 @@ void Foam::processorLduInterface::compressedSend commsType, neighbProcNo(), receiveBuf_.begin(), - receiveBuf_.size() + receiveBuf_.size(), + tag() ); OPstream::write @@ -223,7 +229,8 @@ void Foam::processorLduInterface::compressedSend commsType, neighbProcNo(), sendBuf_.begin(), - nBytes + nBytes, + tag() ); } else @@ -264,7 +271,8 @@ void Foam::processorLduInterface::compressedReceive commsType, neighbProcNo(), receiveBuf_.begin(), - nBytes + nBytes, + tag() ); } else if (commsType != Pstream::nonBlocking) @@ -350,7 +358,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive // commsType, // neighbProcNo(), // sendBuf_.begin(), -// sendBuf_.size() +// sendBuf_.size(), +// tag() // ); // } // else if (commsType == Pstream::nonBlocking) @@ -362,7 +371,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive // commsType, // neighbProcNo(), // receiveBuf_.begin(), -// receiveBuf_.size() +// receiveBuf_.size(), +// tag() // ); // // OPstream::write @@ -370,7 +380,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive // commsType, // neighbProcNo(), // sendBuf_.begin(), -// sendBuf_.size() +// sendBuf_.size(), +// tag() // ); // } // else @@ -405,7 +416,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive // commsType, // neighbProcNo(), // receiveBuf_.begin(), -// receiveBuf_.size() +// receiveBuf_.size(), +// tag() // ); // } // else if (commsType != Pstream::nonBlocking) @@ -441,7 +453,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive // commsType, // neighbProcNo(), // receiveBuf_.begin(), -// receiveBuf_.size() +// receiveBuf_.size(), +// tag() // ); // } // else if (commsType != Pstream::nonBlocking) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C index 54be31bdf6b86aab82eb623afae1cb772396e83c..e56550e812de8a0028cc1db8c4e25eb7ad9bcede 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixUpdateMatrixInterfaces.C @@ -112,10 +112,13 @@ void Foam::lduMatrix::updateMatrixInterfaces ) { // Block until all sends/receives have been finished - if (Pstream::defaultCommsType == Pstream::nonBlocking) + if + ( + Pstream::parRun() + && Pstream::defaultCommsType == Pstream::nonBlocking + ) { - IPstream::waitRequests(); - OPstream::waitRequests(); + UPstream::waitRequests(); } forAll (interfaces, interfaceI) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C index 8b9d433e403a26d3066785e8d5ec4fbfdb018902..09af0b719b9d0d4224b1a5285a1e8777e086fb87 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C @@ -81,20 +81,13 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix const Pstream::commsTypes ) const { - scalarField pnf(size()); + // 'send' neighbouring field + scalarField pnf(cyclicInterface_.interfaceInternalField(psiInternal)()); - label sizeby2 = size()/2; + transformCoupleField(pnf, cmpt); const unallocLabelList& faceCells = cyclicInterface_.faceCells(); - for (label facei=0; facei<sizeby2; facei++) - { - pnf[facei] = psiInternal[faceCells[facei + sizeby2]]; - pnf[facei + sizeby2] = psiInternal[faceCells[facei]]; - } - - transformCoupleField(pnf, cmpt); - forAll(faceCells, elemI) { result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index df7b8d96a3ec48964c0860f1aaa35cb2616fae70..7d7e53a767e8b94b7b011927b84a4d4fa8902573 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -136,6 +136,12 @@ public: } } + //- Return message tag to use for communication + virtual int tag() const + { + return procPolyPatch_.tag(); + } + //- Return processor number int myProcNo() const { diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C index 684580aaf6cf11e5f7871497fc71c08c355da051..97fd1611db6579f40d2cc18d319fb58512c933b3 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C @@ -382,7 +382,8 @@ processorCyclicPointPatch::processorCyclicPointPatch const pointBoundaryMesh& bm ) : - processorPointPatch(patch, bm) + processorPointPatch(patch, bm), + procCycPolyPatch_(refCast<const processorCyclicPolyPatch>(patch)) {} diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H index 12e1084038888ee6d7924eda0f2dfb747a816792..71f8bbc50cbada62842480628d2c30d6795aa1f7 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H @@ -60,6 +60,9 @@ class processorCyclicPointPatch : public processorPointPatch { + // Private data + + const processorCyclicPolyPatch& procCycPolyPatch_; //- Disallow default construct as copy processorCyclicPointPatch(const processorCyclicPointPatch&); @@ -90,6 +93,13 @@ public: // Member functions + + //- Return message tag to use for communication + virtual int tag() const + { + return procCycPolyPatch_.tag(); + } + // //- Return true if running parallel // virtual bool coupled() const // { diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index ba9294014468da52651ee3375b486f4769313bfa..6ab7eb6614121f85cead3823c4518ad545fe5b76 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -78,34 +78,38 @@ void Foam::globalMeshData::initProcAddr() if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send indices of my processor patches to my neighbours forAll (processorPatches_, i) { label patchi = processorPatches_[i]; - OPstream toNeighbour + UOPstream toNeighbour ( - Pstream::blocking, refCast<const processorPolyPatch> ( mesh_.boundaryMesh()[patchi] - ).neighbProcNo() + ).neighbProcNo(), + pBufs ); toNeighbour << processorPatchIndices_[patchi]; } + pBufs.finishedSends(); + forAll(processorPatches_, i) { label patchi = processorPatches_[i]; - IPstream fromNeighbour + UIPstream fromNeighbour ( - Pstream::blocking, refCast<const processorPolyPatch> ( mesh_.boundaryMesh()[patchi] - ).neighbProcNo() + ).neighbProcNo(), + pBufs ); fromNeighbour >> processorPatchNeighbours_[patchi]; @@ -1560,6 +1564,8 @@ void Foam::globalMeshData::updateMesh() pointStatus.set(meshPointI, SHARED); } + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send patch local points forAll(processorPatches_, i) { @@ -1568,11 +1574,13 @@ void Foam::globalMeshData::updateMesh() const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]); - OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); toNeighbour << procPatch.localPoints(); } + pBufs.finishedSends(); + // Receive patch local points and uncount if coincident (and not shared) forAll(processorPatches_, i) { @@ -1581,7 +1589,7 @@ void Foam::globalMeshData::updateMesh() const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]); - IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo()); + UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs); pointField nbrPoints(fromNeighbour); diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index 6dfc702fdd65213b894dd5d6ac0d67a1017fe5b8..c39d20872b096d590c09fcbd3f3cdc4cf181d5bd 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -431,17 +431,16 @@ void Foam::globalPoints::receivePatchPoints const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>(pp); - const labelList& meshPoints = pp.meshPoints(); + const labelList& meshPoints = cycPatch.meshPoints(); + const labelList coupledMeshPoints(reverseMeshPoints(cycPatch)); //const edgeList& connections = cycPatch.coupledPoints(); - const edgeList connections(coupledPoints(cycPatch)); + //const edgeList connections(coupledPoints(cycPatch)); - forAll(connections, i) + forAll(meshPoints, i) { - const edge& e = connections[i]; - - label meshPointA = meshPoints[e[0]]; - label meshPointB = meshPoints[e[1]]; + label meshPointA = meshPoints[i]; + label meshPointB = coupledMeshPoints[i]; label localA = meshToLocalPoint ( @@ -823,13 +822,15 @@ void Foam::globalPoints::receiveSharedPoints // Sync all info. //const edgeList& connections = cycPatch.coupledPoints(); - const edgeList connections(coupledPoints(cycPatch)); + //const edgeList connections(coupledPoints(cycPatch)); + + const labelList& meshPoints = cycPatch.meshPoints(); + const labelList coupledMeshPoints(reverseMeshPoints(cycPatch)); - forAll(connections, i) + forAll(meshPoints, i) { - const edge& e = connections[i]; - label meshPointA = pp.meshPoints()[e[0]]; - label meshPointB = pp.meshPoints()[e[1]]; + label meshPointA = meshPoints[i]; + label meshPointB = coupledMeshPoints[i]; label localA = meshToLocalPoint ( @@ -902,51 +903,25 @@ void Foam::globalPoints::receiveSharedPoints } -Foam::edgeList Foam::globalPoints::coupledPoints(const cyclicPolyPatch& pp) +Foam::labelList Foam::globalPoints::reverseMeshPoints +( + const cyclicPolyPatch& pp +) { - // Look at cyclic patch as two halves, A and B. - // Now all we know is that relative face index in halfA is same - // as coupled face in halfB and also that the 0th vertex - // corresponds. - - // From halfA point to halfB or -1. - labelList coupledPoint(pp.nPoints(), -1); - - for (label patchFaceA = 0; patchFaceA < pp.size()/2; patchFaceA++) - { - const face& fA = pp.localFaces()[patchFaceA]; - - forAll(fA, indexA) - { - label patchPointA = fA[indexA]; - - if (coupledPoint[patchPointA] == -1) - { - const face& fB = pp.localFaces()[patchFaceA + pp.size()/2]; - - label indexB = (fB.size() - indexA) % fB.size(); - - coupledPoint[patchPointA] = fB[indexB]; - } - } - } + const cyclicPolyPatch& nbrPatch = pp.neighbPatch(); - edgeList connected(pp.nPoints()); + faceList masterFaces(nbrPatch.size()); - // Extract coupled points. - label connectedI = 0; - - forAll(coupledPoint, i) + forAll (nbrPatch, faceI) { - if (coupledPoint[i] != -1) - { - connected[connectedI++] = edge(i, coupledPoint[i]); - } + masterFaces[faceI] = nbrPatch[faceI].reverseFace(); } - connected.setSize(connectedI); - - return connected; + return primitiveFacePatch + ( + masterFaces, + nbrPatch.points() + ).meshPoints(); } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H index 41d010ec9f2c2e91a4c5ff987ce7dbae4760d8ac..f3e2baf6b9aa6b2c0f9ded633b6072f13f9c13a4 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.H @@ -156,9 +156,6 @@ class globalPoints // information is collected. static label countPatchPoints(const polyBoundaryMesh&); - ////- Get all faces on coupled patches - //static labelListl coupledFaces(const polyBoundaryMesh&); - //- Add information about patchPointI in relative indices to send // buffers (patchFaces, indexInFace etc.) static void addToSend @@ -246,9 +243,8 @@ class globalPoints labelList& ); - //- Should move into cyclicPolyPatch ordering problem - // keeps on giving problems. - static edgeList coupledPoints(const cyclicPolyPatch&); + //- Return mesh points of other side in same order as my meshPoints. + static labelList reverseMeshPoints(const cyclicPolyPatch&); //- Do all calculations. void calculateSharedPoints diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index f9b4a37e465d416e78f6a6d3fb0c3cc5b39ca681..e22afb5d8c31b1c90ce74ee11e2186ebafed1dbd 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -75,7 +75,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule slave++ ) { - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::scheduled, slave); List<labelPair> nbrData(fromSlave); forAll(nbrData, i) @@ -96,18 +96,18 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule slave++ ) { - OPstream toSlave(Pstream::blocking, slave); + OPstream toSlave(Pstream::scheduled, slave); toSlave << allComms; } } else { { - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); toMaster << allComms; } { - IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); + IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); fromMaster >> allComms; } } @@ -596,6 +596,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed) // Send elemIsUsed field to neighbour. Use nonblocking code from // mapDistribute but in reverse order. + if (Pstream::parRun()) { List<boolList> sendFields(Pstream::nProcs()); diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C index 29d9fc5c96911ab930447c72592ceae76f69603f..82084f8de42a73bf18fc4e8d3f22f49ab68da79a 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C @@ -42,6 +42,30 @@ void Foam::mapDistribute::distribute List<T>& field ) { + if (!Pstream::parRun()) + { + // Do only me to me. + + const labelList& mySubMap = subMap[Pstream::myProcNo()]; + + List<T> subField(mySubMap.size()); + forAll(mySubMap, i) + { + subField[i] = field[mySubMap[i]]; + } + + // Receive sub field from myself (subField) + const labelList& map = constructMap[Pstream::myProcNo()]; + + field.setSize(constructSize); + + forAll(map, i) + { + field[map[i]] = subField[i]; + } + return; + } + if (commsType == Pstream::blocking) { // Since buffered sending can reuse the field to collect the @@ -407,6 +431,30 @@ void Foam::mapDistribute::distribute const T& nullValue ) { + if (!Pstream::parRun()) + { + // Do only me to me. + + const labelList& mySubMap = subMap[Pstream::myProcNo()]; + + List<T> subField(mySubMap.size()); + forAll(mySubMap, i) + { + subField[i] = field[mySubMap[i]]; + } + + // Receive sub field from myself (subField) + const labelList& map = constructMap[Pstream::myProcNo()]; + + field.setSize(constructSize); + + forAll(map, i) + { + field[map[i]] = subField[i]; + } + return; + } + if (commsType == Pstream::blocking) { // Since buffered sending can reuse the field to collect the diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index e8b1ae5998df6f416add5dec82fa8c052037c802..0db1d6f6a2dde12226a9f0faccc463ae00001f57 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -294,13 +294,13 @@ Foam::polyMesh::polyMesh(const IOobject& io) // Calculate the geometry for the patches (transformation tensors etc.) boundary_.calcGeometry(); - // Warn if global empty mesh (constructs globalData!) - if (globalData().nTotalPoints() == 0) + // Warn if global empty mesh + if (returnReduce(nPoints(), sumOp<label>()) == 0) { WarningIn("polyMesh(const IOobject&)") << "no points in mesh" << endl; } - if (globalData().nTotalCells() == 0) + if (returnReduce(nCells(), sumOp<label>()) == 0) { WarningIn("polyMesh(const IOobject&)") << "no cells in mesh" << endl; @@ -744,8 +744,12 @@ void Foam::polyMesh::resetPrimitives // Calculate the geometry for the patches (transformation tensors etc.) boundary_.calcGeometry(); - // Warn if global empty mesh (constructs globalData!) - if (globalData().nTotalPoints() == 0 || globalData().nTotalCells() == 0) + // Warn if global empty mesh + if + ( + (returnReduce(nPoints(), sumOp<label>()) == 0) + || (returnReduce(nCells(), sumOp<label>()) == 0) + ) { FatalErrorIn ( diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index 3a7c7eebc1932b80a334498c624961099e05a5ca..b43158f3bc5e8b9c3d6b94bd83d0bd005e5eba25 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -265,7 +265,8 @@ void Foam::coupledPolyPatch::calcTransformTensors Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl << " (half)size:" << Cf.size() << nl << " absTol:" << absTol << nl - //<< " smallDist:" << smallDist << nl + << " smallDist min:" << min(smallDist) << nl + << " smallDist max:" << max(smallDist) << nl << " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl; } @@ -277,7 +278,7 @@ void Foam::coupledPolyPatch::calcTransformTensors // Then the overall error of summing the normals is sqrt(size())*absTol // - separation calculation: pass in from the outside an allowable error. - if (size() == 0) + if (Cf.size() == 0) { // Dummy geometry. separated = false; @@ -308,7 +309,7 @@ void Foam::coupledPolyPatch::calcTransformTensors // Check - forAll (forwardT, facei) + forAll(forwardT, facei) { tensor T = rotationTensor(-nr[facei], nf[facei]); diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 54f59b2ccf2ac02c5bca15139fe4ca08599dc6c0..fe8f6f27a77f617b31ea4fb811d70e7d0bbab72c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -235,6 +235,15 @@ public: return true; } + //- Does this side own the patch ? + virtual bool owner() const = 0; + + //- Does the coupled side own the patch ? + virtual bool neighbour() const + { + return !owner(); + } + //- Transform a patch-based field from other side to this side. //!! TDB with macros? virtual bool doTransform() const = 0; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 53b3373362ba6e6cf8343a74155b87ab10a01549..1f28f4b9070e3cc089ed7432826bcaecb35a3229 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -175,13 +175,6 @@ void Foam::cyclicPolyPatch::calcTransforms const UList<point>& half1Areas ) { -Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl - << " half0Ctrs:" - << " min:" << min(half0Ctrs) << " max:" << max(half0Ctrs)<< endl - << " half1Ctrs:" - << " min:" << min(half1Ctrs) << " max:" << max(half1Ctrs)<< endl - << endl; - if (half0Ctrs.size() != half1Ctrs.size()) { FatalErrorIn @@ -265,16 +258,6 @@ Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl half1Normals, half0Tols ); - -Pout<< "cyclicPolyPatch::calcTransforms : calculated transforms for:" - << name() << endl - << " separated_:" << separated_ << endl - << " separation_:" << separation_ << endl - << " parallel_:" << parallel_ << endl - << " forwardT_:" << forwardT_ << endl - << " reverseT_:" << reverseT_ << endl - << endl; - } } @@ -445,7 +428,7 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace if (debug) { - Info<< "getConsistentRotationFace(const pointField&)" << nl + Pout<< "getConsistentRotationFace(const pointField&)" << nl << " rotFace = " << rotFace << nl << " point = " << faceCentres[rotFace] << endl; } @@ -679,7 +662,7 @@ void Foam::cyclicPolyPatch::calcGeometry //polyPatch::calcGeometry(); Pout<< "cyclicPolyPatch::calcGeometry : name:" << name() - << " referred from:" << referPatch.size() << endl; + << " referred from a patch with nFaces:" << referPatch.size() << endl; calcTransforms ( @@ -694,7 +677,6 @@ Pout<< "cyclicPolyPatch::calcGeometry : name:" << name() void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) { -Pout<< "cyclicPolyPatch::calcGeometry() for " << name() << endl; calcGeometry ( *this, diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index 166de53c1d2894b8a916489dd256807022648f0a..ce8f3e1982c6f3227d0ecdb9104cf3e5a66ec9a3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -417,34 +417,34 @@ public: // Low level geometric information - //- Are the coupled planes separated - virtual bool separated() const - { - return separated_; - } + //- Are the coupled planes separated + virtual bool separated() const + { + return separated_; + } - virtual const vector& separation() const - { - return separation_; - } + virtual const vector& separation() const + { + return separation_; + } - //- Are the cyclic planes parallel - virtual bool parallel() const - { - return parallel_; - } + //- Are the cyclic planes parallel + virtual bool parallel() const + { + return parallel_; + } - //- Return face transformation tensor - virtual const tensor& forwardT() const - { - return forwardT_; - } + //- Return face transformation tensor + virtual const tensor& forwardT() const + { + return forwardT_; + } - //- Return neighbour-cell transformation tensor - virtual const tensor& reverseT() const - { - return reverseT_; - } + //- Return neighbour-cell transformation tensor + virtual const tensor& reverseT() const + { + return reverseT_; + } label transformGlobalFace(const label facei) const { @@ -466,6 +466,31 @@ public: } } + //- Type of transform + transformType transform() const + { + return transform_; + } + + //- Axis of rotation for rotational cyclics + const vector& rotationAxis() const + { + return rotationAxis_; + } + + //- point on axis of rotation for rotational cyclics + const point& rotationCentre() const + { + return rotationCentre_; + } + + //- Translation vector for translational cyclics + const vector& separationVector() const + { + return separationVector_; + } + + //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 472cf1300a52d8da6438a3ee992710d163e65bec..88dfb510e2da18a38887be2554fcf898b99b8a37 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -158,7 +158,7 @@ Foam::processorPolyPatch::~processorPolyPatch() void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs) { -Pout<< "**processorPolyPatch::initGeometry()" << endl; +//Pout<< "**processorPolyPatch::initGeometry()" << endl; if (Pstream::parRun()) { UOPstream toNeighbProc(neighbProcNo(), pBufs); @@ -187,22 +187,94 @@ Pout<< "processorPolyPatch::calcGeometry() for " << name() << endl; Pout<< "processorPolyPatch::calcGeometry() : received data for " << neighbFaceCentres_.size() << " faces." << endl; - - calcGeometry - ( - *this, - faceCentres(), - faceAreas(), - faceCellCentres()(), - neighbFaceCentres_, - neighbFaceAreas_, - neighbFaceCellCentres_ - ); +//Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl; +//Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl; +//Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl; + + + +// // My normals +// vectorField faceNormals(size()); +// +// // Neighbour normals +// vectorField nbrFaceNormals(neighbFaceAreas_.size()); +// +// // Calculate normals from areas and check +// forAll(faceNormals, facei) +// { +// scalar magSf = mag(faceAreas()[facei]); +// scalar nbrMagSf = mag(neighbFaceAreas_[facei]); +// scalar avSf = (magSf + nbrMagSf)/2.0; +// +// if (magSf < ROOTVSMALL && nbrMagSf < ROOTVSMALL) +// { +// // Undetermined normal. Use dummy normal to force separation +// // check. (note use of sqrt(VSMALL) since that is how mag +// // scales) +// faceNormals[facei] = point(1, 0, 0); +// nbrFaceNormals[facei] = faceNormals[facei]; +// } +// else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol) +// { +// fileName nm +// ( +// boundaryMesh().mesh().time().path() +// /name()+"_faces.obj" +// ); +// Pout<< "processorPolyPatch::order : Writing my " << size() +// << " faces to OBJ file " << nm << endl; +// writeOBJ(nm, *this, points()); +// +// FatalErrorIn +// ( +// "processorPolyPatch::calcGeometry()" +// ) << "face " << facei << " area does not match neighbour by " +// << 100*mag(magSf - nbrMagSf)/avSf +// << "% -- possible face ordering problem." << endl +// << "patch:" << name() +// << " my area:" << magSf +// << " neighbour area:" << nbrMagSf +// << " matching tolerance:" << coupledPolyPatch::matchTol +// << endl +// << "Mesh face:" << start()+facei +// << " vertices:" +// << UIndirectList<point>(points(), operator[](facei))() +// << endl +// << "Rerun with processor debug flag set for" +// << " more information." << exit(FatalError); +// } +// else +// { +// faceNormals[facei] = faceAreas()[facei]/magSf; +// nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf; +// } +// } +// +// +// // Calculate transformation tensors +// calcTransformTensors +// ( +// separated_, +// separation_, +// parallel_, +// forwardT_, +// reverseT_, +// faceCentres(), +// neighbFaceCentres_, +// faceNormals, +// nbrFaceNormals, +// calcFaceTol(*this, points(), faceCentres()) +// ); +// +//Pout<< "cyclicPolyPatch::calcTransforms : calculated transforms for:" +// << name() << endl +// << " separated_:" << separated_ << endl +// << " separation_:" << separation_ << endl +// << " parallel_:" << parallel_ << endl +// << " forwardT_:" << forwardT_ << endl +// << " reverseT_:" << reverseT_ << endl +// << endl; } -Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl; -Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl; -Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl; - } @@ -292,7 +364,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs) { // Note cannot predict exact size since opposite nPoints might // be different from one over here. - IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); + UIPstream fromNeighbProc(neighbProcNo(), pBufs); fromNeighbProc >> nbrPointFace diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index 249ee69c96c03b39a12e4bf750c54fe3402978da..fa192eb47ab3fe33cc5366732df54e5927d790c8 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -292,6 +292,12 @@ public: //- Return neighbour edge labels. WIP. const labelList& neighbEdges() const; + //- Return message tag to use for communication + virtual int tag() const + { + return Pstream::msgType(); + } + //- Transform a patch-based field from other side to this side. virtual bool doTransform() const { @@ -317,21 +323,21 @@ public: //- Are the planes separated. virtual bool separated() const { - notImplemented("processorPolyPatch::separated(..)"); + //notImplemented("processorPolyPatch::separated(..)"); return false; } //- If the planes are separated the separation vector. virtual const vector& separation() const { - notImplemented("processorPolyPatch::separation(..)"); + //notImplemented("processorPolyPatch::separation(..)"); return vector::zero; } //- Are the cyclic planes parallel. virtual bool parallel() const { - notImplemented("processorPolyPatch::parallel()"); + //notImplemented("processorPolyPatch::parallel()"); return true; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index 830e886c0461383af84cfb88bbce8562c159ced7..df93919fd21bb5c2da94bb35f929bb1d62458d75 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -55,6 +55,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch ) : processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo), + tag_(UPstream::allocateTag()), referPatchName_(referPatchName), referPatchID_(-1) {} @@ -69,6 +70,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch ) : processorPolyPatch(name, dict, index, bm), + tag_(UPstream::allocateTag()), referPatchName_(dict.lookup("referPatch")), referPatchID_(-1) {} @@ -81,6 +83,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch ) : processorPolyPatch(pp, bm), + tag_(pp.tag_), referPatchName_(pp.referPatchName()), referPatchID_(-1) {} @@ -97,6 +100,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch ) : processorPolyPatch(pp, bm, index, newSize, newStart), + tag_(pp.tag_), referPatchName_(referPatchName), referPatchID_(-1) {} @@ -112,6 +116,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch ) : processorPolyPatch(pp, bm, index, mapAddressing, newStart), + tag_(pp.tag_), referPatchName_(pp.referPatchName()), referPatchID_(-1) {} @@ -120,7 +125,9 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch() -{} +{ + UPstream::freeTag(tag_); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -128,8 +135,6 @@ Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch() void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) { -Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl; - // Send over processorPolyPatch data processorPolyPatch::initGeometry(pBufs); } @@ -137,8 +142,6 @@ Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl; void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) { -Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl; - // Receive and initialise processorPolyPatch data processorPolyPatch::calcGeometry(pBufs); @@ -158,7 +161,7 @@ Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl; pp.calcGeometry ( - pp, + *this, faceCentres(), faceAreas(), faceCellCentres(), diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index ae81c5ab2fd034b3bcf7238dcaa78d4e83a65281..7f10305d7589ffd89b932abe5ccbe038112a30ec 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -55,13 +55,15 @@ class processorCyclicPolyPatch { // Private data + //- Message tag to use for communication + const int tag_; + //- Name of originating patch const word referPatchName_; //- Index of originating patch mutable label referPatchID_; - // Private member functions @@ -270,7 +272,19 @@ public: const coupledPolyPatch& referPatch() const { const polyPatch& pp = this->boundaryMesh()[referPatchID()]; - return refCast<const processorCyclicPolyPatch>(pp); + return refCast<const coupledPolyPatch>(pp); + } + + //- Return message tag to use for communication + virtual int tag() const + { + return tag_; + } + + //- Does this side own the patch ? + virtual bool owner() const + { + return referPatch().owner(); } //- Transform a patch-based field from other side to this side. diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C index 7ca34fe473a926af6b4d06b21ae19439de8de64d..741b2fe9a1c3b21b4726699ac55dbed3317a04a7 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C @@ -137,63 +137,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh) { if (patches[patchI].coupled()) { - if - ( - Pstream::parRun() - && isA<processorPolyPatch>(patches[patchI]) - ) - { - const processorPolyPatch& pp = - refCast<const processorPolyPatch>(patches[patchI]); - - const labelList& meshPoints = pp.meshPoints(); + const coupledPolyPatch& pp = + refCast<const coupledPolyPatch>(patches[patchI]); - forAll(meshPoints, i) - { - label pointI = meshPoints[i]; - - if (donePoint.get(pointI) == 0u) - { - donePoint.set(pointI, 1u); + const labelList& meshPoints = pp.meshPoints(); - if (pp.owner()) - { - isMasterPoint.set(pointI, 1u); - } - } - } - } - else if (isA<cyclicPolyPatch>(patches[patchI])) + forAll(meshPoints, i) { - const cyclicPolyPatch& pp = - refCast<const cyclicPolyPatch>(patches[patchI]); - - const edgeList& coupledPoints = pp.coupledPoints(); - const labelList& meshPoints = pp.meshPoints(); + label pointI = meshPoints[i]; - forAll(coupledPoints, i) + if (donePoint.get(pointI) == 0u) { - // First one of couple points is master + donePoint.set(pointI, 1u); - const edge& pointPair = coupledPoints[i]; - label p0 = meshPoints[pointPair[0]]; - label p1 = meshPoints[pointPair[1]]; - - if (donePoint.get(p0) == 0u) + if (pp.owner()) { - donePoint.set(p0, 1u); - isMasterPoint.set(p0, 1u); - donePoint.set(p1, 1u); + isMasterPoint.set(pointI, 1u); } } } - else - { - FatalErrorIn("syncTools::getMasterPoints(const polyMesh&)") - << "Cannot handle coupled patch " << patches[patchI].name() - << " of type " << patches[patchI].type() - << abort(FatalError); - } } } @@ -256,63 +218,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh) { if (patches[patchI].coupled()) { - if - ( - Pstream::parRun() - && isA<processorPolyPatch>(patches[patchI]) - ) - { - const processorPolyPatch& pp = - refCast<const processorPolyPatch>(patches[patchI]); + const coupledPolyPatch& pp = + refCast<const coupledPolyPatch>(patches[patchI]); - const labelList& meshEdges = pp.meshEdges(); - - forAll(meshEdges, i) - { - label edgeI = meshEdges[i]; - - if (doneEdge.get(edgeI) == 0u) - { - doneEdge.set(edgeI, 1u); + const labelList& meshEdges = pp.meshEdges(); - if (pp.owner()) - { - isMasterEdge.set(edgeI, 1u); - } - } - } - } - else if (isA<cyclicPolyPatch>(patches[patchI])) + forAll(meshEdges, i) { - const cyclicPolyPatch& pp = - refCast<const cyclicPolyPatch>(patches[patchI]); - - const edgeList& coupledEdges = pp.coupledEdges(); - const labelList& meshEdges = pp.meshEdges(); + label edgeI = meshEdges[i]; - forAll(coupledEdges, i) + if (doneEdge.get(edgeI) == 0u) { - // First one of couple edges is master + doneEdge.set(edgeI, 1u); - const edge& edgePair = coupledEdges[i]; - label e0 = meshEdges[edgePair[0]]; - label e1 = meshEdges[edgePair[1]]; - - if (doneEdge.get(e0) == 0u) + if (pp.owner()) { - doneEdge.set(e0, 1u); - isMasterEdge.set(e0, 1u); - doneEdge.set(e1, 1u); + isMasterEdge.set(edgeI, 1u); } } } - else - { - FatalErrorIn("syncTools::getMasterEdges(const polyMesh&)") - << "Cannot handle coupled patch " << patches[patchI].name() - << " of type " << patches[patchI].type() - << abort(FatalError); - } } } @@ -344,36 +268,16 @@ Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh) { if (patches[patchI].coupled()) { - if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI])) - { - const processorPolyPatch& pp = - refCast<const processorPolyPatch>(patches[patchI]); + const coupledPolyPatch& pp = + refCast<const coupledPolyPatch>(patches[patchI]); - if (!pp.owner()) - { - forAll(pp, i) - { - isMasterFace.unset(pp.start()+i); - } - } - } - else if (isA<cyclicPolyPatch>(patches[patchI])) + if (!pp.owner()) { - const cyclicPolyPatch& pp = - refCast<const cyclicPolyPatch>(patches[patchI]); - - for (label i = pp.size()/2; i < pp.size(); i++) + forAll(pp, i) { isMasterFace.unset(pp.start()+i); } } - else - { - FatalErrorIn("syncTools::getMasterFaces(const polyMesh&)") - << "Cannot handle coupled patch " << patches[patchI].name() - << " of type " << patches[patchI].type() - << abort(FatalError); - } } } diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 7a41c7c90bb927c1891b660e617a7d7d8ea0d681..9519632f2dba0b2a85c6ff4abb0f1b381d5582f8 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -101,6 +101,8 @@ void Foam::syncTools::syncPointMap if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -134,11 +136,12 @@ void Foam::syncTools::syncPointMap } } - OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNeighb(procPatch.neighbProcNo(), pBufs); toNeighb << patchInfo; } } + pBufs.finishedSends(); // Receive and combine. @@ -153,7 +156,7 @@ void Foam::syncTools::syncPointMap const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(patches[patchI]); - IPstream fromNb(Pstream::blocking, procPatch.neighbProcNo()); + UIPstream fromNb(procPatch.neighbProcNo(), pBufs); Map<T> nbrPatchInfo(fromNb); // Transform @@ -198,7 +201,7 @@ void Foam::syncTools::syncPointMap const labelList& meshPtsA = cycPatch.meshPoints(); const labelList& meshPtsB = nbrPatch.meshPoints(); - // Extract local values. Create map from nbrPoint to value. + // Extract local values. Create map from coupled-edge to value. Map<T> half0Values(meshPtsA.size() / 20); Map<T> half1Values(half0Values.size()); @@ -311,7 +314,7 @@ void Foam::syncTools::syncPointMap slave++ ) { - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::scheduled, slave); Map<T> nbrValues(fromSlave); // Merge neighbouring values with my values @@ -335,7 +338,7 @@ void Foam::syncTools::syncPointMap slave++ ) { - OPstream toSlave(Pstream::blocking, slave); + OPstream toSlave(Pstream::scheduled, slave); toSlave << sharedPointValues; } } @@ -343,14 +346,14 @@ void Foam::syncTools::syncPointMap { // Slave: send to master { - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); toMaster << sharedPointValues; } // Receive merged values { IPstream fromMaster ( - Pstream::blocking, + Pstream::scheduled, Pstream::masterNo() ); fromMaster >> sharedPointValues; @@ -416,6 +419,8 @@ void Foam::syncTools::syncEdgeMap if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -453,11 +458,12 @@ void Foam::syncTools::syncEdgeMap } } - OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNeighb(procPatch.neighbProcNo(), pBufs); toNeighb << patchInfo; } } + pBufs.finishedSends(); // Receive and combine. @@ -474,11 +480,7 @@ void Foam::syncTools::syncEdgeMap EdgeMap<T> nbrPatchInfo; { - IPstream fromNbr - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNbr(procPatch.neighbProcNo(), pBufs); fromNbr >> nbrPatchInfo; } @@ -704,7 +706,7 @@ void Foam::syncTools::syncEdgeMap slave++ ) { - IPstream fromSlave(Pstream::blocking, slave); + IPstream fromSlave(Pstream::scheduled, slave); EdgeMap<T> nbrValues(fromSlave); // Merge neighbouring values with my values @@ -729,7 +731,7 @@ void Foam::syncTools::syncEdgeMap ) { - OPstream toSlave(Pstream::blocking, slave); + OPstream toSlave(Pstream::scheduled, slave); toSlave << sharedEdgeValues; } } @@ -737,12 +739,12 @@ void Foam::syncTools::syncEdgeMap { // Send to master { - OPstream toMaster(Pstream::blocking, Pstream::masterNo()); + OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); toMaster << sharedEdgeValues; } // Receive merged values { - IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); + IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); fromMaster >> sharedEdgeValues; } } @@ -807,6 +809,8 @@ void Foam::syncTools::syncPointList if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -832,11 +836,12 @@ void Foam::syncTools::syncPointList patchInfo[nbrPointI] = pointValues[meshPts[pointI]]; } - OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNbr(procPatch.neighbProcNo(), pBufs); toNbr << patchInfo; } } + pBufs.finishedSends(); // Receive and combine. @@ -853,11 +858,7 @@ void Foam::syncTools::syncPointList Field<T> nbrPatchInfo(procPatch.nPoints()); { - IPstream fromNbr - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNbr(procPatch.neighbProcNo(), pBufs); fromNbr >> nbrPatchInfo; } @@ -1032,6 +1033,8 @@ void Foam::syncTools::syncEdgeList if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -1058,11 +1061,13 @@ void Foam::syncTools::syncEdgeList patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]]; } - OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNbr(procPatch.neighbProcNo(), pBufs); toNbr << patchInfo; } } + pBufs.finishedSends(); + // Receive and combine. forAll(patches, patchI) @@ -1083,11 +1088,7 @@ void Foam::syncTools::syncEdgeList Field<T> nbrPatchInfo(procPatch.nEdges()); { - IPstream fromNeighb - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs); fromNeighb >> nbrPatchInfo; } @@ -1215,6 +1216,8 @@ void Foam::syncTools::syncBoundaryFaceList if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -1230,31 +1233,21 @@ void Foam::syncTools::syncBoundaryFaceList label patchStart = procPatch.start()-mesh.nInternalFaces(); - if (contiguous<T>()) - { - OPstream::write + UOPstream toNbr(procPatch.neighbProcNo(), pBufs); + toNbr << + SubField<T> ( - Pstream::blocking, - procPatch.neighbProcNo(), - reinterpret_cast<const char*>(&faceValues[patchStart]), - procPatch.size()*sizeof(T) + faceValues, + procPatch.size(), + patchStart ); - } - else - { - OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); - toNbr << - SubField<T> - ( - faceValues, - procPatch.size(), - patchStart - ); - } } } + pBufs.finishedSends(); + + // Receive and combine. forAll(patches, patchI) @@ -1270,25 +1263,8 @@ void Foam::syncTools::syncBoundaryFaceList Field<T> nbrPatchInfo(procPatch.size()); - if (contiguous<T>()) - { - IPstream::read - ( - Pstream::blocking, - procPatch.neighbProcNo(), - reinterpret_cast<char*>(nbrPatchInfo.begin()), - nbrPatchInfo.byteSize() - ); - } - else - { - IPstream fromNeighb - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); - fromNeighb >> nbrPatchInfo; - } + UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs); + fromNeighb >> nbrPatchInfo; top(procPatch, nbrPatchInfo); @@ -1373,6 +1349,8 @@ void Foam::syncTools::syncFaceList if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -1392,12 +1370,14 @@ void Foam::syncTools::syncFaceList patchInfo[i] = faceValues[procPatch.start()+i]; } - OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNbr(procPatch.neighbProcNo(), pBufs); toNbr << patchInfo; } } + pBufs.finishedSends(); + // Receive and combine. forAll(patches, patchI) @@ -1413,11 +1393,7 @@ void Foam::syncTools::syncFaceList List<unsigned int> patchInfo(procPatch.size()); { - IPstream fromNbr - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNbr(procPatch.neighbProcNo(), pBufs); fromNbr >> patchInfo; } @@ -1508,6 +1484,8 @@ void Foam::syncTools::syncPointList if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -1532,12 +1510,14 @@ void Foam::syncTools::syncPointList patchInfo[nbrPointI] = pointValues[meshPts[pointI]]; } - OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNbr(procPatch.neighbProcNo(), pBufs); toNbr << patchInfo; } } + pBufs.finishedSends(); + // Receive and combine. forAll(patches, patchI) @@ -1555,11 +1535,7 @@ void Foam::syncTools::syncPointList { // We do not know the number of points on the other side // so cannot use Pstream::read. - IPstream fromNbr - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNbr(procPatch.neighbProcNo(), pBufs); fromNbr >> nbrPatchInfo; } @@ -1672,6 +1648,8 @@ void Foam::syncTools::syncEdgeList if (Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send forAll(patches, patchI) @@ -1696,11 +1674,12 @@ void Foam::syncTools::syncEdgeList patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]]; } - OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); + UOPstream toNbr(procPatch.neighbProcNo(), pBufs); toNbr << patchInfo; } } + pBufs.finishedSends(); // Receive and combine. @@ -1719,11 +1698,7 @@ void Foam::syncTools::syncEdgeList List<unsigned int> nbrPatchInfo(procPatch.nEdges()); { - IPstream fromNeighb - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs); fromNeighb >> nbrPatchInfo; } diff --git a/src/Pstream/dummy/UIPread.C b/src/Pstream/dummy/UIPread.C index a91a007e43eb60a60926d6ab3f6ed6c39743f1b5..da9613af37d1c807336171b32eab946d3cc1a59a 100644 --- a/src/Pstream/dummy/UIPread.C +++ b/src/Pstream/dummy/UIPread.C @@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream const commsTypes commsType, const int fromProcNo, DynamicList<char>& externalBuf, + label& externalBufPosition, const int tag, streamFormat format, versionNumber version @@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream Istream(format, version), fromProcNo_(fromProcNo), externalBuf_(externalBuf), - externalBufPosition_(0), + externalBufPosition_(externalBufPosition), tag_(tag), messageSize_(0) { @@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream "const commsTypes," "const int fromProcNo," "DynamicList<char>&," + "label&," "const int tag," "streamFormat, versionNumber" ")" diff --git a/src/Pstream/mpi/UIPread.C b/src/Pstream/mpi/UIPread.C index fb6a9ec7d7b45930a594280a75bc0707194654e4..9a70f456b9da3e10b5a9229da3cb7a922610932b 100644 --- a/src/Pstream/mpi/UIPread.C +++ b/src/Pstream/mpi/UIPread.C @@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream const commsTypes commsType, const int fromProcNo, DynamicList<char>& externalBuf, + label& externalBufPosition, const int tag, streamFormat format, versionNumber version @@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream Istream(format, version), fromProcNo_(fromProcNo), externalBuf_(externalBuf), - externalBufPosition_(0), + externalBufPosition_(externalBufPosition), tag_(tag), messageSize_(0) { @@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers) Istream(buffers.format_, buffers.version_), fromProcNo_(fromProcNo), externalBuf_(buffers.recvBuf_[fromProcNo]), - externalBufPosition_(0), + externalBufPosition_(buffers.recvBufPos_[fromProcNo]), tag_(buffers.tag_), messageSize_(0) { diff --git a/src/Pstream/mpi/UOPwrite.C b/src/Pstream/mpi/UOPwrite.C index 9f8726d9a036d2e4af275f51bd4a20140bc7521d..8d272fc0ca5f3420b2a6c9e2a9d6c46d9dab8924 100644 --- a/src/Pstream/mpi/UOPwrite.C +++ b/src/Pstream/mpi/UOPwrite.C @@ -45,7 +45,7 @@ bool Foam::UOPstream::write { if (debug) { - Pout<< "UIPstream::write : starting write to:" << toProcNo + Pout<< "UOPstream::write : starting write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << Foam::endl; @@ -67,7 +67,7 @@ bool Foam::UOPstream::write if (debug) { - Pout<< "UIPstream::write : finished write to:" << toProcNo + Pout<< "UOPstream::write : finished write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << Foam::endl; @@ -87,7 +87,7 @@ bool Foam::UOPstream::write if (debug) { - Pout<< "UIPstream::write : finished write to:" << toProcNo + Pout<< "UOPstream::write : finished write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << Foam::endl; @@ -110,7 +110,7 @@ bool Foam::UOPstream::write if (debug) { - Pout<< "UIPstream::write : started write to:" << toProcNo + Pout<< "UOPstream::write : started write to:" << toProcNo << " tag:" << tag << " size:" << label(bufSize) << " commsType:" << UPstream::commsTypeNames[commsType] << " request:" << PstreamGlobals::outstandingRequests_.size() diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 9f20363c338d4b0113c8611c52647c8292f29371..aaba6ee2419fcc2848bd0d6f46d86dcf2fb14437 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -21,13 +21,12 @@ $(constraintFvPatches)/symmetry/symmetryFvPatch.C $(constraintFvPatches)/wedge/wedgeFvPatch.C $(constraintFvPatches)/cyclic/cyclicFvPatch.C $(constraintFvPatches)/processor/processorFvPatch.C +$(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C derivedFvPatches = $(fvPatches)/derived $(derivedFvPatches)/wall/wallFvPatch.C -/* $(derivedFvPatches)/directMapped/directMappedFvPatch.C $(derivedFvPatches)/directMapped/directMappedWallFvPatch.C -*/ wallDist = fvMesh/wallDist $(wallDist)/wallPointYPlus/wallPointYPlus.C @@ -101,6 +100,8 @@ $(constraintFvPatchFields)/empty/emptyFvPatchFields.C $(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C $(constraintFvPatchFields)/processor/processorFvPatchFields.C $(constraintFvPatchFields)/processor/processorFvPatchScalarField.C +$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C +$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchScalarField.C $(constraintFvPatchFields)/symmetry/symmetryFvPatchFields.C $(constraintFvPatchFields)/wedge/wedgeFvPatchFields.C $(constraintFvPatchFields)/wedge/wedgeFvPatchScalarField.C @@ -109,15 +110,12 @@ derivedFvPatchFields = $(fvPatchFields)/derived $(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C $(derivedFvPatchFields)/advective/advectiveFvPatchFields.C -/* $(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C $(derivedFvPatchFields)/fan/fanFvPatchFields.C $(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C -*/ $(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C -/* $(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C $(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C $(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -156,7 +154,6 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C -*/ fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C @@ -171,6 +168,7 @@ constraintFvsPatchFields = $(fvsPatchFields)/constraint $(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C $(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C $(constraintFvsPatchFields)/processor/processorFvsPatchFields.C +$(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C $(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C $(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C @@ -206,7 +204,6 @@ $(surfaceInterpolation)/surfaceInterpolationScheme/surfaceInterpolationSchemes.C schemes = $(surfaceInterpolation)/schemes $(schemes)/linear/linear.C $(schemes)/midPoint/midPoint.C -/* $(schemes)/downwind/downwind.C $(schemes)/weighted/weighted.C $(schemes)/cubic/cubic.C @@ -221,6 +218,7 @@ $(schemes)/localBlended/localBlended.C $(schemes)/localMax/localMax.C $(schemes)/localMin/localMin.C +/* $(schemes)/linearFit/linearFit.C $(schemes)/biLinearFit/biLinearFit.C $(schemes)/quadraticLinearFit/quadraticLinearFit.C @@ -236,7 +234,6 @@ $(schemes)/linearPureUpwindFit/linearPureUpwindFit.C limitedSchemes = $(surfaceInterpolation)/limitedSchemes $(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C $(limitedSchemes)/upwind/upwind.C -/* $(limitedSchemes)/blended/blended.C $(limitedSchemes)/linearUpwind/linearUpwind.C $(limitedSchemes)/linearUpwind/linearUpwindV.C @@ -258,7 +255,6 @@ $(limitedSchemes)/filteredLinear/filteredLinear.C $(limitedSchemes)/filteredLinear2/filteredLinear2.C $(limitedSchemes)/filteredLinear3/filteredLinear3.C $(limitedSchemes)/limitWith/limitWith.C -*/ multivariateSchemes = $(surfaceInterpolation)/multivariateSchemes $(multivariateSchemes)/multivariateSurfaceInterpolationScheme/multivariateSurfaceInterpolationSchemes.C @@ -340,7 +336,6 @@ general = cfdTools/general $(general)/findRefCell/findRefCell.C $(general)/adjustPhi/adjustPhi.C $(general)/bound/bound.C -/* porousMedia = $(general)/porousMedia $(porousMedia)/porousZone.C $(porousMedia)/porousZones.C @@ -363,6 +358,5 @@ $(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource. $(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C $(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C $(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C -*/ LIB = $(FOAM_LIBBIN)/libfiniteVolume diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 07290f190595ac5396983b2d1c4202d51e598663..a01db3b8a5dfed6a1c290bb80633a337b6e5b215 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -109,9 +109,9 @@ cyclicFvPatchField<Type>::cyclicFvPatchField << exit(FatalIOError); } - Pout<< "Construct from dictionary for " << p.name() << endl - << "Underlying cyclic:" << cyclicPatch_.name() - << " with parallel:" << cyclicPatch_.parallel() << endl; +// Pout<< "Construct from dictionary for " << p.name() << endl +// << "Underlying cyclic:" << cyclicPatch_.name() +// << " with parallel:" << cyclicPatch_.parallel() << endl; this->coupledFvPatchField<Type>::evaluate(Pstream::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index dcd3440e3662cf9d6264302e1b295831116c6ade..5bd48d2f1041329fda72b409770e3956d6d129c5 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -100,7 +100,8 @@ template<class Type> tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const { const Field<Type>& iField = this->internalField(); - const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); + const unallocLabelList& nbrFaceCells = + this->cyclicPatch().neighbFvPatch().faceCells(); tmp<Field<Type> > tpnf(new Field<Type>(this->size())); Field<Type>& pnf = tpnf(); @@ -108,29 +109,21 @@ tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const tmp<Field<scalar> > tjf = jump(); const Field<scalar>& jf = tjf(); - label sizeby2 = this->size()/2; - if (this->doTransform()) { - for (label facei=0; facei<sizeby2; facei++) + forAll(*this, facei) { pnf[facei] = transform ( - this->forwardT()[0], iField[faceCells[facei + sizeby2]] + this->forwardT(), iField[nbrFaceCells[facei]] ) - jf[facei]; - - pnf[facei + sizeby2] = transform - ( - this->reverseT()[0], iField[faceCells[facei]] + jf[facei] - ); } } else { - for (label facei=0; facei<sizeby2; facei++) + forAll(*this, facei) { - pnf[facei] = iField[faceCells[facei + sizeby2]] - jf[facei]; - pnf[facei + sizeby2] = iField[faceCells[facei]] + jf[facei]; + pnf[facei] = iField[nbrFaceCells[facei]] - jf[facei]; } } @@ -151,26 +144,24 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix { scalarField pnf(this->size()); - label sizeby2 = this->size()/2; - const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); + const unallocLabelList& nbrFaceCells = + this->cyclicPatch().neighbFvPatch().faceCells(); if (&psiInternal == &this->internalField()) { tmp<Field<scalar> > tjf = jump(); const Field<scalar>& jf = tjf(); - for (label facei=0; facei<sizeby2; facei++) + forAll(*this, facei) { - pnf[facei] = psiInternal[faceCells[facei + sizeby2]] - jf[facei]; - pnf[facei + sizeby2] = psiInternal[faceCells[facei]] + jf[facei]; + pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei]; } } else { - for (label facei=0; facei<sizeby2; facei++) + forAll(*this, facei) { - pnf[facei] = psiInternal[faceCells[facei + sizeby2]]; - pnf[facei + sizeby2] = psiInternal[faceCells[facei]]; + pnf[facei] = psiInternal[nbrFaceCells[facei]]; } } @@ -178,6 +169,7 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix this->transformCoupleField(pnf, cmpt); // Multiply the field by coefficients and add into the result + const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); forAll(faceCells, elemI) { result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index b2930077c0eda047ab871048f9d2a6f2cbccc5e5..c42305fd9bc785f19ba9a292bac49c515a4922ed 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -74,7 +74,7 @@ processorFvPatchField<Type>::processorFvPatchField coupledFvPatchField<Type>(ptf, p, iF, mapper), procPatch_(refCast<const processorFvPatch>(p)) { - if (!isType<processorFvPatch>(this->patch())) + if (!isA<processorFvPatch>(this->patch())) { FatalErrorIn ( @@ -106,7 +106,7 @@ processorFvPatchField<Type>::processorFvPatchField coupledFvPatchField<Type>(p, iF, dict), procPatch_(refCast<const processorFvPatch>(p)) { - if (!isType<processorFvPatch>(p)) + if (!isA<processorFvPatch>(p)) { FatalIOErrorIn ( diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..3188d5d4f4dd6f6b22655666ef12818f4825f78e --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.C @@ -0,0 +1,267 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "processorCyclicFvPatchField.H" +#include "processorCyclicFvPatch.H" +#include "demandDrivenData.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +processorCyclicFvPatchField<Type>::processorCyclicFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + //coupledFvPatchField<Type>(p, iF), + processorFvPatchField<Type>(p, iF), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{} + + +template<class Type> +processorCyclicFvPatchField<Type>::processorCyclicFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const Field<Type>& f +) +: + //coupledFvPatchField<Type>(p, iF, f), + processorFvPatchField<Type>(p, iF, f), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{} + + +// Construct by mapping given processorCyclicFvPatchField<Type> +template<class Type> +processorCyclicFvPatchField<Type>::processorCyclicFvPatchField +( + const processorCyclicFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + //coupledFvPatchField<Type>(ptf, p, iF, mapper), + processorFvPatchField<Type>(ptf, p, iF, mapper), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{ + if (!isType<processorCyclicFvPatch>(this->patch())) + { + FatalErrorIn + ( + "processorCyclicFvPatchField<Type>::processorCyclicFvPatchField\n" + "(\n" + " const processorCyclicFvPatchField<Type>& ptf,\n" + " const fvPatch& p,\n" + " const DimensionedField<Type, volMesh>& iF,\n" + " const fvPatchFieldMapper& mapper\n" + ")\n" + ) << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } +} + + +template<class Type> +processorCyclicFvPatchField<Type>::processorCyclicFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + //coupledFvPatchField<Type>(p, iF, dict), + processorFvPatchField<Type>(p, iF, dict), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{ + if (!isType<processorCyclicFvPatch>(p)) + { + FatalIOErrorIn + ( + "processorCyclicFvPatchField<Type>::processorCyclicFvPatchField\n" + "(\n" + " const fvPatch& p,\n" + " const Field<Type>& field,\n" + " const dictionary& dict\n" + ")\n", + dict + ) << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } +} + + +template<class Type> +processorCyclicFvPatchField<Type>::processorCyclicFvPatchField +( + const processorCyclicFvPatchField<Type>& ptf +) +: + //processorLduInterfaceField(), + //coupledFvPatchField<Type>(ptf), + processorFvPatchField<Type>(ptf), + procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch())) +{} + + +template<class Type> +processorCyclicFvPatchField<Type>::processorCyclicFvPatchField +( + const processorCyclicFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + //coupledFvPatchField<Type>(ptf, iF), + processorFvPatchField<Type>(ptf, iF), + procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch())) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template<class Type> +processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +//template<class Type> +//tmp<Field<Type> > processorCyclicFvPatchField<Type>::patchNeighbourField() const +//{ +// return *this; +//} +// +// +//template<class Type> +//void processorCyclicFvPatchField<Type>::initEvaluate +//( +// const Pstream::commsTypes commsType +//) +//{ +// if (Pstream::parRun()) +// { +// procPatch_.compressedSend(commsType, this->patchInternalField()()); +// } +//} +// +// +//template<class Type> +//void processorCyclicFvPatchField<Type>::evaluate +//( +// const Pstream::commsTypes commsType +//) +//{ +// if (Pstream::parRun()) +// { +// procPatch_.compressedReceive<Type>(commsType, *this); +// +// if (doTransform()) +// { +// transform(*this, procPatch_.forwardT(), *this); +// } +// } +//} +// +// +//template<class Type> +//tmp<Field<Type> > processorCyclicFvPatchField<Type>::snGrad() const +//{ +// return this->patch().deltaCoeffs()*(*this - this->patchInternalField()); +//} +// +// +//template<class Type> +//void processorCyclicFvPatchField<Type>::initInterfaceMatrixUpdate +//( +// const scalarField& psiInternal, +// scalarField&, +// const lduMatrix&, +// const scalarField&, +// const direction, +// const Pstream::commsTypes commsType +//) const +//{ +// procPatch_.compressedSend +// ( +// commsType, +// this->patch().patchInternalField(psiInternal)() +// ); +//} +// +// +//template<class Type> +//void processorCyclicFvPatchField<Type>::updateInterfaceMatrix +//( +// const scalarField&, +// scalarField& result, +// const lduMatrix&, +// const scalarField& coeffs, +// const direction cmpt, +// const Pstream::commsTypes commsType +//) const +//{ +// scalarField pnf +// ( +// procPatch_.compressedReceive<scalar>(commsType, this->size())() +// ); +// +// // Transform according to the transformation tensor +// transformCoupleField(pnf, cmpt); +// +// // Multiply the field by coefficients and add into the result +// +// const unallocLabelList& faceCells = this->patch().faceCells(); +// +// forAll(faceCells, elemI) +// { +// result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; +// } +//} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..d3ac41625a73eae0bcd82f410d933b2c8f59413e --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchField.H @@ -0,0 +1,338 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::processorCyclicFvPatchField + +Description + Foam::processorCyclicFvPatchField + +SourceFiles + processorCyclicFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef processorCyclicFvPatchField_H +#define processorCyclicFvPatchField_H + +//#include "coupledFvPatchField.H" +//#include "processorLduInterfaceField.H" +#include "processorCyclicFvPatch.H" +#include "processorFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class processorCyclicFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class processorCyclicFvPatchField +: +// public processorLduInterfaceField, +// public coupledFvPatchField<Type> + public processorFvPatchField<Type> +{ + // Private data + + //- Local reference cast into the processor patch + const processorCyclicFvPatch& procPatch_; + + // Private Member Functions + +// //- Get other patchfield +// const coupledFvPatchField<Type>& patchField(const label patchID) const; +public: + + //- Runtime type information + TypeName(processorCyclicFvPatch::typeName_()); + + + // Constructors + + //- Construct from patch and internal field + processorCyclicFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch and internal field and patch field + processorCyclicFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const Field<Type>& + ); + + //- Construct from patch, internal field and dictionary + processorCyclicFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given processorCyclicFvPatchField onto a + // new patch + processorCyclicFvPatchField + ( + const processorCyclicFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + processorCyclicFvPatchField(const processorCyclicFvPatchField<Type>&); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new processorCyclicFvPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + processorCyclicFvPatchField + ( + const processorCyclicFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new processorCyclicFvPatchField<Type>(*this, iF) + ); + } + + + // Destructor + + ~processorCyclicFvPatchField(); + + + // Member functions + + // Access + +// //- Return true if running parallel +// virtual bool coupled() const +// { +// if (Pstream::parRun()) +// { +// return true; +// } +// else +// { +// return false; +// } +// } +// +// //- Return neighbour field given internal field +// tmp<Field<Type> > patchNeighbourField() const; +// +// +// // Evaluation functions +// +// //- Initialise the evaluation of the patch field +// virtual void initEvaluate(const Pstream::commsTypes commsType); +// +// //- Evaluate the patch field +// virtual void evaluate(const Pstream::commsTypes commsType); +// +// //- Return patch-normal gradient +// virtual tmp<Field<Type> > snGrad() const; +// +// //- Initialise neighbour matrix update +// virtual void initInterfaceMatrixUpdate +// ( +// const scalarField& psiInternal, +// scalarField& result, +// const lduMatrix& m, +// const scalarField& coeffs, +// const direction cmpt, +// const Pstream::commsTypes commsType +// ) const; +// +// //- Update result field based on interface functionality +// virtual void updateInterfaceMatrix +// ( +// const scalarField& psiInternal, +// scalarField& result, +// const lduMatrix& m, +// const scalarField& coeffs, +// const direction cmpt, +// const Pstream::commsTypes commsType +// ) const; +// +// //- Processor coupled interface functions +// +// //- Return processor number +// virtual int myProcNo() const +// { +// return procPatch_.myProcNo(); +// } +// +// //- Return neigbour processor number +// virtual int neighbProcNo() const +// { +// return procPatch_.neighbProcNo(); +// } + + //- Does the patch field perform the transfromation + virtual bool doTransform() const + { + return !(procPatch_.parallel() || pTraits<Type>::rank == 0); + } + + //- Return face transformation tensor + virtual const tensor& forwardT() const + { + return procPatch_.forwardT(); + } + +// //- Return rank of component for transform +// virtual int rank() const +// { +// return pTraits<Type>::rank; +// } + +// //- Transform given patch component field +// void transformCoupleField +// ( +// scalarField& f, +// const direction cmpt +// ) const; + +// // Referred-patch functionality. Get called with a slice (size, start) +// // of a patch that supplies fields and geometry/topology. +// +// //- Get patch-normal gradient +// virtual void snGrad +// ( +// Field<Type>& exchangeBuf, +// const Field<Type>& subFld, +// const coupledFvPatch& referringPatch, +// const label size, +// const label start +// ) const +// { +// notImplemented("processorCyclicFvPatchField::snGrad(..)"); +// } +// +// //- Initialise the evaluation of the patch field. +// virtual void initEvaluate +// ( +// Field<Type>& exchangeBuf, +// const coupledFvPatch& referringPatch, +// const label size, +// const label start +// ) const +// { +// notImplemented("processorCyclicFvPatchField::initEvaluate(..)"); +// } +// +// //- Evaluate the patch field. +// virtual void evaluate +// ( +// Field<Type>& exchangeBuf, +// const coupledFvPatch& referringPatch, +// const label size, +// const label start +// ) const +// { +// notImplemented("processorCyclicFvPatchField::evaluate(..)"); +// } +// +// //- Initialise neighbour matrix update +// virtual void initInterfaceMatrixUpdate +// ( +// const scalarField& psiInternal, +// scalarField& result, +// const lduMatrix& m, +// const scalarField& coeffs, +// const direction cmpt, +// const coupledFvPatch& referringPatch, +// const label size, +// const label start, +// scalarField& exchangeBuf +// ) const +// { +// notImplemented +// ( +// "processorCyclicFvPatchField::initInterfaceMatrixUpdate(..)" +// ); +// } +// +// //- Update result field based on interface functionality +// virtual void updateInterfaceMatrix +// ( +// const scalarField& psiInternal, +// scalarField& result, +// const lduMatrix&, +// const scalarField& coeffs, +// const direction, +// const coupledFvPatch& referringPatch, +// const label size, +// const label start, +// scalarField& exchangeBuf +// ) const +// { +// notImplemented +// ( +// "processorCyclicFvPatchField::updateInterfaceMatrix(..)" +// ); +// } + + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "processorCyclicFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C similarity index 91% rename from src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFields.C rename to src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C index de2d731b9d90ec14126acbb335fd1024932b5c85..3f11c04ce8286b82a02f1133308b060ebc36a860 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "processorFvPatchFields.H" +#include "processorCyclicFvPatchFields.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" @@ -35,8 +35,8 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFields(processor); -//makePatchTypeField(fvPatchScalarField, processorFvPatchScalarField); +makePatchFields(processorCyclic); +//makePatchTypeField(fvPatchScalarField, processorCyclicFvPatchScalarField); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.H similarity index 90% rename from src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFields.H rename to src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.H index 97df670892e1ce813fefb86aa2cb6d44aff3ae56..e4ea110ee83a2b1169c39fa870c44df60781e3c7 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFields.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.H @@ -24,10 +24,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef processorFvPatchFields_H -#define processorFvPatchFields_H +#ifndef processorCyclicFvPatchFields_H +#define processorCyclicFvPatchFields_H -#include "processorFvPatchScalarField.H" +#include "processorCyclicFvPatchScalarField.H" #include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeFieldTypedefs(processor) +makePatchTypeFieldTypedefs(processorCyclic) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFieldsFwd.H similarity index 92% rename from src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFieldsFwd.H rename to src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFieldsFwd.H index 95306902cdb4e8c8ace1a5009825e799694c2e74..32465f89bdfb4a9b637d133d6017f593f4aa1313 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchFieldsFwd.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFieldsFwd.H @@ -24,8 +24,8 @@ License \*---------------------------------------------------------------------------*/ -#ifndef processorFvPatchFieldsFwd_H -#define processorFvPatchFieldsFwd_H +#ifndef processorCyclicFvPatchFieldsFwd_H +#define processorCyclicFvPatchFieldsFwd_H #include "fieldTypes.H" @@ -36,7 +36,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template<class Type> class processorFvPatchField; +template<class Type> class processorCyclicFvPatchField; makePatchTypeFieldTypedefs(processor) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchScalarField.C similarity index 60% rename from src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchScalarField.C rename to src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchScalarField.C index 3a3f6936fb6e208b887520b5f16a552fdd299e41..9283a96691bb30e1dece847435cc51b0872e7026 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "processorFvPatchScalarField.H" +#include "processorCyclicFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -33,48 +33,48 @@ namespace Foam // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<> -void processorFvPatchField<scalar>::initInterfaceMatrixUpdate -( - const scalarField& psiInternal, - scalarField&, - const lduMatrix&, - const scalarField&, - const direction, - const Pstream::commsTypes commsType -) const -{ - procPatch_.compressedSend - ( - commsType, - patch().patchInternalField(psiInternal)() - ); -} - - -template<> -void processorFvPatchField<scalar>::updateInterfaceMatrix -( - const scalarField&, - scalarField& result, - const lduMatrix&, - const scalarField& coeffs, - const direction, - const Pstream::commsTypes commsType -) const -{ - scalarField pnf - ( - procPatch_.compressedReceive<scalar>(commsType, this->size())() - ); - - const unallocLabelList& faceCells = patch().faceCells(); - - forAll(faceCells, facei) - { - result[faceCells[facei]] -= coeffs[facei]*pnf[facei]; - } -} +//template<> +//void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate +//( +// const scalarField& psiInternal, +// scalarField&, +// const lduMatrix&, +// const scalarField&, +// const direction, +// const Pstream::commsTypes commsType +//) const +//{ +// procPatch_.compressedSend +// ( +// commsType, +// patch().patchInternalField(psiInternal)() +// ); +//} +// +// +//template<> +//void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix +//( +// const scalarField&, +// scalarField& result, +// const lduMatrix&, +// const scalarField& coeffs, +// const direction, +// const Pstream::commsTypes commsType +//) const +//{ +// scalarField pnf +// ( +// procPatch_.compressedReceive<scalar>(commsType, this->size())() +// ); +// +// const unallocLabelList& faceCells = patch().faceCells(); +// +// forAll(faceCells, facei) +// { +// result[faceCells[facei]] -= coeffs[facei]*pnf[facei]; +// } +//} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchScalarField.H similarity index 71% rename from src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchScalarField.H rename to src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchScalarField.H index af9ba9bb425e5657babb23b864d69882bd04d2fe..ddbe013dc44b4945bf9e8e2d115e60fa7d65afdc 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchScalarField.H @@ -24,10 +24,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef processorFvPatchScalarField_H -#define processorFvPatchScalarField_H +#ifndef processorCyclicFvPatchScalarField_H +#define processorCyclicFvPatchScalarField_H -#include "processorFvPatchField.H" +#include "processorCyclicFvPatchField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -36,28 +36,28 @@ namespace Foam // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<> -void processorFvPatchField<scalar>::initInterfaceMatrixUpdate -( - const scalarField&, - scalarField&, - const lduMatrix&, - const scalarField&, - const direction, - const Pstream::commsTypes commsType -) const; - - -template<> -void processorFvPatchField<scalar>::updateInterfaceMatrix -( - const scalarField&, - scalarField& result, - const lduMatrix&, - const scalarField& coeffs, - const direction, - const Pstream::commsTypes commsType -) const; +//template<> +//void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate +//( +// const scalarField&, +// scalarField&, +// const lduMatrix&, +// const scalarField&, +// const direction, +// const Pstream::commsTypes commsType +//) const; +// +// +//template<> +//void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix +//( +// const scalarField&, +// scalarField& result, +// const lduMatrix&, +// const scalarField& coeffs, +// const direction, +// const Pstream::commsTypes commsType +//) const; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchField.C deleted file mode 100644 index b2930077c0eda047ab871048f9d2a6f2cbccc5e5..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchField.C +++ /dev/null @@ -1,261 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "processorFvPatchField.H" -#include "processorFvPatch.H" -#include "demandDrivenData.H" -#include "transformField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -processorFvPatchField<Type>::processorFvPatchField -( - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF -) -: - coupledFvPatchField<Type>(p, iF), - procPatch_(refCast<const processorFvPatch>(p)) -{} - - -template<class Type> -processorFvPatchField<Type>::processorFvPatchField -( - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF, - const Field<Type>& f -) -: - coupledFvPatchField<Type>(p, iF, f), - procPatch_(refCast<const processorFvPatch>(p)) -{} - - -// Construct by mapping given processorFvPatchField<Type> -template<class Type> -processorFvPatchField<Type>::processorFvPatchField -( - const processorFvPatchField<Type>& ptf, - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - coupledFvPatchField<Type>(ptf, p, iF, mapper), - procPatch_(refCast<const processorFvPatch>(p)) -{ - if (!isType<processorFvPatch>(this->patch())) - { - FatalErrorIn - ( - "processorFvPatchField<Type>::processorFvPatchField\n" - "(\n" - " const processorFvPatchField<Type>& ptf,\n" - " const fvPatch& p,\n" - " const DimensionedField<Type, volMesh>& iF,\n" - " const fvPatchFieldMapper& mapper\n" - ")\n" - ) << "\n patch type '" << p.type() - << "' not constraint type '" << typeName << "'" - << "\n for patch " << p.name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() - << exit(FatalIOError); - } -} - - -template<class Type> -processorFvPatchField<Type>::processorFvPatchField -( - const fvPatch& p, - const DimensionedField<Type, volMesh>& iF, - const dictionary& dict -) -: - coupledFvPatchField<Type>(p, iF, dict), - procPatch_(refCast<const processorFvPatch>(p)) -{ - if (!isType<processorFvPatch>(p)) - { - FatalIOErrorIn - ( - "processorFvPatchField<Type>::processorFvPatchField\n" - "(\n" - " const fvPatch& p,\n" - " const Field<Type>& field,\n" - " const dictionary& dict\n" - ")\n", - dict - ) << "\n patch type '" << p.type() - << "' not constraint type '" << typeName << "'" - << "\n for patch " << p.name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() - << exit(FatalIOError); - } -} - - -template<class Type> -processorFvPatchField<Type>::processorFvPatchField -( - const processorFvPatchField<Type>& ptf -) -: - processorLduInterfaceField(), - coupledFvPatchField<Type>(ptf), - procPatch_(refCast<const processorFvPatch>(ptf.patch())) -{} - - -template<class Type> -processorFvPatchField<Type>::processorFvPatchField -( - const processorFvPatchField<Type>& ptf, - const DimensionedField<Type, volMesh>& iF -) -: - coupledFvPatchField<Type>(ptf, iF), - procPatch_(refCast<const processorFvPatch>(ptf.patch())) -{} - - -// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -template<class Type> -processorFvPatchField<Type>::~processorFvPatchField() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const -{ - return *this; -} - - -template<class Type> -void processorFvPatchField<Type>::initEvaluate -( - const Pstream::commsTypes commsType -) -{ - if (Pstream::parRun()) - { - procPatch_.compressedSend(commsType, this->patchInternalField()()); - } -} - - -template<class Type> -void processorFvPatchField<Type>::evaluate -( - const Pstream::commsTypes commsType -) -{ - if (Pstream::parRun()) - { - procPatch_.compressedReceive<Type>(commsType, *this); - - if (doTransform()) - { - transform(*this, procPatch_.forwardT(), *this); - } - } -} - - -template<class Type> -tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const -{ - return this->patch().deltaCoeffs()*(*this - this->patchInternalField()); -} - - -template<class Type> -void processorFvPatchField<Type>::initInterfaceMatrixUpdate -( - const scalarField& psiInternal, - scalarField&, - const lduMatrix&, - const scalarField&, - const direction, - const Pstream::commsTypes commsType -) const -{ - procPatch_.compressedSend - ( - commsType, - this->patch().patchInternalField(psiInternal)() - ); -} - - -template<class Type> -void processorFvPatchField<Type>::updateInterfaceMatrix -( - const scalarField&, - scalarField& result, - const lduMatrix&, - const scalarField& coeffs, - const direction cmpt, - const Pstream::commsTypes commsType -) const -{ - scalarField pnf - ( - procPatch_.compressedReceive<scalar>(commsType, this->size())() - ); - - // Transform according to the transformation tensor - transformCoupleField(pnf, cmpt); - - // Multiply the field by coefficients and add into the result - - const unallocLabelList& faceCells = this->patch().faceCells(); - - forAll(faceCells, elemI) - { - result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchField.H deleted file mode 100644 index 2829334b14d323f7a58fb87b6439f638ee638b20..0000000000000000000000000000000000000000 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorFvPatchField.H +++ /dev/null @@ -1,323 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::processorFvPatchField - -Description - Foam::processorFvPatchField - -SourceFiles - processorFvPatchField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef processorFvPatchField_H -#define processorFvPatchField_H - -#include "coupledFvPatchField.H" -#include "processorLduInterfaceField.H" -#include "processorFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class processorFvPatch Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class processorFvPatchField -: - public processorLduInterfaceField, - public coupledFvPatchField<Type> -{ - // Private data - - //- Local reference cast into the processor patch - const processorFvPatch& procPatch_; - - // Private Member Functions - - //- Get other patchfield - const coupledFvPatchField<Type>& patchField(const label patchID) const; -public: - - //- Runtime type information - TypeName(processorFvPatch::typeName_()); - - - // Constructors - - //- Construct from patch and internal field - processorFvPatchField - ( - const fvPatch&, - const DimensionedField<Type, volMesh>& - ); - - //- Construct from patch and internal field and patch field - processorFvPatchField - ( - const fvPatch&, - const DimensionedField<Type, volMesh>&, - const Field<Type>& - ); - - //- Construct from patch, internal field and dictionary - processorFvPatchField - ( - const fvPatch&, - const DimensionedField<Type, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given processorFvPatchField onto a new patch - processorFvPatchField - ( - const processorFvPatchField<Type>&, - const fvPatch&, - const DimensionedField<Type, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - processorFvPatchField(const processorFvPatchField<Type>&); - - //- Construct and return a clone - virtual tmp<fvPatchField<Type> > clone() const - { - return tmp<fvPatchField<Type> > - ( - new processorFvPatchField<Type>(*this) - ); - } - - //- Construct as copy setting internal field reference - processorFvPatchField - ( - const processorFvPatchField<Type>&, - const DimensionedField<Type, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchField<Type> > clone - ( - const DimensionedField<Type, volMesh>& iF - ) const - { - return tmp<fvPatchField<Type> > - ( - new processorFvPatchField<Type>(*this, iF) - ); - } - - - // Destructor - - ~processorFvPatchField(); - - - // Member functions - - // Access - - //- Return true if running parallel - virtual bool coupled() const - { - if (Pstream::parRun()) - { - return true; - } - else - { - return false; - } - } - - //- Return neighbour field given internal field - tmp<Field<Type> > patchNeighbourField() const; - - - // Evaluation functions - - //- Initialise the evaluation of the patch field - virtual void initEvaluate(const Pstream::commsTypes commsType); - - //- Evaluate the patch field - virtual void evaluate(const Pstream::commsTypes commsType); - - //- Return patch-normal gradient - virtual tmp<Field<Type> > snGrad() const; - - //- Initialise neighbour matrix update - virtual void initInterfaceMatrixUpdate - ( - const scalarField& psiInternal, - scalarField& result, - const lduMatrix& m, - const scalarField& coeffs, - const direction cmpt, - const Pstream::commsTypes commsType - ) const; - - //- Update result field based on interface functionality - virtual void updateInterfaceMatrix - ( - const scalarField& psiInternal, - scalarField& result, - const lduMatrix& m, - const scalarField& coeffs, - const direction cmpt, - const Pstream::commsTypes commsType - ) const; - - //- Processor coupled interface functions - - //- Return processor number - virtual int myProcNo() const - { - return procPatch_.myProcNo(); - } - - //- Return neigbour processor number - virtual int neighbProcNo() const - { - return procPatch_.neighbProcNo(); - } - - //- Return rank of component for transform - virtual int rank() const - { - return pTraits<Type>::rank; - } - -// //- Transform given patch component field -// void transformCoupleField -// ( -// scalarField& f, -// const direction cmpt -// ) const; - - // Referred-patch functionality. Get called with a slice (size, start) - // of a patch that supplies fields and geometry/topology. - - //- Get patch-normal gradient - virtual void snGrad - ( - Field<Type>& exchangeBuf, - const Field<Type>& subFld, - const coupledFvPatch& referringPatch, - const label size, - const label start - ) const - { - notImplemented("processorFvPatchField::snGrad(..)"); - } - - //- Initialise the evaluation of the patch field. - virtual void initEvaluate - ( - Field<Type>& exchangeBuf, - const coupledFvPatch& referringPatch, - const label size, - const label start - ) const - { - notImplemented("processorFvPatchField::initEvaluate(..)"); - } - - //- Evaluate the patch field. - virtual void evaluate - ( - Field<Type>& exchangeBuf, - const coupledFvPatch& referringPatch, - const label size, - const label start - ) const - { - notImplemented("processorFvPatchField::evaluate(..)"); - } - - //- Initialise neighbour matrix update - virtual void initInterfaceMatrixUpdate - ( - const scalarField& psiInternal, - scalarField& result, - const lduMatrix& m, - const scalarField& coeffs, - const direction cmpt, - const coupledFvPatch& referringPatch, - const label size, - const label start, - scalarField& exchangeBuf - ) const - { - notImplemented - ( - "processorFvPatchField::initInterfaceMatrixUpdate(..)" - ); - } - - //- Update result field based on interface functionality - virtual void updateInterfaceMatrix - ( - const scalarField& psiInternal, - scalarField& result, - const lduMatrix&, - const scalarField& coeffs, - const direction, - const coupledFvPatch& referringPatch, - const label size, - const label start, - scalarField& exchangeBuf - ) const - { - notImplemented - ( - "processorFvPatchField::updateInterfaceMatrix(..)" - ); - } - - -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "processorFvPatchField.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 1e4f3ffcc5cc79cd6af1201c0748a38de3a55519..a928c44df4e8d694c07be5c7e69a6f6728be7fe6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -28,6 +28,7 @@ License #include "addToRunTimeSelectionTable.H" #include "volFields.H" #include "surfaceFields.H" +#include "cyclicFvPatch.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -45,6 +46,7 @@ activeBaffleVelocityFvPatchVectorField orientation_(1), initWallSf_(0), initCyclicSf_(0), + nbrCyclicSf_(0), openFraction_(0), openingTime_(0), maxOpenFractionDelta_(0), @@ -68,6 +70,7 @@ activeBaffleVelocityFvPatchVectorField orientation_(ptf.orientation_), initWallSf_(ptf.initWallSf_), initCyclicSf_(ptf.initCyclicSf_), + nbrCyclicSf_(ptf.nbrCyclicSf_), openFraction_(ptf.openFraction_), openingTime_(ptf.openingTime_), maxOpenFractionDelta_(ptf.maxOpenFractionDelta_), @@ -84,23 +87,25 @@ activeBaffleVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - pName_("p"), + pName_(dict.lookupOrDefault<word>("p", "p")), cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), orientation_(readLabel(dict.lookup("orientation"))), initWallSf_(p.Sf()), initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()), + nbrCyclicSf_ + ( + refCast<const cyclicFvPatch> + ( + p.boundaryMesh()[cyclicPatchLabel_] + ).neighbFvPatch().Sf() + ), openFraction_(readScalar(dict.lookup("openFraction"))), openingTime_(readScalar(dict.lookup("openingTime"))), maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))), curTimeIndex_(-1) { fvPatchVectorField::operator=(vector::zero); - - if (dict.found("p")) - { - dict.lookup("p") >> pName_; - } } @@ -117,6 +122,7 @@ activeBaffleVelocityFvPatchVectorField orientation_(ptf.orientation_), initWallSf_(ptf.initWallSf_), initCyclicSf_(ptf.initCyclicSf_), + nbrCyclicSf_(ptf.nbrCyclicSf_), openFraction_(ptf.openFraction_), openingTime_(ptf.openingTime_), maxOpenFractionDelta_(ptf.maxOpenFractionDelta_), @@ -138,6 +144,7 @@ activeBaffleVelocityFvPatchVectorField orientation_(ptf.orientation_), initWallSf_(ptf.initWallSf_), initCyclicSf_(ptf.initCyclicSf_), + nbrCyclicSf_(ptf.nbrCyclicSf_), openFraction_(ptf.openFraction_), openingTime_(ptf.openingTime_), maxOpenFractionDelta_(ptf.maxOpenFractionDelta_), @@ -166,6 +173,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::autoMap [ cyclicPatchLabel_ ].patchSlice(areas); + nbrCyclicSf_ = refCast<const cyclicFvPatch> + ( + patch().boundaryMesh() + [ + cyclicPatchLabel_ + ] + ).neighbFvPatch().patch().patchSlice(areas); } void Foam::activeBaffleVelocityFvPatchVectorField::rmap @@ -183,6 +197,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::rmap [ cyclicPatchLabel_ ].patchSlice(areas); + nbrCyclicSf_ = refCast<const cyclicFvPatch> + ( + patch().boundaryMesh() + [ + cyclicPatchLabel_ + ] + ).neighbFvPatch().patch().patchSlice(areas); } @@ -203,31 +224,42 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs() const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_]; const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells(); - label nCyclicFaces = cyclicFaceCells.size(); - label nCyclicFacesPerSide = nCyclicFaces/2; + const fvPatch& nbrPatch = refCast<const cyclicFvPatch> + ( + cyclicPatch + ).neighbFvPatch(); + const labelList& nbrFaceCells = nbrPatch.patch().faceCells(); scalar forceDiff = 0; - for (label facei=0; facei<nCyclicFacesPerSide; facei++) + // Add this side + forAll(cyclicFaceCells, facei) { forceDiff += p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]); } - for (label facei=nCyclicFacesPerSide; facei<nCyclicFaces; facei++) + // Remove other side + forAll(nbrFaceCells, facei) { - forceDiff -= p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]); + forceDiff -= p[nbrFaceCells[facei]]*mag(nbrCyclicSf_[facei]); } openFraction_ = - max(min( - openFraction_ - + max + max + ( + min ( - this->db().time().deltaTValue()/openingTime_, - maxOpenFractionDelta_ - ) - *(orientation_*sign(forceDiff)), - 1 - 1e-6), 1e-6); + openFraction_ + + max + ( + this->db().time().deltaTValue()/openingTime_, + maxOpenFractionDelta_ + ) + *(orientation_*sign(forceDiff)), + 1 - 1e-6 + ), + 1e-6 + ); Info<< "openFraction = " << openFraction_ << endl; @@ -239,10 +271,16 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs() } const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf()); + // Update owner side of cyclic const_cast<vectorField&>(cyclicPatch.Sf()) = openFraction_*initCyclicSf_; const_cast<scalarField&>(cyclicPatch.magSf()) = mag(cyclicPatch.Sf()); + // Update neighbour side of cyclic + const_cast<vectorField&>(nbrPatch.Sf()) = + openFraction_*nbrCyclicSf_; + const_cast<scalarField&>(nbrPatch.magSf()) = + mag(nbrPatch.Sf()); curTimeIndex_ = this->db().time().timeIndex(); } @@ -264,8 +302,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const << maxOpenFractionDelta_ << token::END_STATEMENT << nl; os.writeKeyword("openFraction") << openFraction_ << token::END_STATEMENT << nl; - os.writeKeyword("p") - << pName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "p", "p", pName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H index 1f4f3d2b903ee3f93f83526e31809adf1c90ab80..f9f5f290d87b9acd194e6b9cdb0d36e0553b0c60 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.H @@ -72,9 +72,12 @@ class activeBaffleVelocityFvPatchVectorField //- Initial wall patch areas vectorField initWallSf_; - //- Initial cyclic patch areas + //- Initial this-side cyclic patch areas vectorField initCyclicSf_; + //- Initial neighbour-side cyclic patch areas + vectorField nbrCyclicSf_; + //- Current fraction of the active baffle which is open scalar openFraction_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 78bf1745353454effb3dbbd01207790b88af7fa4..39611abdc9e0211562345fb92106e4dc49831b36 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -43,7 +43,7 @@ fanFvPatchField<Type>::fanFvPatchField : jumpCyclicFvPatchField<Type>(p, iF), f_(0), - jump_(this->size()/2, 0.0) + jump_(this->size(), 0.0) {} @@ -72,12 +72,14 @@ fanFvPatchField<Type>::fanFvPatchField : jumpCyclicFvPatchField<Type>(p, iF), f_(), - jump_(this->size()/2, 0.0) + jump_(this->size(), 0.0) { { Istream& is = dict.lookup("f"); is.format(IOstream::ASCII); is >> f_; + + // Check that f_ table is same on both sides.? } if (dict.found("value")) @@ -129,21 +131,7 @@ void fanFvPatchField<Type>::autoMap ) { jumpCyclicFvPatchField<Type>::autoMap(m); - - // Jump is half size. Expand to full size, map and truncate. - if (jump_.size() && jump_.size() == this->size()/2) - { - label oldSize = jump_.size(); - jump_.setSize(this->size()); - - for (label i = oldSize; i < jump_.size(); i++) - { - jump_[i] = jump_[i-oldSize]; - } - - jump_.autoMap(m); - jump_.setSize(oldSize); - } + jump_.autoMap(m); } @@ -156,24 +144,9 @@ void fanFvPatchField<Type>::rmap { jumpCyclicFvPatchField<Type>::rmap(ptf, addr); - // Jump is half size. Expand to full size, map and truncate. - if (jump_.size() && jump_.size() == this->size()/2) - { - label oldSize = jump_.size(); - jump_.setSize(this->size()); - - for (label i = oldSize; i < jump_.size(); i++) - { - jump_[i] = jump_[i-oldSize]; - } - - const fanFvPatchField<Type>& tiptf = - refCast<const fanFvPatchField<Type> >(ptf); - - jump_.rmap(tiptf.jump_, addr); - - jump_.setSize(oldSize); - } + const fanFvPatchField<Type>& tiptf = + refCast<const fanFvPatchField<Type> >(ptf); + jump_.rmap(tiptf.jump_, addr); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 3b8d668c9808630a769eb25d82f01d4beedee3b2..d1eac5633ebe785751d618c40ca8f9d03748d818 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -132,7 +132,13 @@ public: // Access - //- Return the "jump" across the patch as a "half" field + //- Return the polynomial coefficients + const List<scalar>& f() const + { + return f_; + } + + //- Return the "jump" across the patch. virtual tmp<Field<Type> > jump() const { return jump_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index 2ae16afc957fd0d17719289b5876c0ce96642897..e63157202c216eb642165d058b12dc0c65e777fa 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -47,6 +47,7 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs() return; } + // Constant jump_ = f_[0]; if (f_.size() > 1) @@ -57,21 +58,11 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs() const fvsPatchField<scalar>& phip = patch().patchField<surfaceScalarField, scalar>(phi); - scalarField Un = max - ( - scalarField::subField(phip, size()/2) - /scalarField::subField(patch().magSf(), size()/2), - scalar(0) - ); + scalarField Un = max(phip/patch().magSf(), scalar(0)); if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { - Un /= - scalarField::subField - ( - patch().lookupPatchField<volScalarField, scalar>("rho"), - size()/2 - ); + Un /= patch().lookupPatchField<volScalarField, scalar>("rho"); } for (label i=1; i<f_.size(); i++) diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..918c7731196179a68e365b4869f07b8a14612d5b --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.C @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "processorCyclicFvsPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField +( + const fvPatch& p, + const DimensionedField<Type, surfaceMesh>& iF +) +: + coupledFvsPatchField<Type>(p, iF), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{} + + +template<class Type> +processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField +( + const fvPatch& p, + const DimensionedField<Type, surfaceMesh>& iF, + const Field<Type>& f +) +: + coupledFvsPatchField<Type>(p, iF, f), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{} + + +// Construct by mapping given processorCyclicFvsPatchField<Type> +template<class Type> +processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField +( + const processorCyclicFvsPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, surfaceMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + coupledFvsPatchField<Type>(ptf, p, iF, mapper), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{ + if (!isType<processorCyclicFvPatch>(this->patch())) + { + FatalErrorIn + ( + "processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField\n" + "(\n" + " const processorCyclicFvsPatchField<Type>& ptf,\n" + " const fvPatch& p,\n" + " const DimensionedField<Type, surfaceMesh>& iF,\n" + " const fvPatchFieldMapper& mapper\n" + ")\n" + ) << "Field type does not correspond to patch type for patch " + << this->patch().index() << "." << endl + << "Field type: " << typeName << endl + << "Patch type: " << this->patch().type() + << exit(FatalError); + } +} + + +template<class Type> +processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField +( + const fvPatch& p, + const DimensionedField<Type, surfaceMesh>& iF, + const dictionary& dict +) +: + coupledFvsPatchField<Type>(p, iF, dict), + procPatch_(refCast<const processorCyclicFvPatch>(p)) +{ + if (!isType<processorCyclicFvPatch>(p)) + { + FatalIOErrorIn + ( + "processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField\n" + "(\n" + " const fvPatch& p,\n" + " const Field<Type>& field,\n" + " const dictionary& dict\n" + ")\n", + dict + ) << "patch " << this->patch().index() << " not processor type. " + << "Patch type = " << p.type() + << exit(FatalIOError); + } +} + + +template<class Type> +processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField +( + const processorCyclicFvsPatchField<Type>& ptf +) +: + coupledFvsPatchField<Type>(ptf), + procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch())) +{} + + +template<class Type> +processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField +( + const processorCyclicFvsPatchField<Type>& ptf, + const DimensionedField<Type, surfaceMesh>& iF +) +: + coupledFvsPatchField<Type>(ptf, iF), + procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch())) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template<class Type> +processorCyclicFvsPatchField<Type>::~processorCyclicFvsPatchField() +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..b418bd7aa9e4129c22d7bd9b7c8fcead7d7b6f43 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchField.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::processorCyclicFvsPatchField + +Description + Foam::processorCyclicFvsPatchField + +SourceFiles + processorCyclicFvsPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef processorCyclicFvsPatchField_H +#define processorCyclicFvsPatchField_H + +#include "coupledFvsPatchField.H" +#include "processorCyclicFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class processorCyclicFvsPatch Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class processorCyclicFvsPatchField +: + public coupledFvsPatchField<Type> +{ + // Private data + + //- Local reference cast into the processor patch + const processorCyclicFvPatch& procPatch_; + + +public: + + //- Runtime type information + TypeName(processorCyclicFvPatch::typeName_()); + + + // Constructors + + //- Construct from patch and internal field + processorCyclicFvsPatchField + ( + const fvPatch&, + const DimensionedField<Type, surfaceMesh>& + ); + + //- Construct from patch and internal field and patch field + processorCyclicFvsPatchField + ( + const fvPatch&, + const DimensionedField<Type, surfaceMesh>&, + const Field<Type>& + ); + + //- Construct from patch, internal field and dictionary + processorCyclicFvsPatchField + ( + const fvPatch&, + const DimensionedField<Type, surfaceMesh>&, + const dictionary& + ); + + //- Construct by mapping given processorCyclicFvsPatchField onto a + // new patch + processorCyclicFvsPatchField + ( + const processorCyclicFvsPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, surfaceMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + processorCyclicFvsPatchField(const processorCyclicFvsPatchField<Type>&); + + //- Construct and return a clone + virtual tmp<fvsPatchField<Type> > clone() const + { + return tmp<fvsPatchField<Type> > + ( + new processorCyclicFvsPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + processorCyclicFvsPatchField + ( + const processorCyclicFvsPatchField<Type>&, + const DimensionedField<Type, surfaceMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvsPatchField<Type> > clone + ( + const DimensionedField<Type, surfaceMesh>& iF + ) const + { + return tmp<fvsPatchField<Type> > + ( + new processorCyclicFvsPatchField<Type>(*this, iF) + ); + } + + + // Destructor + + ~processorCyclicFvsPatchField(); + + + // Member functions + + // Access + + //- Return true if running parallel + virtual bool coupled() const + { + if (Pstream::parRun()) + { + return true; + } + else + { + return false; + } + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "processorCyclicFvsPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFields.C b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..9ac8157e92c317a52f9ce7cf5ce245e031221c0c --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFields.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "processorCyclicFvsPatchFields.H" +#include "fvsPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeFvsPatchFields(processorCyclic); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFields.H b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..5e4684c48080c4fd378848b182e08e91f89cef71 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFields.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#ifndef processorCyclicFvsPatchFields_H +#define processorCyclicFvsPatchFields_H + +#include "processorCyclicFvsPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeFvsPatchTypeFieldTypedefs(processorCyclic) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFieldsFwd.H b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..ad19f47e4e56ed30f8fb28627520cbda5620c569 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/processorCyclic/processorCyclicFvsPatchFieldsFwd.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#ifndef processorCyclicFvsPatchFieldsFwd_H +#define processorCyclicFvsPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class processorCyclicFvsPatchField; + +makeFvsPatchTypeFieldTypedefs(processor) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C index dc2aec8960d320fdf0ee8ed33cfe664fedb398ec..925748a16b4bf6400d557ac4fab5021826bfa2d0 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C @@ -103,6 +103,8 @@ void Foam::fvMeshSubset::doCoupledPatches if (syncPar && Pstream::parRun()) { + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send face usage across processor patches forAll (oldPatches, oldPatchI) { @@ -113,17 +115,14 @@ void Foam::fvMeshSubset::doCoupledPatches const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(pp); - OPstream toNeighbour - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); toNeighbour << SubList<label>(nCellsUsingFace, pp.size(), pp.start()); } } + pBufs.finishedSends(); // Receive face usage count and check for faces that become uncoupled. forAll (oldPatches, oldPatchI) @@ -135,11 +134,7 @@ void Foam::fvMeshSubset::doCoupledPatches const processorPolyPatch& procPatch = refCast<const processorPolyPatch>(pp); - IPstream fromNeighbour - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); + UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs); labelList nbrCellsUsingFace(fromNeighbour); diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H index b2d13558920901dd6dc819e70c72d9280f0fdad3..73e07f776c50e6196e229020999f2085a58b26a5 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H @@ -100,6 +100,12 @@ public: return procPolyPatch_.neighbProcNo(); } + //- Return message tag used for sending + virtual int tag() const + { + return UPstream::msgType(); + } + //- Return true if running parallel virtual bool coupled() const { diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.C new file mode 100644 index 0000000000000000000000000000000000000000..aa779f5ee222968e438b2d30c11be3f6a216ee6c --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.C @@ -0,0 +1,170 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "processorCyclicFvPatch.H" +#include "addToRunTimeSelectionTable.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defineTypeNameAndDebug(processorCyclicFvPatch, 0); +addToRunTimeSelectionTable(fvPatch, processorCyclicFvPatch, polyPatch); + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +//void processorCyclicFvPatch::makeWeights(scalarField& w) const +//{ +// if (Pstream::parRun()) +// { +// // The face normals point in the opposite direction on the other side +// scalarField neighbFaceCentresCn +// ( +// ( +// procPolyPatch_.neighbFaceAreas() +// /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL) +// ) +// & ( +// procPolyPatch_.neighbFaceCentres() +// - procPolyPatch_.neighbFaceCellCentres()) +// ); +// +// w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn); +// } +// else +// { +// w = 1.0; +// } +//} +// +// +//void processorCyclicFvPatch::makeDeltaCoeffs(scalarField& dc) const +//{ +// if (Pstream::parRun()) +// { +// dc = (1.0 - weights())/(nf() & fvPatch::delta()); +// } +// else +// { +// dc = 1.0/(nf() & fvPatch::delta()); +// } +//} +// +// +//tmp<vectorField> processorCyclicFvPatch::delta() const +//{ +// if (Pstream::parRun()) +// { +// // To the transformation if necessary +// if (parallel()) +// { +// return +// fvPatch::delta() +// - ( +// procPolyPatch_.neighbFaceCentres() +// - procPolyPatch_.neighbFaceCellCentres() +// ); +// } +// else +// { +// return +// fvPatch::delta() +// - transform +// ( +// forwardT(), +// ( +// procPolyPatch_.neighbFaceCentres() +// - procPolyPatch_.neighbFaceCellCentres() +// ) +// ); +// } +// } +// else +// { +// return fvPatch::delta(); +// } +//} +// +// +//tmp<labelField> processorCyclicFvPatch::interfaceInternalField +//( +// const unallocLabelList& internalData +//) const +//{ +// return patchInternalField(internalData); +//} + + +// void processorCyclicFvPatch::initTransfer +// ( +// const Pstream::commsTypes commsType, +// const unallocLabelList& interfaceData +// ) const +// { +// send(commsType, interfaceData); +// } +// +// +// tmp<labelField> processorCyclicFvPatch::transfer +// ( +// const Pstream::commsTypes commsType, +// const unallocLabelList& +// ) const +// { +// return receive<label>(commsType, this->size()); +// } + + +//void processorCyclicFvPatch::initInternalFieldTransfer +//( +// const Pstream::commsTypes commsType, +// const unallocLabelList& iF +//) const +//{ +// send(commsType, patchInternalField(iF)()); +//} +// +// +//tmp<labelField> processorCyclicFvPatch::internalFieldTransfer +//( +// const Pstream::commsTypes commsType, +// const unallocLabelList& +//) const +//{ +// return receive<label>(commsType, this->size()); +//} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H new file mode 100644 index 0000000000000000000000000000000000000000..11cf68239d3c99c12016c8cc0a6b7682c0d75609 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processorCyclic/processorCyclicFvPatch.H @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::processorCyclicFvPatch + +Description + Processor patch. + +SourceFiles + processorCyclicFvPatch.C + +\*---------------------------------------------------------------------------*/ + +#ifndef processorCyclicFvPatch_H +#define processorCyclicFvPatch_H + +//#include "coupledFvPatch.H" +//#include "processorLduInterface.H" +#include "processorCyclicPolyPatch.H" +#include "processorFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class processorCyclicFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class processorCyclicFvPatch +: +// public coupledFvPatch, +// public processorLduInterface + public processorFvPatch +{ + // Private Data + + const processorCyclicPolyPatch& procPolyPatch_; + + +//protected: +// +// // Protected Member functions +// +// //- Make patch weighting factors +// void makeWeights(scalarField&) const; +// +// //- Make patch face - neighbour cell distances +// void makeDeltaCoeffs(scalarField&) const; + + +public: + + //- Runtime type information + TypeName(processorCyclicPolyPatch::typeName_()); + + + // Constructors + + //- Construct from components + processorCyclicFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm) + : +// coupledFvPatch(patch, bm), + processorFvPatch(patch, bm), + procPolyPatch_(refCast<const processorCyclicPolyPatch>(patch)) + {} + + + // Member functions + +// //- Return processor number +// int myProcNo() const +// { +// return procPolyPatch_.myProcNo(); +// } +// +// //- Return neigbour processor number +// int neighbProcNo() const +// { +// return procPolyPatch_.neighbProcNo(); +// } +// +// //- Return true if running parallel +// virtual bool coupled() const +// { +// if (Pstream::parRun()) +// { +// return true; +// } +// else +// { +// return false; +// } +// } + + //- Return message tag used for sending + virtual int tag() const + { + // Allocate from Pstream? + return procPolyPatch_.tag(); + } + + const processorCyclicPolyPatch& procPolyPatch() const + { + return procPolyPatch_; + } + +// //- Are the planes separated. +// virtual bool separated() const +// { +// return procPolyPatch_.separated(); +// } +// +// //- If the planes are separated the separation vector. +// virtual const vector& separation() const +// { +// return procPolyPatch_.separation(); +// } +// + + //- Are the cyclic planes parallel + virtual bool parallel() const + { + return procPolyPatch_.parallel(); + } + + //- Return face transformation tensor + virtual const tensor& forwardT() const + { + return procPolyPatch_.forwardT(); + } + + //- Return neighbour-cell transformation tensor + virtual const tensor& reverseT() const + { + return procPolyPatch_.reverseT(); + } +// +// +// //- Return delta (P to N) vectors across coupled patch +// virtual tmp<vectorField> delta() const; + + + // Interface transfer functions + +// //- Return the values of the given internal data adjacent to +// // the interface as a field +// virtual tmp<labelField> interfaceInternalField +// ( +// const unallocLabelList& internalData +// ) const; + +// //- Initialise interface data transfer +// virtual void initTransfer +// ( +// const Pstream::commsTypes commsType, +// const unallocLabelList& interfaceData +// ) const; +// +// //- Transfer and return neighbour field +// virtual tmp<labelField> transfer +// ( +// const Pstream::commsTypes commsType, +// const unallocLabelList& interfaceData +// ) const; + +// //- Initialise neighbour field transfer +// virtual void initInternalFieldTransfer +// ( +// const Pstream::commsTypes commsType, +// const unallocLabelList& internalData +// ) const; +// +// //- Return neighbour field +// virtual tmp<labelField> internalFieldTransfer +// ( +// const Pstream::commsTypes commsType, +// const unallocLabelList& internalData +// ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 700843950fef38ead6570642eb82d2498f2ed25c..08b9fa108e927424855ba6d3e1a967e1a0f558f4 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -322,36 +322,18 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement forAll(patches, patchI) { - if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI])) - { - const processorPolyPatch& pp = - refCast<const processorPolyPatch>(patches[patchI]); - - if (pp.myProcNo() < pp.neighbProcNo()) - { - const vectorField::subField faceCentres = pp.faceCentres(); - - forAll(pp, i) - { - const face& f = pp[i]; - const point& fc = faceCentres[i]; - - forAll(f, fp) - { - globalSum[f[fp]] += fc; - globalNum[f[fp]]++; - } - } - } - } - else if (isA<cyclicPolyPatch>(patches[patchI])) + if + ( + patches[patchI].coupled() + && refCast<const coupledPolyPatch>(patches[patchI]).owner() + ) { - const cyclicPolyPatch& pp = - refCast<const cyclicPolyPatch>(patches[patchI]); + const coupledPolyPatch& pp = + refCast<const coupledPolyPatch>(patches[patchI]); const vectorField::subField faceCentres = pp.faceCentres(); - for (label i = 0; i < pp.size()/2; i++) + forAll(pp, i) { const face& f = pp[i]; const point& fc = faceCentres[i]; diff --git a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C index 78d479a780cd3f775019acd7954827da45856189..cc64b5cc6e365536a843f96ea6b73906475cb729 100644 --- a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C +++ b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C @@ -91,20 +91,6 @@ bool Foam::blockMesh::readPatches >> patchTypes[nPatches] >> patchNames[nPatches]; - // Read optional neighbour patch name - if (patchTypes[nPatches] == cyclicPolyPatch::typeName) - { - patchStream >> lastToken; - if (lastToken.isWord()) - { - nbrPatchNames[nPatches] = lastToken.wordToken(); - } - else - { - patchStream.putBack(lastToken); - } - } - // Read patch faces patchStream >> tmpBlocksPatches[nPatches]; @@ -138,57 +124,56 @@ bool Foam::blockMesh::readPatches if (patchTypes[nPatches-1] == cyclicPolyPatch::typeName) { - if (nbrPatchNames[nPatches] == word::null) + word halfA = patchNames[nPatches-1] + "_half0"; + word halfB = patchNames[nPatches-1] + "_half1"; + + WarningIn("blockMesh::createTopology(IOdictionary&)") + << "Old-style cyclic definition." + << " Splitting patch " + << patchNames[nPatches-1] << " into two halves " + << halfA << " and " << halfB << endl + << " Alternatively use new 'boundary' dictionary syntax." + << endl; + + // Add extra patch + if (tmpBlocksPatches.size() <= nPatches) { - word halfA = patchNames[nPatches-1] + "_half0"; - word halfB = patchNames[nPatches-1] + "_half1"; - - WarningIn("blockMesh::createTopology(IOdictionary&)") - << "Old-style cyclic definition." - << " Splitting patch " - << patchNames[nPatches-1] << " into two halves " - << halfA << " and " << halfB << endl - << " Alternatively use new syntax " - << " cyclic <name> <neighbourname> <faces>" << endl; - - // Add extra patch - if (tmpBlocksPatches.size() <= nPatches) - { - tmpBlocksPatches.setSize(nPatches + 1); - patchNames.setSize(nPatches + 1); - patchTypes.setSize(nPatches + 1); - nbrPatchNames.setSize(nPatches + 1); - } - - patchNames[nPatches-1] = halfA; - nbrPatchNames[nPatches-1] = halfB; - patchTypes[nPatches] = patchTypes[nPatches-1]; - patchNames[nPatches] = halfB; - nbrPatchNames[nPatches] = halfA; - - // Split faces - if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0) - { - FatalErrorIn - ( - "blockMesh::createTopology(IOdictionary&)" - ) << "Size of cyclic faces is not a multiple of 2 :" - << tmpBlocksPatches[nPatches-1] - << exit(FatalError); - } - label sz = tmpBlocksPatches[nPatches-1].size()/2; - faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true); - tmpBlocksPatches[nPatches-1] = faceList - ( - SubList<face>(unsplitFaces, sz) - ); - tmpBlocksPatches[nPatches] = faceList - ( - SubList<face>(unsplitFaces, sz, sz) - ); + tmpBlocksPatches.setSize(nPatches + 1); + patchNames.setSize(nPatches + 1); + patchTypes.setSize(nPatches + 1); + nbrPatchNames.setSize(nPatches + 1); + } + + // Update halfA info + patchNames[nPatches-1] = halfA; + nbrPatchNames[nPatches-1] = halfB; + // Update halfB info + patchTypes[nPatches] = patchTypes[nPatches-1]; + patchNames[nPatches] = halfB; + nbrPatchNames[nPatches] = halfA; - nPatches++; + // Split faces + if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0) + { + FatalErrorIn + ( + "blockMesh::createTopology(IOdictionary&)" + ) << "Size of cyclic faces is not a multiple of 2 :" + << tmpBlocksPatches[nPatches-1] + << exit(FatalError); } + label sz = tmpBlocksPatches[nPatches-1].size()/2; + faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true); + tmpBlocksPatches[nPatches-1] = faceList + ( + SubList<face>(unsplitFaces, sz) + ); + tmpBlocksPatches[nPatches] = faceList + ( + SubList<face>(unsplitFaces, sz, sz) + ); + + nPatches++; } patchStream >> lastToken; @@ -495,6 +480,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) patchPhysicalTypes ); + + // Convert into dictionary + PtrList<dictionary> patchDicts(patchNames.size()); + forAll(patchDicts, patchI) + { + patchDicts.set(patchI, new dictionary()); + patchDicts[patchI].set("name", patchNames[patchI]); + patchDicts[patchI].set("type", patchTypes[patchI]); + if (nbrPatchNames[patchI] != word::null) + { + patchDicts[patchI].set("neighbourPatch", nbrPatchNames[patchI]); + } + if (patchPhysicalTypes[patchI] != word::null) + { + patchDicts[patchI].set + ( + "physicalType", + patchPhysicalTypes[patchI] + ); + } + } + + blockMeshPtr = new polyMesh ( IOobject @@ -509,11 +517,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) xferCopy(blockPointField_), // copy these points, do NOT move tmpBlockCells, tmpBlocksPatches, - patchNames, - patchTypes, + patchDicts, defaultPatchName, - defaultPatchType, - patchPhysicalTypes + defaultPatchType ); } else if (meshDescription.found("boundary")) diff --git a/src/meshTools/PointEdgeWave/PointEdgeWave.C b/src/meshTools/PointEdgeWave/PointEdgeWave.C index faa9951fbad0fabc81211e0ba32dd0adf46926be..023fd417dcd9f28c1f13d27ce6be3d7e666e6a70 100644 --- a/src/meshTools/PointEdgeWave/PointEdgeWave.C +++ b/src/meshTools/PointEdgeWave/PointEdgeWave.C @@ -57,49 +57,6 @@ void Foam::PointEdgeWave<Type>::offset(const label val, labelList& elems) // - list of halfA points (in cyclic patch points) // - list of halfB points (can overlap with A!) // - for every patchPoint its corresponding point -template <class Type> -void Foam::PointEdgeWave<Type>::calcCyclicAddressing() -{ - label cycHalf = 0; - - forAll(mesh_.boundaryMesh(), patchI) - { - const polyPatch& patch = mesh_.boundaryMesh()[patchI]; - - if (isA<cyclicPolyPatch>(patch)) - { - label halfSize = patch.size()/2; - - SubList<face> halfAFaces - ( - mesh_.faces(), - halfSize, - patch.start() - ); - - cycHalves_.set - ( - cycHalf++, - new primitivePatch(halfAFaces, mesh_.points()) - ); - - SubList<face> halfBFaces - ( - mesh_.faces(), - halfSize, - patch.start() + halfSize - ); - - cycHalves_.set - ( - cycHalf++, - new primitivePatch(halfBFaces, mesh_.points()) - ); - } - } -} - - // Handle leaving domain. Implementation referred to Type template <class Type> void Foam::PointEdgeWave<Type>::leaveDomain @@ -559,96 +516,57 @@ void Foam::PointEdgeWave<Type>::handleCyclicPatches() // 1. Send all point info on cyclic patches. Send as // face label + offset in face. - label cycHalf = 0; - forAll(mesh_.boundaryMesh(), patchI) { const polyPatch& patch = mesh_.boundaryMesh()[patchI]; if (isA<cyclicPolyPatch>(patch)) { - const primitivePatch& halfA = cycHalves_[cycHalf++]; - const primitivePatch& halfB = cycHalves_[cycHalf++]; - - // HalfA : get all changed points in relative addressing - - DynamicList<Type> halfAInfo(halfA.nPoints()); - DynamicList<label> halfAPoints(halfA.nPoints()); - DynamicList<label> halfAOwner(halfA.nPoints()); - DynamicList<label> halfAIndex(halfA.nPoints()); - - getChangedPatchPoints - ( - halfA, - halfAInfo, - halfAPoints, - halfAOwner, - halfAIndex - ); + const cyclicPolyPatch& cycPatch = + refCast<const cyclicPolyPatch>(patch); - // HalfB : get all changed points in relative addressing + const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch(); - DynamicList<Type> halfBInfo(halfB.nPoints()); - DynamicList<label> halfBPoints(halfB.nPoints()); - DynamicList<label> halfBOwner(halfB.nPoints()); - DynamicList<label> halfBIndex(halfB.nPoints()); + DynamicList<Type> nbrInfo(nbrPatch.nPoints()); + DynamicList<label> nbrPoints(nbrPatch.nPoints()); + DynamicList<label> nbrOwner(nbrPatch.nPoints()); + DynamicList<label> nbrIndex(nbrPatch.nPoints()); getChangedPatchPoints ( - halfB, - halfBInfo, - halfBPoints, - halfBOwner, - halfBIndex + nbrPatch, + nbrInfo, + nbrPoints, + nbrOwner, + nbrIndex ); - - // HalfA : adapt for leaving domain - leaveDomain(patch, halfA, halfAPoints, halfAInfo); - - // HalfB : adapt for leaving domain - leaveDomain(patch, halfB, halfBPoints, halfBInfo); - + // nbr : adapt for leaving domain + leaveDomain(nbrPatch, nbrPatch, nbrPoints, nbrInfo); // Apply rotation for non-parallel planes - const cyclicPolyPatch& cycPatch = - refCast<const cyclicPolyPatch>(patch); if (!cycPatch.parallel()) { // received data from half1 - transform(cycPatch.forwardT(), halfAInfo); - - // received data from half2 - transform(cycPatch.reverseT(), halfBInfo); + transform(cycPatch.forwardT(), nbrInfo); } if (debug) { Pout<< "Cyclic patch " << patchI << ' ' << patch.name() - << " Changed on first half : " << halfAInfo.size() - << " Changed on second half : " << halfBInfo.size() + << " Changed : " << nbrInfo.size() << endl; } // Half1: update with data from halfB updateFromPatchInfo ( - patch, - halfA, - halfBOwner, - halfBIndex, - halfBInfo - ); - - // Half2: update with data from halfA - updateFromPatchInfo - ( - patch, - halfB, - halfAOwner, - halfAIndex, - halfAInfo + cycPatch, + cycPatch, + nbrOwner, + nbrIndex, + nbrInfo ); if (debug) @@ -687,7 +605,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave changedEdges_(mesh_.nEdges()), nChangedEdges_(0), nCyclicPatches_(countPatchType<cyclicPolyPatch>()), - cycHalves_(2*nCyclicPatches_), nEvals_(0), nUnvisitedPoints_(mesh_.nPoints()), nUnvisitedEdges_(mesh_.nEdges()) @@ -720,13 +637,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave } - // Calculate cyclic halves addressing. - if (nCyclicPatches_ > 0) - { - calcCyclicAddressing(); - } - - // Set from initial changed points data setPointInfo(changedPoints, changedPointsInfo); diff --git a/src/meshTools/PointEdgeWave/PointEdgeWave.H b/src/meshTools/PointEdgeWave/PointEdgeWave.H index 7a679a52dca1fc385fbc3848d620d02d34146b16..f156d0045ce24ee5b0c5523f52ab41b801526873 100644 --- a/src/meshTools/PointEdgeWave/PointEdgeWave.H +++ b/src/meshTools/PointEdgeWave/PointEdgeWave.H @@ -231,9 +231,6 @@ class PointEdgeWave //- Merge data from across processor boundaries void handleProcPatches(); - //- Calculate cyclic halves addressing. - void calcCyclicAddressing(); - //- Merge data from across cyclic boundaries void handleCyclicPatches(); diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C index 4646987153900d0385268bc971b34f5963b0fa0f..d8dd38bd3be0d6f85b77ce9e3340d9ae7c0c2762 100644 --- a/src/meshTools/regionSplit/regionSplit.C +++ b/src/meshTools/regionSplit/regionSplit.C @@ -210,16 +210,22 @@ void Foam::regionSplit::fillSeedMask { const polyPatch& pp = patches[patchI]; - if (isA<cyclicPolyPatch>(pp)) + if + ( + isA<cyclicPolyPatch>(pp) + && refCast<const cyclicPolyPatch>(pp).owner() + ) { - label faceI = pp.start(); + // Transfer from neighbourPatch to here or vice versa. + + const cyclicPolyPatch& cycPatch = + refCast<const cyclicPolyPatch>(pp); - label halfSz = pp.size()/2; + label faceI = cycPatch.start(); - for (label i = 0; i < halfSz; i++) + forAll(cycPatch, i) { - label otherFaceI = refCast<const cyclicPolyPatch>(pp) - .transformGlobalFace(faceI); + label otherFaceI = cycPatch.transformGlobalFace(faceI); transferCoupledFaceRegion ( diff --git a/src/meshTools/sets/topoSets/cellZoneSet.C b/src/meshTools/sets/topoSets/cellZoneSet.C index 613a23bc8c7d59eed456b26e6db1544181c54261..3469aa90cd902a260eb742fe82f56b80379e9cc8 100644 --- a/src/meshTools/sets/topoSets/cellZoneSet.C +++ b/src/meshTools/sets/topoSets/cellZoneSet.C @@ -27,8 +27,6 @@ License #include "cellZoneSet.H" #include "mapPolyMesh.H" #include "polyMesh.H" -#include "processorPolyPatch.H" -#include "cyclicPolyPatch.H" #include "addToRunTimeSelectionTable.H" diff --git a/src/meshTools/sets/topoSets/faceSet.C b/src/meshTools/sets/topoSets/faceSet.C index 782ebf3a5b6a0a4ad52d36f23a0e92cb7b9cd3e4..8a984a9aeaa7c19b98226174f879a1de7f81ea7d 100644 --- a/src/meshTools/sets/topoSets/faceSet.C +++ b/src/meshTools/sets/topoSets/faceSet.C @@ -27,8 +27,6 @@ License #include "faceSet.H" #include "mapPolyMesh.H" #include "polyMesh.H" -#include "processorPolyPatch.H" -#include "cyclicPolyPatch.H" #include "syncTools.H" #include "addToRunTimeSelectionTable.H" @@ -139,105 +137,6 @@ void faceSet::sync(const polyMesh& mesh) } } - //const polyBoundaryMesh& patches = mesh.boundaryMesh(); - // - //if (Pstream::parRun()) - //{ - // // Send faces in set that are on a processorPatch. Send as patch face - // // indices. - // forAll(patches, patchI) - // { - // const polyPatch& pp = patches[patchI]; - // - // if (isType<processorPolyPatch>(pp)) - // { - // const processorPolyPatch& procPatch = - // refCast<const processorPolyPatch>(pp); - // - // // Convert faceSet locally to labelList. - // DynamicList<label> setFaces(pp.size()); - // - // forAll(pp, i) - // { - // if (found(pp.start() + i)) - // { - // setFaces.append(i); - // } - // } - // setFaces.shrink(); - // - // OPstream toNeighbour - // ( - // Pstream::blocking, - // procPatch.neighbProcNo() - // ); - // - // toNeighbour << setFaces; - // } - // } - // - // // Receive - // forAll(patches, patchI) - // { - // const polyPatch& pp = patches[patchI]; - // - // if (isType<processorPolyPatch>(pp)) - // { - // const processorPolyPatch& procPatch = - // refCast<const processorPolyPatch>(pp); - // - // IPstream fromNeighbour - // ( - // Pstream::blocking, - // procPatch.neighbProcNo() - // ); - // - // labelList setFaces(fromNeighbour); - // - // forAll(setFaces, i) - // { - // if (insert(pp.start() + setFaces[i])) - // { - // nAdded++; - // } - // } - // } - // } - //} - // - //// Couple cyclic patches - //forAll (patches, patchI) - //{ - // const polyPatch& pp = patches[patchI]; - // - // if (typeid(pp) == typeid(cyclicPolyPatch)) - // { - // const cyclicPolyPatch& cycPatch = - // refCast<const cyclicPolyPatch>(pp); - // - // forAll (cycPatch, i) - // { - // label thisFaceI = cycPatch.start() + i; - // label otherFaceI = cycPatch.transformGlobalFace(thisFaceI); - // - // if (found(thisFaceI)) - // { - // if (insert(otherFaceI)) - // { - // nAdded++; - // } - // } - // else if (found(otherFaceI)) - // { - // if (insert(thisFaceI)) - // { - // nAdded++; - // } - // } - // } - // } - //} - reduce(nAdded, sumOp<label>()); if (nAdded > 0) { diff --git a/src/meshTools/sets/topoSets/faceZoneSet.C b/src/meshTools/sets/topoSets/faceZoneSet.C index 85069a83ae2d6de8e9282ff2ae0fab82fd537b27..2fc79e9ac1e36d678b9c833daa0e55ca6944d692 100644 --- a/src/meshTools/sets/topoSets/faceZoneSet.C +++ b/src/meshTools/sets/topoSets/faceZoneSet.C @@ -27,8 +27,6 @@ License #include "faceZoneSet.H" #include "mapPolyMesh.H" #include "polyMesh.H" -#include "processorPolyPatch.H" -#include "cyclicPolyPatch.H" #include "addToRunTimeSelectionTable.H" diff --git a/src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.C b/src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.C index 5375fb529bf870cc74b1bc0ad8311c6d51d0a3a2..64e3a397261b0a0a8ff7ac3b8535d1f30f81b29b 100644 --- a/src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.C @@ -576,16 +576,25 @@ void Foam::scotchDecomp::calcCSR // Coupled faces. Only cyclics done. forAll(pbm, patchi) { - if (isA<cyclicPolyPatch>(pbm[patchi])) + if + ( + isA<cyclicPolyPatch>(pbm[patchi]) + && refCast<const cyclicPolyPatch>(pbm[patchi]).owner() + ) { - const unallocLabelList& faceCells = pbm[patchi].faceCells(); + const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch> + ( + pbm[patchi] + ); - label sizeby2 = faceCells.size()/2; + const unallocLabelList& faceCells = cycPatch.faceCells(); + const unallocLabelList& nbrCells = + cycPatch.neighbPatch().faceCells(); - for (label facei=0; facei<sizeby2; facei++) + forAll(faceCells, facei) { label own = faceCells[facei]; - label nei = faceCells[facei + sizeby2]; + label nei = nbrCells[facei]; adjncy[xadj[own] + nFacesPerCell[own]++] = nei; adjncy[xadj[nei] + nFacesPerCell[nei]++] = own; diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index e84fe07402fabd8e73589b497893eb87d7ba67b2..07aa4a0c102486358eac92a84c154a593a6946ee 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -28,7 +28,7 @@ License #include "fvMesh.H" #include "cyclicPolyPatch.H" #include "emptyPolyPatch.H" -#include "processorPolyPatch.H" +#include "coupledPolyPatch.H" #include "surfaceFields.H" #include "volFields.H" #include "IOList.H" @@ -100,9 +100,9 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces() { facePatchId = mesh().boundaryMesh().whichPatch(faceI); const polyPatch& pp = mesh().boundaryMesh()[facePatchId]; - if (isA<processorPolyPatch>(pp)) + if (isA<coupledPolyPatch>(pp)) { - if (refCast<const processorPolyPatch>(pp).owner()) + if (refCast<const coupledPolyPatch>(pp).owner()) { faceId = pp.whichFace(faceI); } @@ -111,18 +111,6 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces() faceId = -1; } } - else if (isA<cyclicPolyPatch>(pp)) - { - label patchFaceI = faceI - pp.start(); - if (patchFaceI < pp.size()/2) - { - faceId = patchFaceI; - } - else - { - faceId = -1; - } - } else if (!isA<emptyPolyPatch>(pp)) { faceId = faceI - pp.start(); diff --git a/unitTestCases/README.txt b/unitTestCases/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e7b1f8de0bb76963752561a4bb4b008ad0999c6 --- /dev/null +++ b/unitTestCases/README.txt @@ -0,0 +1 @@ +channel395-newBlockMeshDict : channel395 with new blockMesh syntax