diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 9a844e1eb5..611e3c506b 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -703,9 +703,43 @@ Foam::cyclicPolyPatch::~cyclicPolyPatch() } - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::label Foam::cyclicPolyPatch::neighbPatchID() const +{ + if (neighbPatchID_ == -1) + { + neighbPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName_); + + if (neighbPatchID_ == -1) + { + FatalErrorIn("cyclicPolyPatch::neighbPatchID() const") + << "Illegal neighbourPatch name " << neighbPatchName_ + << endl << "Valid patch names are " + << this->boundaryMesh().names() + << exit(FatalError); + } + + // Check that it is a cyclic + const cyclicPolyPatch& nbrPatch = refCast + ( + this->boundaryMesh()[neighbPatchID_] + ); + + if (nbrPatch.neighbPatchName() != name()) + { + WarningIn("cyclicPolyPatch::neighbPatchID() const") + << "Patch " << name() + << " specifies neighbour patch " << neighbPatchName() + << endl << " but that in return specifies " + << nbrPatch.neighbPatchName() + << endl; + } + } + return neighbPatchID_; +} + + void Foam::cyclicPolyPatch::transformPosition(pointField& l) const { if (!parallel()) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index 7b0d369317..c2ce20f732 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -325,25 +325,7 @@ public: } //- Neighbour patchID. - virtual label neighbPatchID() const - { - if (neighbPatchID_ == -1) - { - neighbPatchID_ = this->boundaryMesh().findPatchID - ( - neighbPatchName_ - ); - if (neighbPatchID_ == -1) - { - FatalErrorIn("cyclicPolyPatch::neighbPatchID() const") - << "Illegal neighbourPatch name " << neighbPatchName_ - << endl << "Valid patch names are " - << this->boundaryMesh().names() - << exit(FatalError); - } - } - return neighbPatchID_; - } + virtual label neighbPatchID() const; virtual bool owner() const {