diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C index 43c5d18429..a8c4da3b13 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -87,20 +88,27 @@ void Foam::basicSymmetryPointPatchField::evaluate const Pstream::commsTypes ) { - const vectorField& nHat = this->patch().pointNormals(); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type : no-op + } + else + { + const vectorField& nHat = this->patch().pointNormals(); - tmp> tvalues = - ( + const Field pif(this->patchInternalField()); + + // Could write as loop instead... + tmp> tvalues ( - this->patchInternalField() - + transform(I - 2.0*sqr(nHat), this->patchInternalField()) - )/2.0 - ); + 0.5*(pif + transform(I - 2.0*sqr(nHat), pif)) + ); - // Get internal field to insert values into - Field& iF = const_cast&>(this->primitiveField()); + // Get internal field to insert values into + auto& iF = const_cast&>(this->primitiveField()); - this->setInInternalField(iF, tvalues()); + this->setInInternalField(iF, tvalues()); + } } diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C index 686033987e..166f6172c1 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.C @@ -27,7 +27,6 @@ License \*---------------------------------------------------------------------------*/ #include "fixedValuePointPatchField.H" -#include "boolList.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclicSlip/cyclicSlipPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclicSlip/cyclicSlipPointPatchField.C index da2604590c..2126c25863 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclicSlip/cyclicSlipPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclicSlip/cyclicSlipPointPatchField.C @@ -84,20 +84,27 @@ Foam::cyclicSlipPointPatchField::cyclicSlipPointPatchField template void Foam::cyclicSlipPointPatchField::evaluate(const Pstream::commsTypes) { - const vectorField& nHat = this->patch().pointNormals(); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type : no-op + } + else + { + const vectorField& nHat = this->patch().pointNormals(); - tmp> tvalues = - ( + const Field pif(this->patchInternalField()); + + // Could write as loop instead... + tmp> tvalues ( - this->patchInternalField() - + transform(I - 2.0*sqr(nHat), this->patchInternalField()) - )/2.0 - ); + 0.5*(pif + transform(I - 2.0*sqr(nHat), pif)) + ); - // Get internal field to insert values into - Field& iF = const_cast&>(this->primitiveField()); + // Get internal field to insert values into + auto& iF = const_cast&>(this->primitiveField()); - this->setInInternalField(iF, tvalues()); + this->setInInternalField(iF, tvalues()); + } } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatchField.C index 732371d0c0..ee2ea085b9 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPointPatchField.C @@ -91,20 +91,27 @@ void Foam::nonuniformTransformCyclicPointPatchField::evaluate const Pstream::commsTypes ) { - const vectorField& nHat = this->patch().pointNormals(); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type : no-op + } + else + { + const vectorField& nHat = this->patch().pointNormals(); - tmp> tvalues = - ( + const Field pif(this->patchInternalField()); + + // Could write as loop instead... + tmp> tvalues ( - this->patchInternalField() - + transform(I - 2.0*sqr(nHat), this->patchInternalField()) - )/2.0 - ); + 0.5*(pif + transform(I - 2.0*sqr(nHat), pif)) + ); - // Get internal field to insert values into - Field& iF = const_cast&>(this->primitiveField()); + // Get internal field to insert values into + auto& iF = const_cast&>(this->primitiveField()); - this->setInInternalField(iF, tvalues()); + this->setInInternalField(iF, tvalues()); + } } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C index 9eac7d0329..7dd6bcdf71 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.C @@ -106,20 +106,27 @@ void Foam::symmetryPlanePointPatchField::evaluate const Pstream::commsTypes ) { - vector nHat = symmetryPlanePatch_.n(); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type : no-op + } + else + { + const symmTensor rot(I - 2.0*sqr(symmetryPlanePatch_.n())); - tmp> tvalues = - ( + const Field pif(this->patchInternalField()); + + // Could write as loop instead... + tmp> tvalues ( - this->patchInternalField() - + transform(I - 2.0*sqr(nHat), this->patchInternalField()) - )/2.0 - ); + 0.5*(pif + transform(rot, pif)) + ); - // Get internal field to insert values into - Field& iF = const_cast&>(this->primitiveField()); + // Get internal field to insert values into + auto& iF = const_cast&>(this->primitiveField()); - this->setInInternalField(iF, tvalues()); + this->setInInternalField(iF, tvalues()); + } } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.C index 6ec8dce45e..457d195c90 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +29,6 @@ License #include "wedgePointPatchField.H" #include "transformField.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -101,17 +101,28 @@ Foam::wedgePointPatchField::wedgePointPatchField template void Foam::wedgePointPatchField::evaluate(const Pstream::commsTypes) { - // In order to ensure that the wedge patch is always flat, take the - // normal vector from the first point - const vector& nHat = this->patch().pointNormals()[0]; + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type : no-op + } + else + { + // In order to ensure that the wedge patch is always flat, take the + // normal vector from the first point - tmp> tvalues = - transform(I - nHat*nHat, this->patchInternalField()); + const symmTensor rot(I - 2.0*sqr(this->patch().pointNormals()[0])); - // Get internal field to insert values into - Field& iF = const_cast&>(this->primitiveField()); + // Could write as loop instead... + tmp> tvalues + ( + transform(rot, this->patchInternalField()) + ); - this->setInInternalField(iF, tvalues()); + // Get internal field to insert values into + auto& iF = const_cast&>(this->primitiveField()); + + this->setInInternalField(iF, tvalues()); + } } diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/fixedNormalSlip/fixedNormalSlipPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/fixedNormalSlip/fixedNormalSlipPointPatchField.C index a68cec5e43..85ce07b2e5 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/fixedNormalSlip/fixedNormalSlipPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/fixedNormalSlip/fixedNormalSlipPointPatchField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,13 +89,22 @@ void Foam::fixedNormalSlipPointPatchField::evaluate const Pstream::commsTypes ) { - tmp> tvalues = - transform(I - n_*n_, this->patchInternalField()); + if constexpr (!is_rotational_vectorspace_v) + { + // Rotational-invariant type : no-op + } + else + { + tmp> tvalues + ( + transform(I - n_*n_, this->patchInternalField()) + ); - // Get internal field to insert values into - Field& iF = const_cast&>(this->primitiveField()); + // Get internal field to insert values into + auto& iF = const_cast&>(this->primitiveField()); - this->setInInternalField(iF, tvalues()); + this->setInInternalField(iF, tvalues()); + } } diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index 2c59c5c9f3..669c1f48d3 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -167,13 +167,13 @@ public: } //- Return processor number - int myProcNo() const + int myProcNo() const noexcept { return procPolyPatch_.myProcNo(); } //- Return neighbour processor number - int neighbProcNo() const + int neighbProcNo() const noexcept { return procPolyPatch_.neighbProcNo(); } @@ -191,13 +191,13 @@ public: } //- Return the underlying processorPolyPatch - const processorPolyPatch& procPolyPatch() const + const processorPolyPatch& procPolyPatch() const noexcept { return procPolyPatch_; } //- Return mesh points in the correct order for the receiving side - const labelList& reverseMeshPoints() const + const labelList& reverseMeshPoints() const noexcept { return reverseMeshPoints_; }