Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
meshes
polyMesh
zones
ZoneID
polyPatchID.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::polyPatchID
26
27
Description
28
A class holds the data needed to identify a patch in a dynamic mesh.
29
30
The patch is identified by name and its index in the boundary mesh
31
is updated if the mesh has changed.
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef polyPatchID_H
36
#define polyPatchID_H
37
38
#include <
OpenFOAM/polyBoundaryMesh.H
>
39
40
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41
42
namespace
Foam
43
{
44
45
// Forward declaration of friend functions and operators
46
47
class
polyPatchID;
48
Ostream&
operator<<
(Ostream& os,
const
polyPatchID&
p
);
49
50
51
/*---------------------------------------------------------------------------*\
52
Class polyPatchID Declaration
53
\*---------------------------------------------------------------------------*/
54
55
class
polyPatchID
56
{
57
// Private data
58
59
//- Patch name
60
word
name_;
61
62
//- Patch index
63
label index_;
64
65
66
public
:
67
68
// Constructors
69
70
//- Construct from name
71
polyPatchID
(
const
word
&
name
,
const
polyBoundaryMesh
& bm)
72
:
73
name_(name),
74
index_(bm.findPatchID(name))
75
{}
76
77
//- Construct from Istream
78
polyPatchID
(
Istream
& is,
const
polyBoundaryMesh
& bm)
79
:
80
name_(is),
81
index_(bm.findPatchID(name_))
82
{}
83
84
85
// Member Functions
86
87
// Access
88
89
//- Return name
90
const
word
&
name
()
const
91
{
92
return
name_;
93
}
94
95
//- Return index
96
label
index
()
const
97
{
98
return
index_;
99
}
100
101
//- Has the patch been found
102
bool
active
()
const
103
{
104
return
index_ > -1;
105
}
106
107
108
// Edit
109
110
//- Update
111
void
update
(
const
polyBoundaryMesh
& bm)
112
{
113
index_ = bm.
findPatchID
(name_);
114
}
115
116
117
// Ostream Operator
118
119
friend
Ostream
&
operator<<
(
Ostream
& os,
const
polyPatchID
&
p
)
120
{
121
os <<
token::BEGIN_LIST
122
<< p.name_ <<
token::SPACE
123
<< p.index_
124
<<
token::END_LIST
;
125
126
// Check state of Ostream
127
os.
check
(
"Ostream& operator<<(Ostream&, const polyPatchID&)"
);
128
129
return
os;
130
}
131
};
132
133
134
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136
}
// End namespace Foam
137
138
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140
#endif
141
142
// ************************ vim: set sw=4 sts=4 et: ************************ //