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 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(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  isPointVal_(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  isPointVal_(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  readChecked<bool>("value", dict, len, uniform)
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  );
278 
279  if (!ok)
280  {
281  if (valType_.empty())
282  {
283  // For the error message only
284  valType_ = "None";
285  }
286 
288  << "Do not know how to read data type " << valType_
289  << (uniform ? " as a single value." : ".") << nl
290  << exit(FatalError);
291  }
292  }
293  else if (needsValue)
294  {
296  << "No entry 'value' defined in " << dict.name() << nl
297  << exit(FatalIOError);
298  }
299 }
300 
301 
304 (
305  const dictionary& dict
306 )
307 {
308  const word resultType
309  (
310  dict.getOrDefault<word>("resultType", "exprResult")
311  );
312 
313  if (dict.getOrDefault("unsetValue", false))
314  {
315  auto cstrIter = emptyConstructorTablePtr_->cfind(resultType);
316 
317  if (!cstrIter.found())
318  {
320  (
321  "resultType",
322  resultType,
323  *emptyConstructorTablePtr_
324  ) << exit(FatalError);
325  }
326 
327  DebugInfo
328  << "Creating unset result of type " << resultType << nl;
329 
330  return autoPtr<exprResult>(cstrIter()());
331  }
332 
333 
334  auto cstrIter = dictionaryConstructorTablePtr_->cfind(resultType);
335 
336  if (!cstrIter.found())
337  {
339  (
340  "resultType",
341  resultType,
342  *dictionaryConstructorTablePtr_
343  ) << exit(FatalError);
344  }
345 
346  DebugInfo
347  << "Creating result of type " << resultType << nl;
348 
349  return autoPtr<exprResult>(cstrIter()(dict));
350 }
351 
352 
353 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
354 
356 {
357  DebugInFunction << nl;
358 
359  uglyDelete();
360 }
361 
362 
363 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
364 
366 {
367  clear();
368 }
369 
370 
372 {
373  if (force || !noReset_ || needsReset_)
374  {
375  this->resetImpl();
376  return true;
377  }
378 
379  return false;
380 }
381 
382 
384 {
385  uglyDelete();
386  valType_.clear();
387  objectPtr_.reset();
388  size_ = 0;
389 }
390 
391 
392 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
393 
394 void Foam::expressions::exprResult::uglyDelete()
395 {
396  if (fieldPtr_)
397  {
398  const bool ok =
399  (
400  deleteChecked<scalar>()
401  || deleteChecked<vector>()
402  || deleteChecked<tensor>()
403  || deleteChecked<symmTensor>()
404  || deleteChecked<sphericalTensor>()
405  || deleteChecked<bool>()
406  );
407 
408  if (!ok)
409  {
411  << "Unknown type " << valType_
412  << " probable memory loss" << nl
413  << exit(FatalError);
414  }
415 
416  fieldPtr_ = nullptr;
417  size_ = 0;
418  }
419 }
420 
421 
424 (
425  const label size,
426  const bool noWarn,
427  const bool parRun
428 ) const
429 {
430  if (fieldPtr_ == nullptr)
431  {
433  << "Not set. Cannot construct uniform value" << nl
434  << exit(FatalError);
435  }
436 
437  exprResult ret;
438 
439  const bool ok =
440  (
441  getUniformChecked<scalar>(ret, size, noWarn, parRun)
442  || getUniformChecked<vector>(ret, size, noWarn, parRun)
443  || getUniformChecked<tensor>(ret, size, noWarn, parRun)
444  || getUniformChecked<symmTensor>(ret, size, noWarn, parRun)
445  || getUniformChecked<sphericalTensor>(ret, size, noWarn, parRun)
446  );
447 
448  if (!ok)
449  {
451  << "Cannot get uniform value for type " << valType_ << nl
452  << exit(FatalError);
453  }
454 
455  return ret;
456 }
457 
458 
460 {
461  if (fieldPtr_ == nullptr)
462  {
464  << "Not set - cannot determine if uniform" << nl << endl;
465  return;
466  }
467 
468  const bool ok =
469  (
470  setAverageValueChecked<scalar>(parRun)
471  || setAverageValueChecked<vector>(parRun)
472  || setAverageValueChecked<tensor>(parRun)
473  || setAverageValueChecked<symmTensor>(parRun)
474  || setAverageValueChecked<sphericalTensor>(parRun)
475  || setAverageValueCheckedBool(parRun)
476  );
477 
478  if (!ok)
479  {
481  << "Unknown type " << valType_ << nl << endl;
482  }
483 }
484 
485 
487 {
488  if (this == &rhs)
489  {
490  return; // Self-assignment is a no-op
491  }
492 
493  DebugInFunction << "rhs:" << rhs << nl;
494 
495  clear();
496 
497  valType_ = rhs.valType_;
498  isUniform_ = rhs.isUniform_;
499  isPointVal_ = rhs.isPointVal_;
500  single_ = rhs.single_;
501 
502  if (rhs.fieldPtr_)
503  {
504  const bool ok =
505  (
506  duplicateFieldChecked<scalar>(rhs.fieldPtr_)
507  || duplicateFieldChecked<vector>(rhs.fieldPtr_)
508  || duplicateFieldChecked<tensor>(rhs.fieldPtr_)
509  || duplicateFieldChecked<symmTensor>(rhs.fieldPtr_)
510  || duplicateFieldChecked<sphericalTensor>(rhs.fieldPtr_)
511  || duplicateFieldChecked<bool>(rhs.fieldPtr_)
512  );
513 
514  if (!ok)
515  {
517  << " Type " << valType_ << " can not be copied" << nl
518  << exit(FatalError);
519  }
520  }
521  else if (objectPtr_.valid())
522  {
524  << "Assignment with general content not possible" << nl
525  << exit(FatalError);
526  }
527 }
528 
529 
531 {
532  if (this == &rhs)
533  {
534  return; // Self-assignment is a no-op
535  }
536 
537  clear();
538 
539  valType_ = rhs.valType_;
540  isUniform_ = rhs.isUniform_;
541  isPointVal_ = rhs.isPointVal_;
542  noReset_ = rhs.noReset_;
543  needsReset_ = rhs.needsReset_;
544  size_ = rhs.size_;
545 
546  single_ = rhs.single_;
547  fieldPtr_ = rhs.fieldPtr_;
548 
549  objectPtr_.reset(rhs.objectPtr_.release());
550 
551  rhs.fieldPtr_ = nullptr; // Took ownership of field pointer
552  rhs.clear();
553 }
554 
555 
557 (
558  const word& keyword,
559  Ostream& os
560 ) const
561 {
562  const bool ok =
563  (
564  writeEntryChecked<scalar>(keyword, os)
565  || writeEntryChecked<vector>(keyword, os)
566  || writeEntryChecked<tensor>(keyword, os)
567  || writeEntryChecked<symmTensor>(keyword, os)
568  || writeEntryChecked<sphericalTensor>(keyword, os)
569  || writeEntryChecked<bool>(keyword, os)
570  );
571 
572  if (!ok)
573  {
575  << "Unknown data type " << valType_ << endl;
576  }
577 }
578 
579 
581 (
582  Ostream& os,
583  const bool subDict
584 ) const
585 {
586  // const auto oldFmt = os.format(IOstream::ASCII);
587 
589  << Foam::name(this) << nl
590  << "Format: "
592 
593  if (subDict)
594  {
595  os.beginBlock();
596  }
597 
598  os.writeEntry("resultType", valueType());
599  os.writeEntryIfDifferent<Switch>("noReset_", false, noReset_);
600 
601  if (fieldPtr_ == nullptr)
602  {
603  os.writeEntry<Switch>("unsetValue", true);
604  }
605  else
606  {
607  os.writeEntry("valueType", valType_);
608 
609  os.writeEntryIfDifferent<Switch>("isPointValue", false, isPointVal_);
610  os.writeEntry<Switch>("isSingleValue", isUniform_);
611 
612  const bool ok =
613  (
614  writeValueFieldChecked<scalar>(os)
615  || writeValueFieldChecked<vector>(os)
616  || writeValueFieldChecked<tensor>(os)
617  || writeValueFieldChecked<symmTensor>(os)
618  || writeValueFieldChecked<sphericalTensor>(os)
619  || writeValueFieldChecked<bool>(os)
620  );
621 
622  if (!ok)
623  {
625  << "Unknown data type " << valType_ << endl;
626  }
627  }
628 
629  if (subDict)
630  {
631  os.endBlock();
632  }
633 
634  // os.format(oldFmt);
635 }
636 
637 
639 (
640  Ostream& os
641 ) const
642 {
643  // const auto oldFmt = os.format(IOstream::ASCII);
644 
646  << Foam::name(this) << nl
647  << "Format: "
649 
650  const bool ok =
651  (
652  writeSingleValueChecked<scalar>(os)
653  || writeSingleValueChecked<vector>(os)
654  || writeSingleValueChecked<tensor>(os)
655  || writeSingleValueChecked<symmTensor>(os)
656  || writeSingleValueChecked<sphericalTensor>(os)
657  || writeSingleValueChecked<label>(os)
658  || writeSingleValueChecked<bool>(os)
659  );
660 
661  if (!ok)
662  {
664  << "Unknown data type " << valType_ << endl;
665  }
666 }
667 
668 
669 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
670 
672 Foam::expressions::exprResult::operator*=
673 (
674  const scalar& b
675 )
676 {
677  if (isObject())
678  {
680  << "Can only multiply Field-type exprResult. Not "
681  << valType_ << nl
682  << exit(FatalError);
683  }
684  if (!fieldPtr_)
685  {
687  << "Can not multiply. Unallocated field of type" << valType_ << nl
688  << exit(FatalError);
689  }
690 
691  const bool ok =
692  (
693  multiplyEqChecked<scalar>(b)
694  || multiplyEqChecked<vector>(b)
695  || multiplyEqChecked<tensor>(b)
696  || multiplyEqChecked<symmTensor>(b)
697  || multiplyEqChecked<sphericalTensor>(b)
698  );
699 
700  if (!ok)
701  {
703  << "Can not multiply field of type "
704  << valType_ << nl
705  << exit(FatalError);
706  }
707 
708  return *this;
709 }
710 
711 
713 Foam::expressions::exprResult::operator+=
714 (
715  const exprResult& b
716 )
717 {
718  if (isObject())
719  {
721  << "Can only add Field-type, not type: "
722  << valType_ << nl
723  << exit(FatalError);
724  }
725  if (!fieldPtr_)
726  {
728  << "Can not add. Unallocated field of type " << valType_ << nl
729  << exit(FatalError);
730  }
731 
732  if (this->size() != b.size())
733  {
735  << "Different sizes " << this->size() << " and " << b.size() << nl
736  << exit(FatalError);
737  }
738 
739  const bool ok =
740  (
741  plusEqChecked<scalar>(b)
742  || plusEqChecked<vector>(b)
743  || plusEqChecked<tensor>(b)
744  || plusEqChecked<symmTensor>(b)
745  || plusEqChecked<sphericalTensor>(b)
746  );
747 
748  if (!ok)
749  {
751  << "Can not add Field-type exprResult of type"
752  << valType_ << nl
753  << exit(FatalError);
754  }
755 
756  return *this;
757 }
758 
759 
760 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
761 
762 Foam::Istream& Foam::operator>>
763 (
764  Istream& is,
766 )
767 {
768  dictionary dict(is);
769 
771 
772  return is;
773 }
774 
775 
776 Foam::Ostream& Foam::operator<<
777 (
778  Ostream& os,
780 )
781 {
782  data.writeDict(os);
783 
784  return os;
785 }
786 
787 
788 Foam::expressions::exprResult Foam::operator*
789 (
790  const scalar& a,
792 )
793 {
794  expressions::exprResult result(b);
795  return result *= a;
796 }
797 
798 
799 Foam::expressions::exprResult Foam::operator*
800 (
801  const expressions::exprResult& a,
802  const scalar& b
803 )
804 {
805  expressions::exprResult result(a);
806  result *= b;
807 
808  return result;
809 }
810 
811 
812 Foam::expressions::exprResult Foam::operator+
813 (
814  const expressions::exprResult& a,
816 )
817 {
818  expressions::exprResult result(a);
819  result += b;
820 
821  return result;
822 }
823 
824 
826 {
827  #undef defineExpressionMethod
828  #define defineExpressionMethod(Type) \
829  if (isType<Type>()) \
830  { \
831  return static_cast<Field<Type>*>(fieldPtr_)->cdata(); \
832  }
833 
834  defineExpressionMethod(scalar);
839 
840  #undef defineExpressionMethod
841 
843  << "Unsupported type" << valType_ << nl
844  << exit(FatalError);
845 
846  return nullptr;
847 }
848 
849 
850 // ************************************************************************* //
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:231
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
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:70
Foam::expressions::exprResult::writeDict
void writeDict(Ostream &os, const bool subDict=true) const
Write entry as dictionary contents.
Definition: exprResult.C:581
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:459
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:273
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
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:486
sphericalTensor.H
Foam::expressions::exprResult::reset
bool reset(bool force=false)
Reset at new timestep according to type.
Definition: exprResult.C:371
defineExpressionMethod
#define defineExpressionMethod(Type)
Foam::uniform
Definition: uniform.H:50
Foam::expressions::exprResult::null
static const exprResult null
An empty result.
Definition: exprResult.H:330
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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:356
Foam::expressions::exprResult::New
static autoPtr< exprResult > New(const dictionary &dict)
Return a reference to the selected value driver.
Definition: exprResult.C:304
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:639
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
FatalErrorInLookup
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
Definition: error.H:359
Foam::expressions::exprResult::resetImpl
virtual void resetImpl()
Reset at new timestep according to the derived class type.
Definition: exprResult.C:365
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:424
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:355
Foam::expressions::exprResult::exprResult
exprResult()
Construct null.
Definition: exprResult.C:205
DebugInfo
#define DebugInfo
Report an information message using Foam::Info.
Definition: messageStream.H:350
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Foam::expressions::exprResult::clear
void clear()
Clear (zero) the result.
Definition: exprResult.C:383
Foam::Vector< scalar >
Foam::expressions::exprResult::writeEntry
void writeEntry(const word &keyword, Ostream &os) const
Forwarding to Field::writeEntry.
Definition: exprResult.C:557
Foam::expressions::exprResult::~exprResult
virtual ~exprResult()
Destructor.
Definition: exprResult.C:355
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:219
vector.H
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:375
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:294
Foam::IOstreamOption::formatNames
static const Enum< streamFormat > formatNames
Stream format names (ascii, binary)
Definition: IOstreamOption.H:187
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:54
Foam::expressions::exprResult::dataAddress
const void * dataAddress() const
The address of the field data content.
Definition: exprResult.C:825