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-------------------------------------------------------------------------------
10License
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
33template<class Type>
35(
36 const faPatch& p,
38)
39:
40 Field<Type>(p.size()),
41 patch_(p),
42 internalField_(iF)
43{}
44
45
46template<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
60template<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
75template<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
101template<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
113template<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
128template<class Type>
130{
131 // Note: Lookup fields from the field DB rather than the mesh
132 return internalField_.db();
133}
134
135
136template<class Type>
138{
139 if (&patch_ != &(ptf.patch_))
140 {
142 << "different patches for faePatchField<Type>s"
143 << abort(FatalError);
144 }
145}
146
147
148template<class Type>
150(
151 const faPatchFieldMapper& m
152)
153{
155}
156
158template<class Type>
160(
161 const faePatchField<Type>& ptf,
162 const labelList& addr
163)
165 Field<Type>::rmap(ptf, addr);
166}
167
168
169template<class Type>
171{
172 os.writeEntry("type", type());
173
174 // if (!patchType_.empty())
175 // {
176 // os.writeEntry("patchType", patchType_);
177 // }
178}
179
181// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
182
183template<class Type>
185(
186 const UList<Type>& ul
187)
188{
190}
191
192
193template<class Type>
195(
196 const faePatchField<Type>& ptf
197)
199 check(ptf);
201}
202
203
204template<class Type>
206(
207 const faePatchField<Type>& ptf
208)
209{
210 check(ptf);
212}
213
214
215template<class Type>
217(
218 const faePatchField<Type>& ptf
219)
220{
221 check(ptf);
223}
224
225
226template<class Type>
228(
229 const faePatchField<scalar>& ptf
230)
231{
232 if (&patch_ != &ptf.patch())
233 {
235 << "incompatible patches for patch fields"
236 << abort(FatalError);
237 }
238
240}
241
242
243template<class Type>
245(
246 const faePatchField<scalar>& ptf
247)
248{
249 if (&patch_ != &ptf.patch())
250 {
252 << " incompatible patches for patch fields"
253 << abort(FatalError);
254 }
255
257}
258
259
260template<class Type>
262(
263 const Field<Type>& tf
264)
265{
267}
268
269
270template<class Type>
272(
273 const Field<Type>& tf
274)
275{
277}
279
280template<class Type>
282(
283 const scalarField& tf
284)
285{
287}
288
289
290template<class Type>
292(
293 const scalarField& tf
294)
295{
297}
298
299
300template<class Type>
302(
303 const Type& t
304)
305{
307}
308
309
310template<class Type>
312(
313 const Type& t
314)
315{
317}
318
320template<class Type>
322(
323 const Type& t
324)
327}
328
329
330template<class Type>
332(
333 const scalar s
334)
335{
337}
338
340template<class Type>
342(
343 const scalar s
345{
350template<class Type>
354)
357}
360template<class Type>
363 const Field<Type>& tf
364)
365{
370template<class Type>
372(
373 const Type& t
374)
375{
377}
378
379
380// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
381
382template<class Type>
384{
385 ptf.write(os);
386
388
389 return os;
390}
391
392
393// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
394
395#include "faePatchFieldNew.C"
396
397// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
void operator=(const Field< Type > &)
Copy assignment.
Definition: Field.C:641
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
Definition: Field.C:403
void operator+=(const UList< Type > &)
Definition: Field.C:693
void operator-=(const UList< Type > &)
Definition: Field.C:694
void operator*=(const UList< scalar > &)
Definition: Field.C:695
void operator/=(const UList< scalar > &)
Definition: Field.C:696
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:466
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
A FieldMapper for finite-area patch fields.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
Definition: faePatchField.H:83
virtual void write(Ostream &) const
Write.
const faPatch & patch() const
Return patch.
const objectRegistry & db() const
Return local objectRegistry.
virtual void operator=(const UList< Type > &)
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faePatchField onto this faePatchField.
virtual bool write()
Write the output fields.
Registry of regIOobjects.
volScalarField & p
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
OBJstream os(runTime.globalPath()/outputName)
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))
#define FUNCTION_NAME
static void check(const int retVal, const char *what)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError
labelList f(nPoints)
dictionary dict
A non-counting (dummy) refCount.
Definition: refCount.H:59