mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: consistency improvements for surface patch handling (fixes #483)
- remove (unused) Istream constructors, prune some unused methods, rationalize write() vs writeDict(). Deprecate inconsistent construction order. - handle empty names for ".ftr" surface patches (for plain triSurface format) with double-quoted strings for more reliable streaming. Written on a single line. This is _backward_ compatible, but if users have been parsing these files manually, they will need to adjust their code. Previously: ``` ( frt-fairing:001%1 empty windshield:002%2 empty ... ) ``` Updated (with example handling of empty name): ``` ( frt-fairing:001%1 empty windshield:002%2 "" ... ) ```
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -781,9 +782,9 @@ void Foam::boundaryMesh::writeTriSurface(const fileName& fName) const
|
||||
surfPatches[patchi] =
|
||||
geometricSurfacePatch
|
||||
(
|
||||
bp.physicalType(),
|
||||
bp.name(),
|
||||
patchi
|
||||
patchi,
|
||||
bp.physicalType()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,34 +60,14 @@ Foam::boundaryPatch::boundaryPatch
|
||||
{}
|
||||
|
||||
|
||||
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p)
|
||||
:
|
||||
patchIdentifier(p.name(), p.index(), p.physicalType()),
|
||||
size_(p.size()),
|
||||
start_(p.start())
|
||||
{}
|
||||
|
||||
|
||||
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p, const label index)
|
||||
:
|
||||
patchIdentifier(p.name(), index, p.physicalType()),
|
||||
size_(p.size()),
|
||||
start_(p.start())
|
||||
{}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::boundaryPatch> Foam::boundaryPatch::clone() const
|
||||
boundaryPatch(p)
|
||||
{
|
||||
return autoPtr<boundaryPatch>::New(*this);
|
||||
patchIdentifier::index() = index;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::boundaryPatch::~boundaryPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::boundaryPatch::write(Ostream& os) const
|
||||
@ -97,7 +78,7 @@ void Foam::boundaryPatch::write(Ostream& os) const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& p)
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,8 +28,9 @@ Class
|
||||
Foam::boundaryPatch
|
||||
|
||||
Description
|
||||
Like polyPatch but without reference to mesh. patchIdentifier::index
|
||||
is not used. Used in boundaryMesh to hold data on patches.
|
||||
Like polyPatch but without reference to mesh.
|
||||
Used in boundaryMesh to hold data on patches.
|
||||
The patchIdentifier::index is set, but not used.
|
||||
|
||||
SourceFiles
|
||||
boundaryPatch.C
|
||||
@ -46,28 +48,25 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class boundaryPatch;
|
||||
|
||||
Ostream& operator<<(Ostream&, const boundaryPatch&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class boundaryPatch Declaration
|
||||
Class boundaryPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class boundaryPatch
|
||||
:
|
||||
public patchIdentifier
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
label size_;
|
||||
|
||||
label start_;
|
||||
|
||||
public:
|
||||
|
||||
// Generated Methods: copy construct, copy assignment
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
@ -88,18 +87,15 @@ public:
|
||||
const label index
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
boundaryPatch(const boundaryPatch&);
|
||||
//- Copy construct, resetting the index
|
||||
boundaryPatch(const boundaryPatch& p, const label index);
|
||||
|
||||
//- Construct as copy, resetting the index
|
||||
boundaryPatch(const boundaryPatch&, const label index);
|
||||
|
||||
//- Clone
|
||||
autoPtr<boundaryPatch> clone() const;
|
||||
|
||||
|
||||
//- Destructor
|
||||
~boundaryPatch();
|
||||
autoPtr<boundaryPatch> clone() const
|
||||
{
|
||||
return autoPtr<boundaryPatch>::New(*this);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -125,16 +121,17 @@ public:
|
||||
}
|
||||
|
||||
|
||||
//- Write dictionary
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const boundaryPatch&);
|
||||
//- Write dictionary entries (without surrounding braces)
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// Global Operators
|
||||
|
||||
//- Write boundaryPatch as dictionary entries (without surrounding braces)
|
||||
Ostream& operator<<(Ostream&, const boundaryPatch& p);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
Reference in New Issue
Block a user