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,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -550,9 +550,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
patches[nRegions] = geometricSurfacePatch
|
patches[nRegions] = geometricSurfacePatch
|
||||||
(
|
(
|
||||||
"patch",
|
|
||||||
geometry[surfaces[i]].name() + "_" + regions[regionI],
|
geometry[surfaces[i]].name() + "_" + regions[regionI],
|
||||||
nRegions
|
nRegions,
|
||||||
|
"patch"
|
||||||
);
|
);
|
||||||
nRegions++;
|
nRegions++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -262,9 +263,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
patches[nRegions] = geometricSurfacePatch
|
patches[nRegions] = geometricSurfacePatch
|
||||||
(
|
(
|
||||||
"patch",
|
|
||||||
geometry[surfaces[i]].name() + "_" + regions[regionI],
|
geometry[surfaces[i]].name() + "_" + regions[regionI],
|
||||||
nRegions
|
nRegions,
|
||||||
|
"patch"
|
||||||
);
|
);
|
||||||
nRegions++;
|
nRegions++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2014 OpenFOAM Foundation
|
Copyright (C) 2014 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -121,9 +122,9 @@ bool Foam::searchableSurfaceModifiers::autoPatch::modify
|
|||||||
{
|
{
|
||||||
geometricSurfacePatch patch
|
geometricSurfacePatch patch
|
||||||
(
|
(
|
||||||
surf.patches()[regionI].geometricType(),
|
|
||||||
surf.patches()[regionI].name() + Foam::name(subI),
|
surf.patches()[regionI].name() + Foam::name(subI),
|
||||||
surf.patches().size()
|
surf.patches().size(),
|
||||||
|
surf.patches()[regionI].geometricType()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2014 OpenFOAM Foundation
|
Copyright (C) 2014 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,13 +74,12 @@ void Foam::searchableSurfaceModifiers::cut::triangulate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
geometricSurfacePatchList patches(fcs.size());
|
geometricSurfacePatchList patches(fcs.size());
|
||||||
forAll(patches, patchI)
|
forAll(patches, patchi)
|
||||||
{
|
{
|
||||||
patches[patchI] = geometricSurfacePatch
|
patches[patchi] = geometricSurfacePatch
|
||||||
(
|
(
|
||||||
"",
|
"patch" + Foam::name(patchi),
|
||||||
"patch" + Foam::name(patchI),
|
patchi
|
||||||
patchI
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
cutSurf = triSurface(tris, patches, pts, true);
|
cutSurf = triSurface(tris, patches, pts, true);
|
||||||
@ -345,9 +345,9 @@ bool Foam::searchableSurfaceModifiers::cut::modify
|
|||||||
newPatches.setSize(sz+1);
|
newPatches.setSize(sz+1);
|
||||||
newPatches[sz] = geometricSurfacePatch
|
newPatches[sz] = geometricSurfacePatch
|
||||||
(
|
(
|
||||||
newPatches[sz-1].geometricType(),
|
|
||||||
newPatches[sz-1].name() + "_inside",
|
newPatches[sz-1].name() + "_inside",
|
||||||
newPatches[sz-1].index()
|
newPatches[sz-1].index(),
|
||||||
|
newPatches[sz-1].geometricType()
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Moving " << nInside << " out of " << surf3.size()
|
Info<< "Moving " << nInside << " out of " << surf3.size()
|
||||||
|
|||||||
@ -588,7 +588,6 @@ DebugSwitches
|
|||||||
generic 0;
|
generic 0;
|
||||||
genericPatch 0;
|
genericPatch 0;
|
||||||
geomCellLooper 0;
|
geomCellLooper 0;
|
||||||
geometricSurfacePatch 0;
|
|
||||||
global 0;
|
global 0;
|
||||||
globalIndexAndTransform 0;
|
globalIndexAndTransform 0;
|
||||||
globalMeshData 0;
|
globalMeshData 0;
|
||||||
@ -880,7 +879,6 @@ DebugSwitches
|
|||||||
surfaceInterpolationScheme 0;
|
surfaceInterpolationScheme 0;
|
||||||
surfaceIntersection 0;
|
surfaceIntersection 0;
|
||||||
surfaceNormalFixedValue 0;
|
surfaceNormalFixedValue 0;
|
||||||
surfacePatch 0;
|
|
||||||
surfaceScalarField 0;
|
surfaceScalarField 0;
|
||||||
surfaceScalarField::Internal 0;
|
surfaceScalarField::Internal 0;
|
||||||
surfaceSlipDisplacement 0;
|
surfaceSlipDisplacement 0;
|
||||||
|
|||||||
@ -49,8 +49,7 @@ Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashTable<labelList>::const_iterator fnd =
|
const auto fnd = pbm.groupPatchIDs().cfind(name());
|
||||||
pbm.groupPatchIDs().find(name());
|
|
||||||
|
|
||||||
if (!fnd.found())
|
if (!fnd.found())
|
||||||
{
|
{
|
||||||
@ -131,18 +130,6 @@ Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::coupleGroupIdentifier::coupleGroupIdentifier()
|
|
||||||
:
|
|
||||||
name_()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::coupleGroupIdentifier::coupleGroupIdentifier(const word& patchGroupName)
|
|
||||||
:
|
|
||||||
name_(patchGroupName)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::coupleGroupIdentifier::coupleGroupIdentifier(const dictionary& dict)
|
Foam::coupleGroupIdentifier::coupleGroupIdentifier(const dictionary& dict)
|
||||||
:
|
:
|
||||||
name_()
|
name_()
|
||||||
@ -232,7 +219,7 @@ void Foam::coupleGroupIdentifier::write(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const coupleGroupIdentifier& p)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const coupleGroupIdentifier& p)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013 OpenFOAM Foundation
|
Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,12 +28,11 @@ Class
|
|||||||
Foam::coupleGroupIdentifier
|
Foam::coupleGroupIdentifier
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Encapsulates using patchGroups to specify coupled patch
|
Encapsulates using "patchGroups" to specify coupled patch
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
coupleGroupIdentifierI.H
|
coupleGroupIdentifierI.H
|
||||||
coupleGroupIdentifier.C
|
coupleGroupIdentifier.C
|
||||||
coupleGroupIdentifierIO.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -47,16 +47,10 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class dictionary;
|
class dictionary;
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
class polyPatch;
|
class polyPatch;
|
||||||
class Ostream;
|
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
class coupleGroupIdentifier;
|
|
||||||
Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class coupleGroupIdentifier Declaration
|
Class coupleGroupIdentifier Declaration
|
||||||
@ -64,7 +58,7 @@ Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p);
|
|||||||
|
|
||||||
class coupleGroupIdentifier
|
class coupleGroupIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Name of patchGroup
|
//- Name of patchGroup
|
||||||
word name_;
|
word name_;
|
||||||
@ -72,7 +66,8 @@ class coupleGroupIdentifier
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Find other patch in specified mesh. Returns index of patch or -1.
|
//- Find other patch in specified mesh.
|
||||||
|
// \return index of patch or -1
|
||||||
label findOtherPatchID
|
label findOtherPatchID
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -82,16 +77,19 @@ class coupleGroupIdentifier
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- Default construct
|
||||||
|
coupleGroupIdentifier() = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
|
||||||
coupleGroupIdentifier();
|
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
coupleGroupIdentifier(const word& patchGroupName);
|
inline explicit coupleGroupIdentifier(const word& patchGroupName);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
coupleGroupIdentifier(const dictionary& dict);
|
explicit coupleGroupIdentifier(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -102,31 +100,30 @@ public:
|
|||||||
//- Is a valid patchGroup
|
//- Is a valid patchGroup
|
||||||
inline bool valid() const;
|
inline bool valid() const;
|
||||||
|
|
||||||
//- Find other patch in same region. Returns index of patch or -1.
|
//- Find other patch in same region.
|
||||||
|
// \return index of patch or -1.
|
||||||
label findOtherPatchID(const polyPatch& thisPatch) const;
|
label findOtherPatchID(const polyPatch& thisPatch) const;
|
||||||
|
|
||||||
//- Find other patch and region. Returns index of patch and sets
|
//- Find other patch and region.
|
||||||
// otherRegion to name of region. Fatal error if patch not found
|
// Returns index of patch and sets otherRegion to name of region.
|
||||||
|
// FatalError if patch not found
|
||||||
label findOtherPatchID
|
label findOtherPatchID
|
||||||
(
|
(
|
||||||
const polyPatch& thisPatch,
|
const polyPatch& thisPatch,
|
||||||
word& otherRegion
|
word& otherRegion
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write the data as a dictionary
|
//- Write the coupleGroup dictionary entry
|
||||||
void write(Ostream& os) const;
|
void write(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
|
||||||
|
|
||||||
friend Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const coupleGroupIdentifier& p
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Write the coupleGroup dictionary entry
|
||||||
|
Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -25,7 +25,16 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "coupleGroupIdentifier.H"
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::coupleGroupIdentifier::coupleGroupIdentifier
|
||||||
|
(
|
||||||
|
const word& patchGroupName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(patchGroupName)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,10 +28,27 @@ License
|
|||||||
|
|
||||||
#include "patchIdentifier.H"
|
#include "patchIdentifier.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "ListOps.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::patchIdentifier::patchIdentifier()
|
||||||
|
:
|
||||||
|
name_(),
|
||||||
|
index_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::patchIdentifier::patchIdentifier
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label index
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
index_(index)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::patchIdentifier::patchIdentifier
|
Foam::patchIdentifier::patchIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -53,8 +71,7 @@ Foam::patchIdentifier::patchIdentifier
|
|||||||
const label index
|
const label index
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
patchIdentifier(name, index)
|
||||||
index_(index)
|
|
||||||
{
|
{
|
||||||
dict.readIfPresent("physicalType", physicalType_);
|
dict.readIfPresent("physicalType", physicalType_);
|
||||||
dict.readIfPresent("inGroups", inGroups_);
|
dict.readIfPresent("inGroups", inGroups_);
|
||||||
@ -76,18 +93,13 @@ Foam::patchIdentifier::patchIdentifier
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::patchIdentifier::inGroup(const word& name) const
|
|
||||||
{
|
|
||||||
return inGroups_.found(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::patchIdentifier::write(Ostream& os) const
|
void Foam::patchIdentifier::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
if (physicalType_.size())
|
if (physicalType_.size())
|
||||||
{
|
{
|
||||||
os.writeEntry("physicalType", physicalType_);
|
os.writeEntry("physicalType", physicalType_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inGroups_.size())
|
if (inGroups_.size())
|
||||||
{
|
{
|
||||||
os.writeKeyword("inGroups");
|
os.writeKeyword("inGroups");
|
||||||
@ -97,7 +109,7 @@ void Foam::patchIdentifier::write(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const patchIdentifier& p)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const patchIdentifier& p)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,18 +39,14 @@ SourceFiles
|
|||||||
#define patchIdentifier_H
|
#define patchIdentifier_H
|
||||||
|
|
||||||
#include "wordList.H"
|
#include "wordList.H"
|
||||||
#include "label.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
class dictionary;
|
class dictionary;
|
||||||
class patchIdentifier;
|
|
||||||
Ostream& operator<<(Ostream& os, const patchIdentifier& p);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class patchIdentifier Declaration
|
Class patchIdentifier Declaration
|
||||||
@ -57,7 +54,7 @@ Ostream& operator<<(Ostream& os, const patchIdentifier& p);
|
|||||||
|
|
||||||
class patchIdentifier
|
class patchIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Name of patch
|
//- Name of patch
|
||||||
word name_;
|
word name_;
|
||||||
@ -73,14 +70,32 @@ class patchIdentifier
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
patchIdentifier(const patchIdentifier&) = default;
|
||||||
|
|
||||||
|
//- Copy assignment
|
||||||
|
patchIdentifier& operator=(const patchIdentifier&) = default;
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~patchIdentifier() = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Default construct, with index zero
|
||||||
|
patchIdentifier();
|
||||||
|
|
||||||
|
//- Construct from mandatory components
|
||||||
|
patchIdentifier(const word& name, const label index);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
patchIdentifier
|
patchIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label index,
|
const label index,
|
||||||
const word& physicalType = word::null,
|
const word& physicalType,
|
||||||
const wordList& inGroups = wordList()
|
const wordList& inGroups = wordList()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -100,13 +115,9 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~patchIdentifier() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the patch name
|
//- The patch name
|
||||||
const word& name() const
|
const word& name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
@ -118,13 +129,13 @@ public:
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The optional physical type of the patch
|
//- The (optional) physical type of the patch
|
||||||
const word& physicalType() const
|
const word& physicalType() const
|
||||||
{
|
{
|
||||||
return physicalType_;
|
return physicalType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Modifiable optional physical type of the patch
|
//- Modifiable (optional) physical type of the patch
|
||||||
word& physicalType()
|
word& physicalType()
|
||||||
{
|
{
|
||||||
return physicalType_;
|
return physicalType_;
|
||||||
@ -136,37 +147,43 @@ public:
|
|||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Modifiable the index of this patch in the boundaryMesh
|
//- Modifiable index of this patch in the boundaryMesh
|
||||||
label& index()
|
label& index()
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The optional groups that the patch belongs to
|
//- The (optional) groups that the patch belongs to
|
||||||
const wordList& inGroups() const
|
const wordList& inGroups() const
|
||||||
{
|
{
|
||||||
return inGroups_;
|
return inGroups_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Modifiable optional groups that the patch belongs to
|
//- Modifiable (optional) groups that the patch belongs to
|
||||||
wordList& inGroups()
|
wordList& inGroups()
|
||||||
{
|
{
|
||||||
return inGroups_;
|
return inGroups_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Check if the patch is in named group
|
//- True if the patch is in named group
|
||||||
bool inGroup(const word& name) const;
|
bool inGroup(const word& name) const
|
||||||
|
{
|
||||||
|
return inGroups_.found(name);
|
||||||
|
}
|
||||||
|
|
||||||
//- Write patchIdentifier as a dictionary
|
//- Write (physicalType, inGroups) dictionary entries
|
||||||
|
//- (without surrounding braces)
|
||||||
void write(Ostream& os) const;
|
void write(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// Ostream Operator
|
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream& os, const patchIdentifier& p);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Write (physicalType, inGroups) dictionary entries
|
||||||
|
//- (without surrounding braces)
|
||||||
|
Ostream& operator<<(Ostream& os, const patchIdentifier& p);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,31 +29,54 @@ License
|
|||||||
#include "geometricSurfacePatch.H"
|
#include "geometricSurfacePatch.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(geometricSurfacePatch, 0);
|
|
||||||
|
static inline word readOptionalWord(Istream& is)
|
||||||
|
{
|
||||||
|
token tok(is);
|
||||||
|
|
||||||
|
if (tok.isWord())
|
||||||
|
{
|
||||||
|
return tok.wordToken();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Allow empty words
|
||||||
|
return word::validate(tok.stringToken());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Foam::word Foam::geometricSurfacePatch::emptyType = "empty";
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::geometricSurfacePatch::geometricSurfacePatch()
|
Foam::geometricSurfacePatch::geometricSurfacePatch()
|
||||||
:
|
:
|
||||||
geometricType_(emptyType),
|
geometricSurfacePatch(0)
|
||||||
name_("patch"),
|
|
||||||
index_(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::geometricSurfacePatch::geometricSurfacePatch(const label index)
|
Foam::geometricSurfacePatch::geometricSurfacePatch(const label index)
|
||||||
:
|
:
|
||||||
geometricType_(emptyType),
|
|
||||||
name_("patch"),
|
name_("patch"),
|
||||||
index_(index)
|
index_(index),
|
||||||
|
geometricType_(emptyType)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::geometricSurfacePatch::geometricSurfacePatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label index
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
index_(index),
|
||||||
|
geometricType_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -64,66 +87,10 @@ Foam::geometricSurfacePatch::geometricSurfacePatch
|
|||||||
const word& geometricType
|
const word& geometricType
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometricType_(geometricType),
|
|
||||||
name_(name),
|
name_(name),
|
||||||
index_(index)
|
index_(index),
|
||||||
{
|
geometricType_(geometricType)
|
||||||
if (geometricType_.empty())
|
{}
|
||||||
{
|
|
||||||
geometricType_ = emptyType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::geometricSurfacePatch::geometricSurfacePatch
|
|
||||||
(
|
|
||||||
const word& geometricType,
|
|
||||||
const word& name,
|
|
||||||
const label index
|
|
||||||
)
|
|
||||||
:
|
|
||||||
geometricType_(geometricType),
|
|
||||||
name_(name),
|
|
||||||
index_(index)
|
|
||||||
{
|
|
||||||
if (geometricType_.empty())
|
|
||||||
{
|
|
||||||
geometricType_ = emptyType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::geometricSurfacePatch::geometricSurfacePatch
|
|
||||||
(
|
|
||||||
const surfZoneIdentifier& ident
|
|
||||||
)
|
|
||||||
:
|
|
||||||
geometricType_(ident.geometricType()),
|
|
||||||
name_(ident.name()),
|
|
||||||
index_(ident.index())
|
|
||||||
{
|
|
||||||
if (geometricType_.empty())
|
|
||||||
{
|
|
||||||
geometricType_ = emptyType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::geometricSurfacePatch::geometricSurfacePatch
|
|
||||||
(
|
|
||||||
Istream& is,
|
|
||||||
const label index
|
|
||||||
)
|
|
||||||
:
|
|
||||||
geometricType_(is),
|
|
||||||
name_(is),
|
|
||||||
index_(index)
|
|
||||||
{
|
|
||||||
if (geometricType_.empty())
|
|
||||||
{
|
|
||||||
geometricType_ = emptyType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::geometricSurfacePatch::geometricSurfacePatch
|
Foam::geometricSurfacePatch::geometricSurfacePatch
|
||||||
@ -133,26 +100,31 @@ Foam::geometricSurfacePatch::geometricSurfacePatch
|
|||||||
const label index
|
const label index
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometricType_(emptyType),
|
|
||||||
name_(name),
|
name_(name),
|
||||||
index_(index)
|
index_(index),
|
||||||
|
geometricType_()
|
||||||
{
|
{
|
||||||
dict.readIfPresent("geometricType", geometricType_);
|
dict.readIfPresent("geometricType", geometricType_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::geometricSurfacePatch::geometricSurfacePatch
|
||||||
|
(
|
||||||
|
const surfZoneIdentifier& ident
|
||||||
|
)
|
||||||
|
:
|
||||||
|
geometricSurfacePatch(ident.name(), ident.index(), ident.geometricType())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::geometricSurfacePatch::write(Ostream& os) const
|
void Foam::geometricSurfacePatch::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << nl << name_
|
if (geometricType_.size())
|
||||||
<< nl << geometricType_;
|
{
|
||||||
}
|
os.writeEntry("geometricType", geometricType_);
|
||||||
|
}
|
||||||
|
|
||||||
void Foam::geometricSurfacePatch::writeDict(Ostream& os) const
|
|
||||||
{
|
|
||||||
os.writeEntry("geometricType", geometricType_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,21 +154,54 @@ bool Foam::operator!=
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, geometricSurfacePatch& p)
|
Foam::Istream& Foam::operator>>(Istream& is, geometricSurfacePatch& obj)
|
||||||
{
|
{
|
||||||
is >> p.name_ >> p.geometricType_;
|
obj.name() = readOptionalWord(is);
|
||||||
|
obj.geometricType() = readOptionalWord(is);
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const geometricSurfacePatch& p)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const geometricSurfacePatch& obj)
|
||||||
{
|
{
|
||||||
p.write(os);
|
// Force unconditional line-breaks on list output.
|
||||||
|
// We otherwise risk extremely unreadable entries
|
||||||
|
os << nl;
|
||||||
|
|
||||||
|
// Empty words are double-quoted so they are treated as 'string'
|
||||||
|
|
||||||
|
os.writeQuoted(obj.name(), obj.name().empty()) << token::SPACE;
|
||||||
|
os.writeQuoted(obj.geometricType(), obj.geometricType().empty());
|
||||||
|
|
||||||
|
// Equivalent for OpenFOAM-1912 and earlier:
|
||||||
|
// if (obj.geometricType().empty())
|
||||||
|
// {
|
||||||
|
// os << emptyType;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// os << obj.geometricType();
|
||||||
|
// }
|
||||||
|
|
||||||
os.check(FUNCTION_NAME);
|
os.check(FUNCTION_NAME);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Housekeeping * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::geometricSurfacePatch::geometricSurfacePatch
|
||||||
|
(
|
||||||
|
const word& geometricType,
|
||||||
|
const word& name,
|
||||||
|
const label index
|
||||||
|
)
|
||||||
|
:
|
||||||
|
geometricSurfacePatch(name, index, geometricType)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,7 +39,6 @@ SourceFiles
|
|||||||
#ifndef geometricSurfacePatch_H
|
#ifndef geometricSurfacePatch_H
|
||||||
#define geometricSurfacePatch_H
|
#define geometricSurfacePatch_H
|
||||||
|
|
||||||
#include "typeInfo.H"
|
|
||||||
#include "surfZoneIdentifier.H"
|
#include "surfZoneIdentifier.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -47,13 +46,6 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
class dictionary;
|
|
||||||
class geometricSurfacePatch;
|
|
||||||
|
|
||||||
Istream& operator>>(Istream& is, geometricSurfacePatch& p);
|
|
||||||
Ostream& operator<<(Ostream& os, const geometricSurfacePatch& p);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class geometricSurfacePatch Declaration
|
Class geometricSurfacePatch Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -62,65 +54,65 @@ class geometricSurfacePatch
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Type name of patch
|
|
||||||
word geometricType_;
|
|
||||||
|
|
||||||
//- Name of patch
|
//- Name of patch
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
//- Index of patch in boundary
|
//- Index of patch in boundary
|
||||||
label index_;
|
label index_;
|
||||||
|
|
||||||
|
//- Type name of patch
|
||||||
|
word geometricType_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public Data
|
// Public Data
|
||||||
|
|
||||||
//- The name for an 'empty' type
|
//- The name for an 'empty' type
|
||||||
static const word emptyType;
|
static constexpr const char* const emptyType = "empty";
|
||||||
|
|
||||||
|
|
||||||
|
// Public Classes
|
||||||
|
|
||||||
//- Helper to convert identifier types as an operation
|
//- Helper to convert identifier types as an operation
|
||||||
struct fromIdentifier
|
struct fromIdentifier
|
||||||
{
|
{
|
||||||
geometricSurfacePatch operator()(const surfZoneIdentifier& ident)
|
geometricSurfacePatch
|
||||||
const
|
operator()(const surfZoneIdentifier& ident) const
|
||||||
{
|
{
|
||||||
return geometricSurfacePatch(ident);
|
return geometricSurfacePatch(ident);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
// Generated Methods
|
||||||
ClassName("geometricSurfacePatch");
|
|
||||||
|
//- Copy construct
|
||||||
|
geometricSurfacePatch(const geometricSurfacePatch&) = default;
|
||||||
|
|
||||||
|
//- Copy assignment
|
||||||
|
geometricSurfacePatch&
|
||||||
|
operator=(const geometricSurfacePatch&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct, use index=0, name="patch"
|
||||||
geometricSurfacePatch();
|
geometricSurfacePatch();
|
||||||
|
|
||||||
//- Construct null with specified index
|
//- Construct null with specified index
|
||||||
explicit geometricSurfacePatch(const label index);
|
explicit geometricSurfacePatch(const label index);
|
||||||
|
|
||||||
|
//- Construct from mandatory components
|
||||||
|
geometricSurfacePatch(const word& name, const label index);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
geometricSurfacePatch
|
geometricSurfacePatch
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label index,
|
const label index,
|
||||||
const word& geometricType = word::null
|
const word& geometricType
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
geometricSurfacePatch
|
|
||||||
(
|
|
||||||
const word& geometricType,
|
|
||||||
const word& name,
|
|
||||||
const label index
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Implicit conversion from surfZoneIdentifier, which has similar
|
|
||||||
//- information but in a different order
|
|
||||||
geometricSurfacePatch(const surfZoneIdentifier& ident);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
geometricSurfacePatch
|
geometricSurfacePatch
|
||||||
(
|
(
|
||||||
@ -129,59 +121,76 @@ public:
|
|||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Implicit conversion from surfZoneIdentifier
|
||||||
geometricSurfacePatch(Istream& is, const label index);
|
geometricSurfacePatch(const surfZoneIdentifier& ident);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name
|
//- The patch/zone name
|
||||||
const word& name() const
|
const word& name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return name
|
//- Modifiable patch/zone name
|
||||||
word& name()
|
word& name()
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the patch
|
//- The geometric type of the patch/zone
|
||||||
const word& geometricType() const
|
const word& geometricType() const
|
||||||
{
|
{
|
||||||
return geometricType_;
|
return geometricType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the patch for modification
|
//- Modifiable geometric type of the patch/zone
|
||||||
word& geometricType()
|
word& geometricType()
|
||||||
{
|
{
|
||||||
return geometricType_;
|
return geometricType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the index of this patch in the surface mesh
|
//- The index of this patch/zone in the surface mesh
|
||||||
label index() const
|
label index() const
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the index of this patch in the surface mesh for modification
|
//- Modifiable index of this patch/zone in the surface mesh
|
||||||
label& index()
|
label& index()
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write
|
//- Write (geometricType) dictionary entry
|
||||||
|
//- (without surrounding braces)
|
||||||
|
// \warning Prior to 2020-01 was identical to operator<< output
|
||||||
void write(Ostream& os) const;
|
void write(Ostream& os) const;
|
||||||
|
|
||||||
//- Write dictionary
|
|
||||||
void writeDict(Ostream& os) const;
|
|
||||||
|
|
||||||
|
// Housekeeping
|
||||||
|
|
||||||
// Ostream Operator
|
//- Removed(2020-01) Construct from Istream
|
||||||
|
// \deprecated(2020-01) - unused, inconsistent
|
||||||
|
geometricSurfacePatch(Istream& is, const label index) = delete;
|
||||||
|
|
||||||
friend Istream& operator>>(Istream& is, geometricSurfacePatch& p);
|
//- Deprecated(2020-01) Construct from components
|
||||||
friend Ostream& operator<<(Ostream& os, const geometricSurfacePatch& p);
|
// \deprecated(2020-01) - order inconsistent with other identifiers
|
||||||
|
geometricSurfacePatch
|
||||||
|
(
|
||||||
|
const word& geometricType,
|
||||||
|
const word& name,
|
||||||
|
const label index
|
||||||
|
) FOAM_DEPRECATED(2020-01);
|
||||||
|
|
||||||
|
//- Deprecated(2020-01) Write dictionary
|
||||||
|
// \deprecated(2020-01) - Write dictionary
|
||||||
|
void FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
|
||||||
|
writeDict(Ostream& os) const
|
||||||
|
{
|
||||||
|
write(os);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -194,6 +203,13 @@ bool operator==(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
|
|||||||
bool operator!=(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
|
bool operator!=(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
|
||||||
|
|
||||||
|
|
||||||
|
//- Read name, geometricType
|
||||||
|
Istream& operator>>(Istream& is, geometricSurfacePatch& obj);
|
||||||
|
|
||||||
|
//- Write name, geometricType. Entries are quoted to support empty words.
|
||||||
|
Ostream& operator<<(Ostream& os, const geometricSurfacePatch& obj);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -27,6 +27,7 @@ Typedef
|
|||||||
Foam::geometricSurfacePatchList
|
Foam::geometricSurfacePatchList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A List of geometricSurfacePatch.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
typedef List<geometricSurfacePatch> geometricSurfacePatchList;
|
typedef List<geometricSurfacePatch> geometricSurfacePatchList;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,9 +29,27 @@ License
|
|||||||
#include "surfZoneIdentifier.H"
|
#include "surfZoneIdentifier.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::word Foam::surfZoneIdentifier::emptyType = "empty";
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
static inline word readOptionalWord(Istream& is)
|
||||||
|
{
|
||||||
|
token tok(is);
|
||||||
|
|
||||||
|
if (tok.isWord())
|
||||||
|
{
|
||||||
|
return tok.wordToken();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Allow empty words
|
||||||
|
return word::validate(tok.stringToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -52,6 +70,18 @@ Foam::surfZoneIdentifier::surfZoneIdentifier(const label index)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::surfZoneIdentifier::surfZoneIdentifier
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label index
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
index_(index),
|
||||||
|
geometricType_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfZoneIdentifier::surfZoneIdentifier
|
Foam::surfZoneIdentifier::surfZoneIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -105,7 +135,11 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b)
|
bool Foam::operator==
|
||||||
|
(
|
||||||
|
const surfZoneIdentifier& a,
|
||||||
|
const surfZoneIdentifier& b
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
@ -116,7 +150,11 @@ bool Foam::operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b)
|
bool Foam::operator!=
|
||||||
|
(
|
||||||
|
const surfZoneIdentifier& a,
|
||||||
|
const surfZoneIdentifier& b
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return !(a == b);
|
return !(a == b);
|
||||||
}
|
}
|
||||||
@ -126,15 +164,24 @@ bool Foam::operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b)
|
|||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
|
Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
|
||||||
{
|
{
|
||||||
is >> obj.name() >> obj.geometricType();
|
obj.name() = readOptionalWord(is);
|
||||||
|
obj.geometricType() = readOptionalWord(is);
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj)
|
||||||
{
|
{
|
||||||
// Newlines to separate, since that is what triSurface currently expects
|
// Force unconditional line-breaks on list output.
|
||||||
os << nl << obj.name() << nl << obj.geometricType();
|
// We otherwise risk extremely unreadable entries
|
||||||
|
os << nl;
|
||||||
|
|
||||||
|
// Empty words are double-quoted so they are treated as 'string'
|
||||||
|
|
||||||
|
os.writeQuoted(obj.name(), obj.name().empty()) << token::SPACE;
|
||||||
|
os.writeQuoted(obj.geometricType(), obj.geometricType().empty());
|
||||||
|
|
||||||
os.check(FUNCTION_NAME);
|
os.check(FUNCTION_NAME);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,13 +43,14 @@ SourceFiles
|
|||||||
|
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
|
#include "stdFoam.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
class dictionary;
|
class dictionary;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -58,7 +59,7 @@ class dictionary;
|
|||||||
|
|
||||||
class surfZoneIdentifier
|
class surfZoneIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Name of zone
|
//- Name of zone
|
||||||
word name_;
|
word name_;
|
||||||
@ -69,29 +70,40 @@ class surfZoneIdentifier
|
|||||||
//- Type name of zone
|
//- Type name of zone
|
||||||
mutable word geometricType_;
|
mutable word geometricType_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public data
|
// Public Data
|
||||||
|
|
||||||
//- The name for an 'empty' type
|
//- The name for an 'empty' type
|
||||||
static const word emptyType;
|
static constexpr const char* const emptyType = "empty";
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
surfZoneIdentifier(const surfZoneIdentifier&) = default;
|
||||||
|
|
||||||
|
//- Copy assignment
|
||||||
|
surfZoneIdentifier& operator=(const surfZoneIdentifier&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null, with index zero
|
//- Default construct, with index zero
|
||||||
surfZoneIdentifier();
|
surfZoneIdentifier();
|
||||||
|
|
||||||
//- Construct null with specified index
|
//- Construct null with specified index
|
||||||
explicit surfZoneIdentifier(const label index);
|
explicit surfZoneIdentifier(const label index);
|
||||||
|
|
||||||
|
//- Construct from mandatory components
|
||||||
|
surfZoneIdentifier(const word& name, const label index);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
surfZoneIdentifier
|
surfZoneIdentifier
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const label index,
|
const label index,
|
||||||
const word& geometricType = word::null
|
const word& geometricType
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
@ -102,7 +114,7 @@ public:
|
|||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct from another zone identifier, resetting the index
|
//- Copy construct, resetting the index
|
||||||
surfZoneIdentifier
|
surfZoneIdentifier
|
||||||
(
|
(
|
||||||
const surfZoneIdentifier& p,
|
const surfZoneIdentifier& p,
|
||||||
@ -110,64 +122,52 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~surfZoneIdentifier() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name
|
//- The patch/zone name
|
||||||
const word& name() const
|
const word& name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return name for modification
|
//- Modifiable patch/zone name
|
||||||
word& name()
|
word& name()
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the patch/zone
|
//- The geometric type of the patch/zone
|
||||||
const word& geometricType() const
|
const word& geometricType() const
|
||||||
{
|
{
|
||||||
return geometricType_;
|
return geometricType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the patch/zone for modification
|
//- Modifiable geometric type of the patch/zone
|
||||||
word& geometricType()
|
word& geometricType()
|
||||||
{
|
{
|
||||||
return geometricType_;
|
return geometricType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the index of this patch/zone in the surface mesh
|
//- The index of this patch/zone in the surface mesh
|
||||||
label index() const
|
label index() const
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the index of this patch/zone for modification
|
//- Modifiable index of this patch/zone in the surface mesh
|
||||||
label& index()
|
label& index()
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Write (geometricType) dictionary entry
|
||||||
//- Write identifier as a dictionary
|
//- (without surrounding braces)
|
||||||
void write(Ostream& os) const;
|
void write(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Global Operators
|
// Global Operators
|
||||||
|
|
||||||
// Ostream Operator
|
|
||||||
|
|
||||||
//- Read name/type
|
|
||||||
Istream& operator>>(Istream& is, surfZoneIdentifier& obj);
|
|
||||||
|
|
||||||
//- Write name/type
|
|
||||||
Ostream& operator<<(Ostream& os, const surfZoneIdentifier& obj);
|
|
||||||
|
|
||||||
//- Compare zone indentifiers for equality
|
//- Compare zone indentifiers for equality
|
||||||
bool operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
|
bool operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
|
||||||
|
|
||||||
@ -175,6 +175,13 @@ bool operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
|
|||||||
bool operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
|
bool operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
|
||||||
|
|
||||||
|
|
||||||
|
//- Read name, geometricType
|
||||||
|
Istream& operator>>(Istream& is, surfZoneIdentifier& obj);
|
||||||
|
|
||||||
|
//- Write name, geometricType. Entries are quoted to support empty words.
|
||||||
|
Ostream& operator<<(Ostream& os, const surfZoneIdentifier& obj);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -27,6 +27,7 @@ Typedef
|
|||||||
Foam::surfZoneIdentifierList
|
Foam::surfZoneIdentifierList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A List of surfZoneIdentifier.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
typedef List<surfZoneIdentifier> surfZoneIdentifierList;
|
typedef List<surfZoneIdentifier> surfZoneIdentifierList;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -781,9 +782,9 @@ void Foam::boundaryMesh::writeTriSurface(const fileName& fName) const
|
|||||||
surfPatches[patchi] =
|
surfPatches[patchi] =
|
||||||
geometricSurfacePatch
|
geometricSurfacePatch
|
||||||
(
|
(
|
||||||
bp.physicalType(),
|
|
||||||
bp.name(),
|
bp.name(),
|
||||||
patchi
|
patchi,
|
||||||
|
bp.physicalType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
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)
|
Foam::boundaryPatch::boundaryPatch(const boundaryPatch& p, const label index)
|
||||||
:
|
:
|
||||||
patchIdentifier(p.name(), index, p.physicalType()),
|
boundaryPatch(p)
|
||||||
size_(p.size()),
|
|
||||||
start_(p.start())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::boundaryPatch> Foam::boundaryPatch::clone() const
|
|
||||||
{
|
{
|
||||||
return autoPtr<boundaryPatch>::New(*this);
|
patchIdentifier::index() = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::boundaryPatch::~boundaryPatch()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::boundaryPatch::write(Ostream& os) const
|
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)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& p)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,8 +28,9 @@ Class
|
|||||||
Foam::boundaryPatch
|
Foam::boundaryPatch
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Like polyPatch but without reference to mesh. patchIdentifier::index
|
Like polyPatch but without reference to mesh.
|
||||||
is not used. Used in boundaryMesh to hold data on patches.
|
Used in boundaryMesh to hold data on patches.
|
||||||
|
The patchIdentifier::index is set, but not used.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
boundaryPatch.C
|
boundaryPatch.C
|
||||||
@ -46,28 +48,25 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
|
|
||||||
class boundaryPatch;
|
|
||||||
|
|
||||||
Ostream& operator<<(Ostream&, const boundaryPatch&);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class boundaryPatch Declaration
|
Class boundaryPatch Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class boundaryPatch
|
class boundaryPatch
|
||||||
:
|
:
|
||||||
public patchIdentifier
|
public patchIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
label size_;
|
label size_;
|
||||||
|
|
||||||
label start_;
|
label start_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Generated Methods: copy construct, copy assignment
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
@ -88,18 +87,15 @@ public:
|
|||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Copy construct, resetting the index
|
||||||
boundaryPatch(const boundaryPatch&);
|
boundaryPatch(const boundaryPatch& p, const label index);
|
||||||
|
|
||||||
//- Construct as copy, resetting the index
|
|
||||||
boundaryPatch(const boundaryPatch&, const label index);
|
|
||||||
|
|
||||||
//- Clone
|
//- Clone
|
||||||
autoPtr<boundaryPatch> clone() const;
|
autoPtr<boundaryPatch> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<boundaryPatch>::New(*this);
|
||||||
//- Destructor
|
}
|
||||||
~boundaryPatch();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -125,16 +121,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Write dictionary
|
//- Write dictionary entries (without surrounding braces)
|
||||||
virtual void write(Ostream&) const;
|
virtual void write(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
// Ostream Operator
|
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const boundaryPatch&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Write boundaryPatch as dictionary entries (without surrounding braces)
|
||||||
|
Ostream& operator<<(Ostream&, const boundaryPatch& p);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -1019,7 +1019,7 @@ Foam::triSurface Foam::isoSurface::stitchTriPoints
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
triSurface surf(tris, geometricSurfacePatchList(0), newPoints);
|
triSurface surf(tris, geometricSurfacePatchList(), newPoints);
|
||||||
|
|
||||||
forAll(surf, facei)
|
forAll(surf, facei)
|
||||||
{
|
{
|
||||||
@ -1054,7 +1054,7 @@ Foam::triSurface Foam::isoSurface::stitchTriPoints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return triSurface(tris, geometricSurfacePatchList(0), newPoints, true);
|
return triSurface(tris, geometricSurfacePatchList(), newPoints, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -340,7 +340,7 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface
|
|||||||
triSurface surf
|
triSurface surf
|
||||||
(
|
(
|
||||||
localTris,
|
localTris,
|
||||||
geometricSurfacePatchList(0),
|
geometricSurfacePatchList(),
|
||||||
localPoints,
|
localPoints,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -1053,7 +1053,7 @@ Foam::triSurface Foam::isoSurfaceCell::stitchTriPoints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return triSurface(tris, geometricSurfacePatchList(0), newPoints, true);
|
return triSurface(tris, geometricSurfacePatchList(), newPoints, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,15 +28,6 @@ License
|
|||||||
|
|
||||||
#include "surfZone.H"
|
#include "surfZone.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "word.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(surfZone, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -71,19 +62,6 @@ Foam::surfZone::surfZone
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfZone::surfZone(Istream& is, const label index)
|
|
||||||
:
|
|
||||||
surfZoneIdentifier(),
|
|
||||||
size_(0),
|
|
||||||
start_(0)
|
|
||||||
{
|
|
||||||
word name(is);
|
|
||||||
dictionary dict(is);
|
|
||||||
|
|
||||||
operator=(surfZone(name, dict, index));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::surfZone::surfZone
|
Foam::surfZone::surfZone
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -97,31 +75,17 @@ Foam::surfZone::surfZone
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfZone::surfZone(const surfZone& zone)
|
|
||||||
:
|
|
||||||
surfZoneIdentifier(zone, zone.index()),
|
|
||||||
size_(zone.size()),
|
|
||||||
start_(zone.start())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::surfZone::surfZone(const surfZone& zone, const label index)
|
Foam::surfZone::surfZone(const surfZone& zone, const label index)
|
||||||
:
|
:
|
||||||
surfZoneIdentifier(zone, index),
|
surfZone(zone)
|
||||||
size_(zone.size()),
|
{
|
||||||
start_(zone.start())
|
surfZoneIdentifier::index() = index;
|
||||||
{}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::surfZone::write(Ostream& os) const
|
void Foam::surfZone::write(Ostream& os) const
|
||||||
{
|
|
||||||
writeDict(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::surfZone::writeDict(Ostream& os) const
|
|
||||||
{
|
{
|
||||||
os.beginBlock(name());
|
os.beginBlock(name());
|
||||||
|
|
||||||
@ -133,39 +97,44 @@ void Foam::surfZone::writeDict(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::surfZone::operator!=(const surfZone& rhs) const
|
bool Foam::operator==(const surfZone& a, const surfZone& b)
|
||||||
{
|
|
||||||
return !(*this == rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::surfZone::operator==(const surfZone& rhs) const
|
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
size() == rhs.size()
|
a.size() == b.size()
|
||||||
&& start() == rhs.start()
|
&& a.start() == b.start()
|
||||||
&& geometricType() == rhs.geometricType()
|
&& a.geometricType() == b.geometricType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
bool Foam::operator!=(const surfZone& a, const surfZone& b)
|
||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, surfZone& zone)
|
|
||||||
{
|
{
|
||||||
zone = surfZone(is, 0);
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Istream& Foam::operator>>(Istream& is, surfZone& obj)
|
||||||
|
{
|
||||||
|
const word name(is);
|
||||||
|
const dictionary dict(is);
|
||||||
|
|
||||||
|
// Could also leave index untouched?
|
||||||
|
obj = surfZone(name, dict, 0);
|
||||||
|
|
||||||
is.check(FUNCTION_NAME);
|
is.check(FUNCTION_NAME);
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZone& zone)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZone& obj)
|
||||||
{
|
{
|
||||||
zone.write(os);
|
obj.write(os);
|
||||||
|
|
||||||
os.check(FUNCTION_NAME);
|
os.check(FUNCTION_NAME);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,9 +40,6 @@ SourceFiles
|
|||||||
#ifndef surfZone_H
|
#ifndef surfZone_H
|
||||||
#define surfZone_H
|
#define surfZone_H
|
||||||
|
|
||||||
#include "word.H"
|
|
||||||
#include "label.H"
|
|
||||||
#include "className.H"
|
|
||||||
#include "surfZoneIdentifier.H"
|
#include "surfZoneIdentifier.H"
|
||||||
#include "labelRange.H"
|
#include "labelRange.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
@ -53,12 +50,6 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
class surfZone;
|
|
||||||
|
|
||||||
Istream& operator>>(Istream&, surfZone&);
|
|
||||||
Ostream& operator<<(Ostream&, const surfZone&);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfZone Declaration
|
Class surfZone Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -67,7 +58,7 @@ class surfZone
|
|||||||
:
|
:
|
||||||
public surfZoneIdentifier
|
public surfZoneIdentifier
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Size of this group in the face list
|
//- Size of this group in the face list
|
||||||
label size_;
|
label size_;
|
||||||
@ -78,13 +69,18 @@ class surfZone
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
// Generated Methods
|
||||||
ClassName("surfZone");
|
|
||||||
|
//- Copy construct
|
||||||
|
surfZone(const surfZone&) = default;
|
||||||
|
|
||||||
|
//- Copy assignment
|
||||||
|
surfZone& operator=(const surfZone&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null with zero start, size, index
|
//- Default construct, with zero start, size, index
|
||||||
surfZone();
|
surfZone();
|
||||||
|
|
||||||
//- Construct with name, size. With zero start, index
|
//- Construct with name, size. With zero start, index
|
||||||
@ -100,9 +96,6 @@ public:
|
|||||||
const word& geometricType = word::null
|
const word& geometricType = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
|
||||||
surfZone(Istream& is, const label index);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
surfZone
|
surfZone
|
||||||
(
|
(
|
||||||
@ -111,10 +104,7 @@ public:
|
|||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Copy construct, resetting the index
|
||||||
surfZone(const surfZone&);
|
|
||||||
|
|
||||||
//- Construct from another zone, resetting the index
|
|
||||||
surfZone(const surfZone&, const label index);
|
surfZone(const surfZone&, const label index);
|
||||||
|
|
||||||
//- Return clone
|
//- Return clone
|
||||||
@ -126,8 +116,8 @@ public:
|
|||||||
|
|
||||||
static autoPtr<surfZone> New(Istream& is)
|
static autoPtr<surfZone> New(Istream& is)
|
||||||
{
|
{
|
||||||
word name(is);
|
const word name(is);
|
||||||
dictionary dict(is);
|
const dictionary dict(is);
|
||||||
|
|
||||||
return autoPtr<surfZone>::New(name, dict, 0);
|
return autoPtr<surfZone>::New(name, dict, 0);
|
||||||
}
|
}
|
||||||
@ -135,58 +125,73 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return start label of this zone in the face list
|
//- The start label of this zone in the face list
|
||||||
label start() const
|
label start() const
|
||||||
{
|
{
|
||||||
return start_;
|
return start_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return start label of this zone in the face list
|
//- Modifiable start label of this zone in the face list
|
||||||
label& start()
|
label& start()
|
||||||
{
|
{
|
||||||
return start_;
|
return start_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return size of this zone in the face list
|
//- The size of this zone in the face list
|
||||||
label size() const
|
label size() const
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return size of this zone in the face list
|
//- Modifiable size of this zone in the face list
|
||||||
label& size()
|
label& size()
|
||||||
{
|
{
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return start/size range of this zone
|
//- The start/size range of this zone
|
||||||
labelRange range() const
|
labelRange range() const
|
||||||
{
|
{
|
||||||
return labelRange(start_, size_);
|
return labelRange(start_, size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write
|
//- Write dictionary, includes surrounding braces
|
||||||
void write(Ostream&) const;
|
// \warning Prior to 2020-01 was identical to operator<< output
|
||||||
|
void write(Ostream& os) const;
|
||||||
//- Write dictionary
|
|
||||||
void writeDict(Ostream&) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Housekeeping
|
||||||
|
|
||||||
bool operator!=(const surfZone&) const;
|
//- Removed(2020-01) Construct from Istream
|
||||||
|
// \deprecated(2020-01) - unused, inconsistent
|
||||||
|
surfZone(Istream& is, const label index) = delete;
|
||||||
|
|
||||||
//- compare.
|
//- Deprecated(2020-01) Write dictionary
|
||||||
bool operator==(const surfZone&) const;
|
// \deprecated(2020-01) - Write dictionary
|
||||||
|
void FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
|
||||||
|
writeDict(Ostream& os) const
|
||||||
// IOstream Operators
|
{
|
||||||
|
write(os);
|
||||||
friend Istream& operator>>(Istream&, surfZone&);
|
}
|
||||||
friend Ostream& operator<<(Ostream&, const surfZone&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Compare surfZones for equality
|
||||||
|
bool operator==(const surfZone& a, const surfZone& b);
|
||||||
|
|
||||||
|
//- Compare surfZones for inequality
|
||||||
|
bool operator!=(const surfZone& a, const surfZone& b);
|
||||||
|
|
||||||
|
|
||||||
|
//- Read as dictionary
|
||||||
|
Istream& operator>>(Istream& is, surfZone& obj);
|
||||||
|
|
||||||
|
//- Write as dictionary
|
||||||
|
Ostream& operator<<(Ostream&, const surfZone& obj);
|
||||||
|
|
||||||
|
|
||||||
// Global Functions
|
// Global Functions
|
||||||
|
|
||||||
//- The labelRange of a surfZone
|
//- The labelRange of a surfZone
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,7 +32,7 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(surfZoneIOList, 0);
|
defineTypeName(surfZoneIOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -57,40 +57,28 @@ Foam::surfZoneIOList::surfZoneIOList
|
|||||||
Istream& is = readStream(typeName);
|
Istream& is = readStream(typeName);
|
||||||
|
|
||||||
PtrList<entry> dictEntries(is);
|
PtrList<entry> dictEntries(is);
|
||||||
zones.setSize(dictEntries.size());
|
zones.resize(dictEntries.size());
|
||||||
|
|
||||||
label facei = 0;
|
label facei = 0;
|
||||||
forAll(zones, zoneI)
|
forAll(zones, zonei)
|
||||||
{
|
{
|
||||||
const dictionary& dict = dictEntries[zoneI].dict();
|
zones[zonei] = surfZone
|
||||||
|
|
||||||
const label zoneSize = dict.get<label>("nFaces");
|
|
||||||
const label startFacei = dict.get<label>("startFace");
|
|
||||||
|
|
||||||
zones[zoneI] = surfZone
|
|
||||||
(
|
(
|
||||||
dictEntries[zoneI].keyword(),
|
dictEntries[zonei].keyword(),
|
||||||
zoneSize,
|
dictEntries[zonei].dict(),
|
||||||
startFacei,
|
zonei
|
||||||
zoneI
|
|
||||||
);
|
);
|
||||||
|
|
||||||
word geoType;
|
if (zones[zonei].start() != facei)
|
||||||
if (dict.readIfPresent("geometricType", geoType))
|
|
||||||
{
|
|
||||||
zones[zoneI].geometricType() = geoType;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startFacei != facei)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "surfZones are not ordered. Start of zone " << zoneI
|
<< "surfZones are not ordered. Start of zone " << zonei
|
||||||
<< " does not correspond to sum of preceding zones." << nl
|
<< " does not correspond to sum of preceding zones." << nl
|
||||||
<< "while reading " << io.objectPath() << endl
|
<< "while reading " << io.objectPath() << endl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
facei += zoneSize;
|
facei += zones[zonei].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
is.check(FUNCTION_NAME);
|
is.check(FUNCTION_NAME);
|
||||||
@ -125,7 +113,26 @@ Foam::surfZoneIOList::surfZoneIOList
|
|||||||
|
|
||||||
bool Foam::surfZoneIOList::writeData(Ostream& os) const
|
bool Foam::surfZoneIOList::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
return (os << *this).good();
|
const surfZoneList& zones = *this;
|
||||||
|
const label sz = zones.size();
|
||||||
|
|
||||||
|
if (sz)
|
||||||
|
{
|
||||||
|
os << sz << nl << token::BEGIN_LIST << incrIndent << nl;
|
||||||
|
|
||||||
|
for (const surfZone& zn : zones)
|
||||||
|
{
|
||||||
|
zn.write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
os << decrIndent << token::END_LIST;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << sz << token::BEGIN_LIST << token::END_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
return os.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,18 +144,11 @@ void Foam::surfZoneIOList::operator=(const surfZoneIOList& rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIOList& list)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIOList& zones)
|
||||||
{
|
{
|
||||||
os << list.size() << nl << token::BEGIN_LIST << incrIndent << nl;
|
zones.writeData(os);
|
||||||
|
|
||||||
for (const surfZone& item : list)
|
|
||||||
{
|
|
||||||
item.writeDict(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
os << decrIndent << token::END_LIST;
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,21 +40,13 @@ SourceFiles
|
|||||||
|
|
||||||
#include "surfZoneList.H"
|
#include "surfZoneList.H"
|
||||||
#include "regIOobject.H"
|
#include "regIOobject.H"
|
||||||
#include "faceList.H"
|
#include "typeInfo.H"
|
||||||
#include "className.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
|
|
||||||
class surfZoneIOList;
|
|
||||||
|
|
||||||
Ostream& operator<<(Ostream&, const surfZoneIOList&);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfZoneIOList Declaration
|
Class surfZoneIOList Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -67,7 +59,7 @@ class surfZoneIOList
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("surfZoneList");
|
TypeNameNoDebug("surfZoneList");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -88,7 +80,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- The writeData function for regIOobject
|
//- The writeData function - required by regIOobject
|
||||||
bool writeData(Ostream& os) const;
|
bool writeData(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
@ -99,14 +91,15 @@ public:
|
|||||||
|
|
||||||
//- Copy or move assignment of entries
|
//- Copy or move assignment of entries
|
||||||
using surfZoneList::operator=;
|
using surfZoneList::operator=;
|
||||||
|
|
||||||
|
|
||||||
// IOstream Operators
|
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream& os, const surfZoneIOList& list);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Write surfZone list using its writeData() method
|
||||||
|
Ostream& operator<<(Ostream& os, const surfZoneIOList& zones);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,28 +29,18 @@ License
|
|||||||
#include "surfacePatch.H"
|
#include "surfacePatch.H"
|
||||||
#include "surfZone.H"
|
#include "surfZone.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "word.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(surfacePatch, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfacePatch::surfacePatch()
|
Foam::surfacePatch::surfacePatch()
|
||||||
:
|
:
|
||||||
geometricSurfacePatch(word::null, word::null, -1),
|
surfacePatch(-1)
|
||||||
size_(0),
|
|
||||||
start_(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfacePatch::surfacePatch(const label index)
|
Foam::surfacePatch::surfacePatch(const label index)
|
||||||
:
|
:
|
||||||
geometricSurfacePatch(word::null, word::null, index),
|
geometricSurfacePatch(word::null, index, word::null),
|
||||||
size_(0),
|
size_(0),
|
||||||
start_(0)
|
start_(0)
|
||||||
{}
|
{}
|
||||||
@ -58,29 +48,19 @@ Foam::surfacePatch::surfacePatch(const label index)
|
|||||||
|
|
||||||
Foam::surfacePatch::surfacePatch
|
Foam::surfacePatch::surfacePatch
|
||||||
(
|
(
|
||||||
const word& geometricType,
|
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label size,
|
||||||
const label start,
|
const label start,
|
||||||
const label index
|
const label index,
|
||||||
|
const word& geometricType
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometricSurfacePatch(geometricType, name, index),
|
geometricSurfacePatch(name, index, geometricType),
|
||||||
size_(size),
|
size_(size),
|
||||||
start_(start)
|
start_(start)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfacePatch::surfacePatch(Istream& is, const label index)
|
|
||||||
:
|
|
||||||
geometricSurfacePatch(is, index),
|
|
||||||
size_(0),
|
|
||||||
start_(0)
|
|
||||||
{
|
|
||||||
is >> size_ >> start_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::surfacePatch::surfacePatch
|
Foam::surfacePatch::surfacePatch
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -94,32 +74,18 @@ Foam::surfacePatch::surfacePatch
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::surfacePatch::surfacePatch(const surfacePatch& sp)
|
|
||||||
:
|
|
||||||
geometricSurfacePatch(sp),
|
|
||||||
size_(sp.size()),
|
|
||||||
start_(sp.start())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::surfacePatch::write(Ostream& os) const
|
void Foam::surfacePatch::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << nl
|
os.beginBlock(name());
|
||||||
<< static_cast<const geometricSurfacePatch&>(*this) << endl
|
|
||||||
<< size() << tab << start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Foam::surfacePatch::writeDict(Ostream& os) const
|
geometricSurfacePatch::write(os);
|
||||||
{
|
|
||||||
os << nl << name() << nl << token::BEGIN_BLOCK << nl;
|
|
||||||
|
|
||||||
geometricSurfacePatch::writeDict(os);
|
os.writeEntry("nFaces", size());
|
||||||
|
os.writeEntry("startFace", start());
|
||||||
|
|
||||||
os << " nFaces " << size() << ';' << nl
|
os.endBlock();
|
||||||
<< " startFace " << start() << ';' << nl
|
|
||||||
<< token::END_BLOCK << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,31 +104,59 @@ Foam::surfacePatch::operator Foam::surfZone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::surfacePatch::operator!=(const surfacePatch& p) const
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
{
|
|
||||||
return !(*this == p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bool Foam::operator==
|
||||||
bool Foam::surfacePatch::operator==(const surfacePatch& p) const
|
(
|
||||||
|
const surfacePatch& a,
|
||||||
|
const surfacePatch& b
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
(geometricType() == p.geometricType())
|
(a.geometricType() == b.geometricType())
|
||||||
&& (size() == p.size())
|
&& (a.size() == b.size())
|
||||||
&& (start() == p.start())
|
&& (a.start() == b.start())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
bool Foam::operator!=
|
||||||
|
(
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatch& p)
|
const surfacePatch& a,
|
||||||
|
const surfacePatch& b
|
||||||
|
)
|
||||||
{
|
{
|
||||||
p.write(os);
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatch& obj)
|
||||||
|
{
|
||||||
|
os << static_cast<const geometricSurfacePatch&>(obj) << token::SPACE
|
||||||
|
<< obj.size() << token::SPACE
|
||||||
|
<< obj.start();
|
||||||
|
|
||||||
os.check(FUNCTION_NAME);
|
os.check(FUNCTION_NAME);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Housekeeping * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::surfacePatch::surfacePatch
|
||||||
|
(
|
||||||
|
const word& geometricType,
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index
|
||||||
|
)
|
||||||
|
:
|
||||||
|
surfacePatch(name, size, start, index, geometricType)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,7 +28,7 @@ Class
|
|||||||
Foam::surfacePatch
|
Foam::surfacePatch
|
||||||
|
|
||||||
Description
|
Description
|
||||||
'Patch' on surface as subset of triSurface.
|
A 'patch' on surface as subset of triSurface.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfacePatch.C
|
surfacePatch.C
|
||||||
@ -39,21 +39,15 @@ SourceFiles
|
|||||||
#define surfacePatch_H
|
#define surfacePatch_H
|
||||||
|
|
||||||
#include "geometricSurfacePatch.H"
|
#include "geometricSurfacePatch.H"
|
||||||
#include "className.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward Declarations
|
||||||
|
|
||||||
class surfacePatch;
|
|
||||||
class surfZone;
|
class surfZone;
|
||||||
|
|
||||||
Ostream& operator<<(Ostream&, const surfacePatch&);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class surfacePatch Declaration
|
Class surfacePatch Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -62,23 +56,29 @@ class surfacePatch
|
|||||||
:
|
:
|
||||||
public geometricSurfacePatch
|
public geometricSurfacePatch
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Size of this patch in the triSurface face list
|
//- Size of this patch in the face list
|
||||||
label size_;
|
label size_;
|
||||||
|
|
||||||
//- Start label of this patch in the triSurface face list
|
//- Start label of this patch in the face list
|
||||||
label start_;
|
label start_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
// Generated Methods
|
||||||
ClassName("surfacePatch");
|
|
||||||
|
//- Copy construct
|
||||||
|
surfacePatch(const surfacePatch&) = default;
|
||||||
|
|
||||||
|
//- Copy assignment
|
||||||
|
surfacePatch& operator=(const surfacePatch&) = default;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct, with zero start, size, index=-1
|
||||||
surfacePatch();
|
surfacePatch();
|
||||||
|
|
||||||
//- Construct null with specified index
|
//- Construct null with specified index
|
||||||
@ -87,16 +87,13 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
surfacePatch
|
surfacePatch
|
||||||
(
|
(
|
||||||
const word& geometricType,
|
|
||||||
const word& name,
|
const word& name,
|
||||||
const label size,
|
const label size,
|
||||||
const label start,
|
const label start,
|
||||||
const label index
|
const label index,
|
||||||
|
const word& geometricType = word::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
|
||||||
surfacePatch(Istream& is, const label index);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
surfacePatch
|
surfacePatch
|
||||||
(
|
(
|
||||||
@ -105,9 +102,6 @@ public:
|
|||||||
const label index
|
const label index
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
surfacePatch(const surfacePatch&);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
@ -135,11 +129,9 @@ public:
|
|||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write
|
//- Write dictionary, includes surrounding braces
|
||||||
void write(Ostream&) const;
|
// \warning Prior to 2020-01 was identical to operator<< output
|
||||||
|
void write(Ostream& os) const;
|
||||||
//- Write dictionary
|
|
||||||
void writeDict(Ostream&) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -148,19 +140,45 @@ public:
|
|||||||
explicit operator surfZone() const;
|
explicit operator surfZone() const;
|
||||||
|
|
||||||
|
|
||||||
//- Compare.
|
// Housekeeping
|
||||||
bool operator!=(const surfacePatch&) const;
|
|
||||||
|
|
||||||
//- Compare.
|
//- Removed(2020-01) Construct from Istream
|
||||||
bool operator==(const surfacePatch&) const;
|
// \deprecated(2020-01) - unused, inconsistent
|
||||||
|
surfacePatch(Istream& is, const label index) = delete;
|
||||||
|
|
||||||
|
//- Deprecated(2020-01) Construct from components
|
||||||
|
// \deprecated(2020-01) - order inconsistent with other identifiers
|
||||||
|
surfacePatch
|
||||||
|
(
|
||||||
|
const word& geometricType,
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index
|
||||||
|
) FOAM_DEPRECATED(2020-01);
|
||||||
|
|
||||||
// IOstream Operators
|
//- Deprecated(2020-01) Ostream output
|
||||||
|
// \deprecated(2020-01) - Ostream output
|
||||||
friend Ostream& operator<<(Ostream&, const surfacePatch&);
|
void FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
|
||||||
|
writeDict(Ostream& os) const
|
||||||
|
{
|
||||||
|
write(os);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Global Operators
|
||||||
|
|
||||||
|
//- Compare patches for equality
|
||||||
|
bool operator==(const surfacePatch& a, const surfacePatch& b);
|
||||||
|
|
||||||
|
//- Compare patches for inequality
|
||||||
|
bool operator!=(const surfacePatch& a, const surfacePatch& b);
|
||||||
|
|
||||||
|
//- Write name, geometricType, size, start
|
||||||
|
Ostream& operator<<(Ostream& os, const surfacePatch& obj);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -27,6 +27,7 @@ Typedef
|
|||||||
Foam::surfacePatchList
|
Foam::surfacePatchList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
A List of surfacePatch.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
typedef List<surfacePatch> surfacePatchList;
|
typedef List<surfacePatch> surfacePatchList;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -371,7 +371,7 @@ Foam::triSurface::calcPatches(labelList& faceMap) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newPatch.geometricType() = geometricSurfacePatch::emptyType;
|
newPatch.geometricType() = surfacePatch::emptyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
startFacei += newPatch.size();
|
startFacei += newPatch.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user