Loading...
Searching...
No Matches
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-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
29#include "faePatchField.H"
30#include "faPatchFieldMapper.H"
31
32// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
33
34template<class Type>
36(
37 const dictionary& dict,
39)
40{
41 if (!IOobjectOption::isAnyRead(readOpt)) return false;
42 const auto& p = faePatchFieldBase::patch();
43
44
45 const auto* eptr = dict.findEntry("value", keyType::LITERAL);
46
47 if (eptr)
48 {
49 Field<Type>::assign(*eptr, p.size());
50 return true;
51 }
52
54 {
56 << "Required entry 'value' : missing for patch " << p.name()
57 << " in dictionary " << dict.relativeName() << nl
59 }
60
61 return false;
62}
63
64
65// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66
67template<class Type>
69(
70 const faPatch& p,
72)
73:
75 Field<Type>(p.size()),
76 internalField_(iF)
77{}
78
79
80template<class Type>
82(
83 const faPatch& p,
85 const Type& value
86)
87:
89 Field<Type>(p.size(), value),
90 internalField_(iF)
91{}
92
93
94template<class Type>
96(
97 const faPatch& p,
99 const Field<Type>& pfld
100)
101:
103 Field<Type>(pfld),
104 internalField_(iF)
105{}
106
107
108template<class Type>
110(
111 const faPatch& p,
113 Field<Type>&& pfld
114)
115:
117 Field<Type>(std::move(pfld)),
118 internalField_(iF)
119{}
120
121
122template<class Type>
124(
125 const faPatch& p,
127 const dictionary& dict,
128 IOobjectOption::readOption requireValue
129)
130:
132 Field<Type>(p.size()),
133 internalField_(iF)
134{
135 if (!readValueEntry(dict, requireValue))
136 {
137 // Not read (eg, optional and missing): define zero
139 }
140}
141
142
143template<class Type>
145(
146 const faePatchField<Type>& ptf,
147 const faPatch& p,
148 const DimensionedField<Type, edgeMesh>& iF,
149 const faPatchFieldMapper& mapper
150)
151:
153 Field<Type>(ptf, mapper),
154 internalField_(iF)
155{}
156
157
158template<class Type>
160(
161 const faePatchField<Type>& pfld,
162 const faPatch& p,
164 const Type& value
165)
166:
168 Field<Type>(p.size(), value),
169 internalField_(iF)
170{}
171
172
173template<class Type>
175(
176 const faePatchField<Type>& pfld,
178)
179:
180 faePatchFieldBase(pfld),
181 Field<Type>(pfld),
182 internalField_(iF)
183{}
184
185
186// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
187
188template<class Type>
190{
192}
193
194
195template<class Type>
197(
198 const faPatchFieldMapper& m
200{
202}
203
204
205template<class Type>
207(
208 const faePatchField<Type>& ptf,
209 const labelList& addr
211{
212 Field<Type>::rmap(ptf, addr);
213}
214
215
216template<class Type>
218{
219 os.writeEntry("type", type());
220
221 // if (!patchType().empty())
222 // {
223 // os.writeEntry("patchType", patchType());
224 // }
225}
226
227
228// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
229
230template<class Type>
232(
233 const UList<Type>& ul
235{
237}
238
239
240template<class Type>
242(
243 const faePatchField<Type>& ptf
244)
248}
249
250
251template<class Type>
253(
254 const faePatchField<Type>& ptf
255)
259}
260
261
262template<class Type>
264(
265 const faePatchField<Type>& ptf
266)
270}
271
272
273template<class Type>
275(
276 const faePatchField<scalar>& ptf
277)
281}
282
283
284template<class Type>
286(
287 const faePatchField<scalar>& ptf
288)
292}
293
294
295template<class Type>
297(
298 const Field<Type>& tf
300{
302}
303
304
305template<class Type>
307(
308 const Field<Type>& tf
309)
310{
312}
313
314
315template<class Type>
317(
318 const scalarField& tf
319)
320{
322}
323
324
325template<class Type>
326void Foam::faePatchField<Type>::operator/=
327(
328 const scalarField& tf
330{
332}
333
334
335template<class Type>
337(
338 const Type& t
340{
342}
343
344
345template<class Type>
348 const Type& t
350{
352}
353
354
355template<class Type>
357(
358 const Type& t
360{
362}
363
364
365template<class Type>
367(
368 const scalar s
370{
372}
373
374
375template<class Type>
377(
378 const scalar s
380{
382}
383
384
385template<class Type>
387(
388 const faePatchField<Type>& ptf
390{
392}
393
394
395template<class Type>
397(
398 const Field<Type>& tf
400{
402}
403
404
405template<class Type>
407(
408 const Type& t
409)
410{
412}
413
414
415// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
416
417template<class Type>
419{
420 ptf.write(os);
421
422 os.check(FUNCTION_NAME);
423
424 return os;
425}
426
427
428// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
void operator=(const Field< Type > &)
Copy assignment.
Definition Field.C:781
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
Definition Field.C:465
void operator+=(const UList< Type > &)
Definition Field.C:833
void operator-=(const UList< Type > &)
Definition Field.C:834
constexpr Field() noexcept
Default construct.
Definition FieldI.H:24
void operator*=(const UList< scalar > &)
Definition Field.C:835
void assign(const entry &e, const label len)
Assign from a primitive dictionary entry with the following behaviour:
Definition Field.C:206
void operator/=(const UList< scalar > &)
Definition Field.C:836
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition Field.C:528
static bool isReadRequired(readOption opt) noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
readOption
Enumeration defining read preferences.
static bool isAnyRead(readOption opt) noexcept
True if any reading may be required (ie, != NO_READ).
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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:89
void size(const label n)
Definition UList.H:118
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FieldMapper for finite-area patch fields.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
Template invariant parts for faePatchField.
faePatchFieldBase(const faPatch &p)
Construct from patch.
void checkPatch(const faePatchFieldBase &rhs) const
Check that patches are identical.
const faPatch & patch() const noexcept
Return the patch.
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
faePatchField(const faPatch &, const DimensionedField< Type, edgeMesh > &)
Construct from patch and internal field.
void check(const faePatchField< Type > &) const
Check against given patch field.
virtual void write(Ostream &os) const
Write.
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faePatchField onto this faePatchField.
@ LITERAL
String literal.
Definition keyType.H:82
volScalarField & p
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition error.H:629
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
List< label > labelList
A List of labels.
Definition List.H:62
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict