From 242d9e40a2ec5e2cb51df33df911a3d561e54387 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Sat, 24 Oct 2020 13:15:12 +0200 Subject: [PATCH] ENH: consistency update for GeometricField::Boundary constructor - make patchFieldType default to calculated, as per GeometricField constructor --- .../GeometricField/GeometricBoundaryField.C | 6 ++--- .../GeometricField/GeometricField.H | 22 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index 7d43c87cf21..4443f6f7bac 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -621,7 +621,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::operator== Boundary& bf ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == bf[patchi]; } @@ -634,7 +634,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::operator== const FieldField<PatchField, Type>& ptff ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == ptff[patchi]; } @@ -647,7 +647,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::operator== const Type& t ) { - forAll((*this), patchi) + forAll(*this, patchi) { this->operator[](patchi) == t; } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 320c3193908..78cfc3e5724 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -54,7 +54,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class dictionary; template<class Type, template<class> class PatchField, class GeoMesh> @@ -95,7 +95,7 @@ class GeometricField public: - // Public typedefs + // Public Typedefs //- Type of mesh on which this GeometricField is instantiated typedef typename GeoMesh::Mesh Mesh; @@ -112,11 +112,12 @@ public: typedef PatchField<Type> Patch; + //- The boundary fields class Boundary : public FieldField<PatchField, Type> { - // Private data + // Private Data //- Reference to BoundaryMesh for which this field is defined const BoundaryMesh& bmesh_; @@ -126,8 +127,8 @@ public: // Constructors - //- Construct from a BoundaryMesh - Boundary(const BoundaryMesh& bmesh); + //- Construct from a BoundaryMesh, setting patches later + explicit Boundary(const BoundaryMesh& bmesh); //- Construct from a BoundaryMesh, reference to the internal field //- and a patch type @@ -135,7 +136,7 @@ public: ( const BoundaryMesh& bmesh, const Internal& field, - const word& patchFieldType + const word& patchFieldType = PatchField<Type>::calculatedType() ); //- Construct from a BoundaryMesh, reference to the internal field @@ -175,15 +176,12 @@ public: const word& patchFieldName ); - //- Construct as copy + //- Copy construct // Dangerous because Field may be set to a field which gets deleted // Need new type of BoundaryField, one which is part of a geometric // field for which snGrad etc. may be called and a free standing // BoundaryField for which such operations are unavailable. - Boundary - ( - const Boundary& btf - ); + Boundary(const Boundary& btf); //- Construct from dictionary Boundary @@ -231,7 +229,7 @@ public: void writeEntries(Ostream& os) const; - // Member operators + // Member Operators //- Assignment to BoundaryField<Type, PatchField, BoundaryMesh> void operator=(const Boundary&); -- GitLab