fvsPatchField.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) 2011-2015 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
25 
26 #include "IOobject.H"
27 #include "dictionary.H"
28 #include "fvMesh.H"
29 #include "fvPatchFieldMapper.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
38 template<class Type>
40 (
41  const fvPatch& p,
42  const DimensionedField<Type, surfaceMesh>& iF
43 )
44 :
45  Field<Type>(p.size()),
46  patch_(p),
47  internalField_(iF)
48 {}
49 
50 
51 template<class Type>
53 (
54  const fvPatch& p,
55  const DimensionedField<Type, surfaceMesh>& iF,
56  const Field<Type>& f
57 )
58 :
59  Field<Type>(f),
60  patch_(p),
61  internalField_(iF)
62 {}
63 
64 
65 template<class Type>
67 (
68  const fvsPatchField<Type>& ptf,
69  const fvPatch& p,
70  const DimensionedField<Type, surfaceMesh>& iF,
71  const fvPatchFieldMapper& mapper
72 )
73 :
74  Field<Type>(ptf, mapper),
75  patch_(p),
76  internalField_(iF)
77 {}
78 
79 
80 template<class Type>
82 (
83  const fvPatch& p,
84  const DimensionedField<Type, surfaceMesh>& iF,
85  const dictionary& dict
86 )
87 :
88  Field<Type>(p.size()),
89  patch_(p),
90  internalField_(iF)
91 {
92  if (dict.found("value"))
93  {
95  (
96  Field<Type>("value", dict, p.size())
97  );
98  }
99  else
100  {
102  (
103  dict
104  ) << "essential value entry not provided"
105  << exit(FatalIOError);
106  }
107 }
108 
109 
110 template<class Type>
112 (
113  const fvsPatchField<Type>& ptf
114 )
115 :
116  Field<Type>(ptf),
117  patch_(ptf.patch_),
118  internalField_(ptf.internalField_)
119 {}
120 
121 
122 template<class Type>
124 (
125  const fvsPatchField<Type>& ptf,
126  const DimensionedField<Type, surfaceMesh>& iF
127 )
128 :
129  Field<Type>(ptf),
130  patch_(ptf.patch_),
131  internalField_(iF)
132 {}
133 
134 
135 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
136 
137 template<class Type>
139 {
140  return patch_.boundaryMesh().mesh();
141 }
142 
143 
144 template<class Type>
146 {
147  if (&patch_ != &(ptf.patch_))
148  {
150  << "different patches for fvsPatchField<Type>s"
151  << abort(FatalError);
152  }
153 }
154 
155 
156 // Map from self
157 template<class Type>
159 (
160  const fvPatchFieldMapper& m
161 )
162 {
164 }
165 
166 
167 // Reverse-map the given fvsPatchField onto this fvsPatchField
168 template<class Type>
170 (
171  const fvsPatchField<Type>& ptf,
172  const labelList& addr
173 )
174 {
175  Field<Type>::rmap(ptf, addr);
176 }
177 
178 
179 // Write
180 template<class Type>
182 {
183  os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
184  this->writeEntry("value", os);
185 }
186 
187 
188 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
189 
190 template<class Type>
192 (
193  const UList<Type>& ul
194 )
195 {
197 }
198 
199 
200 template<class Type>
202 (
203  const fvsPatchField<Type>& ptf
204 )
205 {
206  check(ptf);
208 }
209 
210 
211 template<class Type>
213 (
214  const fvsPatchField<Type>& ptf
215 )
216 {
217  check(ptf);
219 }
220 
221 
222 template<class Type>
224 (
225  const fvsPatchField<Type>& ptf
226 )
227 {
228  check(ptf);
230 }
231 
232 
233 template<class Type>
235 (
236  const fvsPatchField<scalar>& ptf
237 )
238 {
239  if (&patch_ != &ptf.patch())
240  {
242  << "incompatible patches for patch fields"
243  << abort(FatalError);
244  }
245 
247 }
248 
249 
250 template<class Type>
252 (
253  const fvsPatchField<scalar>& ptf
254 )
255 {
256  if (&patch_ != &ptf.patch())
257  {
259  << abort(FatalError);
260  }
261 
263 }
264 
265 
266 template<class Type>
268 (
269  const Field<Type>& tf
270 )
271 {
273 }
274 
275 
276 template<class Type>
278 (
279  const Field<Type>& tf
280 )
281 {
283 }
284 
285 
286 template<class Type>
288 (
289  const scalarField& tf
290 )
291 {
293 }
294 
295 
296 template<class Type>
298 (
299  const scalarField& tf
300 )
301 {
303 }
304 
305 
306 template<class Type>
308 (
309  const Type& t
310 )
311 {
313 }
314 
315 
316 template<class Type>
318 (
319  const Type& t
320 )
321 {
323 }
324 
325 
326 template<class Type>
328 (
329  const Type& t
330 )
331 {
333 }
334 
335 
336 template<class Type>
338 (
339  const scalar s
340 )
341 {
343 }
344 
345 
346 template<class Type>
348 (
349  const scalar s
350 )
351 {
353 }
354 
355 
356 // Force an assignment, overriding fixedValue status
357 template<class Type>
359 (
360  const fvsPatchField<Type>& ptf
361 )
362 {
364 }
365 
366 
367 template<class Type>
369 (
370  const Field<Type>& tf
371 )
372 {
374 }
375 
376 
377 template<class Type>
379 (
380  const Type& t
381 )
382 {
384 }
385 
386 
387 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
388 
389 template<class Type>
391 {
392  ptf.write(os);
393 
394  os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
395 
396  return os;
397 }
398 
399 
400 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
401 
402 } // End namespace Foam
403 
404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405 
406 # include "fvsPatchFieldNew.C"
407 
408 // ************************************************************************* //
Foam::Field< Type >::operator-=
void operator-=(const UList< Type > &)
p
p
Definition: pEqn.H:62
Foam::fvsPatchField::patch_
const fvPatch & patch_
Reference to patch.
Definition: fvsPatchField.H:83
Foam::fvsPatchField< Type >::operator
friend Ostream & operator(Ostream &, const fvsPatchField< Type > &)
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:65
Foam::Field< Type >::operator+=
void operator+=(const UList< Type > &)
Foam::FatalIOError
IOerror FatalIOError
fvPatchFieldMapper.H
Foam::fvsPatchField::db
const objectRegistry & db() const
Return local objectRegistry.
Definition: fvsPatchField.C:138
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
tf
const tensorField & tf
Definition: getPatchFieldTensor.H:36
Foam::dictionary::found
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:304
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
fvsPatchFieldNew.C
dict
dictionary dict
Definition: searchingEngine.H:14
IOobject.H
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam::FatalError
error FatalError
operator<<
std::ostream & operator<<(std::ostream &os, const Vector< C > &v)
Definition: Test-Field.H:39
Foam::fvsPatchField::fvsPatchField
fvsPatchField(const fvPatch &, const DimensionedField< Type, surfaceMesh > &)
Construct from patch and internal field.
Foam::fvsPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fvsPatchField.C:181
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::Field< Type >::operator=
void operator=(const Field< Type > &)
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::Field< Type >::operator/=
void operator/=(const UList< scalar > &)
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::fvsPatchField::patch
const fvPatch & patch() const
Return patch.
Definition: fvsPatchField.H:278
f
labelList f(nPoints)
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
scalarField
volScalarField scalarField(fieldObject, mesh)
Foam::Ostream::writeKeyword
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
Foam::UList< Type >
dictionary.H
Foam::Field< Type >::operator*=
void operator*=(const UList< scalar > &)
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:330
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
write
Tcoeff write()