faePatchField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "faePatchField.H"
29 #include "faPatchFieldMapper.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const faPatch& p,
38 )
39 :
40  Field<Type>(p.size()),
41  patch_(p),
42  internalField_(iF)
43 {}
44 
45 
46 template<class Type>
48 (
49  const faPatch& p,
51  const Field<Type>& f
52 )
53 :
54  Field<Type>(f),
55  patch_(p),
56  internalField_(iF)
57 {}
58 
59 
60 template<class Type>
62 (
63  const faePatchField<Type>& ptf,
64  const faPatch& p,
66  const faPatchFieldMapper& mapper
67 )
68 :
69  Field<Type>(ptf, mapper),
70  patch_(p),
71  internalField_(iF)
72 {}
73 
74 
75 template<class Type>
77 (
78  const faPatch& p,
80  const dictionary& dict
81 )
82 :
83  Field<Type>(p.size()),
84  patch_(p),
85  internalField_(iF)
86 {
87  if (dict.found("value"))
88  {
90  (
91  Field<Type>("value", dict, p.size())
92  );
93  }
94  else
95  {
97  }
98 }
99 
100 
101 template<class Type>
103 (
104  const faePatchField<Type>& ptf
105 )
106 :
107  Field<Type>(ptf),
108  patch_(ptf.patch_),
109  internalField_(ptf.internalField_)
110 {}
111 
112 
113 template<class Type>
115 (
116  const faePatchField<Type>& ptf,
118 )
119 :
120  Field<Type>(ptf),
121  patch_(ptf.patch_),
122  internalField_(iF)
123 {}
124 
125 
126 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
127 
128 template<class Type>
130 {
131  // Note: Lookup fields from the field DB rather than the mesh
132  return internalField_.db();
133 }
134 
135 
136 template<class Type>
138 {
139  if (&patch_ != &(ptf.patch_))
140  {
142  << "different patches for faePatchField<Type>s"
143  << abort(FatalError);
144  }
145 }
146 
147 
148 template<class Type>
150 (
151  const faPatchFieldMapper& m
152 )
153 {
155 }
156 
157 
158 template<class Type>
160 (
161  const faePatchField<Type>& ptf,
162  const labelList& addr
163 )
164 {
165  Field<Type>::rmap(ptf, addr);
166 }
167 
168 
169 template<class Type>
171 {
172  os.writeEntry("type", type());
173 }
174 
175 
176 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
177 
178 template<class Type>
180 (
181  const UList<Type>& ul
182 )
183 {
185 }
186 
187 
188 template<class Type>
190 (
191  const faePatchField<Type>& ptf
192 )
193 {
194  check(ptf);
196 }
197 
198 
199 template<class Type>
201 (
202  const faePatchField<Type>& ptf
203 )
204 {
205  check(ptf);
207 }
208 
209 
210 template<class Type>
212 (
213  const faePatchField<Type>& ptf
214 )
215 {
216  check(ptf);
218 }
219 
220 
221 template<class Type>
223 (
224  const faePatchField<scalar>& ptf
225 )
226 {
227  if (&patch_ != &ptf.patch())
228  {
230  << "incompatible patches for patch fields"
231  << abort(FatalError);
232  }
233 
235 }
236 
237 
238 template<class Type>
240 (
241  const faePatchField<scalar>& ptf
242 )
243 {
244  if (&patch_ != &ptf.patch())
245  {
247  << " incompatible patches for patch fields"
248  << abort(FatalError);
249  }
250 
252 }
253 
254 
255 template<class Type>
257 (
258  const Field<Type>& tf
259 )
260 {
262 }
263 
264 
265 template<class Type>
267 (
268  const Field<Type>& tf
269 )
270 {
272 }
273 
274 
275 template<class Type>
277 (
278  const scalarField& tf
279 )
280 {
282 }
283 
284 
285 template<class Type>
287 (
288  const scalarField& tf
289 )
290 {
292 }
293 
294 
295 template<class Type>
297 (
298  const Type& t
299 )
300 {
302 }
303 
304 
305 template<class Type>
307 (
308  const Type& t
309 )
310 {
312 }
313 
314 
315 template<class Type>
317 (
318  const Type& t
319 )
320 {
322 }
323 
324 
325 template<class Type>
327 (
328  const scalar s
329 )
330 {
332 }
333 
334 
335 template<class Type>
337 (
338  const scalar s
339 )
340 {
342 }
343 
344 
345 template<class Type>
347 (
348  const faePatchField<Type>& ptf
349 )
350 {
352 }
353 
354 
355 template<class Type>
357 (
358  const Field<Type>& tf
359 )
360 {
362 }
363 
364 
365 template<class Type>
367 (
368  const Type& t
369 )
370 {
372 }
373 
374 
375 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
376 
377 template<class Type>
379 {
380  ptf.write(os);
381 
382  os.check(FUNCTION_NAME);
383 
384  return os;
385 }
386 
387 
388 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389 
390 #include "faePatchFieldNew.C"
391 
392 // ************************************************************************* //
faePatchFieldNew.C
Foam::faePatchField::check
void check(const faePatchField< Type > &) const
Check faePatchField<Type> against given faePatchField<Type>
Definition: faePatchField.C:137
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::faePatchField::db
const objectRegistry & db() const
Return local objectRegistry.
Definition: faePatchField.C:129
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Definition: gmvOutputSpray.H:25
Foam::faePatchField
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
Definition: edgeFieldsFwd.H:49
Foam::faePatchField::write
virtual void write(Ostream &) const
Write.
Definition: faePatchField.C:170
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
faePatchField.H
faPatchFieldMapper.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::faePatchField::autoMap
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: faePatchField.C:150
Foam::check
static void check(const int retVal, const char *what)
Definition: ptscotchDecomp.C:80
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::faePatchField::rmap
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faePatchField onto this faePatchField.
Definition: faePatchField.C:160
Foam::faePatchField::patch
const faPatch & patch() const
Return patch.
Definition: faePatchField.H:263
Foam::faePatchField::faePatchField
faePatchField(const faPatch &, const DimensionedField< Type, edgeMesh > &)
Construct from patch and internal field.
Definition: faePatchField.C:35
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
f
labelList f(nPoints)
Foam::List< label >
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::UList< Type >
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::IOobject::db
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:487