FreeFOAM The Cross-Platform CFD Toolkit
patchIdentifier.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::patchIdentifier
26 
27 Description
28  Identifies patch by name, patch index and physical type
29 
30 SourceFiles
31  patchIdentifier.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef patchIdentifier_H
36 #define patchIdentifier_H
37 
38 #include <OpenFOAM/word.H>
39 #include <OpenFOAM/label.H>
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 class dictionary;
47 
48 // Forward declaration of friend functions and operators
49 
50 class patchIdentifier;
51 Ostream& operator<<(Ostream&, const patchIdentifier&);
52 
53 
54 /*---------------------------------------------------------------------------*\
55  Class patchIdentifier Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60  // Private data
61 
62  //- Name of patch
63  word name_;
64 
65  //- Index of patch in boundary
66  label index_;
67 
68  //- Optional physical type
69  mutable word physicalType_;
70 
71 
72 public:
73 
74  // Constructors
75 
76  //- Construct from components
78  (
79  const word& name,
80  const label index,
82  );
83 
84  //- Construct from dictionary
86  (
87  const word& name,
88  const dictionary&,
89  const label index
90  );
91 
92  //- Construct from geometric patch, resetting the index
94  (
95  const patchIdentifier&,
96  const label index
97  );
98 
99 
100  // Destructor
101 
102  virtual ~patchIdentifier();
103 
104 
105  // Member Functions
106 
107  //- Return name
108  const word& name() const
109  {
110  return name_;
111  }
112 
113  //- Return name for modification
115  {
116  return name_;
117  }
118 
119  //- Return the optional physical type of the patch
120  const word& physicalType() const
121  {
122  return physicalType_;
123  }
124 
125  //- Return the optional physical type of the patch for modification
127  {
128  return physicalType_;
129  }
130 
131  //- Return the index of this patch in the boundaryMesh
132  label index() const
133  {
134  return index_;
135  }
136 
137  //- Return the index of this patch in the boundaryMesh for modification
138  label& index()
139  {
140  return index_;
141  }
142 
143  //- Write patchIdentifier as a dictionary
144  void write(Ostream&) const;
145 
146 
147  // Ostream Operator
148 
149  friend Ostream& operator<<(Ostream&, const patchIdentifier&);
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************ vim: set sw=4 sts=4 et: ************************ //