diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index be267f872476d9597ee360dc9ea33013451645ca..b61d997399f39a31315b4dc5cde0a68d15a63977 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -45,7 +45,7 @@ Description so cannot have any cells in any other zone. - useCellZonesOnly does not do a walk and uses the cellZones only. Use this if you don't mind having disconnected domains in a single region. - This option requires all cells to be in one (and one only) region. + This option requires all cells to be in one (and one only) cellZone. \*---------------------------------------------------------------------------*/ diff --git a/bin/mpirunDebug b/bin/mpirunDebug index 57df760873478f36ba49b44ac000ec76d7be37d0..2376d22601c0e1c6f7f58cc1f95a70e9bef9476a 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -206,6 +206,21 @@ done cmd="" if [ .$WM_MPLIB = .OPENMPI ]; then cmd="mpirun -app $PWD/mpirun.schema </dev/null" +elif [ .$WM_MPLIB = .MPICH ]; then + cmd="mpiexec" + for ((proc=0; proc<$nProcs; proc++)) + do + read procCmd + + procXtermCmdFile="$PWD/processor${proc}Xterm.sh" + echo "#!/bin/sh" > $procXtermCmdFile + echo "$procCmd" >> $procXtermCmdFile + chmod +x $procXtermCmdFile + if [ $proc -ne 0 ]; then + cmd="${cmd} :" + fi + cmd="${cmd} -n 1 ${procXtermCmdFile}" + done < $PWD/mpirun.schema fi echo "Constructed $PWD/mpirun.schema file." diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index 087f685ff6cf182cee3be9fe3a4c24370d3f25fa..b829c99ea5f69cbe6233b827c972117437d14b4e 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -184,6 +184,12 @@ public: // an out-of-range element returns false without any ill-effects inline const T& operator[](const label) const; + //- Return last element of UList. + inline T& last(); + + //- Return last element of UList. + inline const T& last() const; + //- Allow cast to a const List<T>& inline operator const Foam::List<T>&() const; diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index 5c1df4be15c318df142cb195940dd5643b7db0d7..aa7d396f105c2387b25120113f81e6e26dda8759 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.H @@ -114,6 +114,20 @@ inline void Foam::UList<T>::checkIndex(const label i) const } +template<class T> +inline T& Foam::UList<T>::last() +{ + return this->operator[](this->size()-1); +} + + +template<class T> +inline const T& Foam::UList<T>::last() const +{ + return this->operator[](this->size()-1); +} + + template<class T> inline const T* Foam::UList<T>::cdata() const { diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C index 87f940db406263fc8e747134db6197456772cd0a..41cb1c4f110bc75c61dfdcd904812cc77d13eac3 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.C @@ -82,9 +82,6 @@ void Foam::PstreamBuffers::finishedSends(labelListList& sizes, const bool block) if (commsType_ == UPstream::nonBlocking) { - labelListList sizes; - labelListList send,recv; - Pstream::exchange<DynamicList<char>, char> ( sendBuf_, @@ -96,20 +93,30 @@ void Foam::PstreamBuffers::finishedSends(labelListList& sizes, const bool block) } else { - sizes.setSize(UPstream::nProcs()); - labelList& nsTransPs = sizes[UPstream::myProcNo()]; - nsTransPs.setSize(UPstream::nProcs()); - - forAll(sendBuf_, procI) - { - nsTransPs[procI] = sendBuf_[procI].size(); - } - - // Send sizes across. - int oldTag = UPstream::msgType(); - UPstream::msgType() = tag_; - combineReduce(sizes, UPstream::listEq()); - UPstream::msgType() = oldTag; + FatalErrorIn + ( + "PstreamBuffers::finishedSends(labelListList&, const bool)" + ) << "Obtaining sizes not supported in " + << UPstream::commsTypeNames[commsType_] << endl + << " since transfers already in progress. Use non-blocking instead." + << exit(FatalError); + + // Note: possible only if using different tag from write started + // by ~UOPstream. Needs some work. + //sizes.setSize(UPstream::nProcs()); + //labelList& nsTransPs = sizes[UPstream::myProcNo()]; + //nsTransPs.setSize(UPstream::nProcs()); + // + //forAll(sendBuf_, procI) + //{ + // nsTransPs[procI] = sendBuf_[procI].size(); + //} + // + //// Send sizes across. + //int oldTag = UPstream::msgType(); + //UPstream::msgType() = tag_; + //combineReduce(sizes, UPstream::listEq()); + //UPstream::msgType() = oldTag; } } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H index d3dbbf23db7f60f61f64996439e57591f62ec3c1..75f26f1d6a9468d6caba8174921895dbf84fe1b2 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/PstreamBuffers.H @@ -138,7 +138,8 @@ public: void finishedSends(const bool block = true); //- Mark all sends as having been done. Same as above but also returns - // sizes (bytes) transferred. + // sizes (bytes) transferred. Note:currently only valid for + // non-blocking. void finishedSends(labelListList& sizes, const bool block = true); }; diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C b/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C index 64ced34ecf4c54f4e181a31a5f747f84641872d7..b950ed22f0643da83759b04587e779580902aea6 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C @@ -50,43 +50,42 @@ void Pstream::exchange const bool block ) { - if (UPstream::parRun()) + if (!contiguous<T>()) { - if (!contiguous<T>()) - { - FatalErrorIn - ( - "Pstream::exchange(..)" - ) << "Continuous data only." << Foam::abort(FatalError); - } - - if (sendBufs.size() != UPstream::nProcs()) - { - FatalErrorIn - ( - "Pstream::exchange(..)" - ) << "Size of list:" << sendBufs.size() - << " does not equal the number of processors:" - << UPstream::nProcs() - << Foam::abort(FatalError); - } + FatalErrorIn + ( + "Pstream::exchange(..)" + ) << "Continuous data only." << Foam::abort(FatalError); + } - sizes.setSize(UPstream::nProcs()); - labelList& nsTransPs = sizes[UPstream::myProcNo()]; - nsTransPs.setSize(UPstream::nProcs()); + if (sendBufs.size() != UPstream::nProcs()) + { + FatalErrorIn + ( + "Pstream::exchange(..)" + ) << "Size of list:" << sendBufs.size() + << " does not equal the number of processors:" + << UPstream::nProcs() + << Foam::abort(FatalError); + } - forAll(sendBufs, procI) - { - nsTransPs[procI] = sendBufs[procI].size(); - } + sizes.setSize(UPstream::nProcs()); + labelList& nsTransPs = sizes[UPstream::myProcNo()]; + nsTransPs.setSize(UPstream::nProcs()); - // Send sizes across. - int oldTag = UPstream::msgType(); - UPstream::msgType() = tag; - combineReduce(sizes, UPstream::listEq()); - UPstream::msgType() = oldTag; + forAll(sendBufs, procI) + { + nsTransPs[procI] = sendBufs[procI].size(); + } + // Send sizes across. + int oldTag = UPstream::msgType(); + UPstream::msgType() = tag; + combineReduce(sizes, UPstream::listEq()); + UPstream::msgType() = oldTag; + if (Pstream::parRun()) + { // Set up receives // ~~~~~~~~~~~~~~~ diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index 4e3bf3fad6849ce9daa4d5c6189716b91bd139f8..5c9b96fe685ae7b527dca81f3e83e639782a06d3 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -37,8 +37,43 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict() dict_.readIfPresent("region", regionName_); dict_.readIfPresent("dictionary", dictName_); dict_.readIfPresent("enabled", enabled_); + dict_.readIfPresent("storeFilter", storeFilter_); } +template<class OutputFilter> +void Foam::OutputFilterFunctionObject<OutputFilter>::allocateFilter() +{ + if (dictName_.size()) + { + ptr_.reset + ( + new IOOutputFilter<OutputFilter> + ( + name(), + time_.lookupObject<objectRegistry>(regionName_), + dictName_ + ) + ); + } + else + { + ptr_.reset + ( + new OutputFilter + ( + name(), + time_.lookupObject<objectRegistry>(regionName_), + dict_ + ) + ); + } +} + +template<class OutputFilter> +void Foam::OutputFilterFunctionObject<OutputFilter>::destroyFilter() +{ + ptr_.reset(); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -56,6 +91,7 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject regionName_(polyMesh::defaultRegion), dictName_(), enabled_(true), + storeFilter_(true), outputControl_(t, dict) { readDict(); @@ -83,32 +119,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start() { readDict(); - if (enabled_) + if (enabled_&&storeFilter_) { - if (dictName_.size()) - { - ptr_.reset - ( - new IOOutputFilter<OutputFilter> - ( - name(), - time_.lookupObject<objectRegistry>(regionName_), - dictName_ - ) - ); - } - else - { - ptr_.reset - ( - new OutputFilter - ( - name(), - time_.lookupObject<objectRegistry>(regionName_), - dict_ - ) - ); - } + allocateFilter(); } return true; @@ -120,12 +133,22 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute() { if (enabled_) { + if (!storeFilter_) + { + allocateFilter(); + } + ptr_->execute(); if (enabled_ && outputControl_.output()) { ptr_->write(); } + + if (!storeFilter_) + { + destroyFilter(); + } } return true; @@ -137,12 +160,22 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::end() { if (enabled_) { + if (!storeFilter_) + { + allocateFilter(); + } + ptr_->end(); if (enabled_ && outputControl_.output()) { ptr_->write(); } + + if (!storeFilter_) + { + destroyFilter(); + } } return true; diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index f6c183e803cb0aadf64d2fe346faa8d975e09d10..47009d2643f9a41f8bdac6a316a1cd3e217e1a2a 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -78,6 +78,10 @@ class OutputFilterFunctionObject //- Switch for the execution of the functionObject bool enabled_; + //- Switch to store filter in between writes or use on-the-fly + // construction + bool storeFilter_; + //- Output controls outputFilterOutputControl outputControl_; @@ -89,6 +93,12 @@ class OutputFilterFunctionObject //- Read relevant dictionary entries void readDict(); + + //- Creates most of the data associated with this object. + void allocateFilter(); + + //- Destroys most of the data associated with this object. + void destroyFilter(); //- Disallow default bitwise copy construct OutputFilterFunctionObject(const OutputFilterFunctionObject&); diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C index 11be3c3b86282655666d4a52e7dac4aacd7c1490..36e6fe6afd0dec94487e2e37baa79080d2a0125b 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C @@ -28,6 +28,9 @@ License #include "polyBoundaryMesh.H" #include "facePointPatch.H" #include "globalPointPatch.H" +#include "PstreamBuffers.H" +#include "lduSchedule.H" +#include "globalMeshData.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -58,14 +61,46 @@ Foam::pointBoundaryMesh::pointBoundaryMesh void Foam::pointBoundaryMesh::calcGeometry() { - forAll(*this, patchi) + PstreamBuffers pBufs(Pstream::defaultCommsType); + + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) { - operator[](patchi).initGeometry(); - } + forAll(*this, patchi) + { + operator[](patchi).initGeometry(pBufs); + } - forAll(*this, patchi) + pBufs.finishedSends(); + + forAll(*this, patchi) + { + operator[](patchi).calcGeometry(pBufs); + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) { - operator[](patchi).calcGeometry(); + const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); + + // Dummy. + pBufs.finishedSends(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + + if (patchSchedule[patchEvali].init) + { + operator[](patchi).initGeometry(pBufs); + } + else + { + operator[](patchi).calcGeometry(pBufs); + } + } } } @@ -97,32 +132,92 @@ Foam::pointBoundaryMesh::globalPatch() const void Foam::pointBoundaryMesh::movePoints(const pointField& p) { - pointPatchList& patches = *this; + PstreamBuffers pBufs(Pstream::defaultCommsType); - forAll(patches, patchi) + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) { - patches[patchi].initMovePoints(p); - } + forAll(*this, patchi) + { + operator[](patchi).initMovePoints(pBufs, p); + } - forAll(patches, patchi) + pBufs.finishedSends(); + + forAll(*this, patchi) + { + operator[](patchi).movePoints(pBufs, p); + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) { - patches[patchi].movePoints(p); + const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); + + // Dummy. + pBufs.finishedSends(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + + if (patchSchedule[patchEvali].init) + { + operator[](patchi).initMovePoints(pBufs, p); + } + else + { + operator[](patchi).movePoints(pBufs, p); + } + } } } void Foam::pointBoundaryMesh::updateMesh() { - pointPatchList& patches = *this; + PstreamBuffers pBufs(Pstream::defaultCommsType); - forAll(patches, patchi) + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) { - patches[patchi].initUpdateMesh(); - } + forAll(*this, patchi) + { + operator[](patchi).initUpdateMesh(pBufs); + } + + pBufs.finishedSends(); - forAll(patches, patchi) + forAll(*this, patchi) + { + operator[](patchi).updateMesh(pBufs); + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) { - patches[patchi].updateMesh(); + const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); + + // Dummy. + pBufs.finishedSends(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + + if (patchSchedule[patchEvali].init) + { + operator[](patchi).initUpdateMesh(pBufs); + } + else + { + operator[](patchi).updateMesh(pBufs); + } + } } } diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H index 77cbb4162f972d3cfb623d13deab117afc685418..79a2f2363c536d645f7d8fe2150e7c2b5d7221ff 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H @@ -66,22 +66,22 @@ protected: // Protected Member Functions //- Initialise the calculation of the patch geometry - virtual void initGeometry() = 0; + virtual void initGeometry(PstreamBuffers&) = 0; //- Calculate the patch geometry - virtual void calcGeometry() = 0; + virtual void calcGeometry(PstreamBuffers&) = 0; //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&) = 0; + virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0; //- Correct patches after moving points - virtual void movePoints(const pointField&) = 0; + virtual void movePoints(PstreamBuffers&, const pointField&) = 0; //- Initialise the update of the patch topology - virtual void initUpdateMesh() = 0; + virtual void initUpdateMesh(PstreamBuffers&) = 0; //- Update of the patch topology - virtual void updateMesh() = 0; + virtual void updateMesh(PstreamBuffers&) = 0; public: diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C index 81104d726e24b88254ecc9adc4dd9a24d746ef9e..6f65c70764b4ac4768e99e710cf2364df4211d3f 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C @@ -50,13 +50,13 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void Foam::cyclicPointPatch::initGeometry() +void Foam::cyclicPointPatch::initGeometry(PstreamBuffers&) { transformPairs_.setSize(0); } -void Foam::cyclicPointPatch::calcGeometry() +void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&) { const edgeList& cp = cyclicPolyPatch_.coupledPoints(); const labelList& mp = cyclicPolyPatch_.meshPoints(); @@ -128,16 +128,20 @@ void Foam::cyclicPointPatch::calcGeometry() } else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1) { - FatalErrorIn("cyclicPointPatch::calcGeometry() const") - << "Point " << cp[i][0] << "of point-pair " << i + FatalErrorIn + ( + "cyclicPointPatch::calcGeometry(PstreamBuffers&) const" + ) << "Point " << cp[i][0] << "of point-pair " << i << " is a global point but the other point " << cp[i][1] << " is not" << exit(FatalError); } else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1) { - FatalErrorIn("cyclicPointPatch::calcGeometry() const") - << "Point " << cp[i][1] << "of point-pair " << i + FatalErrorIn + ( + "cyclicPointPatch::calcGeometry(PstreamBuffers&) const" + ) << "Point " << cp[i][1] << "of point-pair " << i << " is a global point but the other point " << cp[i][0] << " is not" << exit(FatalError); @@ -149,25 +153,25 @@ void Foam::cyclicPointPatch::calcGeometry() } -void cyclicPointPatch::initMovePoints(const pointField&) +void cyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&) {} -void cyclicPointPatch::movePoints(const pointField&) +void cyclicPointPatch::movePoints(PstreamBuffers&, const pointField&) {} -void cyclicPointPatch::initUpdateMesh() +void cyclicPointPatch::initUpdateMesh(PstreamBuffers& pBufs) { - facePointPatch::initUpdateMesh(); - cyclicPointPatch::initGeometry(); + facePointPatch::initUpdateMesh(pBufs); + cyclicPointPatch::initGeometry(pBufs); } -void cyclicPointPatch::updateMesh() +void cyclicPointPatch::updateMesh(PstreamBuffers& pBufs) { - facePointPatch::updateMesh(); - cyclicPointPatch::calcGeometry(); + facePointPatch::updateMesh(pBufs); + cyclicPointPatch::calcGeometry(pBufs); } diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H index 999c45613d209b2d1ccd6398a1af004a6167691b..1d013f3421c085903b098436a8df0f4d96f5eb0d 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H @@ -74,22 +74,22 @@ class cyclicPointPatch edgeList transformPairs_; //- Initialise the calculation of the patch geometry - virtual void initGeometry(); + virtual void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - virtual void calcGeometry(); + virtual void calcGeometry(PstreamBuffers&); //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&); + virtual void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - virtual void movePoints(const pointField&); + virtual void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); public: diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C index eb99350c131d49577d126dd4f82aebd45b3499ba..d3aae3ec877fe54fc7fb68a8548ec09ef894f32e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C @@ -52,7 +52,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void Foam::processorPointPatch::initGeometry() +void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs) { // Algorithm: // Depending on whether the patch is a master or a slave, get the primitive @@ -84,16 +84,16 @@ void Foam::processorPointPatch::initGeometry() if (Pstream::parRun()) { - initPatchPatchPoints(); + initPatchPatchPoints(pBufs); } } -void Foam::processorPointPatch::calcGeometry() +void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs) { if (Pstream::parRun()) { - calcPatchPatchPoints(); + calcPatchPatchPoints(pBufs); } // If it is not runing parallel or there are no global points @@ -149,11 +149,11 @@ void Foam::processorPointPatch::calcGeometry() } -void processorPointPatch::initPatchPatchPoints() +void processorPointPatch::initPatchPatchPoints(PstreamBuffers& pBufs) { if (debug) { - Info<< "processorPointPatch::calcPatchPatchPoints() : " + Info<< "processorPointPatch::initPatchPatchPoints(PstreamBuffers&) : " << "constructing patch-patch points" << endl; } @@ -229,7 +229,7 @@ void processorPointPatch::initPatchPatchPoints() // Send the patchPatchPoints to the neighbouring processor - OPstream toNeighbProc(Pstream::blocking, neighbProcNo()); + UOPstream toNeighbProc(neighbProcNo(), pBufs); toNeighbProc << ppmp.size() // number of points for checking @@ -238,17 +238,17 @@ void processorPointPatch::initPatchPatchPoints() if (debug) { - Info<< "processorPointPatch::calcPatchPatchPoints() : " + Info<< "processorPointPatch::initPatchPatchPoints() : " << "constructed patch-patch points" << endl; } } -void Foam::processorPointPatch::calcPatchPatchPoints() +void Foam::processorPointPatch::calcPatchPatchPoints(PstreamBuffers& pBufs) { // Get the patchPatchPoints from the neighbouring processor - IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); + UIPstream fromNeighbProc(neighbProcNo(), pBufs); label nbrNPoints(readLabel(fromNeighbProc)); labelListList patchPatchPoints(fromNeighbProc); @@ -265,7 +265,7 @@ void Foam::processorPointPatch::calcPatchPatchPoints() // separate. if (nbrNPoints != ppmp.size()) { - WarningIn("processorPointPatch::calcPatchPatchPoints()") + WarningIn("processorPointPatch::calcPatchPatchPoints(PstreamBuffers&)") << "Processor patch " << name() << " has " << ppmp.size() << " points; coupled patch has " << nbrNPoints << " points." << endl @@ -352,25 +352,25 @@ void Foam::processorPointPatch::calcPatchPatchPoints() } -void processorPointPatch::initMovePoints(const pointField&) +void processorPointPatch::initMovePoints(PstreamBuffers&, const pointField&) {} -void processorPointPatch::movePoints(const pointField&) +void processorPointPatch::movePoints(PstreamBuffers&, const pointField&) {} -void processorPointPatch::initUpdateMesh() +void processorPointPatch::initUpdateMesh(PstreamBuffers& pBufs) { - facePointPatch::initUpdateMesh(); - processorPointPatch::initGeometry(); + facePointPatch::initUpdateMesh(pBufs); + processorPointPatch::initGeometry(pBufs); } -void processorPointPatch::updateMesh() +void processorPointPatch::updateMesh(PstreamBuffers& pBufs) { - facePointPatch::updateMesh(); - processorPointPatch::calcGeometry(); + facePointPatch::updateMesh(pBufs); + processorPointPatch::calcGeometry(pBufs); } diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index f17a00ca832c9e1926d4ccc5998fac055743e916..373416ac0a46c8817656025a919033e9cf6c3ea0 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -68,30 +68,30 @@ class processorPointPatch // Private Member Functions //- Initialise the calculation of the patch geometry - virtual void initGeometry(); + virtual void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - virtual void calcGeometry(); + virtual void calcGeometry(PstreamBuffers&); //- Initialise the points on this patch which are should also be // on a neighbouring patch but are not part of faces of that patch - void initPatchPatchPoints(); + void initPatchPatchPoints(PstreamBuffers&); //- Calculate the points on this patch which are should also be // on a neighbouring patch but are not part of faces of that patch - void calcPatchPatchPoints(); + void calcPatchPatchPoints(PstreamBuffers&); //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&); + virtual void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - virtual void movePoints(const pointField&); + virtual void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); //- Disallow default construct as copy diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H index dc2437877daf6dcef9e0ade04e4be2ebe6cdee69..a77af7af305f5713ee7f6736b29a7e60f7c8c6f7 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H @@ -86,7 +86,7 @@ protected: // Construction of demand-driven data //- Calculate mesh points - virtual void calcGeometry() = 0; + virtual void calcGeometry(PstreamBuffers&) = 0; public: diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H index 990ab0de9a45c5356c2a6316c7eaec7c5884bd2b..ba89ca950cb2f3ce3b0eb6cc7e96e0cf3cb59af9 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/global/globalPointPatch.H @@ -67,27 +67,27 @@ class globalPointPatch // Protected Member Functions //- Initialise the calculation of the patch geometry - virtual void initGeometry() + virtual void initGeometry(PstreamBuffers&) {} //- Calculate the patch geometry - virtual void calcGeometry() + virtual void calcGeometry(PstreamBuffers&) {} //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&) + virtual void initMovePoints(PstreamBuffers&, const pointField&) {} //- Correct patches after moving points - virtual void movePoints(const pointField&) + virtual void movePoints(PstreamBuffers&, const pointField&) {} //- Initialise the update of the patch topology - virtual void initUpdateMesh() + virtual void initUpdateMesh(PstreamBuffers&) {} //- Update of the patch topology - virtual void updateMesh() + virtual void updateMesh(PstreamBuffers&) {} diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C index 25c91dd398769b9fd5c0c333b0b5fa39c97c7f9e..fb15ac4b96733f71451bfff030f53bfc710425f7 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.C @@ -51,7 +51,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -void facePointPatch::initGeometry() +void facePointPatch::initGeometry(PstreamBuffers&) { meshPoints_.setSize(0); localPoints_.setSize(0); @@ -59,25 +59,25 @@ void facePointPatch::initGeometry() } -void facePointPatch::calcGeometry() +void facePointPatch::calcGeometry(PstreamBuffers&) {} -void facePointPatch::initMovePoints(const pointField&) +void facePointPatch::initMovePoints(PstreamBuffers&, const pointField&) {} -void facePointPatch::movePoints(const pointField&) +void facePointPatch::movePoints(PstreamBuffers&, const pointField&) {} -void facePointPatch::initUpdateMesh() +void facePointPatch::initUpdateMesh(PstreamBuffers& pBufs) { - facePointPatch::initGeometry(); + facePointPatch::initGeometry(pBufs); } -void facePointPatch::updateMesh() +void facePointPatch::updateMesh(PstreamBuffers&) {} diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H index 7a75b4017f3136a0bce2bd8173d60e484a24869b..0094d4ce1a0030f71beb7d1ee96a31b0edc5427f 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H @@ -76,22 +76,22 @@ protected: // Protected Member Functions //- Initialise the calculation of the patch geometry - virtual void initGeometry(); + virtual void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - virtual void calcGeometry(); + virtual void calcGeometry(PstreamBuffers&); //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&); + virtual void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - virtual void movePoints(const pointField&); + virtual void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); private: diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H index bdf67c879bece7bb2aa4519909b0396193b5dc1e..637ac659dd8796f5cc9a842c4a608000f1c3a551 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H @@ -49,6 +49,7 @@ namespace Foam class pointBoundaryMesh; class pointConstraint; +class PstreamBuffers; /*---------------------------------------------------------------------------*\ Class pointPatch Declaration @@ -79,27 +80,27 @@ protected: friend class pointBoundaryMesh; //- Initialise the calculation of the patch geometry - virtual void initGeometry() + virtual void initGeometry(PstreamBuffers&) {} //- Calculate the patch geometry - virtual void calcGeometry() + virtual void calcGeometry(PstreamBuffers&) {} //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&) + virtual void initMovePoints(PstreamBuffers&, const pointField&) {} //- Correct patches after moving points - virtual void movePoints(const pointField&) + virtual void movePoints(PstreamBuffers&, const pointField&) {} //- Initialise the update of the patch topology - virtual void initUpdateMesh() + virtual void initUpdateMesh(PstreamBuffers&) {} //- Update of the patch topology - virtual void updateMesh() + virtual void updateMesh(PstreamBuffers&) {} diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index eff7af933cabc52791bcf22958e3dbd29094c5c9..a111e0435da52d5386bb6b71e5af144b4e285cef 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -29,6 +29,9 @@ License #include "primitiveMesh.H" #include "processorPolyPatch.H" #include "stringListOps.H" +#include "PstreamBuffers.H" +#include "lduSchedule.H" +#include "globalMeshData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -144,14 +147,46 @@ void Foam::polyBoundaryMesh::clearAddressing() void Foam::polyBoundaryMesh::calcGeometry() { - forAll(*this, patchi) + PstreamBuffers pBufs(Pstream::defaultCommsType); + + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) { - operator[](patchi).initGeometry(); - } + forAll(*this, patchi) + { + operator[](patchi).initGeometry(pBufs); + } + + pBufs.finishedSends(); - forAll(*this, patchi) + forAll(*this, patchi) + { + operator[](patchi).calcGeometry(pBufs); + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) { - operator[](patchi).calcGeometry(); + const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); + + // Dummy. + pBufs.finishedSends(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + + if (patchSchedule[patchEvali].init) + { + operator[](patchi).initGeometry(pBufs); + } + else + { + operator[](patchi).calcGeometry(pBufs); + } + } } } @@ -573,16 +608,46 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const void Foam::polyBoundaryMesh::movePoints(const pointField& p) { - polyPatchList& patches = *this; + PstreamBuffers pBufs(Pstream::defaultCommsType); - forAll(patches, patchi) + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) { - patches[patchi].initMovePoints(p); - } + forAll(*this, patchi) + { + operator[](patchi).initMovePoints(pBufs, p); + } - forAll(patches, patchi) + pBufs.finishedSends(); + + forAll(*this, patchi) + { + operator[](patchi).movePoints(pBufs, p); + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) { - patches[patchi].movePoints(p); + const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); + + // Dummy. + pBufs.finishedSends(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + + if (patchSchedule[patchEvali].init) + { + operator[](patchi).initMovePoints(pBufs, p); + } + else + { + operator[](patchi).movePoints(pBufs, p); + } + } } } @@ -591,16 +656,46 @@ void Foam::polyBoundaryMesh::updateMesh() { deleteDemandDrivenData(neighbourEdgesPtr_); - polyPatchList& patches = *this; + PstreamBuffers pBufs(Pstream::defaultCommsType); - forAll(patches, patchi) + if + ( + Pstream::defaultCommsType == Pstream::blocking + || Pstream::defaultCommsType == Pstream::nonBlocking + ) { - patches[patchi].initUpdateMesh(); - } + forAll(*this, patchi) + { + operator[](patchi).initUpdateMesh(pBufs); + } - forAll(patches, patchi) + pBufs.finishedSends(); + + forAll(*this, patchi) + { + operator[](patchi).updateMesh(pBufs); + } + } + else if (Pstream::defaultCommsType == Pstream::scheduled) { - patches[patchi].updateMesh(); + const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); + + // Dummy. + pBufs.finishedSends(); + + forAll(patchSchedule, patchEvali) + { + label patchi = patchSchedule[patchEvali].patch; + + if (patchSchedule[patchEvali].init) + { + operator[](patchi).initUpdateMesh(pBufs); + } + else + { + operator[](patchi).updateMesh(pBufs); + } + } } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index e3277defccab5da29e15d1835df1a281de7d76d1..fdea473ed3abd8b438604cce9b59ca36e15edb82 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -50,8 +50,6 @@ class polyMesh; // Forward declaration of friend functions and operators -class polyBoundaryMesh; - Ostream& operator<<(Ostream&, const polyBoundaryMesh&); diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index f823148d3a48b020a9d98a57e22fa3f5a4d5c853..e1afad60a812a2aa6fe09267fe4e0b830e091645 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -90,22 +90,22 @@ protected: ) const; //- Initialise the calculation of the patch geometry - virtual void initGeometry() = 0; + virtual void initGeometry(PstreamBuffers&) = 0; //- Calculate the patch geometry - virtual void calcGeometry() = 0; + virtual void calcGeometry(PstreamBuffers&) = 0; //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&) = 0; + virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0; //- Correct patches after moving points - virtual void movePoints(const pointField&) = 0; + virtual void movePoints(PstreamBuffers&, const pointField&) = 0; //- Initialise the update of the patch topology - virtual void initUpdateMesh() = 0; + virtual void initUpdateMesh(PstreamBuffers&) = 0; //- Update of the patch topology - virtual void updateMesh() = 0; + virtual void updateMesh(PstreamBuffers&) = 0; //- Write point in OBJ format @@ -283,7 +283,11 @@ public: //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) - virtual void initOrder(const primitivePatch&) const = 0; + virtual void initOrder + ( + PstreamBuffers&, + const primitivePatch& + ) const = 0; //- Return new ordering for primitivePatch. // Ordering is -faceMap: for every face @@ -292,6 +296,7 @@ public: // (faceMap is identity, rotation is 0), true otherwise. virtual bool order ( + PstreamBuffers&, const primitivePatch&, labelList& faceMap, labelList& rotation diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 8c6b20207913c5eac723b45455257560e4c62b92..fef6c98ec0c075dd66177f9107d84c143e1c2f4c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -516,7 +516,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors // if (debug) // { // Pout<< "cyclicPolyPatch::getCentresAndAnchors :" - // << "Specified translation : " << separationVector_ << endl; + // << "Specified translation : " << separationVector_ + // << endl; // } // // half0Ctrs += separationVector_; @@ -858,36 +859,44 @@ Foam::cyclicPolyPatch::~cyclicPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::cyclicPolyPatch::initGeometry() +void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) { - polyPatch::initGeometry(); + polyPatch::initGeometry(pBufs); } -void Foam::cyclicPolyPatch::calcGeometry() +void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) { - polyPatch::calcGeometry(); + polyPatch::calcGeometry(pBufs); calcTransforms(); } -void Foam::cyclicPolyPatch::initMovePoints(const pointField& p) +void Foam::cyclicPolyPatch::initMovePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - polyPatch::initMovePoints(p); + polyPatch::initMovePoints(pBufs, p); } -void Foam::cyclicPolyPatch::movePoints(const pointField& p) +void Foam::cyclicPolyPatch::movePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - polyPatch::movePoints(p); + polyPatch::movePoints(pBufs, p); calcTransforms(); } -void Foam::cyclicPolyPatch::initUpdateMesh() +void Foam::cyclicPolyPatch::initUpdateMesh(PstreamBuffers& pBufs) { - polyPatch::initUpdateMesh(); + polyPatch::initUpdateMesh(pBufs); } -void Foam::cyclicPolyPatch::updateMesh() +void Foam::cyclicPolyPatch::updateMesh(PstreamBuffers& pBufs) { - polyPatch::updateMesh(); + polyPatch::updateMesh(pBufs); deleteDemandDrivenData(coupledPointsPtr_); deleteDemandDrivenData(coupledEdgesPtr_); } @@ -1105,7 +1114,11 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const } -void Foam::cyclicPolyPatch::initOrder(const primitivePatch& pp) const +void Foam::cyclicPolyPatch::initOrder +( + PstreamBuffers&, + const primitivePatch& pp +) const {} @@ -1115,6 +1128,7 @@ void Foam::cyclicPolyPatch::initOrder(const primitivePatch& pp) const // is identity, rotation is 0) bool Foam::cyclicPolyPatch::order ( + PstreamBuffers& pBufs, const primitivePatch& pp, labelList& faceMap, labelList& rotation @@ -1300,7 +1314,8 @@ bool Foam::cyclicPolyPatch::order << endl; // Recalculate untransformed face centres - //pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points()); + //pointField rawHalf0Ctrs = + // calcFaceCentres(half0Faces, pp.points()); label vertI = 0; forAll(half1Ctrs, i) @@ -1413,7 +1428,8 @@ bool Foam::cyclicPolyPatch::order << endl; // Recalculate untransformed face centres - //pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points()); + //pointField rawHalf0Ctrs = + // calcFaceCentres(half0Faces, pp.points()); label vertI = 0; forAll(half1Ctrs, i) @@ -1499,7 +1515,8 @@ bool Foam::cyclicPolyPatch::order << endl; // Recalculate untransformed face centres - //pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points()); + //pointField rawHalf0Ctrs = + // calcFaceCentres(half0Faces, pp.points()); label vertI = 0; forAll(half1Ctrs, i) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index ea67348891994a77bc356d3621e4d28a4216efeb..4f81975e60557bc21b9c440a9a1a1273baaa13b3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -176,22 +176,22 @@ protected: // Protected Member functions //- Initialise the calculation of the patch geometry - virtual void initGeometry(); + virtual void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - virtual void calcGeometry(); + virtual void calcGeometry(PstreamBuffers&); //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&); + virtual void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - virtual void movePoints(const pointField&); + virtual void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); public: @@ -391,7 +391,7 @@ public: //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) - virtual void initOrder(const primitivePatch&) const; + virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; //- Return new ordering for primitivePatch. // Ordering is -faceMap: for every face @@ -400,6 +400,7 @@ public: // (faceMap is identity, rotation is 0), true otherwise. virtual bool order ( + PstreamBuffers&, const primitivePatch&, labelList& faceMap, labelList& rotation diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 6e4df9f4e5cb5b6f63c780aa83d209e2986e7ad1..05969ee593305e064d256a8fa36f1d75571fd3c6 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -34,6 +34,7 @@ License #include "polyMesh.H" #include "Time.H" #include "transformList.H" +#include "PstreamBuffers.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -155,16 +156,11 @@ Foam::processorPolyPatch::~processorPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::processorPolyPatch::initGeometry() +void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs) { if (Pstream::parRun()) { - OPstream toNeighbProc - ( - Pstream::blocking, - neighbProcNo(), - 3*(sizeof(label) + size()*sizeof(vector) + sizeof(scalar)) - ); + UOPstream toNeighbProc(neighbProcNo(), pBufs); toNeighbProc << faceCentres() @@ -174,17 +170,13 @@ void Foam::processorPolyPatch::initGeometry() } -void Foam::processorPolyPatch::calcGeometry() +void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) { if (Pstream::parRun()) { { - IPstream fromNeighbProc - ( - Pstream::blocking, - neighbProcNo(), - 3*(sizeof(label) + size()*sizeof(vector) + sizeof(scalar)) - ); + UIPstream fromNeighbProc(neighbProcNo(), pBufs); + fromNeighbProc >> neighbFaceCentres_ >> neighbFaceAreas_ @@ -251,22 +243,30 @@ void Foam::processorPolyPatch::calcGeometry() } -void Foam::processorPolyPatch::initMovePoints(const pointField& p) +void Foam::processorPolyPatch::initMovePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - polyPatch::movePoints(p); - processorPolyPatch::initGeometry(); + polyPatch::movePoints(pBufs, p); + processorPolyPatch::initGeometry(pBufs); } -void Foam::processorPolyPatch::movePoints(const pointField&) +void Foam::processorPolyPatch::movePoints +( + PstreamBuffers& pBufs, + const pointField& +) { - processorPolyPatch::calcGeometry(); + processorPolyPatch::calcGeometry(pBufs); } -void Foam::processorPolyPatch::initUpdateMesh() +void Foam::processorPolyPatch::initUpdateMesh(PstreamBuffers& pBufs) { - polyPatch::initUpdateMesh(); + polyPatch::initUpdateMesh(pBufs); deleteDemandDrivenData(neighbPointsPtr_); deleteDemandDrivenData(neighbEdgesPtr_); @@ -303,14 +303,7 @@ void Foam::processorPolyPatch::initUpdateMesh() edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI); } - OPstream toNeighbProc - ( - Pstream::blocking, - neighbProcNo(), - 8*sizeof(label) // four headers of labelList - + 2*nPoints()*sizeof(label) // two point-based labellists - + 2*nEdges()*sizeof(label) // two edge-based labelLists - ); + UOPstream toNeighbProc(neighbProcNo(), pBufs); toNeighbProc << pointFace @@ -321,10 +314,10 @@ void Foam::processorPolyPatch::initUpdateMesh() } -void Foam::processorPolyPatch::updateMesh() +void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs) { // For completeness - polyPatch::updateMesh(); + polyPatch::updateMesh(pBufs); if (Pstream::parRun()) { @@ -336,7 +329,7 @@ void Foam::processorPolyPatch::updateMesh() { // 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 @@ -446,7 +439,11 @@ const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const } -void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const +void Foam::processorPolyPatch::initOrder +( + PstreamBuffers& pBufs, + const primitivePatch& pp +) const { if (!Pstream::parRun()) { @@ -491,7 +488,7 @@ void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const pointField anchors(getAnchorPoints(pp, pp.points())); // Now send all info over to the neighbour - OPstream toNeighbour(Pstream::blocking, neighbProcNo()); + UOPstream toNeighbour(neighbProcNo(), pBufs); toNeighbour << ctrs << anchors; } } @@ -503,6 +500,7 @@ void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const // is identity, rotation is 0) bool Foam::processorPolyPatch::order ( + PstreamBuffers& pBufs, const primitivePatch& pp, labelList& faceMap, labelList& rotation @@ -539,7 +537,7 @@ bool Foam::processorPolyPatch::order // Receive data from neighbour { - IPstream fromNeighbour(Pstream::blocking, neighbProcNo()); + UIPstream fromNeighbour(neighbProcNo(), pBufs); fromNeighbour >> masterCtrs >> masterAnchors; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index a8948fee4376804ce4322973d00499160b94c6d1..1955892727c5e54e77b0f605b7618094f7ea6f7a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -28,11 +28,9 @@ Class Description Neighbour processor patch. - Note: morph patch face ordering comes geometric or topological. - Geometric: no cyclics allowed (assumes faces coincident) - Topological: needs unmodified faces on both sides to correspond. Also - needs at least one per connected patch area (so all patch faces can be - visited from an unmodified face) + Note: morph patch face ordering tries to do a geometric ordering. + (assumes faces coincident) Hence will have problems when cyclics + are present. SourceFiles processorPolyPatch.C @@ -97,22 +95,22 @@ protected: // Protected Member functions //- Initialise the calculation of the patch geometry - void initGeometry(); + void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - void calcGeometry(); + void calcGeometry(PstreamBuffers&); //- Initialise the patches for moving points - void initMovePoints(const pointField&); + void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - void movePoints(const pointField&); + void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); public: @@ -283,7 +281,7 @@ public: //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) - virtual void initOrder(const primitivePatch&) const; + virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; //- Return new ordering for primitivePatch. // Ordering is -faceMap: for every face @@ -292,6 +290,7 @@ public: // (faceMap is identity, rotation is 0), true otherwise. virtual bool order ( + PstreamBuffers&, const primitivePatch&, labelList& faceMap, labelList& rotation diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index be0aa378a67e00fffba1b354cd2e65b885d072a1..0a6bde6b4f86d89482eb5206886f0abdeb6a8fa5 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -55,12 +55,12 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::polyPatch::movePoints(const pointField& p) +void Foam::polyPatch::movePoints(PstreamBuffers&, const pointField& p) { primitivePatch::movePoints(p); } -void Foam::polyPatch::updateMesh() +void Foam::polyPatch::updateMesh(PstreamBuffers&) { clearAddressing(); } @@ -334,12 +334,13 @@ void Foam::polyPatch::write(Ostream& os) const } -void Foam::polyPatch::initOrder(const primitivePatch&) const +void Foam::polyPatch::initOrder(PstreamBuffers&, const primitivePatch&) const {} bool Foam::polyPatch::order ( + PstreamBuffers&, const primitivePatch&, labelList& faceMap, labelList& rotation diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index f8c8fa72e72f511f4cdd29d0ead265c3ba66905b..5694e538234a50341d1c9ae1d23c2a0050acaa60 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -56,6 +56,7 @@ namespace Foam class polyBoundaryMesh; class polyPatch; +class PstreamBuffers; Ostream& operator<<(Ostream&, const polyPatch&); @@ -101,26 +102,26 @@ protected: friend class polyBoundaryMesh; //- Initialise the calculation of the patch geometry - virtual void initGeometry() + virtual void initGeometry(PstreamBuffers&) {} //- Calculate the patch geometry - virtual void calcGeometry() + virtual void calcGeometry(PstreamBuffers&) {} //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&) + virtual void initMovePoints(PstreamBuffers&, const pointField&) {} //- Correct patches after moving points - virtual void movePoints(const pointField& p); + virtual void movePoints(PstreamBuffers&, const pointField& p); //- Initialise the update of the patch topology - virtual void initUpdateMesh() + virtual void initUpdateMesh(PstreamBuffers&) {} //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); public: @@ -358,7 +359,7 @@ public: //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) - virtual void initOrder(const primitivePatch&) const; + virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; //- Return new ordering for primitivePatch. // Ordering is -faceMap: for every face @@ -367,6 +368,7 @@ public: // (faceMap is identity, rotation is 0), true otherwise. virtual bool order ( + PstreamBuffers&, const primitivePatch&, labelList& faceMap, labelList& rotation diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C index fc405b2d0e2b3e56523aa642ed5eba03f15127e0..d3f1cfe797f0b216771d6feece2ca3d41db0a1a7 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -1844,6 +1844,8 @@ void Foam::polyTopoChange::reorderCoupledFaces // Rotation on new faces. labelList rotation(faces_.size(), 0); + PstreamBuffers pBufs(Pstream::nonBlocking); + // Send ordering forAll(boundary, patchI) { @@ -1851,6 +1853,7 @@ void Foam::polyTopoChange::reorderCoupledFaces { boundary[patchI].initOrder ( + pBufs, primitivePatch ( SubList<face> @@ -1865,6 +1868,8 @@ void Foam::polyTopoChange::reorderCoupledFaces } } + pBufs.finishedSends(); + // Receive and calculate ordering bool anyChanged = false; @@ -1878,6 +1883,7 @@ void Foam::polyTopoChange::reorderCoupledFaces bool changed = boundary[patchI].order ( + pBufs, primitivePatch ( SubList<face> diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C index e7014038ee6c8e939b965c11fa78afbc3b1b1548..1b6a9e6d5a00120d5c46c68bca65a192d8e29b2c 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C @@ -100,7 +100,7 @@ angularOscillatingDisplacementPointPatchVectorField angle0_(ptf.angle0_), amplitude_(ptf.amplitude_), omega_(ptf.omega_), - p0_(ptf.p0_) + p0_(ptf.p0_, mapper) {} diff --git a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C index dbd769c557734c21ac695a7ca89276f8ef88a400..412c9561a20fd0f85dd35d6e68db9c0ea456074b 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C @@ -91,7 +91,7 @@ oscillatingVelocityPointPatchVectorField fixedValuePointPatchField<vector>(ptf, p, iF, mapper), amplitude_(ptf.amplitude_), omega_(ptf.omega_), - p0_(ptf.p0_) + p0_(ptf.p0_, mapper) {} diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C index db0ff59bfe3985378b63a31664c801b409ccc5bd..8fb0408e6704ae06657d96efddbc6d0e3cc77e00 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -93,7 +93,7 @@ sixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField<vector>(ptf, p, iF, mapper), motion_(ptf.motion_), - p0_(ptf.p0_), + p0_(ptf.p0_, mapper), rhoInf_(ptf.rhoInf_) {} diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 5ffa5ecdc7624b561a4e1586e4a087a90b059d84..91e095a94ada254ec79c919c5dae0481cba7e6bd 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -105,20 +105,15 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td) const globalMeshData& pData = polyMesh_.globalData(); const labelList& processorPatches = pData.processorPatches(); const labelList& processorPatchIndices = pData.processorPatchIndices(); - const labelList& processorPatchNeighbours = - pData.processorPatchNeighbours(); - // Initialise the setpFraction moved for the particles + // Initialise the stepFraction moved for the particles forAllIter(typename Cloud<ParticleType>, *this, pIter) { pIter().stepFraction() = 0; } - // Assume there will be particles to transfer - bool transfered = true; - // While there are particles to transfer - while (transfered) + while (true) { // List of lists of particles to be transfered for all the processor // patches @@ -158,105 +153,94 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td) } } - if (Pstream::parRun()) + if (!Pstream::parRun()) { - // List of the numbers of particles to be transfered across the - // processor patches - labelList nsTransPs(transferList.size()); - - forAll(transferList, i) - { - nsTransPs[i] = transferList[i].size(); - } + break; + } - // List of the numbers of particles to be transfered across the - // processor patches for all the processors - labelListList allNTrans(Pstream::nProcs()); - allNTrans[Pstream::myProcNo()] = nsTransPs; - combineReduce(allNTrans, UPstream::listEq()); - transfered = false; + // Allocate transfer buffers + PstreamBuffers pBufs(Pstream::nonBlocking); - forAll(allNTrans, i) + // Stream into send buffers + forAll(transferList, i) + { + if (transferList[i].size()) { - forAll(allNTrans[i], j) - { - if (allNTrans[i][j]) - { - transfered = true; - break; - } - } - } + UOPstream particleStream + ( + refCast<const processorPolyPatch> + ( + pMesh().boundaryMesh()[processorPatches[i]] + ).neighbProcNo(), + pBufs + ); - if (!transfered) - { - break; + particleStream << transferList[i]; } + } + + // Set up transfers when in non-blocking mode. Returns sizes (in bytes) + // to be sent/received. + labelListList allNTrans(Pstream::nProcs()); + pBufs.finishedSends(allNTrans); - forAll(transferList, i) + bool transfered = false; + + forAll(allNTrans, i) + { + forAll(allNTrans[i], j) { - if (transferList[i].size()) + if (allNTrans[i][j]) { - OPstream particleStream - ( - Pstream::blocking, - refCast<const processorPolyPatch> - ( - pMesh().boundaryMesh()[processorPatches[i]] - ).neighbProcNo() - ); - - particleStream << transferList[i]; + transfered = true; + break; } } + } - forAll(processorPatches, i) - { - label patchi = processorPatches[i]; + if (!transfered) + { + break; + } - const processorPolyPatch& procPatch = - refCast<const processorPolyPatch> - (pMesh().boundaryMesh()[patchi]); - label neighbProci = - procPatch.neighbProcNo() - Pstream::masterNo(); + // Retrieve from receive buffers + forAll(processorPatches, i) + { + label patchi = processorPatches[i]; - label neighbProcPatchi = processorPatchNeighbours[patchi]; + const processorPolyPatch& procPatch = + refCast<const processorPolyPatch> + (pMesh().boundaryMesh()[patchi]); - label nRecPs = allNTrans[neighbProci][neighbProcPatchi]; + label neighbProci = procPatch.neighbProcNo(); - if (nRecPs) - { - IPstream particleStream - ( - Pstream::blocking, - procPatch.neighbProcNo() - ); - IDLList<ParticleType> newParticles - ( - particleStream, - typename ParticleType::iNew(*this) - ); + label nRecPs = allNTrans[neighbProci][Pstream::myProcNo()]; - forAllIter - ( - typename Cloud<ParticleType>, - newParticles, - newpIter - ) - { - ParticleType& newp = newpIter(); - newp.correctAfterParallelTransfer(patchi, td); - addParticle(newParticles.remove(&newp)); - } + if (nRecPs) + { + UIPstream particleStream(neighbProci, pBufs); + + IDLList<ParticleType> newParticles + ( + particleStream, + typename ParticleType::iNew(*this) + ); + + forAllIter + ( + typename Cloud<ParticleType>, + newParticles, + newpIter + ) + { + ParticleType& newp = newpIter(); + newp.correctAfterParallelTransfer(patchi, td); + addParticle(newParticles.remove(&newp)); } } } - else - { - transfered = false; - } } } diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 88f806b5dd1c948ca165439529c4467e19c57f2f..307cb743f813550e026b34293703e5fbbe19b413 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -2411,6 +2411,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify } syncTools::swapBoundaryFaceList(mesh_, neiCellZone, false); + // Get per face whether is it master (of a coupled set of faces) + PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_)); + // Set owner as no-flip forAll(patches, patchI) { @@ -2428,14 +2431,27 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()]; bool flip; - if (ownZone == max(ownZone, neiZone)) + + label maxZone = max(ownZone, neiZone); + + if (maxZone == -1) { flip = false; } - else + else if (ownZone == neiZone) + { + // Can only happen for coupled boundaries. Keep master + // face unflipped. + flip = !isMasterFace[faceI]; + } + else if (neiZone == maxZone) { flip = true; } + else + { + flip = false; + } meshMod.setAction ( diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C index e16b8204f7c4ac72211ed3783173bb4c9312e385..0da60686813aa8a54acdeed7eb12a11553562ad8 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C @@ -145,44 +145,49 @@ Foam::directMappedPolyPatch::~directMappedPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // //- Initialise the calculation of the patch geometry -void Foam::directMappedPolyPatch::initGeometry() +void Foam::directMappedPolyPatch::initGeometry(PstreamBuffers& pBufs) { - polyPatch::initGeometry(); - directMappedPatchBase::clearOut(); + polyPatch::initGeometry(pBufs); } //- Calculate the patch geometry -void Foam::directMappedPolyPatch::calcGeometry() +void Foam::directMappedPolyPatch::calcGeometry(PstreamBuffers& pBufs) { - polyPatch::calcGeometry(); + polyPatch::calcGeometry(pBufs); directMappedPatchBase::clearOut(); } //- Initialise the patches for moving points -void Foam::directMappedPolyPatch::initMovePoints(const pointField& p) +void Foam::directMappedPolyPatch::initMovePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - polyPatch::initMovePoints(p); - directMappedPatchBase::clearOut(); + polyPatch::initMovePoints(pBufs, p); } //- Correct patches after moving points -void Foam::directMappedPolyPatch::movePoints(const pointField& p) +void Foam::directMappedPolyPatch::movePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - polyPatch::movePoints(p); + polyPatch::movePoints(pBufs, p); directMappedPatchBase::clearOut(); } //- Initialise the update of the patch topology -void Foam::directMappedPolyPatch::initUpdateMesh() +void Foam::directMappedPolyPatch::initUpdateMesh(PstreamBuffers& pBufs) { - polyPatch::initUpdateMesh(); - directMappedPatchBase::clearOut(); + polyPatch::initUpdateMesh(pBufs); } //- Update of the patch topology -void Foam::directMappedPolyPatch::updateMesh() +void Foam::directMappedPolyPatch::updateMesh(PstreamBuffers& pBufs) { - polyPatch::updateMesh(); + polyPatch::updateMesh(pBufs); directMappedPatchBase::clearOut(); } diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H index 8cb5907c9514da934a6e05e6409bf31e9fece070..654c3470a481d97343027883a86333ea509898b3 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H @@ -65,22 +65,22 @@ class directMappedPolyPatch protected: //- Initialise the calculation of the patch geometry - virtual void initGeometry(); + virtual void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - virtual void calcGeometry(); + virtual void calcGeometry(PstreamBuffers&); //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&); + virtual void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - virtual void movePoints(const pointField&); + virtual void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); public: diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C index 6d6038430d21ad7189b8b901e1dd4309ef37f735..c4295a31a433550ddb49796cc4af29172073ddcc 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C @@ -150,44 +150,49 @@ Foam::directMappedWallPolyPatch::~directMappedWallPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // //- Initialise the calculation of the patch geometry -void Foam::directMappedWallPolyPatch::initGeometry() +void Foam::directMappedWallPolyPatch::initGeometry(PstreamBuffers& pBufs) { - wallPolyPatch::initGeometry(); - directMappedPatchBase::clearOut(); + wallPolyPatch::initGeometry(pBufs); } //- Calculate the patch geometry -void Foam::directMappedWallPolyPatch::calcGeometry() +void Foam::directMappedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs) { - wallPolyPatch::calcGeometry(); + wallPolyPatch::calcGeometry(pBufs); directMappedPatchBase::clearOut(); } //- Initialise the patches for moving points -void Foam::directMappedWallPolyPatch::initMovePoints(const pointField& p) +void Foam::directMappedWallPolyPatch::initMovePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - wallPolyPatch::initMovePoints(p); - directMappedPatchBase::clearOut(); + wallPolyPatch::initMovePoints(pBufs, p); } //- Correct patches after moving points -void Foam::directMappedWallPolyPatch::movePoints(const pointField& p) +void Foam::directMappedWallPolyPatch::movePoints +( + PstreamBuffers& pBufs, + const pointField& p +) { - wallPolyPatch::movePoints(p); + wallPolyPatch::movePoints(pBufs, p); directMappedPatchBase::clearOut(); } //- Initialise the update of the patch topology -void Foam::directMappedWallPolyPatch::initUpdateMesh() +void Foam::directMappedWallPolyPatch::initUpdateMesh(PstreamBuffers& pBufs) { - wallPolyPatch::initUpdateMesh(); - directMappedPatchBase::clearOut(); + wallPolyPatch::initUpdateMesh(pBufs); } //- Update of the patch topology -void Foam::directMappedWallPolyPatch::updateMesh() +void Foam::directMappedWallPolyPatch::updateMesh(PstreamBuffers& pBufs) { - wallPolyPatch::updateMesh(); + wallPolyPatch::updateMesh(pBufs); directMappedPatchBase::clearOut(); } diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H index 0a2f5bdfd37f2536ed6feae5161df29d8d755614..b0657164da9304bc6db68d48c05dd74c63253745 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H @@ -65,22 +65,22 @@ class directMappedWallPolyPatch protected: //- Initialise the calculation of the patch geometry - virtual void initGeometry(); + virtual void initGeometry(PstreamBuffers&); //- Calculate the patch geometry - virtual void calcGeometry(); + virtual void calcGeometry(PstreamBuffers&); //- Initialise the patches for moving points - virtual void initMovePoints(const pointField&); + virtual void initMovePoints(PstreamBuffers&, const pointField&); //- Correct patches after moving points - virtual void movePoints(const pointField&); + virtual void movePoints(PstreamBuffers&, const pointField&); //- Initialise the update of the patch topology - virtual void initUpdateMesh(); + virtual void initUpdateMesh(PstreamBuffers&); //- Update of the patch topology - virtual void updateMesh(); + virtual void updateMesh(PstreamBuffers&); public: diff --git a/src/sampling/cuttingPlane/cuttingPlane.C b/src/sampling/cuttingPlane/cuttingPlane.C index 09585ec5e7c658b440a4df58f9d7c2f20913a30c..80a4e72bd5dbb7be4a45ef14b84a65e537ff31c2 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.C +++ b/src/sampling/cuttingPlane/cuttingPlane.C @@ -258,6 +258,7 @@ bool Foam::cuttingPlane::walkCell void Foam::cuttingPlane::walkCellCuts ( const primitiveMesh& mesh, + const bool triangulate, const UList<label>& edgePoint ) { @@ -293,7 +294,7 @@ void Foam::cuttingPlane::walkCellCuts // Check for the unexpected ... if (startEdgeI == -1) { - FatalErrorIn("Foam::cuttingPlane::walkCellCuts") + FatalErrorIn("Foam::cuttingPlane::walkCellCuts(..)") << "Cannot find cut edge for cut cell " << cellI << abort(FatalError); } @@ -318,10 +319,18 @@ void Foam::cuttingPlane::walkCellCuts f = f.reverseFace(); } - // the cut faces are usually quite ugly, so always triangulate - label nTri = f.triangles(cutPoints, dynCutFaces); - while (nTri--) + // the cut faces are usually quite ugly, so optionally triangulate + if (triangulate) { + label nTri = f.triangles(cutPoints, dynCutFaces); + while (nTri--) + { + dynCutCells.append(cellI); + } + } + else + { + dynCutFaces.append(f); dynCutCells.append(cellI); } } @@ -346,12 +355,13 @@ Foam::cuttingPlane::cuttingPlane ( const plane& pln, const primitiveMesh& mesh, + const bool triangulate, const UList<label>& cellIdLabels ) : plane(pln) { - reCut(mesh, cellIdLabels); + reCut(mesh, triangulate, cellIdLabels); } @@ -362,6 +372,7 @@ Foam::cuttingPlane::cuttingPlane void Foam::cuttingPlane::reCut ( const primitiveMesh& mesh, + const bool triangulate, const UList<label>& cellIdLabels ) { @@ -379,7 +390,7 @@ void Foam::cuttingPlane::reCut intersectEdges(mesh, dotProducts, edgePoint); // Do topological walk around cell to find closed loop. - walkCellCuts(mesh, edgePoint); + walkCellCuts(mesh, triangulate, edgePoint); } diff --git a/src/sampling/cuttingPlane/cuttingPlane.H b/src/sampling/cuttingPlane/cuttingPlane.H index 6804a9ab18197c687bbb9f84a311cd3662751e0a..aba51a78edf6cb84796f8fc49c9947acf01ddb1f 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.H +++ b/src/sampling/cuttingPlane/cuttingPlane.H @@ -105,6 +105,7 @@ class cuttingPlane void walkCellCuts ( const primitiveMesh& mesh, + const bool triangulate, const UList<label>& edgePoint ); @@ -122,6 +123,7 @@ protected: void reCut ( const primitiveMesh&, + const bool triangulate, const UList<label>& cellIdLabels = UList<label>::null() ); @@ -138,6 +140,7 @@ public: ( const plane&, const primitiveMesh&, + const bool triangulate, const UList<label>& cellIdLabels = UList<label>::null() ); diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C index c5ce93f1d09e8752f87f69bf67493dc0e5e7bb0b..1f03cdcf36c6b603171961f57c18bf426a8a8a95 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C @@ -150,11 +150,11 @@ bool Foam::sampledPlane::update() if (zoneId < 0) { - reCut(mesh()); + reCut(mesh(), true); // always triangulate. Note:Make option? } else { - reCut(mesh(), mesh().cellZones()[zoneId]); + reCut(mesh(), true, mesh().cellZones()[zoneId]); } if (debug) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H index 717f6b1e7cbe3c4dce283e6e405628bf9e6fa6c3..c5e57745d794e32cda1e304f6c9cd32143892f45 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H @@ -97,7 +97,7 @@ class turbulentTemperatureCoupledBaffleFvPatchScalarField public: //- Runtime type information - TypeName("turbulentTemperatureCoupledBaffle"); + TypeName("compressible::turbulentTemperatureCoupledBaffle"); // Constructors diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict index 176b1467df245f1883bc80052ba98e87e5ff934a..6e02e44e34288182b6b6616ff0e15cdb8228c676 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict @@ -34,7 +34,7 @@ hierarchicalCoeffs metisCoeffs { - processorWeights ( 1 1 1 1 ); + //processorWeights ( 1 1 1 1 ); } manualCoeffs