dimensionedType.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) 2016-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 "dimensionedType.H"
30 #include "dictionary.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
34 template<class Type>
35 void Foam::dimensioned<Type>::initialize(Istream& is, const bool checkDims)
36 {
37  token nextToken(is);
38  is.putBack(nextToken);
39 
40  // Optional name found - use it
41  if (nextToken.isWord())
42  {
43  is >> name_;
44  is >> nextToken;
45  is.putBack(nextToken);
46  }
47 
48  scalar mult{1};
49 
50  if (nextToken == token::BEGIN_SQR)
51  {
52  // Optional dimensions found - use them
53  const dimensionSet curr(dimensions_);
54  dimensions_.read(is, mult);
55 
56  if (checkDims && curr != dimensions_)
57  {
59  << "The dimensions " << dimensions_
60  << " provided do not match the expected dimensions "
61  << curr << endl
62  << abort(FatalIOError);
63  }
64  }
65 
66  // Read value
67  is >> value_;
68  value_ *= mult;
69 }
70 
71 
72 template<class Type>
74 (
75  const word& key,
76  const dictionary& dict,
77  IOobjectOption::readOption readOpt,
78  const bool checkDims,
79  enum keyType::option matchOpt
80 )
81 {
82  if (readOpt == IOobjectOption::NO_READ)
83  {
84  return false;
85  }
86 
87  // Largely identical to dictionary::readEntry(),
88  // but with optional handling of checkDims
89 
90  const entry* eptr = dict.findEntry(key, matchOpt);
91 
92  if (eptr)
93  {
94  ITstream& is = eptr->stream();
95 
96  initialize(is, checkDims);
97 
98  dict.checkITstream(is, key);
99 
100  return true;
101  }
102  else if (IOobjectOption::isReadRequired(readOpt))
103  {
105  << "Entry '" << key << "' not found in dictionary "
106  << dict.name()
107  << exit(FatalIOError);
108  }
109 
110  return false;
111 }
112 
113 
114 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
115 
116 template<class Type>
118 :
119  name_("0"),
120  dimensions_(),
121  value_(Zero)
122 {}
123 
124 
125 template<class Type>
127 :
128  name_("0"),
129  dimensions_(dims),
130  value_(Zero)
131 {}
132 
133 
134 template<class Type>
136 (
137  const dimensionSet& dims,
138  const Foam::zero
139 )
140 :
141  name_("0"),
142  dimensions_(dims),
143  value_(Zero)
144 {}
145 
146 
147 template<class Type>
149 (
150  const dimensionSet& dims,
151  const Foam::one
152 )
153 :
154  name_("1"),
155  dimensions_(dims),
156  value_(pTraits<Type>::one)
157 {}
158 
159 
160 template<class Type>
162 (
163  const dimensionSet& dims,
164  const Type& val
165 )
166 :
167  name_(::Foam::name(val)),
168  dimensions_(dims),
169  value_(val)
170 {}
171 
172 
173 template<class Type>
175 (
176  const word& name,
177  const dimensionSet& dims,
178  const Type& val
179 )
180 :
181  name_(name),
182  dimensions_(dims),
183  value_(val)
184 {}
185 
186 
187 template<class Type>
189 (
190  const word& name,
191  const dimensioned<Type>& dt
192 )
193 :
194  name_(name),
195  dimensions_(dt.dimensions_),
196  value_(dt.value_)
197 {}
198 
199 
200 template<class Type>
202 (
203  const primitiveEntry& e
204 )
205 :
206  name_(e.name()),
207  dimensions_(),
208  value_(Zero)
209 {
210  ITstream& is = e.stream();
211 
212  // checkDims = false
213  initialize(is, false);
215  e.checkITstream(is);
216 }
217 
218 
219 template<class Type>
221 (
222  const primitiveEntry& e,
223  const dimensionSet& dims
224 )
225 :
226  name_(e.name()),
227  dimensions_(dims),
228  value_(Zero)
229 {
230  ITstream& is = e.stream();
231 
232  // checkDims = true
233  initialize(is, true);
235  e.checkITstream(is);
236 }
237 
238 
239 template<class Type>
241 (
242  const word& name,
243  const dictionary& dict
244 )
245 :
246  name_(name),
247  dimensions_(),
248  value_(Zero)
249 {
250  // checkDims = false
251  readEntry(name, dict, IOobjectOption::MUST_READ, false);
252 }
253 
254 
255 template<class Type>
257 (
258  const word& name,
259  const dimensionSet& dims,
260  const dictionary& dict
261 )
262 :
263  name_(name),
264  dimensions_(dims),
265  value_(Zero)
266 {
267  // checkDims = true
268  readEntry(name, dict, IOobjectOption::MUST_READ);
269 }
270 
271 
272 template<class Type>
274 (
275  const word& name,
276  const dimensionSet& dims,
277  const dictionary& dict,
278  const word& entryName
279 )
280 :
281  name_(name),
282  dimensions_(dims),
283  value_(Zero)
284 {
285  // checkDims = true
286  readEntry(entryName, dict, IOobjectOption::MUST_READ);
287 }
288 
289 
290 template<class Type>
292 (
293  const word& name,
294  const dimensionSet& dims,
295  const Type& val,
296  const dictionary& dict
297 )
298 :
299  name_(name),
300  dimensions_(dims),
301  value_(val)
302 {
303  // checkDims = true
304  readEntry(name, dict, IOobjectOption::READ_IF_PRESENT);
305 }
306 
307 
308 template<class Type>
310 :
311  dimensions_()
312 {
313  read(is);
314 }
315 
316 
317 template<class Type>
319 (
320  const word& name,
321  Istream& is
322 )
323 :
324  name_(name),
325  dimensions_()
326 {
327  read(is, false); // Don't read name. Read dimensionSet + multiplier only.
328 }
329 
330 
331 template<class Type>
333 (
334  const word& name,
335  const dimensionSet& dims,
336  Istream& is
337 )
338 :
339  name_(name),
340  dimensions_(dims),
341  value_(Zero)
342 {
343  // checkDims = true
344  initialize(is, true);
345 }
346 
347 
348 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
349 
350 template<class Type>
352 (
353  const word& name,
354  const dictionary& dict,
355  const dimensionSet& dims,
356  const Type& deflt
357 )
358 {
359  // checkDims = true
360  return dimensioned<Type>(name, dims, deflt, dict);
361 }
362 
363 
364 template<class Type>
366 (
367  const word& name,
368  const dictionary& dict,
369  const Type& deflt
370 )
371 {
372  return dimensioned<Type>(name, dimless, deflt, dict);
373 }
374 
375 
376 template<class Type>
378 (
379  const word& name,
380  dictionary& dict,
381  const dimensionSet& dims,
382  const Type& deflt
383 )
384 {
385  if (dict.found(name))
386  {
387  return dimensioned<Type>(name, dims, dict);
388  }
389 
390  (void) dict.add(name, deflt);
391  return dimensioned<Type>(name, dims, deflt);
392 }
393 
394 
395 template<class Type>
397 (
398  const word& name,
399  dictionary& dict,
400  const Type& deflt
401 )
402 {
403  return getOrAddToDict(name, dict, dimless, deflt);
404 }
406 
407 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
408 
409 template<class Type>
412 (
413  const direction d
414 ) const
415 {
416  return dimensioned<cmptType>
417  (
418  name_ + ".component(" + Foam::name(d) + ')',
419  dimensions_,
420  value_.component(d)
421  );
422 }
423 
424 
425 template<class Type>
427 (
428  const direction d,
429  const dimensioned<typename dimensioned<Type>::cmptType>& dc
430 )
431 {
432  dimensions_ = dc.dimensions();
433  value_.replace(d, dc.value());
434 }
435 
436 
437 template<class Type>
439 {
440  return read(name_, dict);
441 }
442 
443 
444 template<class Type>
446 {
447  return readIfPresent(name_, dict);
448 }
449 
450 
451 template<class Type>
453 (
454  const word& entryName,
455  const dictionary& dict
456 )
457 {
458  // checkDims = true
459  return readEntry(entryName, dict, IOobjectOption::MUST_READ);
460 }
461 
462 
463 template<class Type>
465 (
466  const word& entryName,
467  const dictionary& dict
468 )
469 {
470  // checkDims = true
471  return readEntry(entryName, dict, IOobjectOption::READ_IF_PRESENT);
472 }
473 
474 
475 template<class Type>
476 Foam::Istream& Foam::dimensioned<Type>::read(Istream& is, const bool readName)
477 {
478  if (readName)
479  {
480  // Read name
481  is >> name_;
482  }
483 
484  // Read dimensionSet + multiplier
485  scalar mult{1};
486  dimensions_.read(is, mult);
487 
488  // Read value
489  is >> value_;
490  value_ *= mult;
491 
493  return is;
494 }
495 
496 
497 template<class Type>
500 {
501  // Read name
502  is >> name_;
503 
504  // Read dimensionSet + multiplier
505  scalar mult{1};
506  dimensions_.read(is, mult, readSet);
507 
508  // Read value
509  is >> value_;
510  value_ *= mult;
511 
513  return is;
514 }
515 
516 
517 template<class Type>
519 (
520  Istream& is,
521  const HashTable<dimensionedScalar>& readSet
522 )
523 {
524  // Read name
525  is >> name_;
526 
527  // Read dimensionSet + multiplier
528  scalar mult{1};
529  dimensions_.read(is, mult, readSet);
530 
531  // Read value
532  is >> value_;
533  value_ *= mult;
534 
536  return is;
537 }
538 
539 
540 template<class Type>
542 (
543  const word& keyword,
544  Ostream& os
545 ) const
546 {
547  if (keyword.size())
548  {
549  os.writeKeyword(keyword);
550 
551  if (keyword != name_)
552  {
553  // The name, only if different from keyword
554  os << name_ << token::SPACE;
555  }
556  }
557  else
558  {
559  // Use the name (no keyword provided)
560  os.writeKeyword(name_);
561  }
562 
563  // The dimensions
564  scalar mult{1};
565  dimensions_.write(os, mult);
566 
567  // The value
568  os << token::SPACE << value_/mult;
569  os.endEntry();
570 
571  os.check(FUNCTION_NAME);
572 }
574 
575 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
576 
577 template<class Type>
580 (
581  const direction d
582 ) const
583 {
584  return component(d);
585 }
586 
587 
588 template<class Type>
590 (
591  const dimensioned<Type>& dt
592 )
593 {
594  dimensions_ += dt.dimensions_;
595  value_ += dt.value_;
596 }
597 
598 
599 template<class Type>
601 (
602  const dimensioned<Type>& dt
603 )
604 {
605  dimensions_ -= dt.dimensions_;
606  value_ -= dt.value_;
607 }
608 
609 
610 template<class Type>
612 (
613  const scalar s
614 )
615 {
616  value_ *= s;
617 }
618 
619 
620 template<class Type>
622 (
623  const scalar s
624 )
625 {
626  value_ /= s;
627 }
628 
629 
630 // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
631 
632 template<class Type, Foam::direction r>
634 Foam::pow(const dimensioned<Type>& dt, typename powProduct<Type, r>::type)
635 {
637  (
638  "pow(" + dt.name() + ',' + name(r) + ')',
639  pow(dt.dimensions(), r),
640  pow(dt.value(), 2)
641  );
642 }
643 
644 
645 template<class Type>
647 Foam::sqr(const dimensioned<Type>& dt)
648 {
650  (
651  "sqr(" + dt.name() + ')',
652  sqr(dt.dimensions()),
653  sqr(dt.value())
654  );
655 }
656 
657 template<class Type>
659 Foam::magSqr(const dimensioned<Type>& dt)
660 {
661  typedef typename typeOfMag<Type>::type magType;
662 
663  return dimensioned<magType>
664  (
665  "magSqr(" + dt.name() + ')',
666  magSqr(dt.dimensions()),
667  magSqr(dt.value())
668  );
669 }
670 
671 template<class Type>
673 Foam::mag(const dimensioned<Type>& dt)
674 {
675  typedef typename typeOfMag<Type>::type magType;
676 
677  return dimensioned<magType>
678  (
679  "mag(" + dt.name() + ')',
680  dt.dimensions(),
681  mag(dt.value())
682  );
683 }
684 
685 
686 template<class Type>
688 (
689  const dimensioned<Type>& dt1,
690  const dimensioned<Type>& dt2
691 )
692 {
693  return dimensioned<Type>
694  (
695  "cmptMultiply(" + dt1.name() + ',' + dt2.name() + ')',
696  cmptMultiply(dt1.dimensions(), dt2.dimensions()),
697  cmptMultiply(dt1.value(), dt2.value())
698  );
699 }
700 
701 template<class Type>
703 (
704  const dimensioned<Type>& dt1,
705  const dimensioned<Type>& dt2
706 )
707 {
708  return dimensioned<Type>
709  (
710  "cmptDivide(" + dt1.name() + ',' + dt2.name() + ')',
711  cmptDivide(dt1.dimensions(), dt2.dimensions()),
712  cmptDivide(dt1.value(), dt2.value())
713  );
714 }
715 
716 
717 template<class Type>
719 (
720  const dimensioned<Type>& a,
721  const dimensioned<Type>& b
722 )
723 {
724  return dimensioned<Type>
725  (
726  "max(" + a.name() + ',' + b.name() + ')',
727  max(a.dimensions(), b.dimensions()),
728  max(a.value(), b.value())
729  );
730 }
731 
732 
733 template<class Type>
735 (
736  const dimensioned<Type>& a,
737  const dimensioned<Type>& b
738 )
739 {
740  return dimensioned<Type>
741  (
742  "min(" + a.name() + ',' + b.name() + ')',
743  min(a.dimensions(), b.dimensions()),
744  min(a.value(), b.value())
745  );
746 }
747 
748 
749 template<class Type>
751 (
752  const dimensioned<Type>& a,
753  const dimensioned<Type>& b,
754  const scalar t
755 )
756 {
757  return dimensioned<Type>
758  (
759  "lerp(" + a.name() + ',' + b.name() + ',' + ::Foam::name(t) + ')',
760  lerp(a.dimensions(), b.dimensions()),
761  lerp(a.value(), b.value(), t)
762  );
763 }
764 
765 
766 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
767 
768 template<class Type>
769 Foam::Istream& Foam::operator>>(Istream& is, dimensioned<Type>& dt)
770 {
771  dt.initialize(is, false); // no checkDims
772  is.check(FUNCTION_NAME);
773  return is;
774 }
775 
776 
777 template<class Type>
778 Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
779 {
780  // The name
781  os << dt.name() << token::SPACE;
782 
783  // The dimensions
784  scalar mult{1};
785  dt.dimensions().write(os, mult);
786 
787  // The value
788  os << token::SPACE << dt.value()/mult;
789 
790  os.check(FUNCTION_NAME);
791  return os;
792 }
793 
794 
795 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
796 
797 template<class Type>
798 bool Foam::operator<
799 (
800  const dimensioned<Type>& dt1,
801  const dimensioned<Type>& dt2
802 )
803 {
804  return dt1.value() < dt2.value();
805 }
806 
807 
808 template<class Type>
809 bool Foam::operator>
810 (
811  const dimensioned<Type>& dt1,
812  const dimensioned<Type>& dt2
813 )
814 {
815  return dt2.value() < dt1.value();
816 }
817 
818 
819 template<class Type>
820 Foam::dimensioned<Type> Foam::operator+
821 (
822  const dimensioned<Type>& dt1,
823  const dimensioned<Type>& dt2
824 )
825 {
826  return dimensioned<Type>
827  (
828  '(' + dt1.name() + '+' + dt2.name() + ')',
829  dt1.dimensions() + dt2.dimensions(),
830  dt1.value() + dt2.value()
831  );
832 }
833 
834 
835 template<class Type>
836 Foam::dimensioned<Type> Foam::operator-(const dimensioned<Type>& dt)
837 {
838  return dimensioned<Type>
839  (
840  '-' + dt.name(),
841  dt.dimensions(),
842  -dt.value()
843  );
844 }
845 
846 
847 template<class Type>
848 Foam::dimensioned<Type> Foam::operator-
849 (
850  const dimensioned<Type>& dt1,
851  const dimensioned<Type>& dt2
852 )
853 {
854  return dimensioned<Type>
855  (
856  '(' + dt1.name() + '-' + dt2.name() + ')',
857  dt1.dimensions() - dt2.dimensions(),
858  dt1.value() - dt2.value()
859  );
860 }
861 
862 
863 template<class Type>
864 Foam::dimensioned<Type> Foam::operator*
865 (
866  const dimensioned<scalar>& ds,
867  const dimensioned<Type>& dt
868 )
869 {
870  return dimensioned<Type>
871  (
872  '(' + ds.name() + '*' + dt.name() + ')',
873  ds.dimensions() * dt.dimensions(),
874  ds.value() * dt.value()
875  );
876 }
877 
878 
879 template<class Type>
880 Foam::dimensioned<Type> Foam::operator/
881 (
882  const dimensioned<Type>& dt,
883  const dimensioned<scalar>& ds
884 )
885 {
886  return dimensioned<Type>
887  (
888  '(' + dt.name() + '|' + ds.name() + ')',
889  dt.dimensions() / ds.dimensions(),
890  dt.value() / ds.value()
891  );
892 }
893 
894 
895 #define PRODUCT_OPERATOR(product, op, opFunc) \
896  \
897 template<class Type1, class Type2> \
898 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \
899 Foam::operator op \
900 ( \
901  const dimensioned<Type1>& dt1, \
902  const dimensioned<Type2>& dt2 \
903 ) \
904 { \
905  return dimensioned<typename product<Type1, Type2>::type> \
906  ( \
907  '(' + dt1.name() + #op + dt2.name() + ')', \
908  dt1.dimensions() op dt2.dimensions(), \
909  dt1.value() op dt2.value() \
910  ); \
911 } \
912  \
913 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
914 Foam::dimensioned<typename Foam::product<Type, Form>::type> \
915 Foam::operator op \
916 ( \
917  const dimensioned<Type>& dt1, \
918  const VectorSpace<Form,Cmpt,nCmpt>& t2 \
919 ) \
920 { \
921  return dimensioned<typename product<Type, Form>::type> \
922  ( \
923  '(' + dt1.name() + #op + name(t2) + ')', \
924  dt1.dimensions(), \
925  dt1.value() op static_cast<const Form&>(t2) \
926  ); \
927 } \
928  \
929 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
930 Foam::dimensioned<typename Foam::product<Form, Type>::type> \
931 Foam::operator op \
932 ( \
933  const VectorSpace<Form,Cmpt,nCmpt>& t1, \
934  const dimensioned<Type>& dt2 \
935 ) \
936 { \
937  return dimensioned<typename product<Form, Type>::type> \
938  ( \
939  '(' + name(t1) + #op + dt2.name() + ')', \
940  dt2.dimensions(), \
941  static_cast<const Form&>(t1) op dt2.value() \
942  ); \
943 }
944 
945 
946 PRODUCT_OPERATOR(outerProduct, *, outer)
947 PRODUCT_OPERATOR(crossProduct, ^, cross)
948 PRODUCT_OPERATOR(innerProduct, &, dot)
949 PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
950 
951 #undef PRODUCT_OPERATOR
952 
953 
954 // ************************************************************************* //
dimensioned< cmptType > component(const direction d) const
Return a component as a dimensioned<cmptType>
const Type & value() const noexcept
Return const reference to value.
dictionary dict
type
Types of root.
Definition: Roots.H:52
uint8_t direction
Definition: direction.H:46
static dimensioned< Type > getOrDefault(const word &name, const dictionary &dict, const dimensionSet &dims=dimless, const Type &deflt=Type(Zero))
Construct dimensioned from dictionary, with default value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:45
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool readIfPresent(const dictionary &dict)
Update the value of dimensioned<Type> if found in the dictionary, lookup in dictionary with the name(...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Generic dimensioned Type class.
const dimensionSet dimless
Dimensionless.
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
#define PRODUCT_OPERATOR(product, op, opFunc)
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
pTraits< Type >::cmptType cmptType
Component type.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
void writeEntry(const word &keyword, Ostream &os) const
Write as a dictionary entry with keyword.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
A class for handling words, derived from Foam::string.
Definition: word.H:63
Istream & operator>>(Istream &, directionInfo &)
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
A HashTable similar to std::unordered_map.
Definition: HashTable.H:108
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
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
bool read(const dictionary &dict)
Update the value of dimensioned<Type>, lookup in dictionary with the name().
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
dimensioned()
A dimensionless Zero, named "0".
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
static dimensioned< Type > getOrAddToDict(const word &name, dictionary &dict, const dimensionSet &dims=dimless, const Type &deflt=Type(Zero))
Construct dimensioned from dictionary, with default value.
const word & name() const noexcept
Return const reference to name.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:627
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
static bool checkDims(const char *what, const dimensionSet &a, const dimensionSet &b)
Definition: dimensionSet.C:41
meshDefDict readIfPresent("polyMeshPatches", polyPatchNames)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
void replace(const direction d, const dimensioned< cmptType > &dc)
Return a component with a dimensioned<cmptType>
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))
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
An input stream of tokens.
Definition: ITstream.H:52
Namespace for OpenFOAM.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:56
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