ENH: consistency update for GeometricField::Boundary constructor

- make patchFieldType default to calculated,
  as per GeometricField constructor
This commit is contained in:
Mark Olesen
2020-10-24 13:15:12 +02:00
parent 410d38b9d9
commit 242d9e40a2
2 changed files with 13 additions and 15 deletions

View File

@ -621,7 +621,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::operator==
Boundary& bf Boundary& bf
) )
{ {
forAll((*this), patchi) forAll(*this, patchi)
{ {
this->operator[](patchi) == bf[patchi]; this->operator[](patchi) == bf[patchi];
} }
@ -634,7 +634,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::operator==
const FieldField<PatchField, Type>& ptff const FieldField<PatchField, Type>& ptff
) )
{ {
forAll((*this), patchi) forAll(*this, patchi)
{ {
this->operator[](patchi) == ptff[patchi]; this->operator[](patchi) == ptff[patchi];
} }
@ -647,7 +647,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::operator==
const Type& t const Type& t
) )
{ {
forAll((*this), patchi) forAll(*this, patchi)
{ {
this->operator[](patchi) == t; this->operator[](patchi) == t;
} }

View File

@ -54,7 +54,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class dictionary; class dictionary;
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
@ -95,7 +95,7 @@ class GeometricField
public: public:
// Public typedefs // Public Typedefs
//- Type of mesh on which this GeometricField is instantiated //- Type of mesh on which this GeometricField is instantiated
typedef typename GeoMesh::Mesh Mesh; typedef typename GeoMesh::Mesh Mesh;
@ -112,11 +112,12 @@ public:
typedef PatchField<Type> Patch; typedef PatchField<Type> Patch;
//- The boundary fields
class Boundary class Boundary
: :
public FieldField<PatchField, Type> public FieldField<PatchField, Type>
{ {
// Private data // Private Data
//- Reference to BoundaryMesh for which this field is defined //- Reference to BoundaryMesh for which this field is defined
const BoundaryMesh& bmesh_; const BoundaryMesh& bmesh_;
@ -126,8 +127,8 @@ public:
// Constructors // Constructors
//- Construct from a BoundaryMesh //- Construct from a BoundaryMesh, setting patches later
Boundary(const BoundaryMesh& bmesh); explicit Boundary(const BoundaryMesh& bmesh);
//- Construct from a BoundaryMesh, reference to the internal field //- Construct from a BoundaryMesh, reference to the internal field
//- and a patch type //- and a patch type
@ -135,7 +136,7 @@ public:
( (
const BoundaryMesh& bmesh, const BoundaryMesh& bmesh,
const Internal& field, const Internal& field,
const word& patchFieldType const word& patchFieldType = PatchField<Type>::calculatedType()
); );
//- Construct from a BoundaryMesh, reference to the internal field //- Construct from a BoundaryMesh, reference to the internal field
@ -175,15 +176,12 @@ public:
const word& patchFieldName const word& patchFieldName
); );
//- Construct as copy //- Copy construct
// Dangerous because Field may be set to a field which gets deleted // Dangerous because Field may be set to a field which gets deleted
// Need new type of BoundaryField, one which is part of a geometric // Need new type of BoundaryField, one which is part of a geometric
// field for which snGrad etc. may be called and a free standing // field for which snGrad etc. may be called and a free standing
// BoundaryField for which such operations are unavailable. // BoundaryField for which such operations are unavailable.
Boundary Boundary(const Boundary& btf);
(
const Boundary& btf
);
//- Construct from dictionary //- Construct from dictionary
Boundary Boundary
@ -231,7 +229,7 @@ public:
void writeEntries(Ostream& os) const; void writeEntries(Ostream& os) const;
// Member operators // Member Operators
//- Assignment to BoundaryField<Type, PatchField, BoundaryMesh> //- Assignment to BoundaryField<Type, PatchField, BoundaryMesh>
void operator=(const Boundary&); void operator=(const Boundary&);