|
|
|
polyPatchID.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::polyPatchID 00027 00028 Description 00029 A class holds the data needed to identify a patch in a dynamic mesh. 00030 00031 The patch is identified by name and its index in the boundary mesh 00032 is updated if the mesh has changed. 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef polyPatchID_H 00037 #define polyPatchID_H 00038 00039 #include "polyBoundaryMesh.H" 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 // Forward declaration of friend functions and operators 00047 00048 class polyPatchID; 00049 Ostream& operator<<(Ostream& os, const polyPatchID& p); 00050 00051 00052 /*---------------------------------------------------------------------------*\ 00053 Class polyPatchID Declaration 00054 \*---------------------------------------------------------------------------*/ 00055 00056 class polyPatchID 00057 { 00058 // Private data 00059 00060 //- Patch name 00061 word name_; 00062 00063 //- Patch index 00064 label index_; 00065 00066 00067 public: 00068 00069 // Constructors 00070 00071 //- Construct from name 00072 polyPatchID(const word& name, const polyBoundaryMesh& bm) 00073 : 00074 name_(name), 00075 index_(bm.findPatchID(name)) 00076 {} 00077 00078 //- Construct from Istream 00079 polyPatchID(Istream& is, const polyBoundaryMesh& bm) 00080 : 00081 name_(is), 00082 index_(bm.findPatchID(name_)) 00083 {} 00084 00085 00086 // Member Functions 00087 00088 // Access 00089 00090 //- Return name 00091 const word& name() const 00092 { 00093 return name_; 00094 } 00095 00096 //- Return index 00097 label index() const 00098 { 00099 return index_; 00100 } 00101 00102 //- Has the patch been found 00103 bool active() const 00104 { 00105 return index_ > -1; 00106 } 00107 00108 00109 // Edit 00110 00111 //- Update 00112 void update(const polyBoundaryMesh& bm) 00113 { 00114 index_ = bm.findPatchID(name_); 00115 } 00116 00117 00118 // Ostream Operator 00119 00120 friend Ostream& operator<<(Ostream& os, const polyPatchID& p) 00121 { 00122 os << token::BEGIN_LIST 00123 << p.name_ << token::SPACE 00124 << p.index_ 00125 << token::END_LIST; 00126 00127 // Check state of Ostream 00128 os.check("Ostream& operator<<(Ostream&, const polyPatchID&)"); 00129 00130 return os; 00131 } 00132 }; 00133 00134 00135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00136 00137 } // End namespace Foam 00138 00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00140 00141 #endif 00142 00143 // ************************************************************************* // |