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