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