dimensionSetIO.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-2015 OpenFOAM Foundation
9  Copyright (C) 2019 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 "dimensionSet.H"
30 #include "IOstreams.H"
31 #include "dimensionedScalar.H"
32 #include <limits>
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
37 {
38  const entry& e = dict.lookupEntry(entryName, keyType::LITERAL);
39  ITstream& is = e.stream();
40 
41  is >> *this;
42 
43  e.checkITstream(is);
44 }
45 
46 
48 {
49  is >> *this;
50 }
51 
52 
53 Foam::dimensionSet::tokeniser::tokeniser(Istream& is)
54 :
55  is_(is),
56  tokens_(100),
57  start_(0),
58  size_(0)
59 {}
60 
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
64 void Foam::dimensionSet::tokeniser::push(const token& t)
65 {
66  const label end = (start_+size_)%tokens_.size();
67  tokens_[end] = t;
68  if (size_ == tokens_.size())
69  {
70  start_ = tokens_.fcIndex(start_);
71  }
72  else
73  {
74  ++size_;
75  }
76 }
77 
78 
79 Foam::token Foam::dimensionSet::tokeniser::pop()
80 {
81  token t = tokens_[start_];
82  start_ = tokens_.fcIndex(start_);
83  --size_;
84  return t;
85 }
86 
87 
88 void Foam::dimensionSet::tokeniser::unpop(const token& t)
89 {
90  ++size_;
91  start_ = tokens_.rcIndex(start_);
92  tokens_[start_] = t;
93 }
94 
95 
96 bool Foam::dimensionSet::tokeniser::hasToken() const
97 {
98  return size_ || is_.good();
99 }
100 
101 
102 bool Foam::dimensionSet::tokeniser::valid(char c)
103 {
104  return
105  (
106  !isspace(c)
107  && c != '"' // string quote
108  && c != '\'' // string quote
109  && c != '/' // div
110  && c != ';' // end statement
111  && c != '{' // beg subdict
112  && c != '}' // end subdict
113  && c != '(' // beg expr
114  && c != ')' // end expr
115  && c != '[' // beg dim
116  && c != ']' // end dim
117  && c != '^' // power
118  && c != '*' // mult
119  );
120 }
121 
122 
123 Foam::label Foam::dimensionSet::tokeniser::priority(const token& t)
124 {
125  if (!t.isPunctuation())
126  {
127  return 0;
128  }
129  else if
130  (
131  t.pToken() == token::MULTIPLY
132  || t.pToken() == token::DIVIDE
133  )
134  {
135  return 2;
136  }
137  else if (t.pToken() == '^')
138  {
139  return 3;
140  }
141  else
142  {
143  return 0;
144  }
145 }
146 
147 
148 void Foam::dimensionSet::tokeniser::splitWord(const word& w)
149 {
150  size_t start = 0;
151  for (size_t i=0; i<w.size(); ++i)
152  {
153  if (!valid(w[i]))
154  {
155  if (i > start)
156  {
157  const word subWord = w.substr(start, i-start);
158  if (isdigit(subWord[0]) || subWord[0] == token::SUBTRACT)
159  {
160  push(token(readScalar(subWord)));
161  }
162  else
163  {
164  push(token(subWord));
165  }
166  }
167  if (w[i] != token::SPACE)
168  {
169  if (isdigit(w[i]))
170  {
171  // Single digit: as scalar value
172  const scalar val = (w[i] - '0');
173  push(token(val));
174  }
175  else
176  {
177  push(token(token::punctuationToken(w[i])));
178  }
179  }
180  start = i+1;
181  }
182  }
183  if (start < w.size())
184  {
185  const word subWord = w.substr(start);
186  if (isdigit(subWord[0]) || subWord[0] == token::SUBTRACT)
187  {
188  push(token(readScalar(subWord)));
189  }
190  else
191  {
192  push(token(subWord));
193  }
194  }
195 }
196 
197 
198 Foam::token Foam::dimensionSet::tokeniser::nextToken()
199 {
200  if (size_ == 0)
201  {
202  token t(is_);
203  if (t.isWord())
204  {
205  splitWord(t.wordToken());
206  return pop();
207  }
208  else
209  {
210  return t;
211  }
212  }
213  else
214  {
215  return pop();
216  }
217 }
218 
219 
220 void Foam::dimensionSet::tokeniser::putBack(const token& t)
221 {
222  if (size_ == 0)
223  {
224  push(t);
225  }
226  else
227  {
228  unpop(t);
229  }
230 }
231 
232 
233 void Foam::dimensionSet::round(const scalar tol)
234 {
235  scalar integralPart;
236  for (scalar& val : exponents_)
237  {
238  const scalar fractionalPart = std::modf(val, &integralPart);
239 
240  if (mag(fractionalPart-1.0) <= tol)
241  {
242  val = 1.0+integralPart;
243  }
244  else if (mag(fractionalPart+1.0) <= tol)
245  {
246  val = -1.0+integralPart;
247  }
248  else if (mag(fractionalPart) <= tol)
249  {
250  val = integralPart;
251  }
252  }
253 }
254 
255 
256 Foam::dimensionedScalar Foam::dimensionSet::parse
257 (
258  const label lastPrior,
259  tokeniser& tis,
260  const HashTable<dimensionedScalar>& readSet
261 ) const
262 {
263  dimensionedScalar ds("", dimless, 1.0);
264 
265  // Get initial token
266  token nextToken(tis.nextToken());
267 
268  // Store type of last token read. Used to detect two consecutive
269  // symbols and assume multiplication
270  bool haveReadSymbol = false;
271 
272 
273  while (true)
274  {
275  if (nextToken.isWord())
276  {
277  const word& unitName = nextToken.wordToken();
278  const dimensionedScalar& unitDim = readSet[unitName];
279  ds.dimensions() *= unitDim.dimensions();
280  ds.value() *= unitDim.value();
281  haveReadSymbol = true;
282  }
283  else if (nextToken.isNumber())
284  {
285  // no dimensions, just value
286  ds.value() *= nextToken.number();
287  haveReadSymbol = true;
288  }
289  else if (nextToken.isPunctuation())
290  {
291  label nextPrior = tokeniser::priority(nextToken);
292 
293  if (nextToken.pToken() == token::BEGIN_SQR)
294  {
295  // No idea when this will happen
296  tis.putBack(nextToken);
297  return ds;
298  }
299  else if (nextToken.pToken() == token::END_SQR)
300  {
301  tis.putBack(nextToken);
302  return ds;
303  }
304  else if (nextToken.pToken() == token::BEGIN_LIST)
305  {
306  dimensionedScalar sub(parse(nextPrior, tis, readSet));
307 
308  token t = tis.nextToken();
309  if (!t.isPunctuation() || t.pToken() != token::END_LIST)
310  {
311  FatalIOErrorInFunction(tis.stream())
312  << "Illegal token " << t << exit(FatalIOError);
313  }
314 
315  ds.dimensions() *= sub.dimensions();
316  ds.value() *= sub.value();
317 
318  haveReadSymbol = true;
319  }
320  else if (nextToken.pToken() == token::END_LIST)
321  {
322  tis.putBack(nextToken);
323  return ds;
324  }
325  else if (nextToken.pToken() == token::MULTIPLY)
326  {
327  if (nextPrior > lastPrior)
328  {
329  dimensionedScalar sub(parse(nextPrior, tis, readSet));
330 
331  ds.dimensions() *= sub.dimensions();
332  ds.value() *= sub.value();
333  }
334  else
335  {
336  // Restore token
337  tis.putBack(nextToken);
338  return ds;
339  }
340  haveReadSymbol = false;
341  }
342  else if (nextToken.pToken() == token::DIVIDE)
343  {
344  if (nextPrior > lastPrior)
345  {
346  dimensionedScalar sub(parse(nextPrior, tis, readSet));
347 
348  ds.dimensions() /= sub.dimensions();
349  ds.value() /= sub.value();
350  }
351  else
352  {
353  tis.putBack(nextToken);
354  return ds;
355  }
356  haveReadSymbol = false;
357  }
358  else if (nextToken.pToken() == '^')
359  {
360  if (nextPrior > lastPrior)
361  {
362  dimensionedScalar exp(parse(nextPrior, tis, readSet));
363 
364  ds.dimensions().reset(pow(ds.dimensions(), exp.value()));
365  // Round to nearest integer if close to it
366  ds.dimensions().round(10*smallExponent);
367  ds.value() = Foam::pow(ds.value(), exp.value());
368  }
369  else
370  {
371  tis.putBack(nextToken);
372  return ds;
373  }
374  haveReadSymbol = false;
375  }
376  else
377  {
378  FatalIOErrorInFunction(tis.stream())
379  << "Illegal token " << nextToken << exit(FatalIOError);
380  }
381  }
382  else
383  {
384  FatalIOErrorInFunction(tis.stream())
385  << "Illegal token " << nextToken << exit(FatalIOError);
386  }
387 
388 
389  if (!tis.hasToken())
390  {
391  break;
392  }
393 
394  nextToken = tis.nextToken();
395  if (nextToken.error())
396  {
397  break;
398  }
399 
400  if (haveReadSymbol && (nextToken.isWord() || nextToken.isNumber()))
401  {
402  // Two consecutive symbols. Assume multiplication
403  tis.putBack(nextToken);
404  nextToken = token(token::MULTIPLY);
405  }
406  }
407 
408  return ds;
409 }
410 
411 
413 (
414  Istream& is,
415  scalar& multiplier,
416  const HashTable<dimensionedScalar>& readSet
417 )
418 {
419  multiplier = 1.0;
420 
421  // Read beginning of dimensionSet
422  token startToken(is);
423 
424  if (startToken != token::BEGIN_SQR)
425  {
427  << "Expected a '" << token::BEGIN_SQR << "' in dimensionSet\n"
428  << "in stream " << is.info() << nl
429  << exit(FatalIOError);
430  }
431 
432  // Read next token
433  token nextToken(is);
434 
435  if (!nextToken.isNumber())
436  {
437  is.putBack(nextToken);
438 
439  tokeniser tis(is);
440 
441  dimensionedScalar ds(parse(0, tis, readSet));
442 
443  multiplier = ds.value();
444  exponents_ = ds.dimensions().values();
445  }
446  else
447  {
448  // Read first five dimensions
449  exponents_[dimensionSet::MASS] = nextToken.number();
450  for (int d=1; d < dimensionSet::CURRENT; ++d)
451  {
452  is >> exponents_[d];
453  }
454 
455  // Read next token
456  token nextToken(is);
457 
458  // If next token is another number
459  // read last two dimensions
460  // and then read another token for the end of the dimensionSet
461  if (nextToken.isNumber())
462  {
463  exponents_[dimensionSet::CURRENT] = nextToken.number();
464  is >> nextToken;
465  exponents_[dimensionSet::LUMINOUS_INTENSITY] = nextToken.number();
466  is >> nextToken;
467  }
468  else
469  {
470  exponents_[dimensionSet::CURRENT] = 0;
471  exponents_[dimensionSet::LUMINOUS_INTENSITY] = 0;
472  }
473 
474  // Check end of dimensionSet
475  if (nextToken != token::END_SQR)
476  {
478  << "Expected a '" << token::END_SQR << "' in dimensionSet\n"
479  << "in stream " << is.info() << nl
480  << exit(FatalIOError);
481  }
482  }
483 
484  is.check(FUNCTION_NAME);
485  return is;
486 }
487 
488 
490 (
491  Istream& is,
492  scalar& multiplier
493 )
494 {
495  return read(is, multiplier, unitSet());
496 }
497 
498 
500 (
501  Istream& is,
502  scalar& multiplier,
503  const dictionary& readSet
504 )
505 {
506  multiplier = 1.0;
507 
508  // Read beginning of dimensionSet
509  token startToken(is);
510 
511  if (startToken != token::BEGIN_SQR)
512  {
514  << "Expected a '" << token::BEGIN_SQR << "' in dimensionSet\n"
515  << "in stream " << is.info() << nl
516  << exit(FatalIOError);
517  }
518 
519  // Read next token
520  token nextToken(is);
521 
522  if (nextToken.isWord())
523  {
524  bool continueParsing = true;
525  do
526  {
527  word symbolPow = nextToken.wordToken();
528  if (symbolPow.back() == token::END_SQR)
529  {
530  symbolPow.resize(symbolPow.size()-1);
531  continueParsing = false;
532  }
533 
534 
535  // Parse unit
536  dimensionSet symbolSet(dimless);
537 
538  const auto index = symbolPow.find('^');
539  if (index != std::string::npos)
540  {
541  const word symbol = symbolPow.substr(0, index);
542  const scalar exponent = readScalar(symbolPow.substr(index+1));
543 
545  s.read(readSet.lookup(symbol), readSet);
546 
547  symbolSet.reset(pow(s.dimensions(), exponent));
548 
549  // Round to nearest integer if close to it
550  symbolSet.round(10*smallExponent);
551  multiplier *= Foam::pow(s.value(), exponent);
552  }
553  else
554  {
556  s.read(readSet.lookup(symbolPow), readSet);
557 
558  symbolSet.reset(s.dimensions());
559  multiplier *= s.value();
560  }
561 
562  // Add dimensions without checking
563  for (int i=0; i < dimensionSet::nDimensions; ++i)
564  {
565  exponents_[i] += symbolSet[i];
566  }
567 
568  if (continueParsing)
569  {
570  nextToken = token(is);
571 
572  if (!nextToken.isWord() || nextToken == token::END_SQR)
573  {
574  continueParsing = false;
575  }
576  }
577  }
578  while (continueParsing);
579  }
580  else
581  {
582  // Read first five dimensions
583  exponents_[dimensionSet::MASS] = nextToken.number();
584  for (int d=1; d < dimensionSet::CURRENT; ++d)
585  {
586  is >> exponents_[d];
587  }
588 
589  // Read next token
590  token nextToken(is);
591 
592  // If next token is another number
593  // read last two dimensions
594  // and then read another token for the end of the dimensionSet
595  if (nextToken.isNumber())
596  {
597  exponents_[dimensionSet::CURRENT] = nextToken.number();
598  is >> nextToken;
599  exponents_[dimensionSet::LUMINOUS_INTENSITY] = nextToken.number();
600  is >> nextToken;
601  }
602  else
603  {
604  exponents_[dimensionSet::CURRENT] = 0;
605  exponents_[dimensionSet::LUMINOUS_INTENSITY] = 0;
606  }
607 
608  // Check end of dimensionSet
609  if (nextToken != token::END_SQR)
610  {
612  << "Expected a '" << token::END_SQR << "' in dimensionSet\n"
613  << "in stream " << is.info() << nl
614  << exit(FatalIOError);
615  }
616  }
617 
618  is.check(FUNCTION_NAME);
619  return is;
620 }
621 
622 
624 (
625  Ostream& os,
626  scalar& multiplier,
627  const dimensionSets& writeUnits
628 ) const
629 {
630  multiplier = 1.0;
631 
632  os << token::BEGIN_SQR;
633 
634  if (writeUnits.valid() && os.format() == IOstream::ASCII)
635  {
637  for (int d=0; d < dimensionSet::nDimensions; ++d)
638  {
639  exponents[d] = exponents_[d];
640  }
641  writeUnits.coefficients(exponents);
642 
643  bool hasPrinted = false;
644 
645  // Set precision to lots
646  std::streamsize oldPrecision = os.precision
647  (
648  std::numeric_limits<scalar>::digits10
649  );
650 
651  forAll(exponents, i)
652  {
653  if (mag(exponents[i]) > smallExponent)
654  {
655  const dimensionedScalar& ds = writeUnits.units()[i];
656 
657  if (hasPrinted)
658  {
659  os << token::SPACE;
660  }
661  hasPrinted = true;
662  os << ds.name();
663  if (mag(exponents[i]-1) > smallExponent)
664  {
665  os << '^' << exponents[i];
666 
667  multiplier *= Foam::pow(ds.value(), exponents[i]);
668  }
669  else
670  {
671  multiplier *= ds.value();
672  }
673  }
674  }
675 
676  // Reset precision
677  os.precision(oldPrecision);
678  }
679  else
680  {
681  for (int d=0; d < dimensionSet::nDimensions; ++d)
682  {
683  if (d) os << token::SPACE;
684  os << exponents_[d];
685  }
686  }
687 
688  os << token::END_SQR;
689 
690  os.check(FUNCTION_NAME);
691  return os;
692 }
693 
694 
696 (
697  Ostream& os,
698  scalar& multiplier
699 ) const
700 {
701  return write(os, multiplier, writeUnitSet());
702 }
703 
704 
705 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
706 
708 {
709  scalar mult(1.0);
710  ds.read(is, mult);
711 
712  if (mag(mult-1.0) > dimensionSet::smallExponent)
713  {
715  << "Cannot use scaled units in dimensionSet"
716  << exit(FatalIOError);
717  }
718 
719  is.check(FUNCTION_NAME);
720  return is;
721 }
722 
723 
725 {
726  scalar mult(1.0);
727  ds.write(os, mult);
728 
729  os.check(FUNCTION_NAME);
730  return os;
731 }
732 
733 
734 // ************************************************************************* //
Foam::token::SUBTRACT
Subtract or start of negative number.
Definition: token.H:138
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::dimensionSet::nDimensions
static constexpr int nDimensions
There are 7 base dimensions.
Definition: dimensionSet.H:76
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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::dimensionSet::LUMINOUS_INTENSITY
Candela Cd.
Definition: dimensionSet.H:87
Foam::dimensionSet::smallExponent
static const scalar smallExponent
Tolerance for 'small' exponents, for near-zero rounding.
Definition: dimensionSet.H:94
Foam::read
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:108
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:289
Foam::dimensioned::name
const word & name() const
Return const reference to name.
Definition: dimensionedType.C:406
Foam::FatalIOError
IOerror FatalIOError
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::token
A token holds an item read from Istream.
Definition: token.H:68
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:434
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
Foam::unitSet
const HashTable< dimensionedScalar > & unitSet()
Set of all dimensions.
Definition: dimensionSets.C:111
Foam::Ostream::precision
virtual int precision() const =0
Get precision of output field.
Foam::token::isWord
bool isWord() const noexcept
Token is WORD or DIRECTIVE word.
Definition: tokenI.H:583
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::dimensionSet::dimensionSet
dimensionSet()
Default construct (dimensionless).
Definition: dimensionSet.C:71
Foam::token::DIVIDE
Divide [isseparator].
Definition: token.H:140
Foam::token::isNumber
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
Definition: tokenI.H:561
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::dimensionSet::read
Istream & read(Istream &is, scalar &multiplier, const dictionary &)
Read using provided units. Used only in initial parsing.
Definition: dimensionSetIO.C:500
Foam::token::number
scalar number() const
Return label, float or double value.
Definition: tokenI.H:567
Foam::Field< scalar >
Foam::ITstream
An input stream of tokens.
Definition: ITstream.H:55
Foam::token::BEGIN_SQR
Begin dimensions [isseparator].
Definition: token.H:124
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::writeUnitSet
const dimensionSets & writeUnitSet()
Set of units.
Definition: dimensionSets.C:179
Foam::IOstream::info
InfoProxy< IOstream > info() const
Return info proxy.
Definition: IOstream.H:404
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
dimensionSet.H
Foam::dimensionSets::coefficients
void coefficients(scalarField &exponents) const
(if valid) obtain set of coefficients of unitNames
Definition: dimensionSets.C:270
Foam::dictionary::lookup
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:424
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:51
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::token::END_SQR
End dimensions [isseparator].
Definition: token.H:125
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:43
stdFoam::end
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:121
Foam::token::MULTIPLY
Multiply [isseparator].
Definition: token.H:139
Foam::dimensionSet::MASS
kilogram kg
Definition: dimensionSet.H:81
Foam::token::wordToken
const word & wordToken() const
Return const reference to the word contents.
Definition: tokenI.H:599
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::token::good
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
Definition: tokenI.H:399
dimensionedScalar.H
Foam::dimensionSet::write
Ostream & write(Ostream &os, scalar &multiplier, const dimensionSets &) const
Write using provided units.
Definition: dimensionSetIO.C:624
Foam::IOstreamOption::ASCII
"ascii" (normal default)
Definition: IOstreamOption.H:72
Foam::dimensionSet::values
const FixedList< scalar, 7 > & values() const
Return const access to the exponents as a list.
Definition: dimensionSet.C:129
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::dimensionSet::CURRENT
Ampere A.
Definition: dimensionSet.H:86
Foam::Istream::putBack
void putBack(const token &tok)
Put back token.
Definition: Istream.C:53
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::token::SPACE
Space [isspace].
Definition: token.H:117
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::dimensionSets::units
const PtrList< dimensionedScalar > & units() const
Return the units.
Definition: dimensionSets.H:114
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:270
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:123
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::dimensionSets::valid
bool valid() const
Is there a valid inverse of the selected unit.
Definition: dimensionSets.H:120
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
Foam::keyType::LITERAL
String literal.
Definition: keyType.H:73
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::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:122
Foam::isspace
bool isspace(char c)
Test for horizontal whitespace.
Definition: char.H:63
Foam::dimensionSets
Construction of unit sets.
Definition: dimensionSets.H:83
Foam::dimensionSet::reset
void reset(const dimensionSet &ds)
Copy assign the exponents from the dimensionSet.
Definition: dimensionSet.C:147
Foam::token::punctuationToken
punctuationToken
Standard punctuation tokens (a character)
Definition: token.H:114