diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C index 34af0b708c57c4acc1d0fdb7431fd2e68df00c1b..d3c78904b972e1dbacbc999947a9ba647a715278 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.C @@ -37,6 +37,40 @@ namespace Foam addToRunTimeSelectionTable(polyPatch, symmetryPlanePolyPatch, dictionary); } + +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // + +void Foam::symmetryPlanePolyPatch::calcGeometry(PstreamBuffers&) +{ + if (returnReduce(size(), sumOp<label>()) == 0) + { + // No faces in patch. Avoid gAverage complaining and set + // normal to nonsense value to catch any use + n_ = vector::rootMax; + } + else + { + const vectorField& nf(faceNormals()); + n_ = gAverage(nf); + + // Check the symmetry plane is planar + forAll(nf, facei) + { + if (magSqr(n_ - nf[facei]) > SMALL) + { + FatalErrorIn("symmetryPlanePolyPatch::n()") + << "Symmetry plane '" << name() << "' is not planar." + << endl + << " Either split the patch into planar parts" + << " or use the " << symmetryPolyPatch::typeName + << " patch type" + << exit(FatalError); + } + } + } +} + + // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch @@ -50,7 +84,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch ) : polyPatch(name, size, start, index, bm, patchType), - n_(calcNormal()) + n_(vector::rootMax) {} @@ -64,7 +98,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch ) : polyPatch(name, dict, index, bm, patchType), - n_(calcNormal()) + n_(vector::rootMax) {} @@ -75,7 +109,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch ) : polyPatch(pp, bm), - n_(calcNormal()) + n_(vector::rootMax) {} @@ -89,7 +123,7 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch ) : polyPatch(pp, bm, index, newSize, newStart), - n_(calcNormal()) + n_(vector::rootMax) {} @@ -103,43 +137,8 @@ Foam::symmetryPlanePolyPatch::symmetryPlanePolyPatch ) : polyPatch(pp, bm, index, mapAddressing, newStart), - n_(calcNormal()) + n_(vector::rootMax) {} -// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // - -Foam::vector Foam::symmetryPlanePolyPatch::calcNormal() const -{ - if (returnReduce(size(), sumOp<label>()) == 0) - { - // No faces in patch. Avoid gAverage complaining and set - // normal to nonsense value to catch any use - return vector::rootMax; - } - else - { - const vectorField& nf(faceNormals()); - vector n = gAverage(nf); - - // Check the symmetry plane is planar - forAll(nf, facei) - { - if (magSqr(n - nf[facei]) > SMALL) - { - FatalErrorIn("symmetryPlanePolyPatch::n()") - << "Symmetry plane '" << name() << "' is not planar." - << endl - << " Either split the patch into planar parts" - << " or use the " << symmetryPolyPatch::typeName - << " patch type" - << exit(FatalError); - } - } - - return n; - } -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.H index 5117b1b7bc8f07b4f4d609b8d0241124b87ec656..90ce862cf829d279c420eb2dc479a02d6a46f570 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetryPlane/symmetryPlanePolyPatch.H @@ -55,10 +55,13 @@ class symmetryPlanePolyPatch //- Symmetry plane normal vector n_; - // Private member functions - //- Calculate and return the symmetry plane normal - vector calcNormal() const; +protected: + + // Protected Member Functions + + //- Calculate the patch geometry + virtual void calcGeometry(PstreamBuffers&); public: