MappedFile.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) 2018-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "polyMesh.H"
29 #include "rawIOField.H"
30 #include "clockTime.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const bool dictConstructed,
38  const polyPatch& pp,
39  const word& entryName,
40  const dictionary& dict,
41  const word& fieldTableName,
42  const bool faceValues
43 )
44 :
45  PatchFunction1<Type>(pp, entryName, dict, faceValues),
46  dictConstructed_(dictConstructed),
47  setAverage_(dict.getOrDefault("setAverage", false)),
48  perturb_(dict.getOrDefault<scalar>("perturb", 1e-5)),
49  fieldTableName_(fieldTableName),
50  pointsName_(dict.getOrDefault<word>("points", "points")),
51  mapMethod_(),
52  filterRadius_(dict.getOrDefault<scalar>("filterRadius", 0)),
53  filterSweeps_(dict.getOrDefault<label>("filterSweeps", 0)),
54  filterFieldPtr_(nullptr),
55  readerFormat_(),
56  readerFile_(),
57  readerPtr_(nullptr),
58  mapperPtr_(nullptr),
59  sampleTimes_(),
60  sampleIndex_(-1, -1),
61  sampleAverage_(Zero, Zero),
62  sampleValues_(),
63  offset_
64  (
65  Function1<Type>::NewIfPresent
66  (
67  "offset",
68  dict,
69  patchFunction1Base::whichDb()
70  )
71  )
72 {
73  if (fieldTableName_.empty())
74  {
75  fieldTableName_ = entryName;
76  }
77 
78  // Simple sanity check
79  if ((filterSweeps_ < 1) || (filterRadius_ <= VSMALL))
80  {
81  filterRadius_ = 0;
82  filterSweeps_ = 0;
83  }
84 
85  if (dict.readIfPresent("sampleFormat", readerFormat_))
86  {
87  dict.readEntry("sampleFile", readerFile_);
88 
89  fileName fName(readerFile_);
90  fName.expand();
91 
92  readerPtr_ = surfaceReader::New
93  (
94  readerFormat_,
95  fName,
96  surfaceReader::formatOptions(dict, readerFormat_, "readOptions")
97  );
98  }
99 
100  if (debug)
101  {
102  Info<< "mappedFile:" << nl;
103  if (readerFormat_.empty())
104  {
105  Info<< " boundary format" << nl;
106  }
107  else
108  {
109  Info<< " format:" << readerFormat_
110  << " file:" << readerFile_ << nl;
111  }
112 
113  Info<< " filter radius=" << filterRadius_
114  << " sweeps=" << filterSweeps_ << endl;
115  }
116 
117  if
118  (
119  dict.readIfPresent("mapMethod", mapMethod_)
120  && !mapMethod_.empty()
121  && mapMethod_ != "nearest"
122  && !mapMethod_.starts_with("planar")
123  )
124  {
126  << "Unknown mapMethod type " << mapMethod_
127  << "\n\nValid mapMethod types :\n"
128  << "(nearest planar)" << nl
130  }
131 }
132 
133 
134 template<class Type>
136 (
137  const polyPatch& pp,
138  const word& redirectType,
139  const word& entryName,
140  const dictionary& dict,
141  const bool faceValues
142 )
143 :
144  MappedFile<Type>
145  (
146  true, // dictConstructed = true
147  pp,
148  entryName,
149  dict,
150  dict.getOrDefault<word>("fieldTable", entryName),
151  faceValues
152  )
153 {}
154 
155 
156 template<class Type>
158 (
159  const polyPatch& pp,
160  const word& entryName,
161  const dictionary& dict,
162  const word& fieldTableName,
163  const bool faceValues
164 )
165 :
166  MappedFile<Type>
167  (
168  false, // dictConstructed = false
169  pp,
170  entryName,
171  dict,
172  fieldTableName,
173  faceValues
174  )
175 {}
176 
177 
178 template<class Type>
180 (
181  const MappedFile<Type>& rhs,
182  const polyPatch& pp
183 )
184 :
185  PatchFunction1<Type>(rhs, pp),
186  dictConstructed_(rhs.dictConstructed_),
187  setAverage_(rhs.setAverage_),
188  perturb_(rhs.perturb_),
189  fieldTableName_(rhs.fieldTableName_),
190  pointsName_(rhs.pointsName_),
191  mapMethod_(rhs.mapMethod_),
192  filterRadius_(rhs.filterRadius_),
193  filterSweeps_(rhs.filterSweeps_),
194  filterFieldPtr_(nullptr),
195  readerFormat_(rhs.readerFormat_),
196  readerFile_(rhs.readerFile_),
197  readerPtr_(nullptr),
198  mapperPtr_(rhs.mapperPtr_.clone()),
199  sampleTimes_(rhs.sampleTimes_),
200  sampleIndex_(rhs.sampleIndex_),
201  sampleAverage_(rhs.sampleAverage_),
202  sampleValues_(rhs.sampleValues_),
203  offset_(rhs.offset_.clone())
204 {
205  if (!readerFormat_.empty() && !readerFile_.empty())
206  {
207  fileName fName(readerFile_);
208  fName.expand();
209 
210  readerPtr_ = surfaceReader::New(readerFormat_, fName);
211  }
212 }
213 
214 
215 template<class Type>
217 (
218  const MappedFile<Type>& rhs
219 )
220 :
221  MappedFile<Type>(rhs, rhs.patch())
222 {}
223 
224 
225 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
226 
227 template<class Type>
229 (
230  const FieldMapper& mapper
231 )
232 {
234 
235  if (sampleValues_.first().size())
236  {
237  sampleValues_.first().autoMap(mapper);
238  }
239  if (sampleValues_.second().size())
240  {
241  sampleValues_.second().autoMap(mapper);
242  }
243 
244  // Clear interpolator
245  filterFieldPtr_.reset(nullptr);
246  mapperPtr_.reset(nullptr);
247  sampleIndex_ = labelPair(-1, -1);
248 }
249 
250 
251 template<class Type>
253 (
254  const PatchFunction1<Type>& pf1,
255  const labelList& addr
256 )
257 {
258  PatchFunction1<Type>::rmap(pf1, addr);
259 
260  const auto& tiptf =
261  refCast<const PatchFunction1Types::MappedFile<Type>>(pf1);
262 
263  if (tiptf.sampleValues_.first().size())
264  {
265  sampleValues_.first().resize(this->size());
266  sampleValues_.first().rmap(tiptf.sampleValues_.first(), addr);
267  }
268 
269  if (tiptf.sampleValues_.second().size())
270  {
271  sampleValues_.second().resize(this->size());
272  sampleValues_.second().rmap(tiptf.sampleValues_.second(), addr);
273  }
274 
275  // Clear interpolator
276  filterFieldPtr_.reset(nullptr);
277  mapperPtr_.reset(nullptr);
278  sampleIndex_ = labelPair(-1, -1);
279 }
280 
281 
282 template<class Type>
284 (
285  const label sampleIndex,
286  Field<Type>& field,
287  Type& avg
288 ) const
289 {
290  tmp<Field<Type>> tvalues;
291 
292  // Update sampled data fields
293  if (readerPtr_)
294  {
295  wordList fieldNames = readerPtr_->fieldNames(sampleIndex);
296 
297  label fieldIndex = fieldNames.find(fieldTableName_);
298 
299  if (fieldIndex < 0)
300  {
302  << "Sample field='" << fieldTableName_
303  << "' not found. Known field names: "
304  << flatOutput(fieldNames) << nl
305  << exit(FatalError);
306  }
307 
308  if (debug)
309  {
310  Pout<< "checkTable : Update index=" << sampleIndex
311  << " field=" << fieldNames[fieldIndex] << endl;
312  }
313 
314  tvalues = readerPtr_->field
315  (
316  sampleIndex,
317  fieldIndex,
318  pTraits<Type>::zero
319  );
320 
321  if (tvalues().size() != mapperPtr_().sourceSize())
322  {
324  << "Number of values (" << tvalues().size()
325  << ") differs from the number of points ("
326  << mapperPtr_().sourceSize() << ")"
327  << exit(FatalError);
328  }
329  }
330  else
331  {
332  const polyMesh& mesh = this->patch_.boundaryMesh().mesh();
333  const Time& time = mesh.time();
334 
335  if (debug)
336  {
337  Pout<< "checkTable : Update index=" << sampleIndex
338  << " Reading values from "
339  <<
340  (
341  "boundaryData"
342  / this->patch_.name()
343  / sampleTimes_[sampleIndex].name()
344  / fieldTableName_
345  ) << endl;
346  }
347 
348  // Reread values and interpolate
349  const fileName valsFile
350  (
351  time.globalPath()
352  /time.constant()
353  /mesh.dbDir() // region
354  /"boundaryData"
355  /this->patch_.name()
356  /sampleTimes_[sampleIndex].name()
357  /fieldTableName_
358  );
359 
360  IOobject io
361  (
362  valsFile, // absolute path
363  time,
367  true // is global object (currently not used)
368  );
369 
370  rawIOField<Type> vals(io, setAverage_);
371 
372  if (vals.hasAverage())
373  {
374  avg = vals.average();
375  }
376 
377  if (vals.size() != mapperPtr_().sourceSize())
378  {
380  << "Number of values (" << vals.size()
381  << ") differs from the number of points ("
382  << mapperPtr_().sourceSize()
383  << ") in file " << valsFile
384  << exit(FatalError);
385  }
386 
387  tvalues = tmp<Field<Type>>::New(std::move(vals.field()));
388  }
389 
390  if (filterFieldPtr_)
391  {
392  DebugInfo
393  << "apply " << filterSweeps_ << " filter sweeps" << endl;
394 
395  tvalues = filterFieldPtr_().evaluate(tvalues, filterSweeps_);
396  }
397 
398  // From input values to interpolated (sampled) positions
399  field = mapperPtr_().interpolate(tvalues);
400 }
401 
402 
403 template<class Type>
405 (
406  const scalar t
407 ) const
408 {
409  const polyMesh& mesh = this->patch_.boundaryMesh().mesh();
410  const Time& time = mesh.time();
411 
412  // Initialise
413  if (!mapperPtr_ && readerPtr_)
414  {
415  clockTime timing;
416 
417  auto& reader = readerPtr_();
418 
419  const meshedSurface& geom = reader.geometry(0);
420 
421  sampleTimes_ = reader.times();
422 
423  // We may have been passed in geometry without any faces
424  // eg, boundaryData
425 
426  const pointField& samplePoints =
427  (
428  geom.nFaces() ? geom.faceCentres() : geom.points()
429  );
430 
431  DebugInfo
432  << "Read " << samplePoints.size() << " sample points from "
433  << readerFile_ << endl
434  << "Found times "
436  << "... in " << timing.timeIncrement() << 's' << endl;
437 
438  // tbd: run-time selection
439  const bool nearestOnly =
440  (
441  !mapMethod_.empty() && !mapMethod_.starts_with("planar")
442  );
443 
444  // Allocate the interpolator
445  if (this->faceValues())
446  {
447  mapperPtr_.reset
448  (
449  new pointToPointPlanarInterpolation
450  (
451  samplePoints,
452  this->localPosition(this->patch_.faceCentres()),
453  perturb_,
454  nearestOnly
455  )
456  );
457  }
458  else
459  {
460  mapperPtr_.reset
461  (
462  new pointToPointPlanarInterpolation
463  (
464  samplePoints,
465  this->localPosition(this->patch_.localPoints()),
466  perturb_,
467  nearestOnly
468  )
469  );
470  }
471 
472  DebugInfo
473  << "Created point/point planar interpolation"
474  << " - in " << timing.timeIncrement() << 's' << endl;
475 
476 
477  // Setup median filter (if any)
478  if (filterSweeps_ > 0)
479  {
480  filterFieldPtr_.reset(new FilterField(geom, filterRadius_));
481 
482  DebugInfo
483  << "Calculated field-filter"
484  << " - in " << timing.timeIncrement() << 's' << endl;
485  }
486  else
487  {
488  filterFieldPtr_.reset(nullptr);
489  }
490  }
491  else if (!mapperPtr_)
492  {
493  clockTime timing;
494 
495  // Reread values and interpolate
496  const fileName samplePointsFile
497  (
498  time.globalPath()
499  /time.constant() // instance
500  /mesh.dbDir() // region
501  /"boundaryData"
502  /this->patch_.name()
503  /pointsName_
504  );
505 
506  IOobject io
507  (
508  samplePointsFile, // absolute path
509  time,
513  true // is global object (currently not used)
514  );
515 
516  // Read data (no average value!)
517  const rawIOField<point> samplePoints(io);
518 
519  // Read the times for which data is available
520  sampleTimes_ = Time::findTimes(samplePointsFile.path());
521 
522  DebugInfo
523  << "Read " << samplePoints.size() << " sample points from "
524  << samplePointsFile << endl
525  << "Found times "
527  << "... in " << timing.timeIncrement() << 's' << endl;
528 
529 
530  // tbd: run-time selection
531  const bool nearestOnly =
532  (
533  !mapMethod_.empty() && !mapMethod_.starts_with("planar")
534  );
535 
536  // Allocate the interpolator
537  if (this->faceValues())
538  {
539  mapperPtr_.reset
540  (
541  new pointToPointPlanarInterpolation
542  (
543  samplePoints,
544  this->localPosition(this->patch_.faceCentres()),
545  perturb_,
546  nearestOnly
547  )
548  );
549  }
550  else
551  {
552  mapperPtr_.reset
553  (
554  new pointToPointPlanarInterpolation
555  (
556  samplePoints,
557  this->localPosition(this->patch_.localPoints()),
558  perturb_,
559  nearestOnly
560  )
561  );
562  }
563 
564  DebugInfo
565  << "Created point/point planar interpolation"
566  << " - in " << timing.timeIncrement() << 's' << endl;
567 
568 
569  // Setup median filter (if any)
570  if (filterSweeps_ > 0)
571  {
572  filterFieldPtr_.reset(new FilterField(samplePoints, filterRadius_));
573 
574  DebugInfo
575  << "Calculated field-filter"
576  << " - in " << timing.timeIncrement() << 's' << endl;
577  }
578  else
579  {
580  filterFieldPtr_.reset(nullptr);
581  }
582  }
583 
584 
585  // Find range of current time indices in sampleTimes
586  labelPair timeIndices = instant::findRange
587  (
588  sampleTimes_,
589  t, //mesh.time().value(),
590  sampleIndex_.first()
591  );
592 
593  if (timeIndices.first() < 0)
594  {
596  << "Cannot find starting sampling values for index "
597  << t << nl
598  << "Have sampling values for "
600  << "In directory "
601  << time.constant()/mesh.dbDir()/"boundaryData"/this->patch_.name()
602  << "\n on patch " << this->patch_.name()
603  << " of field " << fieldTableName_
604  << exit(FatalError);
605  }
606 
607 
608  // Update sampled data fields.
609 
610  if (sampleIndex_.first() != timeIndices.first())
611  {
612  sampleIndex_.first() = timeIndices.first();
613 
614  if (sampleIndex_.first() == sampleIndex_.second())
615  {
616  // Can reuse previous end values
617  sampleValues_.first() = sampleValues_.second();
618  sampleAverage_.first() = sampleAverage_.second();
619  }
620  else
621  {
622  // Update first() values
623  this->updateSampledValues
624  (
625  sampleIndex_.first(),
626  sampleValues_.first(),
627  sampleAverage_.first()
628  );
629  }
630  }
631 
632  if (sampleIndex_.second() != timeIndices.second())
633  {
634  sampleIndex_.second() = timeIndices.second();
635 
636  if (sampleIndex_.second() == -1)
637  {
638  // Index no longer valid - clear values accordingly
639  sampleValues_.second().clear();
640  }
641  else
642  {
643  // Update second() values
644  this->updateSampledValues
645  (
646  sampleIndex_.second(),
647  sampleValues_.second(),
648  sampleAverage_.second()
649  );
650  }
651  }
652 }
653 
654 
655 template<class Type>
658 (
659  const scalar x
660 ) const
661 {
662  checkTable(x);
663 
664  // Interpolate between the sampled data
665  auto tfld = tmp<Field<Type>>::New();
666  auto& fld = tfld.ref();
667  Type wantedAverage;
668 
669  if (sampleIndex_.second() == -1)
670  {
671  // Only start value
672  fld = sampleValues_.first();
673  wantedAverage = sampleAverage_.first();
674  }
675  else
676  {
677  const scalar beg = sampleTimes_[sampleIndex_.first()].value();
678  const scalar end = sampleTimes_[sampleIndex_.second()].value();
679  const scalar s = (x - beg)/(end - beg);
680 
681  fld = (1 - s)*sampleValues_.first() + s*sampleValues_.second();
682 
683  wantedAverage
684  = (1 - s)*sampleAverage_.first() + s*sampleAverage_.second();
685 
686  DebugInfo
687  << "MappedFile<Type>::value : "
688  << "Sampled, interpolated values"
689  << " between time:"
690  << sampleTimes_[sampleIndex_.first()].name()
691  << " and time:" << sampleTimes_[sampleIndex_.second()].name()
692  << " with weight:" << s << endl;
693  }
694 
695  // Enforce average. Either by scaling (if scaling factor > 0.5) or by
696  // offsetting.
697  if (setAverage_)
698  {
699  Type averagePsi;
700 
701  if (this->faceValues())
702  {
703  const scalarField magSf(mag(this->patch_.faceAreas()));
704  averagePsi = gSum(magSf*fld)/gSum(magSf);
705  }
706  else
707  {
708  averagePsi = gAverage(fld);
709  }
710 
711  if (debug)
712  {
713  Pout<< "MappedFile<Type>::value :"
714  << " actual average:" << averagePsi
715  << " wanted average:" << wantedAverage
716  << endl;
717  }
718 
719  if (mag(averagePsi) < VSMALL)
720  {
721  // Field too small to scale. Offset instead.
722  const Type offset = wantedAverage - averagePsi;
723  if (debug)
724  {
725  Pout<< "MappedFile<Type>::value :"
726  << " offsetting with:" << offset << endl;
727  }
728  fld += offset;
729  }
730  else
731  {
732  const scalar scale = mag(wantedAverage)/mag(averagePsi);
733 
734  if (debug)
735  {
736  Pout<< "MappedFile<Type>::value :"
737  << " scaling with:" << scale << endl;
738  }
739  fld *= scale;
740  }
741  }
742 
743  // Apply offset to mapped values
744  if (offset_)
745  {
746  fld += offset_->value(x);
747  }
748 
749  if (debug)
750  {
751  Pout<< "MappedFile<Type>::value : set fixedValue to min:" << gMin(fld)
752  << " max:" << gMax(fld)
753  << " avg:" << gAverage(fld) << endl;
754  }
755 
756  return this->transform(tfld);
757 }
758 
759 
760 template<class Type>
763 (
764  const scalar x1,
765  const scalar x2
766 ) const
767 {
769  return nullptr;
770 }
771 
772 
773 template<class Type>
775 (
776  Ostream& os
777 ) const
778 {
779  if (!readerFormat_.empty() && !readerFile_.empty())
780  {
781  os.writeEntry("readerFormat", readerFormat_);
782  os.writeEntry("readerFile", readerFile_);
783  }
784 
785  os.writeEntryIfDifferent
786  (
787  "fieldTable",
788  this->name(),
789  fieldTableName_
790  );
791 
792  if (!pointsName_.empty())
793  {
794  os.writeEntryIfDifferent<word>("points", "points", pointsName_);
795  }
796 
797  if (!mapMethod_.empty() && !mapMethod_.starts_with("planar"))
798  {
799  os.writeEntry("mapMethod", mapMethod_);
800  }
801 
802  if (setAverage_)
803  {
804  os.writeEntry("setAverage", setAverage_);
805  }
806 
807  os.writeEntryIfDifferent<scalar>("perturb", 1e-5, perturb_);
808 
809  if (filterSweeps_ >= 1)
810  {
811  os.writeEntry("filterRadius", filterRadius_);
812  os.writeEntry("filterSweeps", filterSweeps_);
813  }
814 
815  if (offset_)
816  {
817  offset_->writeData(os);
818  }
819 }
820 
821 
822 template<class Type>
824 (
825  Ostream& os
826 ) const
827 {
829 
830  // Check if field name explicitly provided
831  // (e.g. through timeVaryingMapped bc)
832  if (dictConstructed_)
833  {
834  os.writeEntry(this->name(), type());
835 
836  os.beginBlock(word(this->name() + "Coeffs"));
837  writeEntries(os);
838  os.endBlock();
839  }
840  else
841  {
842  // Note that usually dictConstructed = true. The
843  // construct-from-dictionary (dictConstructed_ = false)
844  // should only be used if there is only
845  // a single potential MappedFile in the local scope.
846  writeEntries(os);
847  }
848 }
849 
850 
851 // ************************************************************************* //
Patch value mapping from a set of values stored in a file and a set of unstructured points using the ...
Definition: MappedFile.H:170
static wordList timeNames(const instantList &times)
Helper: extract words of times.
dictionary dict
rDeltaTY field()
A class for handling file names.
Definition: fileName.H:72
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:608
Type gMin(const FieldField< Field, Type > &f)
static Pair< label > findRange(const UList< instant > &times, const scalar timeVal, const label start=-1)
Find lower/upper indices for given time value in list of instances (linear search) continuing after t...
Definition: instant.C:54
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual tmp< Field< Type > > value(const scalar) const
Return MappedFile value.
Definition: MappedFile.C:651
Ignore writing from objectRegistry::writeObject()
const polyPatch const word const word const dictionary & dict
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
virtual tmp< Field< Type > > integrate(const scalar x1, const scalar x2) const
Integrate between two values.
Definition: MappedFile.C:756
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
dynamicFvMesh & mesh
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
Abstract base class to hold the Field mapping addressing and weights.
Definition: FieldMapper.H:43
A class for handling words, derived from Foam::string.
Definition: word.H:63
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
MeshedSurface< face > meshedSurface
virtual void rmap(const PatchFunction1< Type > &pf1, const labelList &addr)
Reverse map the given PatchFunction1 onto this PatchFunction1.
Definition: MappedFile.C:246
virtual void autoMap(const FieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
label find(const T &val) const
Find index of the first occurrence of the value.
Definition: UList.C:173
const polyPatch const word const word & entryName
#define DebugInfo
Report an information message using Foam::Info.
virtual void writeData(Ostream &os) const
Write in dictionary format.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
int debug
Static debugging option.
Pair< label > labelPair
A pair of labels.
Definition: Pair.H:51
Type gMax(const FieldField< Field, Type > &f)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Definition: stdFoam.H:201
OBJstream os(runTime.globalPath()/outputName)
virtual void writeEntries(Ostream &os) const
Write coefficient entries in dictionary format.
Definition: MappedFile.C:768
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
Definition: surfaceReader.C:36
static instantList findTimes(const fileName &directory, const word &constantDirName="constant")
Search a given directory for valid time directories.
Definition: TimePaths.C:109
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))
List< word > wordList
List of word.
Definition: fileName.H:59
bool starts_with(char c) const
True if string starts with given character (cf. C++20)
Definition: string.H:435
static autoPtr< surfaceReader > New(const word &readType, const fileName &fName, const dictionary &options=dictionary())
Return a reference to the selected surfaceReader.
Definition: surfaceReader.C:71
virtual void autoMap(const FieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
Definition: MappedFile.C:222
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:637
Type gAverage(const FieldField< Field, Type > &f)
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:90
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
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))
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:696
virtual void rmap(const PatchFunction1< Type > &rhs, const labelList &addr)
Reverse map the given PatchFunction1 onto this PatchFunction1.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition: FlatOutput.H:225
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: MappedFile.C:817