exprResult.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) 2012-2018 Bernhard Gschaider <bgschaid@hfd-research.com>
9  Copyright (C) 2019-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 "exprResult.H"
30 #include "vector.H"
31 #include "tensor.H"
32 #include "symmTensor.H"
33 #include "sphericalTensor.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40 namespace expressions
41 {
42  defineTypeNameAndDebug(exprResult,0);
43 
44  defineRunTimeSelectionTable(exprResult, dictionary);
45  defineRunTimeSelectionTable(exprResult, empty);
46 
47  addToRunTimeSelectionTable(exprResult, exprResult, dictionary);
48  addToRunTimeSelectionTable(exprResult, exprResult, empty);
49 
50 } // End namespace expressions
51 } // End namespace Foam
52 
53 
55 
56 
57 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
58 
59 bool Foam::expressions::exprResult::setAverageValueCheckedBool
60 (
61  const bool parRun
62 )
63 {
64  typedef bool Type;
65 
66  if (!isType<Type>())
67  {
68  return false;
69  }
70 
71  const Field<Type>& fld = *static_cast<const Field<Type>*>(fieldPtr_);
72  label len = fld.size();
73 
74  // The average of a bool is slightly dodgy
75 
76  label nTrue = 0;
77  for (const Type val : fld)
78  {
79  if (val)
80  {
81  ++nTrue;
82  }
83  }
84 
85  if (parRun)
86  {
87  reduce(nTrue, sumOp<label>());
88  }
89 
90  if (!nTrue)
91  {
92  isUniform_ = true;
93  single_.set(false);
94  return true;
95  }
96 
97  if (parRun)
98  {
99  reduce(len, sumOp<label>());
100  }
101 
102  if (nTrue == len)
103  {
104  isUniform_ = true;
105  single_.set(true);
106  }
107  else
108  {
109  isUniform_ = false;
110 
111  if (nTrue > len/2)
112  {
113  single_.set(true);
114  }
115  else
116  {
117  single_.set(false);
118  }
119  }
120 
121  return true;
122 }
123 
124 
125 bool Foam::expressions::exprResult::getUniformCheckedBool
126 (
127  exprResult& result,
128  const label size,
129  const bool noWarn,
130  const bool parRun
131 ) const
132 {
133  typedef bool Type;
134 
135  if (!isType<Type>())
136  {
137  return false;
138  }
139 
140  result.clear();
141 
142  const Field<Type>& fld = *static_cast<const Field<Type>*>(fieldPtr_);
143  label len = fld.size();
144 
145  // The average of a bool is slightly dodgy
146 
147  label nTrue = 0;
148  for (const Type val : fld)
149  {
150  if (val)
151  {
152  ++nTrue;
153  }
154  }
155 
156  if (parRun)
157  {
158  reduce(nTrue, sumOp<label>());
159  reduce(len, sumOp<label>());
160  }
161 
162  const Type avg = (nTrue > len/2);
163 
164  if (!noWarn)
165  {
166  // TODO?
167  }
168 
169  result.setResult<Type>(avg, size);
170 
171  return true;
172 }
173 
174 
175 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
176 
177 Foam::expressions::exprResult::singleValue::singleValue()
178 {
179  std::memset(static_cast<void*>(this), '\0', sizeof(*this));
180 }
181 
182 
183 Foam::expressions::exprResult::singleValue::singleValue
184 (
185  const singleValue& val
186 )
187 {
188  std::memcpy(static_cast<void*>(this), &val, sizeof(*this));
189 }
190 
191 
192 void Foam::expressions::exprResult::singleValue::operator=
193 (
194  const singleValue& val
195 )
196 {
197  if (this != &val)
198  {
199  // Self-assignment is a no-op
200  std::memcpy(static_cast<void*>(this), &val, sizeof(*this));
201  }
202 }
203 
204 
206 :
207  refCount(),
208  valType_(),
209  isUniform_(false),
210  isPointData_(false),
211  noReset_(false),
212  needsReset_(false),
213  size_(0),
214  single_(),
215  fieldPtr_(nullptr),
216  objectPtr_(nullptr)
217 {
218  clear();
219 }
220 
221 
223 :
224  exprResult()
225 {
226  this->operator=(rhs);
227 }
228 
229 
231 :
232  exprResult()
233 {
234  this->operator=(std::move(rhs));
235 }
236 
237 
239 (
240  const dictionary& dict,
241  bool uniform,
242  bool needsValue
243 )
244 :
245  refCount(),
246  valType_(dict.getOrDefault<word>("valueType", "")),
247  isUniform_(dict.getOrDefault("isSingleValue", uniform)),
248  isPointData_(dict.getOrDefault("isPointValue", false)),
249  noReset_(dict.getOrDefault("noReset", false)),
250  needsReset_(false),
251  size_(0),
252  single_(),
253  fieldPtr_(nullptr),
254  objectPtr_(nullptr)
255 {
256  DebugInFunction << nl;
257 
258  if (dict.found("value"))
259  {
260  const bool uniform = isUniform_;
261 
262  const label len =
263  (
264  uniform
265  ? dict.getOrDefault<label>("fieldSize", 1)
266  : dict.get<label>("fieldSize")
267  );
268 
269  const bool ok =
270  (
271  // Just use <scalar> for <label>?
272  readChecked<scalar>("value", dict, len, uniform)
273  || readChecked<vector>("value", dict, len, uniform)
274  || readChecked<tensor>("value", dict, len, uniform)
275  || readChecked<symmTensor>("value", dict, len, uniform)
276  || readChecked<sphericalTensor>("value", dict, len, uniform)
277  || readChecked<bool>("value", dict, len, uniform)
278  );
279 
280  if (!ok)
281  {
282  if (valType_.empty())
283  {
284  // For error message only
285  valType_ = "none";
286  }
287 
289  << "Do not know how to read data type " << valType_
290  << (uniform ? " as a single value." : ".") << nl
291  << exit(FatalError);
292  }
293  }
294  else if (needsValue)
295  {
297  << "No entry 'value' defined in " << dict.name() << nl
298  << exit(FatalIOError);
299  }
300 }
301 
302 
305 (
306  const dictionary& dict
307 )
308 {
309  const word resultType
310  (
311  dict.getOrDefault<word>("resultType", "exprResult")
312  );
313 
314  if (dict.getOrDefault("unsetValue", false))
315  {
316  auto cstrIter = emptyConstructorTablePtr_->cfind(resultType);
317 
318  if (!cstrIter.found())
319  {
321  (
322  dict,
323  "resultType",
324  resultType,
325  *emptyConstructorTablePtr_
326  ) << exit(FatalIOError);
327  }
328 
329  DebugInfo
330  << "Creating unset result of type " << resultType << nl;
331 
332  return autoPtr<exprResult>(cstrIter()());
333  }
334 
335 
336  auto cstrIter = dictionaryConstructorTablePtr_->cfind(resultType);
337 
338  if (!cstrIter.found())
339  {
341  (
342  dict,
343  "resultType",
344  resultType,
345  *dictionaryConstructorTablePtr_
346  ) << exit(FatalIOError);
347  }
348 
349  DebugInfo
350  << "Creating result of type " << resultType << nl;
351 
352  return autoPtr<exprResult>(cstrIter()(dict));
353 }
354 
355 
356 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
357 
359 {
360  DebugInFunction << nl;
361 
362  uglyDelete();
363 }
364 
365 
366 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
367 
369 {
370  clear();
371 }
372 
373 
375 {
376  if (force || !noReset_ || needsReset_)
377  {
378  this->resetImpl();
379  return true;
380  }
381 
382  return false;
383 }
384 
385 
387 {
388  uglyDelete();
389  valType_.clear();
390  objectPtr_.reset(nullptr);
391  size_ = 0;
392 }
393 
394 
395 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
396 
397 void Foam::expressions::exprResult::uglyDelete()
398 {
399  if (fieldPtr_)
400  {
401  const bool ok =
402  (
403  deleteChecked<scalar>()
404  || deleteChecked<vector>()
405  || deleteChecked<tensor>()
406  || deleteChecked<symmTensor>()
407  || deleteChecked<sphericalTensor>()
408  || deleteChecked<bool>()
409  );
410 
411  if (!ok)
412  {
414  << "Unknown type " << valType_
415  << " probable memory loss" << nl
416  << exit(FatalError);
417  }
418 
419  fieldPtr_ = nullptr;
420  size_ = 0;
421  }
422 }
423 
424 
427 (
428  const label size,
429  const bool noWarn,
430  const bool parRun
431 ) const
432 {
433  if (fieldPtr_ == nullptr)
434  {
436  << "Not set. Cannot construct uniform value" << nl
437  << exit(FatalError);
438  }
439 
440  exprResult ret;
441 
442  const bool ok =
443  (
444  getUniformChecked<scalar>(ret, size, noWarn, parRun)
445  || getUniformChecked<vector>(ret, size, noWarn, parRun)
446  || getUniformChecked<tensor>(ret, size, noWarn, parRun)
447  || getUniformChecked<symmTensor>(ret, size, noWarn, parRun)
448  || getUniformChecked<sphericalTensor>(ret, size, noWarn, parRun)
449  );
450 
451  if (!ok)
452  {
454  << "Cannot get uniform value for type " << valType_ << nl
455  << exit(FatalError);
456  }
457 
458  return ret;
459 }
460 
461 
463 {
464  if (fieldPtr_ == nullptr)
465  {
467  << "Not set - cannot determine if uniform" << nl << endl;
468  return;
469  }
470 
471  const bool ok =
472  (
473  setAverageValueChecked<scalar>(parRun)
474  || setAverageValueChecked<vector>(parRun)
475  || setAverageValueChecked<tensor>(parRun)
476  || setAverageValueChecked<symmTensor>(parRun)
477  || setAverageValueChecked<sphericalTensor>(parRun)
478  || setAverageValueCheckedBool(parRun)
479  );
480 
481  if (!ok)
482  {
484  << "Unknown type " << valType_ << nl << endl;
485  }
486 }
487 
488 
490 {
491  if (this == &rhs)
492  {
493  return; // Self-assignment is a no-op
494  }
495 
496  DebugInFunction << "rhs:" << rhs << nl;
497 
498  clear();
499 
500  valType_ = rhs.valType_;
501  isUniform_ = rhs.isUniform_;
502  isPointData_ = rhs.isPointData_;
503  single_ = rhs.single_;
504 
505  if (rhs.fieldPtr_)
506  {
507  const bool ok =
508  (
509  duplicateFieldChecked<scalar>(rhs.fieldPtr_)
510  || duplicateFieldChecked<vector>(rhs.fieldPtr_)
511  || duplicateFieldChecked<tensor>(rhs.fieldPtr_)
512  || duplicateFieldChecked<symmTensor>(rhs.fieldPtr_)
513  || duplicateFieldChecked<sphericalTensor>(rhs.fieldPtr_)
514  || duplicateFieldChecked<bool>(rhs.fieldPtr_)
515  );
516 
517  if (!ok)
518  {
520  << " Type " << valType_ << " can not be copied" << nl
521  << exit(FatalError);
522  }
523  }
524  else if (objectPtr_)
525  {
527  << "Assignment with general content not possible" << nl
528  << exit(FatalError);
529  }
530 }
531 
532 
534 {
535  if (this == &rhs)
536  {
537  return; // Self-assignment is a no-op
538  }
539 
540  clear();
541 
542  valType_ = rhs.valType_;
543  isUniform_ = rhs.isUniform_;
544  isPointData_ = rhs.isPointData_;
545  noReset_ = rhs.noReset_;
546  needsReset_ = rhs.needsReset_;
547  size_ = rhs.size_;
548 
549  single_ = rhs.single_;
550  fieldPtr_ = rhs.fieldPtr_;
551 
552  objectPtr_.reset(rhs.objectPtr_.release());
553 
554  rhs.fieldPtr_ = nullptr; // Took ownership of field pointer
555  rhs.clear();
556 }
557 
558 
560 (
561  const word& keyword,
562  Ostream& os
563 ) const
564 {
565  const bool ok =
566  (
567  writeEntryChecked<scalar>(keyword, os)
568  || writeEntryChecked<vector>(keyword, os)
569  || writeEntryChecked<tensor>(keyword, os)
570  || writeEntryChecked<symmTensor>(keyword, os)
571  || writeEntryChecked<sphericalTensor>(keyword, os)
572  || writeEntryChecked<bool>(keyword, os)
573  );
574 
575  if (!ok)
576  {
578  << "Unknown data type " << valType_ << endl;
579  }
580 }
581 
582 
584 (
585  Ostream& os,
586  const bool subDict
587 ) const
588 {
589  // const auto oldFmt = os.format(IOstream::ASCII);
590 
592  << Foam::name(this) << nl
593  << "Format: "
595 
596  if (subDict)
597  {
598  os.beginBlock();
599  }
600 
601  os.writeEntry("resultType", valueType());
602  os.writeEntryIfDifferent<Switch>("noReset", false, noReset_);
603 
604  if (fieldPtr_ == nullptr)
605  {
606  os.writeEntry<Switch>("unsetValue", true);
607  }
608  else
609  {
610  os.writeEntry("valueType", valType_);
611 
612  os.writeEntryIfDifferent<Switch>("isPointValue", false, isPointData_);
613  os.writeEntry<Switch>("isSingleValue", isUniform_);
614 
615  const bool ok =
616  (
617  writeValueFieldChecked<scalar>(os)
618  || writeValueFieldChecked<vector>(os)
619  || writeValueFieldChecked<tensor>(os)
620  || writeValueFieldChecked<symmTensor>(os)
621  || writeValueFieldChecked<sphericalTensor>(os)
622  || writeValueFieldChecked<bool>(os)
623  );
624 
625  if (!ok)
626  {
628  << "Unknown data type " << valType_ << endl;
629  }
630  }
631 
632  if (subDict)
633  {
634  os.endBlock();
635  }
636 
637  // os.format(oldFmt);
638 }
639 
640 
642 (
643  Ostream& os
644 ) const
645 {
646  // const auto oldFmt = os.format(IOstream::ASCII);
647 
649  << Foam::name(this) << nl
650  << "Format: "
652 
653  const bool ok =
654  (
655  writeSingleValueChecked<scalar>(os)
656  || writeSingleValueChecked<vector>(os)
657  || writeSingleValueChecked<tensor>(os)
658  || writeSingleValueChecked<symmTensor>(os)
659  || writeSingleValueChecked<sphericalTensor>(os)
660  || writeSingleValueChecked<label>(os)
661  || writeSingleValueChecked<bool>(os)
662  );
663 
664  if (!ok)
665  {
667  << "Unknown data type " << valType_ << endl;
668  }
669 }
670 
671 
672 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
673 
675 Foam::expressions::exprResult::operator*=
676 (
677  const scalar& b
678 )
679 {
680  if (isObject())
681  {
683  << "Can only multiply Field-type exprResult. Not "
684  << valType_ << nl
685  << exit(FatalError);
686  }
687  if (!fieldPtr_)
688  {
690  << "Can not multiply. Unallocated field of type" << valType_ << nl
691  << exit(FatalError);
692  }
693 
694  const bool ok =
695  (
696  multiplyEqChecked<scalar>(b)
697  || multiplyEqChecked<vector>(b)
698  || multiplyEqChecked<tensor>(b)
699  || multiplyEqChecked<symmTensor>(b)
700  || multiplyEqChecked<sphericalTensor>(b)
701  );
702 
703  if (!ok)
704  {
706  << "Can not multiply field of type "
707  << valType_ << nl
708  << exit(FatalError);
709  }
710 
711  return *this;
712 }
713 
714 
716 Foam::expressions::exprResult::operator+=
717 (
718  const exprResult& b
719 )
720 {
721  if (isObject())
722  {
724  << "Can only add Field-type, not type: "
725  << valType_ << nl
726  << exit(FatalError);
727  }
728  if (!fieldPtr_)
729  {
731  << "Can not add. Unallocated field of type " << valType_ << nl
732  << exit(FatalError);
733  }
734 
735  if (this->size() != b.size())
736  {
738  << "Different sizes " << this->size() << " and " << b.size() << nl
739  << exit(FatalError);
740  }
741 
742  const bool ok =
743  (
744  plusEqChecked<scalar>(b)
745  || plusEqChecked<vector>(b)
746  || plusEqChecked<tensor>(b)
747  || plusEqChecked<symmTensor>(b)
748  || plusEqChecked<sphericalTensor>(b)
749  );
750 
751  if (!ok)
752  {
754  << "Can not add Field-type exprResult of type"
755  << valType_ << nl
756  << exit(FatalError);
757  }
758 
759  return *this;
760 }
761 
762 
763 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
764 
765 Foam::Istream& Foam::operator>>
766 (
767  Istream& is,
769 )
770 {
771  dictionary dict(is);
772 
774 
775  return is;
776 }
777 
778 
779 Foam::Ostream& Foam::operator<<
780 (
781  Ostream& os,
783 )
784 {
785  data.writeDict(os);
786 
787  return os;
788 }
789 
790 
791 Foam::expressions::exprResult Foam::operator*
792 (
793  const scalar& a,
795 )
796 {
797  expressions::exprResult result(b);
798  return result *= a;
799 }
800 
801 
802 Foam::expressions::exprResult Foam::operator*
803 (
804  const expressions::exprResult& a,
805  const scalar& b
806 )
807 {
808  expressions::exprResult result(a);
809  result *= b;
810 
811  return result;
812 }
813 
814 
815 Foam::expressions::exprResult Foam::operator+
816 (
817  const expressions::exprResult& a,
819 )
820 {
821  expressions::exprResult result(a);
822  result += b;
823 
824  return result;
825 }
826 
827 
829 {
830  #undef defineExpressionMethod
831  #define defineExpressionMethod(Type) \
832  if (isType<Type>()) \
833  { \
834  return static_cast<Field<Type>*>(fieldPtr_)->cdata(); \
835  }
836 
837  defineExpressionMethod(scalar);
842 
843  #undef defineExpressionMethod
844 
846  << "Unsupported type" << valType_ << nl
847  << exit(FatalError);
848 
849  return nullptr;
850 }
851 
852 
853 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::Ostream::writeEntryIfDifferent
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:244
Foam::SymmTensor< scalar >
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::expressions::exprResult::writeDict
void writeDict(Ostream &os, const bool subDict=true) const
Write entry as dictionary contents.
Definition: exprResult.C:584
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::refCount
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
Foam::expressions::exprResult::testIfSingleValue
void testIfSingleValue(const bool parRun=Pstream::parRun())
Test if field corresponds to a single-value and thus uniform.
Definition: exprResult.C:462
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:289
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::expressions::defineRunTimeSelectionTable
defineRunTimeSelectionTable(fvExprDriver, dictionary)
Foam::Ostream::beginBlock
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:91
tensor.H
Foam::expressions::exprResult::operator=
virtual void operator=(const exprResult &rhs)
Copy assignment.
Definition: exprResult.C:489
sphericalTensor.H
Foam::expressions::exprResult::reset
bool reset(bool force=false)
Reset at new timestep according to type.
Definition: exprResult.C:374
defineExpressionMethod
#define defineExpressionMethod(Type)
Foam::uniform
Definition: uniform.H:50
Foam::expressions::exprResult::null
static const exprResult null
An empty result.
Definition: exprResult.H:327
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:406
Foam::expressions::exprResult
A polymorphic field/result from evaluating an expression.
Definition: exprResult.H:128
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
symmTensor.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:365
Foam::expressions::exprResult::New
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
Definition: exprResult.C:305
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::expressions::exprResult::writeValue
void writeValue(Ostream &os) const
Write the single value, or the first value from field.
Definition: exprResult.C:642
fld
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::Ostream::endBlock
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:109
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:121
Foam::expressions::exprResult::resetImpl
virtual void resetImpl()
Reset at new timestep according to the derived class type.
Definition: exprResult.C:368
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::expressions::exprResult::getUniform
exprResult getUniform(const label size, const bool noWarn, const bool parRun=Pstream::parRun()) const
Construct a uniform field from the current results.
Definition: exprResult.C:427
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::expressions::exprResult::exprResult
exprResult()
Default construct.
Definition: exprResult.C:205
DebugInfo
#define DebugInfo
Report an information message using Foam::Info.
Definition: messageStream.H:359
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::expressions::exprResult::clear
void clear()
Clear (zero) the result.
Definition: exprResult.C:386
Foam::Vector< scalar >
Foam::expressions::exprResult::writeEntry
void writeEntry(const word &keyword, Ostream &os) const
Forwarding to Field::writeEntry.
Definition: exprResult.C:560
Foam::expressions::exprResult::~exprResult
virtual ~exprResult()
Destructor.
Definition: exprResult.C:358
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
vector.H
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::expressions::addToRunTimeSelectionTable
addToRunTimeSelectionTable(exprResult, exprResult, dictionary)
Foam::expressions::defineTypeNameAndDebug
defineTypeNameAndDebug(fvExprDriver, 0)
exprResult.H
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:303
Foam::IOstreamOption::formatNames
static const Enum< streamFormat > formatNames
Stream format names (ascii, binary)
Definition: IOstreamOption.H:165
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::expressions::exprResult::dataAddress
const void * dataAddress() const
The address of the field data content.
Definition: exprResult.C:828