Field.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2023 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 "FieldMapper.H"
30 #include "FieldM.H"
31 #include "dictionary.H"
32 #include "contiguous.H"
33 #include "mapDistributeBase.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 template<class Type>
39 (
40  const UList<Type>& mapF,
41  const labelUList& mapAddressing
42 )
43 :
44  List<Type>(mapAddressing.size())
45 {
46  map(mapF, mapAddressing);
47 }
48 
49 
50 template<class Type>
52 (
53  const tmp<Field<Type>>& tmapF,
54  const labelUList& mapAddressing
55 )
56 :
57  List<Type>(mapAddressing.size())
58 {
59  map(tmapF, mapAddressing);
60 }
61 
62 
63 template<class Type>
65 (
66  const UList<Type>& mapF,
67  const labelListList& mapAddressing,
68  const scalarListList& mapWeights
69 )
70 :
71  List<Type>(mapAddressing.size())
72 {
73  map(mapF, mapAddressing, mapWeights);
74 }
75 
76 
77 template<class Type>
79 (
80  const tmp<Field<Type>>& tmapF,
81  const labelListList& mapAddressing,
82  const scalarListList& mapWeights
83 )
84 :
85  List<Type>(mapAddressing.size())
86 {
87  map(tmapF, mapAddressing, mapWeights);
88 }
89 
90 
91 template<class Type>
93 (
94  const UList<Type>& mapF,
95  const FieldMapper& mapper,
96  const bool applyFlip
97 )
98 :
99  List<Type>(mapper.size())
100 {
101  map(mapF, mapper, applyFlip);
102 }
103 
104 
105 template<class Type>
107 (
108  const UList<Type>& mapF,
109  const FieldMapper& mapper,
110  const Type& defaultValue,
111  const bool applyFlip
112 )
113 :
114  List<Type>(mapper.size(), defaultValue)
115 {
116  map(mapF, mapper, applyFlip);
117 }
118 
119 
120 template<class Type>
122 (
123  const UList<Type>& mapF,
124  const FieldMapper& mapper,
125  const UList<Type>& defaultValues,
126  const bool applyFlip
127 )
128 :
129  List<Type>(defaultValues)
130 {
131  map(mapF, mapper, applyFlip);
132 }
133 
134 
135 template<class Type>
137 (
138  const tmp<Field<Type>>& tmapF,
139  const FieldMapper& mapper,
140  const bool applyFlip
141 )
142 :
143  List<Type>(mapper.size())
144 {
145  map(tmapF, mapper, applyFlip);
146 }
147 
148 
149 template<class Type>
151 (
152  const tmp<Field<Type>>& tmapF,
153  const FieldMapper& mapper,
154  const Type& defaultValue,
155  const bool applyFlip
156 )
157 :
158  List<Type>(mapper.size(), defaultValue)
159 {
160  map(tmapF, mapper, applyFlip);
161 }
162 
163 
164 template<class Type>
166 (
167  const tmp<Field<Type>>& tmapF,
168  const FieldMapper& mapper,
169  const UList<Type>& defaultValues,
170  const bool applyFlip
171 )
172 :
173  List<Type>(defaultValues)
174 {
175  map(tmapF, mapper, applyFlip);
176 }
177 
178 
179 template<class Type>
180 Foam::Field<Type>::Field(const entry& e, const label len)
181 {
182  Field<Type>::assign(e, len);
183 }
184 
185 
186 template<class Type>
188 (
189  const word& key,
190  const dictionary& dict,
191  const label len,
193 )
194 {
195  if (!Field<Type>::assign(key, dict, len, readOpt))
196  {
197  if (IOobjectOption::isReadOptional(readOpt))
198  {
199  // Lazy read: init with zero value
200  if (len > 0) this->resize(len, Zero);
201  }
202  else
203  {
204  // No read: set length only
205  if (len > 0) this->resize(len);
206  }
207  }
208 }
209 
210 
211 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
212 
213 template<class Type>
214 void Foam::Field<Type>::assign(const entry& e, const label len)
215 {
216  if (len)
217  {
218  ITstream& is = e.stream();
219 
220  // Read first token
221  token firstToken(is);
222 
223  if (firstToken.isWord("uniform"))
224  {
225  // Resize to expected length (or -1 : retain current length)
226  if (len >= 0)
227  {
228  this->resize_nocopy(len);
229  }
230  operator=(pTraits<Type>(is));
231  }
232  else if (firstToken.isWord("nonuniform"))
233  {
234  is >> static_cast<List<Type>&>(*this);
235  const label lenRead = this->size();
236 
237  // Check lengths
238  if (len >= 0 && len != lenRead)
239  {
240  if (len < lenRead && allowConstructFromLargerSize)
241  {
242  // Truncate the data
243  this->resize(len);
244 
245  #ifdef FULLDEBUG
247  << "Sizes do not match. Truncating " << lenRead
248  << " entries to " << len << endl;
249  #endif
250  }
251  else
252  {
254  << "Size " << lenRead
255  << " is not equal to the expected length " << len
256  << exit(FatalIOError);
257  }
258  }
259  }
260  else
261  {
263  << "Expected keyword 'uniform' or 'nonuniform', found "
264  << firstToken.info() << nl
265  << exit(FatalIOError);
266  }
267  }
268 }
269 
270 
271 template<class Type>
273 (
274  const word& key,
275  const dictionary& dict,
276  const label len,
277  IOobjectOption::readOption readOpt
278 )
279 {
280  if (!len)
281  {
282  return true;
283  }
284  else if (readOpt != IOobjectOption::NO_READ)
285  {
286  const entry* eptr = dict.findEntry(key, keyType::LITERAL);
287 
288  if (eptr)
289  {
290  Field<Type>::assign(*eptr, len);
291  return true;
292  }
293 
294  // Missing (mandatory or optional)
295  if (IOobjectOption::isReadRequired(readOpt))
296  {
298  << "Required entry '" << key << "' missing in dictionary "
299  << dict.relativeName() << nl
300  << exit(FatalIOError);
301  }
302  }
304  return false;
305 }
306 
307 
308 template<class Type>
310 (
311  const UList<Type>& mapF,
312  const labelUList& mapAddressing
313 )
314 {
315  Field<Type>& f = *this;
316 
317  if (f.size() != mapAddressing.size())
318  {
319  f.resize(mapAddressing.size());
320  }
321 
322  if (mapF.size() > 0)
323  {
324  forAll(f, i)
325  {
326  const label mapI = mapAddressing[i];
327 
328  if (mapI >= 0)
329  {
330  f[i] = mapF[mapI];
331  }
332  }
333  }
334 }
335 
336 
337 template<class Type>
339 (
340  const tmp<Field<Type>>& tmapF,
341  const labelUList& mapAddressing
342 )
343 {
344  map(tmapF(), mapAddressing);
345  tmapF.clear();
346 }
347 
348 
349 template<class Type>
351 (
352  const UList<Type>& mapF,
353  const labelListList& mapAddressing,
354  const scalarListList& mapWeights
355 )
356 {
357  Field<Type>& f = *this;
358 
359  if (f.size() != mapAddressing.size())
360  {
361  f.resize(mapAddressing.size());
362  }
363 
364  if (mapWeights.size() != mapAddressing.size())
365  {
367  << mapWeights.size() << " map size: " << mapAddressing.size()
368  << abort(FatalError);
369  }
370 
371  forAll(f, i)
372  {
373  const labelList& localAddrs = mapAddressing[i];
374  const scalarList& localWeights = mapWeights[i];
375 
376  f[i] = Zero;
377 
378  forAll(localAddrs, j)
379  {
380  f[i] += localWeights[j]*mapF[localAddrs[j]];
381  }
382  }
383 }
384 
385 
386 template<class Type>
388 (
389  const tmp<Field<Type>>& tmapF,
390  const labelListList& mapAddressing,
391  const scalarListList& mapWeights
392 )
393 {
394  map(tmapF(), mapAddressing, mapWeights);
395  tmapF.clear();
396 }
397 
398 
399 template<class Type>
401 (
402  const UList<Type>& mapF,
403  const FieldMapper& mapper,
404  const bool applyFlip
405 )
406 {
407  if (mapper.distributed())
408  {
409  // Fetch remote parts of mapF
410  const mapDistributeBase& distMap = mapper.distributeMap();
411  Field<Type> newMapF(mapF);
412 
413  if (applyFlip)
414  {
415  distMap.distribute(newMapF);
416  }
417  else
418  {
419  distMap.distribute(newMapF, identityOp());
420  }
421 
422  if (mapper.direct() && notNull(mapper.directAddressing()))
423  {
424  map(newMapF, mapper.directAddressing());
425  }
426  else if (!mapper.direct())
427  {
428  map(newMapF, mapper.addressing(), mapper.weights());
429  }
430  else if (mapper.direct() && isNull(mapper.directAddressing()))
431  {
432  // Special case, no local mapper. Assume ordering already correct
433  // from distribution. Note: this behaviour is different compared
434  // to local mapper.
435  this->transfer(newMapF);
436  this->resize(mapper.size());
437  }
438  }
439  else
440  {
441  if
442  (
443  mapper.direct()
444  && notNull(mapper.directAddressing())
445  && mapper.directAddressing().size()
446  )
447  {
448  map(mapF, mapper.directAddressing());
449  }
450  else if (!mapper.direct() && mapper.addressing().size())
451  {
452  map(mapF, mapper.addressing(), mapper.weights());
453  }
454  }
455 }
456 
457 
458 template<class Type>
460 (
461  const tmp<Field<Type>>& tmapF,
462  const FieldMapper& mapper,
463  const bool applyFlip
464 )
465 {
466  map(tmapF(), mapper, applyFlip);
467  tmapF.clear();
468 }
469 
470 
471 template<class Type>
473 (
474  const FieldMapper& mapper,
475  const bool applyFlip
476 )
477 {
478  if (mapper.distributed())
479  {
480  // Fetch remote parts of *this
481  const mapDistributeBase& distMap = mapper.distributeMap();
482  Field<Type> fCpy(*this);
483 
484  if (applyFlip)
485  {
486  distMap.distribute(fCpy);
487  }
488  else
489  {
490  distMap.distribute(fCpy, identityOp());
491  }
492 
493  if
494  (
495  (mapper.direct()
496  && notNull(mapper.directAddressing()))
497  || !mapper.direct()
498  )
499  {
500  this->map(fCpy, mapper);
501  }
502  else if (mapper.direct() && isNull(mapper.directAddressing()))
503  {
504  // Special case, no local mapper. Assume ordering already correct
505  // from distribution. Note: this behaviour is different compared
506  // to local mapper.
507  this->transfer(fCpy);
508  this->resize(mapper.size());
509  }
510  }
511  else
512  {
513  if
514  (
515  (
516  mapper.direct()
517  && notNull(mapper.directAddressing())
518  && mapper.directAddressing().size()
519  )
520  || (!mapper.direct() && mapper.addressing().size())
521  )
522  {
523  Field<Type> fCpy(*this);
524  map(fCpy, mapper);
525  }
526  else
527  {
528  this->resize(mapper.size());
529  }
530  }
531 }
532 
533 
534 template<class Type>
536 (
537  const UList<Type>& mapF,
538  const labelUList& mapAddressing
539 )
540 {
541  Field<Type>& f = *this;
542 
543  forAll(mapF, i)
544  {
545  label mapI = mapAddressing[i];
546 
547  if (mapI >= 0)
548  {
549  f[mapI] = mapF[i];
550  }
551  }
552 }
553 
554 
555 template<class Type>
557 (
558  const tmp<Field<Type>>& tmapF,
559  const labelUList& mapAddressing
560 )
561 {
562  rmap(tmapF(), mapAddressing);
563  tmapF.clear();
564 }
565 
566 
567 template<class Type>
569 (
570  const UList<Type>& mapF,
571  const labelUList& mapAddressing,
572  const UList<scalar>& mapWeights
573 )
574 {
575  Field<Type>& f = *this;
576 
577  f = Zero;
578 
579  forAll(mapF, i)
580  {
581  f[mapAddressing[i]] += mapF[i]*mapWeights[i];
582  }
583 }
584 
585 
586 template<class Type>
588 (
589  const tmp<Field<Type>>& tmapF,
590  const labelUList& mapAddressing,
591  const UList<scalar>& mapWeights
592 )
593 {
594  rmap(tmapF(), mapAddressing, mapWeights);
595  tmapF.clear();
596 }
597 
598 
599 template<class Type>
601 {
602  TFOR_ALL_F_OP_OP_F(Type, *this, =, -, Type, *this)
603 }
604 
605 
606 // A no-op except for vector specialization
607 template<class Type>
609 {}
610 
611 
612 template<class Type>
615 (
616  const direction d
617 ) const
618 {
619  auto tres = tmp<Field<cmptType>>::New(this->size());
620  ::Foam::component(tres.ref(), *this, d);
621  return tres;
622 }
623 
624 
625 template<class Type>
627 (
628  const direction d,
629  const UList<cmptType>& sf
630 )
631 {
632  TFOR_ALL_F_OP_FUNC_S_F(Type, *this, ., replace, const direction, d,
633  cmptType, sf)
634 }
635 
636 
637 template<class Type>
639 (
640  const direction d,
641  const tmp<Field<cmptType>>& tsf
642 )
643 {
644  replace(d, tsf());
645  tsf.clear();
646 }
647 
648 
649 template<class Type>
651 (
652  const direction d,
653  const cmptType& c
654 )
655 {
656  TFOR_ALL_F_OP_FUNC_S_S(Type, *this, ., replace, const direction, d,
657  cmptType, c)
658 }
659 
660 
661 template<class Type>
662 void Foam::Field<Type>::clamp_min(const Type& lower)
663 {
664  // Use free function max() [sic] to impose component-wise clamp_min
665  // std::for_each
666  for (auto& val : *this)
667  {
668  val = max(val, lower);
669  }
670 }
671 
672 template<class Type>
673 void Foam::Field<Type>::clamp_max(const Type& upper)
674 {
675  // Use free function min() [sic] to impose component-wise clamp_max
676  // std::for_each
677  for (auto& val : *this)
678  {
679  val = min(val, upper);
680  }
681 }
682 
683 
684 template<class Type>
685 void Foam::Field<Type>::clamp_range(const Type& lower, const Type& upper)
686 {
687  // Note: no checks for bad/invalid clamping ranges
688 
689  // Use free functions min(), max() to impose component-wise clamping
690  // std::for_each
691  for (auto& val : *this)
692  {
693  val = min(max(val, lower), upper);
694  }
695 }
696 
697 template<class Type>
698 void Foam::Field<Type>::clamp_range(const MinMax<Type>& range)
699 {
700  Field<Type>::clamp_range(range.min(), range.max());
701 }
702 
703 
704 template<class Type>
705 template<class VSForm>
706 VSForm Foam::Field<Type>::block(const label start) const
707 {
708  VSForm vs;
709  for (direction i=0; i<VSForm::nComponents; i++)
710  {
711  vs[i] = this->operator[](start + i);
712  }
713  return vs;
714 }
715 
716 
717 template<class Type>
719 {
720  auto tres = tmp<Field<Type>>::New(this->size());
721  ::Foam::T(tres.ref(), *this);
722  return tres;
723 }
724 
725 
726 template<class Type>
727 void Foam::Field<Type>::writeEntry(const word& keyword, Ostream& os) const
728 {
729  if (keyword.size())
730  {
731  os.writeKeyword(keyword);
732  }
733 
734  // The contents are 'uniform' if the list is non-empty
735  // and all entries have identical values.
736 
737  if (is_contiguous<Type>::value && List<Type>::uniform())
738  {
739  os << word("uniform") << token::SPACE << List<Type>::front();
740  }
741  else
742  {
743  os << word("nonuniform") << token::SPACE;
745  }
746 
747  os.endEntry();
748 }
749 
750 
751 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
752 
753 template<class Type>
755 {
756  if (this == &rhs)
757  {
758  return; // Self-assignment is a no-op
759  }
760 
762 }
763 
764 
765 template<class Type>
766 void Foam::Field<Type>::operator=(const tmp<Field>& rhs)
767 {
768  if (this == &(rhs()))
769  {
770  return; // Self-assignment is a no-op
771  }
773  List<Type>::operator=(rhs());
774 }
775 
776 
777 template<class Type>
778 template<class Form, class Cmpt, Foam::direction nCmpt>
779 void Foam::Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
780 {
781  TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs)
782 }
783 
784 
785 #define COMPUTED_ASSIGNMENT(TYPE, op) \
786  \
787 template<class Type> \
788 void Foam::Field<Type>::operator op(const UList<TYPE>& f) \
789 { \
790  TFOR_ALL_F_OP_F(Type, *this, op, TYPE, f) \
791 } \
792  \
793 template<class Type> \
794 void Foam::Field<Type>::operator op(const tmp<Field<TYPE>>& tf) \
795 { \
796  operator op(tf()); \
797  tf.clear(); \
798 } \
799  \
800 template<class Type> \
801 void Foam::Field<Type>::operator op(const TYPE& t) \
802 { \
803  TFOR_ALL_F_OP_S(Type, *this, op, TYPE, t) \
804 }
805 
806 COMPUTED_ASSIGNMENT(Type, +=)
807 COMPUTED_ASSIGNMENT(Type, -=)
808 COMPUTED_ASSIGNMENT(scalar, *=)
809 COMPUTED_ASSIGNMENT(scalar, /=)
810 
811 #undef COMPUTED_ASSIGNMENT
812 
813 
814 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
815 
816 template<class Type>
817 Foam::Ostream& Foam::operator<<(Ostream& os, const Field<Type>& f)
818 {
819  os << static_cast<const List<Type>&>(f);
820  return os;
821 }
822 
823 
824 template<class Type>
825 Foam::Ostream& Foam::operator<<(Ostream& os, const tmp<Field<Type>>& tf)
826 {
827  os << tf();
828  tf.clear();
829  return os;
830 }
831 
832 
833 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
834 
835 #include "FieldFunctions.C"
836 
837 // ************************************************************************* //
List< scalar > scalarList
List of scalar.
Definition: scalarList.H:32
dictionary dict
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
uint8_t direction
Definition: direction.H:46
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
patchWriters resize(patchIds.size())
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
#define COMPUTED_ASSIGNMENT(TYPE, op)
Definition: Field.C:778
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
void negate()
Inplace negate this field (negative).
Definition: Field.C:593
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
#define TFOR_ALL_F_OP_OP_F(typeF1, f1, OP1, OP2, typeF2, f2)
Definition: FieldM.H:480
void clamp_min(const Type &lower)
Impose lower (floor) clamp on the field values (in-place)
Definition: Field.C:655
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
pTraits< Foam::vector >::cmptType cmptType
Component type.
Definition: Field.H:123
virtual const labelListList & addressing() const
Return the interpolation addressing.
Definition: FieldMapper.H:115
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
void clamp_range(const Type &lower, const Type &upper)
Clamp field values (in-place) to the specified range.
Definition: Field.C:678
virtual bool direct() const =0
Is it a direct (non-interpolating) mapper?
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Definition: stringOps.C:1187
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
Definition: Field.C:720
bool uniform() const
True if all entries have identical values, and list is non-empty.
Definition: UListI.H:215
virtual const scalarListList & weights() const
Return the interpolation weights.
Definition: FieldMapper.H:127
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Definition: exprTraits.C:40
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Definition: Field.C:620
virtual const labelUList & directAddressing() const
Return the direct addressing values.
Definition: FieldMapper.H:91
List< labelList > labelListList
List of labelList.
Definition: labelList.H:38
scalar range
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
#define TFOR_ALL_F_OP_S(typeF, f, OP, typeS, s)
Definition: FieldM.H:502
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
virtual label size() const =0
The size of the mapper.
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Abstract base class to hold the Field mapping addressing and weights.
Definition: FieldMapper.H:43
Generic templated field type.
Definition: Field.H:62
List< scalarList > scalarListList
List of scalarList.
Definition: scalarList.H:35
A class for handling words, derived from Foam::string.
Definition: word.H:63
VSForm block(const label start) const
Definition: Field.C:699
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
errorManip< error > abort(error &err)
Definition: errorManip.H:139
#define TFOR_ALL_F_OP_FUNC_S_S(typeF1, f1, OP, FUNC, typeS1, s1, typeS2, s2)
Definition: FieldM.H:299
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
Definition: Field.C:303
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
Definition: Field.C:608
virtual const mapDistributeBase & distributeMap() const
Return the distribution map.
Definition: FieldMapper.H:103
Class containing processor-to-processor mapping information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual bool distributed() const
Does the mapper have remote contributions?
Definition: FieldMapper.H:76
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
Definition: FieldOps.C:28
bool isNull(const T *ptr)
True if ptr is a pointer (of type T) to the nullObject.
Definition: nullObject.H:227
OBJstream os(runTime.globalPath()/outputName)
void operator=(const Field< Type > &)
Copy assignment.
Definition: Field.C:747
labelList f(nPoints)
const volScalarField & T
void assign(const entry &e, const label len)
Assign from a primitive dictionary entry with the following behaviour:
Definition: Field.C:207
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
Definition: Field.C:466
#define TFOR_ALL_F_OP_FUNC_S_F(typeF1, f1, OP, FUNC, typeS, s, typeF2, f2)
Definition: FieldM.H:277
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Definition: Field.C:529
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Definition: stringOps.C:1171
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:627
void clamp_max(const Type &upper)
Impose upper (ceiling) clamp on the field values (in-place)
Definition: Field.C:666
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:103
const dimensionedScalar c
Speed of light in a vacuum.
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
Definition: Field.C:711
void writeEntry(Ostream &os) const
Write the UList with its compound type.
Definition: UListIO.C:30
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
List< label > labelList
A List of labels.
Definition: List.H:62
constexpr Field() noexcept
Default construct.
Definition: FieldI.H:33
A class for managing temporary objects.
Definition: HashPtrTable.H:50
void normalise()
Inplace normalise this field. Generally a no-op except for vector fields.
Definition: Field.C:601
Declaration macros for Field<Type> algebra.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
Definition: nullObject.H:246
static void distribute(const UPstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &field, const T &nullValue, const CombineOp &cop, const NegateOp &negOp, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Distribute combine data with specified combine operation and negate operator (for flips)...
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:63
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127
readOption
Enumeration defining read preferences.