FreeFOAM The Cross-Platform CFD Toolkit
surfacePatch.C
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 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "surfacePatch.H"
29 #include <OpenFOAM/dictionary.H>
30 #include <OpenFOAM/word.H>
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
35 
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
40 // Construct null
42 :
43  geometricSurfacePatch("", "", -1),
44  size_(0),
45  start_(0)
46 {}
47 
48 
49 
50 // Construct from components
52 (
53  const word& geometricType,
54  const word& name,
55  const label size,
56  const label start,
57  const label index
58 )
59 :
60  geometricSurfacePatch(geometricType, name, index),
61  size_(size),
62  start_(start)
63 {}
64 
65 
66 // Construct from Istream
68 :
69  geometricSurfacePatch(is, index),
70  size_(0),
71  start_(0)
72 {
73  size_ = readLabel(is);
74  start_ = readLabel(is);
75 }
76 
77 // Construct from dictionary
79 (
80  const word& name,
81  const dictionary& dict,
82  const label index
83 )
84 :
85  geometricSurfacePatch(name, dict, index),
86  size_(readLabel(dict.lookup("nFaces"))),
87  start_(readLabel(dict.lookup("startFace")))
88 {}
89 
90 
91 // Construct as copy
93 :
95  size_(sp.size()),
96  start_(sp.start())
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
103 {
104  os << nl
105  << static_cast<const geometricSurfacePatch&>(*this) << endl
106  << size() << tab << start();
107 }
108 
110 {
111  os << nl << name() << nl << token::BEGIN_BLOCK << nl;
112 
114 
115  os << " nFaces " << size() << ';' << nl
116  << " startFace " << start() << ';' << nl
117  << token::END_BLOCK << endl;
118 }
119 
120 
121 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
122 
124 {
125  return !(*this == p);
126 }
127 
128 
130 {
131  return
132  (
133  (geometricType() == p.geometricType())
134  && (size() == p.size())
135  && (start() == p.start())
136  );
137 }
138 
139 
140 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
141 
143 {
144  p.write(os);
145  os.check("Ostream& operator<<(Ostream& f, const surfacePatch& p");
146  return os;
147 }
148 
149 
150 // ************************ vim: set sw=4 sts=4 et: ************************ //