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;
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
surfZoneIdentifier::write(os);
|
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.writeKeyword("startFace") << start() << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
@ -135,7 +135,7 @@ bool Foam::surfZone::operator==(const surfZone& rhs) const
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
size() == rhs.size()
|
size() == rhs.size()
|
||||||
&& start() == rhs.start()
|
&& start() == rhs.start()
|
||||||
&& geometricType() == rhs.geometricType()
|
&& geometricType() == rhs.geometricType()
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,13 +26,26 @@ License
|
|||||||
#include "surfZoneIdentifier.H"
|
#include "surfZoneIdentifier.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::word Foam::surfZoneIdentifier::emptyType = "empty";
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfZoneIdentifier::surfZoneIdentifier()
|
Foam::surfZoneIdentifier::surfZoneIdentifier()
|
||||||
:
|
:
|
||||||
name_(word::null),
|
name_(),
|
||||||
index_(0),
|
index_(0),
|
||||||
geometricType_(word::null)
|
geometricType_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::surfZoneIdentifier::surfZoneIdentifier(label index)
|
||||||
|
:
|
||||||
|
name_(),
|
||||||
|
index_(index),
|
||||||
|
geometricType_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +70,8 @@ Foam::surfZoneIdentifier::surfZoneIdentifier
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
index_(index)
|
index_(index),
|
||||||
|
geometricType_()
|
||||||
{
|
{
|
||||||
dict.readIfPresent("geometricType", geometricType_);
|
dict.readIfPresent("geometricType", geometricType_);
|
||||||
}
|
}
|
||||||
@ -88,7 +102,8 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
|
|||||||
{
|
{
|
||||||
if (geometricType_.size())
|
if (geometricType_.size())
|
||||||
{
|
{
|
||||||
os.writeKeyword("geometricType") << geometricType_
|
os.writeKeyword("geometricType")
|
||||||
|
<< geometricType_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,41 +111,46 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// bool Foam::surfZoneIdentifier::operator!=
|
// needed for list output
|
||||||
// (
|
|
||||||
// const surfZoneIdentifier& p
|
bool Foam::surfZoneIdentifier::operator!=
|
||||||
// ) const
|
(
|
||||||
// {
|
const surfZoneIdentifier& rhs
|
||||||
// return !(*this == p);
|
) const
|
||||||
// }
|
{
|
||||||
//
|
return !(*this == rhs);
|
||||||
//
|
}
|
||||||
// bool Foam::surfZoneIdentifier::operator==
|
|
||||||
// (
|
|
||||||
// const surfZoneIdentifier& p
|
bool Foam::surfZoneIdentifier::operator==
|
||||||
// ) const
|
(
|
||||||
// {
|
const surfZoneIdentifier& rhs
|
||||||
// return geometricType() == p.geometricType() && name() == p.name();
|
) const
|
||||||
// }
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
name() == rhs.name()
|
||||||
|
&& geometricType() == rhs.geometricType()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& p)
|
Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
|
||||||
// {
|
|
||||||
// is >> p.name_ >> p.geometricType_;
|
|
||||||
//
|
|
||||||
// return is;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& p)
|
|
||||||
{
|
{
|
||||||
p.write(os);
|
is >> obj.name_
|
||||||
os.check
|
>> obj.geometricType_;
|
||||||
(
|
|
||||||
"Ostream& operator<<(Ostream&, const surfZoneIdentifier&)"
|
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;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,10 +25,10 @@ Class
|
|||||||
Foam::surfZoneIdentifier
|
Foam::surfZoneIdentifier
|
||||||
|
|
||||||
Description
|
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
|
SeeAlso
|
||||||
"geometricType" as well.
|
patchIdentifier
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfZoneIdentifier.C
|
surfZoneIdentifier.C
|
||||||
@ -52,6 +52,7 @@ class dictionary;
|
|||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class surfZoneIdentifier;
|
class surfZoneIdentifier;
|
||||||
|
Istream& operator>>(Istream&, surfZoneIdentifier&);
|
||||||
Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
|
Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -74,11 +75,23 @@ class surfZoneIdentifier
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Public data
|
||||||
|
|
||||||
|
//- The name for an 'empty' type
|
||||||
|
static const word emptyType;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
surfZoneIdentifier();
|
surfZoneIdentifier();
|
||||||
|
|
||||||
|
//- Construct null with specified index
|
||||||
|
explicit surfZoneIdentifier
|
||||||
|
(
|
||||||
|
const label index
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
surfZoneIdentifier
|
surfZoneIdentifier
|
||||||
(
|
(
|
||||||
@ -122,42 +135,57 @@ public:
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the geometric type of the zone
|
//- Return 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 zone for modification
|
//- Return the geometric type of the patch/zone for modification
|
||||||
word& geometricType()
|
word& geometricType()
|
||||||
{
|
{
|
||||||
return 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
|
label index() const
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Write surfZoneIdentifier as a dictionary
|
//- Return the index of this patch/zone for modification
|
||||||
void write(Ostream&) const;
|
label& index()
|
||||||
|
{
|
||||||
|
return index_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Write surfZoneIdentifier as a dictionary
|
//- Write surfZoneIdentifier as a dictionary
|
||||||
// void writeDict(Ostream&) const;
|
void write(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
// bool operator!=(const surfZoneIdentifier&) const;
|
bool operator!=(const surfZoneIdentifier&) const;
|
||||||
//
|
bool operator==(const surfZoneIdentifier&) const;
|
||||||
// //- compare.
|
|
||||||
// bool operator==(const surfZoneIdentifier&) const;
|
|
||||||
|
|
||||||
// Ostream Operator
|
// Ostream Operator
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
|
//- Read name/type.
|
||||||
// friend Istream& operator>>(Istream&, surfZoneIdentifier&);
|
friend Istream& operator>>
|
||||||
|
(
|
||||||
|
Istream&,
|
||||||
|
surfZoneIdentifier&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Write name/type.
|
||||||
|
friend Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const surfZoneIdentifier&
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user