mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: minor adjustments to surfZoneIdentifier
- gearing to make it more reusable in triSurface
This commit is contained in:
@ -116,7 +116,7 @@ void Foam::surfZone::writeDict(Ostream& os) const
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||
|
||||
surfZoneIdentifier::write(os);
|
||||
os.writeKeyword("nFaces") << size() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("nFaces") << size() << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("startFace") << start() << token::END_STATEMENT << nl;
|
||||
|
||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||
@ -135,7 +135,7 @@ bool Foam::surfZone::operator==(const surfZone& rhs) const
|
||||
{
|
||||
return
|
||||
(
|
||||
size() == rhs.size()
|
||||
size() == rhs.size()
|
||||
&& start() == rhs.start()
|
||||
&& geometricType() == rhs.geometricType()
|
||||
);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,13 +26,26 @@ License
|
||||
#include "surfZoneIdentifier.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word Foam::surfZoneIdentifier::emptyType = "empty";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfZoneIdentifier::surfZoneIdentifier()
|
||||
:
|
||||
name_(word::null),
|
||||
name_(),
|
||||
index_(0),
|
||||
geometricType_(word::null)
|
||||
geometricType_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfZoneIdentifier::surfZoneIdentifier(label index)
|
||||
:
|
||||
name_(),
|
||||
index_(index),
|
||||
geometricType_()
|
||||
{}
|
||||
|
||||
|
||||
@ -57,7 +70,8 @@ Foam::surfZoneIdentifier::surfZoneIdentifier
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
index_(index)
|
||||
index_(index),
|
||||
geometricType_()
|
||||
{
|
||||
dict.readIfPresent("geometricType", geometricType_);
|
||||
}
|
||||
@ -88,7 +102,8 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
|
||||
{
|
||||
if (geometricType_.size())
|
||||
{
|
||||
os.writeKeyword("geometricType") << geometricType_
|
||||
os.writeKeyword("geometricType")
|
||||
<< geometricType_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
}
|
||||
@ -96,41 +111,46 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
// bool Foam::surfZoneIdentifier::operator!=
|
||||
// (
|
||||
// const surfZoneIdentifier& p
|
||||
// ) const
|
||||
// {
|
||||
// return !(*this == p);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// bool Foam::surfZoneIdentifier::operator==
|
||||
// (
|
||||
// const surfZoneIdentifier& p
|
||||
// ) const
|
||||
// {
|
||||
// return geometricType() == p.geometricType() && name() == p.name();
|
||||
// }
|
||||
// needed for list output
|
||||
|
||||
bool Foam::surfZoneIdentifier::operator!=
|
||||
(
|
||||
const surfZoneIdentifier& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::surfZoneIdentifier::operator==
|
||||
(
|
||||
const surfZoneIdentifier& rhs
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
name() == rhs.name()
|
||||
&& geometricType() == rhs.geometricType()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
// Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& p)
|
||||
// {
|
||||
// is >> p.name_ >> p.geometricType_;
|
||||
//
|
||||
// return is;
|
||||
// }
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& p)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
|
||||
{
|
||||
p.write(os);
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream&, const surfZoneIdentifier&)"
|
||||
);
|
||||
is >> obj.name_
|
||||
>> obj.geometricType_;
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj)
|
||||
{
|
||||
os << obj.name_ << ' ' << obj.geometricType_;
|
||||
|
||||
os.check("Ostream& operator<<(Ostream&, const surfZoneIdentifier&)");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,10 +25,10 @@ Class
|
||||
Foam::surfZoneIdentifier
|
||||
|
||||
Description
|
||||
An identifier for a surface zone on a meshed surface.
|
||||
Identifies a surface patch/zone by name, patch index and geometricType.
|
||||
|
||||
Similar in concept to a faceZone on the surface, but can also have a
|
||||
"geometricType" as well.
|
||||
SeeAlso
|
||||
patchIdentifier
|
||||
|
||||
SourceFiles
|
||||
surfZoneIdentifier.C
|
||||
@ -52,6 +52,7 @@ class dictionary;
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class surfZoneIdentifier;
|
||||
Istream& operator>>(Istream&, surfZoneIdentifier&);
|
||||
Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -74,11 +75,23 @@ class surfZoneIdentifier
|
||||
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- The name for an 'empty' type
|
||||
static const word emptyType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
surfZoneIdentifier();
|
||||
|
||||
//- Construct null with specified index
|
||||
explicit surfZoneIdentifier
|
||||
(
|
||||
const label index
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
surfZoneIdentifier
|
||||
(
|
||||
@ -122,42 +135,57 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return the geometric type of the zone
|
||||
//- Return the geometric type of the patch/zone
|
||||
const word& geometricType() const
|
||||
{
|
||||
return geometricType_;
|
||||
}
|
||||
|
||||
//- Return the geometric type of the zone for modification
|
||||
//- Return the geometric type of the patch/zone for modification
|
||||
word& geometricType()
|
||||
{
|
||||
return geometricType_;
|
||||
}
|
||||
|
||||
//- Return the index of this zone in the surface mesh
|
||||
//- Return the index of this patch/zone in the surface mesh
|
||||
label index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
//- Write surfZoneIdentifier as a dictionary
|
||||
void write(Ostream&) const;
|
||||
//- Return the index of this patch/zone for modification
|
||||
label& index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
|
||||
//- Write surfZoneIdentifier as a dictionary
|
||||
// void writeDict(Ostream&) const;
|
||||
void write(Ostream&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
// bool operator!=(const surfZoneIdentifier&) const;
|
||||
//
|
||||
// //- compare.
|
||||
// bool operator==(const surfZoneIdentifier&) const;
|
||||
bool operator!=(const surfZoneIdentifier&) const;
|
||||
bool operator==(const surfZoneIdentifier&) const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
|
||||
// friend Istream& operator>>(Istream&, surfZoneIdentifier&);
|
||||
//- Read name/type.
|
||||
friend Istream& operator>>
|
||||
(
|
||||
Istream&,
|
||||
surfZoneIdentifier&
|
||||
);
|
||||
|
||||
//- Write name/type.
|
||||
friend Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const surfZoneIdentifier&
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user