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  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "faePatchField.H"
30 #include "faPatchFieldMapper.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const faPatch& p,
39 )
40 :
42  Field<Type>(p.size()),
43  internalField_(iF)
44 {}
45 
46 
47 template<class Type>
49 (
50  const faPatch& p,
52  const Field<Type>& f
53 )
54 :
56  Field<Type>(f),
57  internalField_(iF)
58 {}
59 
60 
61 template<class Type>
63 (
64  const faePatchField<Type>& ptf,
65  const faPatch& p,
67  const faPatchFieldMapper& mapper
68 )
69 :
70  faePatchFieldBase(ptf, p),
71  Field<Type>(ptf, mapper),
72  internalField_(iF)
73 {}
74 
75 
76 template<class Type>
78 (
79  const faPatch& p,
81  const dictionary& dict
82 )
83 :
85  Field<Type>(p.size()),
86  internalField_(iF)
87 {
88  const auto* hasValue = dict.findEntry("value", keyType::LITERAL);
89 
90  if (hasValue)
91  {
92  Field<Type>::assign(*hasValue, p.size());
93  }
94  else
95  {
97  }
98 }
99 
100 
101 template<class Type>
103 (
104  const faePatchField<Type>& ptf
105 )
106 :
107  faePatchFieldBase(ptf),
108  Field<Type>(ptf),
109  internalField_(ptf.internalField_)
110 {}
111 
112 
113 template<class Type>
115 (
116  const faePatchField<Type>& ptf,
118 )
119 :
120  faePatchFieldBase(ptf),
121  Field<Type>(ptf),
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 {
140 }
141 
142 
143 template<class Type>
145 (
146  const faPatchFieldMapper& m
147 )
148 {
150 }
151 
152 
153 template<class Type>
155 (
156  const faePatchField<Type>& ptf,
157  const labelList& addr
158 )
159 {
160  Field<Type>::rmap(ptf, addr);
161 }
162 
163 
164 template<class Type>
166 {
167  os.writeEntry("type", type());
168 
169  // if (!patchType().empty())
170  // {
171  // os.writeEntry("patchType", patchType());
172  // }
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 {
196 }
197 
198 
199 template<class Type>
201 (
202  const faePatchField<Type>& ptf
203 )
204 {
207 }
208 
209 
210 template<class Type>
212 (
213  const faePatchField<Type>& ptf
214 )
215 {
218 }
219 
220 
221 template<class Type>
223 (
224  const faePatchField<scalar>& ptf
225 )
226 {
229 }
230 
231 
232 template<class Type>
234 (
235  const faePatchField<scalar>& ptf
236 )
237 {
240 }
241 
242 
243 template<class Type>
245 (
246  const Field<Type>& tf
247 )
248 {
250 }
251 
252 
253 template<class Type>
255 (
256  const Field<Type>& tf
257 )
258 {
260 }
261 
262 
263 template<class Type>
265 (
266  const scalarField& tf
267 )
268 {
270 }
271 
272 
273 template<class Type>
275 (
276  const scalarField& tf
277 )
278 {
280 }
281 
282 
283 template<class Type>
285 (
286  const Type& t
287 )
288 {
290 }
291 
292 
293 template<class Type>
295 (
296  const Type& t
297 )
298 {
300 }
301 
302 
303 template<class Type>
305 (
306  const Type& t
307 )
308 {
310 }
311 
312 
313 template<class Type>
315 (
316  const scalar s
317 )
318 {
320 }
321 
322 
323 template<class Type>
325 (
326  const scalar s
327 )
328 {
330 }
331 
332 
333 template<class Type>
335 (
336  const faePatchField<Type>& ptf
337 )
338 {
340 }
341 
342 
343 template<class Type>
345 (
346  const Field<Type>& tf
347 )
348 {
350 }
351 
352 
353 template<class Type>
355 (
356  const Type& t
357 )
358 {
360 }
361 
362 
363 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
364 
365 template<class Type>
366 Foam::Ostream& Foam::operator<<(Ostream& os, const faePatchField<Type>& ptf)
367 {
368  ptf.write(os);
369 
371 
372  return os;
373 }
374 
375 
376 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
377 
378 #include "faePatchFieldNew.C"
379 
380 // ************************************************************************* //
dictionary dict
const objectRegistry & db() const
Return local objectRegistry.
void operator-=(const UList< Type > &)
Definition: Field.C:724
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
Template invariant parts for faePatchField.
Definition: faePatchField.H:76
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:45
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:312
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:752
Generic templated field type.
Definition: Field.H:61
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:441
String literal.
Definition: keyType.H:82
virtual void write(Ostream &) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faePatchField onto this faePatchField.
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
void operator=(const Field< Type > &)
Copy assignment.
Definition: Field.C:671
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
labelList f(nPoints)
void assign(const entry &e, const label len)
Assign from a dictionary (primitive) entry.
Definition: Field.C:195
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
Definition: Field.C:433
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:496
void check(const faePatchField< Type > &) const
Check faePatchField<Type> against given faePatchField<Type>
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
faePatchField(const faPatch &, const DimensionedField< Type, edgeMesh > &)
Construct from patch and internal field.
Definition: faePatchField.C:29
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
Definition: edgeFieldsFwd.H:46
void operator+=(const UList< Type > &)
Definition: Field.C:723
volScalarField & p
Registry of regIOobjects.
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))
A FieldMapper for finite-area patch fields.
void operator/=(const UList< scalar > &)
Definition: Field.C:726
void checkPatch(const faePatchFieldBase &rhs) const
Check that patches are identical.
void operator*=(const UList< scalar > &)
Definition: Field.C:725
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:157