Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
34template<class Type>
35Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
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 {
125 FatalIOErrorInFunction(dict)
126 << "Unknown mapMethod type " << mapMethod_
127 << "\n\nValid mapMethod types :\n"
128 << "(nearest planar)" << nl
129 << exit(FatalIOError);
130 }
131}
132
133
134template<class Type>
135Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
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),
152 )
153{}
154
155
156template<class Type>
157Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
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,
174 )
175{}
176
177
178template<class Type>
179Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
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();
210 readerPtr_ = surfaceReader::New(readerFormat_, fName);
211 }
212}
213
214
215template<class Type>
216Foam::PatchFunction1Types::MappedFile<Type>::MappedFile
217(
218 const MappedFile<Type>& rhs
219)
220:
221 MappedFile<Type>(rhs, rhs.patch())
222{}
223
224
225// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
226
227template<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
251template<class Type>
253(
254 const PatchFunction1<Type>& pf1,
255 const labelList& addr
256)
257{
259
260 const auto& tiptf =
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
282template<class Type>
283void Foam::PatchFunction1Types::MappedFile<Type>::updateSampledValues
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 {
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}
402
403template<class Type>
404void Foam::PatchFunction1Types::MappedFile<Type>::checkTable
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_();
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
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 =
441 !mapMethod_.empty() && !mapMethod_.starts_with("planar")
442 );
443
444 // Allocate the interpolator
445 if (this->faceValues())
446 {
447 mapperPtr_.reset
448 (
450 (
451 samplePoints,
452 this->localPosition(this->patch_.faceCentres()),
453 perturb_,
454 nearestOnly
455 )
456 );
457 }
458 else
459 {
460 mapperPtr_.reset
461 (
463 (
464 samplePoints,
465 this->localPosition(this->patch_.localPoints()),
466 perturb_,
467 nearestOnly
468 )
469 );
470 }
471
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
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
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
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
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 );
651 }
652}
653
654
655template<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
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 averagePsi = gWeightedAverage(this->patch_.magFaceAreas(), fld);
704 }
705 else
706 {
707 averagePsi = gAverage(fld);
708 }
709
710 if (debug)
711 {
712 Pout<< "MappedFile<Type>::value :"
713 << " actual average:" << averagePsi
714 << " wanted average:" << wantedAverage
715 << endl;
716 }
717
718 if (mag(averagePsi) < VSMALL)
719 {
720 // Field too small to scale. Offset instead.
721 const Type offset = wantedAverage - averagePsi;
722 if (debug)
723 {
724 Pout<< "MappedFile<Type>::value :"
725 << " offsetting with:" << offset << endl;
726 }
727 fld += offset;
728 }
729 else
730 {
731 const scalar scale = mag(wantedAverage)/mag(averagePsi);
732
733 if (debug)
734 {
735 Pout<< "MappedFile<Type>::value :"
736 << " scaling with:" << scale << endl;
737 }
738 fld *= scale;
739 }
740 }
741
742 // Apply offset to mapped values
743 if (offset_)
744 {
745 fld += offset_->value(x);
746 }
747
748 if (debug)
749 {
750 auto limits = gMinMax(fld);
751 auto avg = gAverage(fld);
752
753 Pout<< "MappedFile<Type>::value : set fixedValue to min:"
754 << limits.min()
755 << " max:" << limits.max()
756 << " avg:" << avg << endl;
757 }
759 return this->transform(tfld);
760}
761
762
763template<class Type>
766(
767 const scalar x1,
768 const scalar x2
769) const
772 return nullptr;
773}
774
775
776template<class Type>
778(
779 Ostream& os
780) const
781{
782 if (!readerFormat_.empty() && !readerFile_.empty())
783 {
784 os.writeEntry("readerFormat", readerFormat_);
785 os.writeEntry("readerFile", readerFile_);
786 }
787
788 os.writeEntryIfDifferent
789 (
790 "fieldTable",
791 this->name(),
792 fieldTableName_
793 );
794
795 if (!pointsName_.empty())
796 {
797 os.writeEntryIfDifferent<word>("points", "points", pointsName_);
798 }
799
800 if (!mapMethod_.empty() && !mapMethod_.starts_with("planar"))
801 {
802 os.writeEntry("mapMethod", mapMethod_);
803 }
804
805 if (setAverage_)
806 {
807 os.writeEntry("setAverage", setAverage_);
808 }
809
810 os.writeEntryIfDifferent<scalar>("perturb", 1e-5, perturb_);
811
812 if (filterSweeps_ >= 1)
813 {
814 os.writeEntry("filterRadius", filterRadius_);
815 os.writeEntry("filterSweeps", filterSweeps_);
816 }
817
818 if (offset_)
820 offset_->writeData(os);
821 }
822}
823
824
825template<class Type>
827(
828 Ostream& os
829) const
830{
832
833 // Check if field name explicitly provided
834 // (e.g. through timeVaryingMapped bc)
835 if (dictConstructed_)
836 {
837 os.writeEntry(this->name(), type());
838
839 os.beginBlock(word(this->name() + "Coeffs"));
840 writeEntries(os);
841 os.endBlock();
842 }
843 else
844 {
845 // Note that usually dictConstructed = true. The
846 // construct-from-dictionary (dictConstructed_ = false)
847 // should only be used if there is only
848 // a single potential MappedFile in the local scope.
849 writeEntries(os);
850 }
851}
852
853
854// ************************************************************************* //
if(maxValue - minValue< SMALL)
if(patchID !=-1)
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Abstract base class to hold the Field mapping addressing and weights.
Definition FieldMapper.H:44
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition Ostream.C:90
The FilterField helper class provides a multi-sweep median filter for a Field of data associated with...
Patch value mapping from a set of values stored in a file and a set of unstructured points using the ...
Definition MappedFile.H:173
virtual tmp< Field< Type > > integrate(const scalar x1, const scalar x2) const
Integrate between two values.
Definition MappedFile.C:759
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.
Definition MappedFile.C:222
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition MappedFile.C:820
virtual tmp< PatchFunction1< Type > > clone() const
Return a clone.
Definition MappedFile.H:357
virtual void writeEntries(Ostream &os) const
Write coefficient entries in dictionary format.
Definition MappedFile.C:771
virtual tmp< Field< Type > > value(const scalar) const
Return MappedFile value.
Definition MappedFile.C:651
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
const polyPatch const word const word & entryName
virtual void rmap(const PatchFunction1< Type > &rhs, const labelList &addr)
Reverse map the given PatchFunction1 onto this PatchFunction1.
virtual void autoMap(const FieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
virtual void writeData(Ostream &os) const
Write in dictionary format.
const polyPatch const word const word const dictionary & dict
virtual tmp< pointField > localPosition(const pointField &globalPos) const
const polyPatch & pp
const polyPatch const word const word const dictionary const bool faceValues
label nFaces() const noexcept
Number of faces in the patch.
const Field< point_type > & points() const noexcept
Return reference to global points.
const Field< point_type > & faceCentres() const
Return face centres for patch.
const word & constant() const noexcept
Return constant name.
Definition TimePathsI.H:131
static instantList findTimes(const fileName &directory, const word &constantDirName="constant")
Search a given directory for valid time directories.
Definition TimePaths.C:109
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
fileName globalPath() const
The global path for the case = rootPath/globalCaseName.
Definition TimePathsI.H:108
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
label find(const T &val) const
Find index of the first occurrence of the value.
Definition UList.C:160
Starts timing and returns elapsed time from start. Uses std::chrono::high_resolution_clock for better...
Definition clockTime.H:59
double timeIncrement() const
The time [seconds] since the last call to elapsedTime(), timeIncrement() or resetTime(),...
Definition clockTimeI.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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
const Time & time() const noexcept
Return time registry.
const Time & time() const
Return false: function not created with time database.
const polyPatch & patch_
Reference to the patch.
const polyPatch & patch() const noexcept
Reference to the patch.
label size() const
Number of faces or points on the patch.
Interpolates between two sets of unstructured points using 2D Delaunay triangulation....
static wordList timeNames(const instantList &times)
Helper: extract words of times.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
auto limits
Definition setRDeltaT.H:186
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
OBJstream os(runTime.globalPath()/outputName)
const auto & io
auto & name
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))
#define DebugInfo
Report an information message using Foam::Info.
const char * end
Definition SVGTools.H:223
Namespace for handling debugging switches.
Definition debug.C:45
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
Pair< label > labelPair
A pair of labels.
Definition Pair.H:54
List< word > wordList
List of word.
Definition fileName.H:60
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.
Type gWeightedAverage(const UList< scalar > &weights, const UList< Type > &fld, const label comm)
The global weighted average of a field, using the mag() of the weights.
List< label > labelList
A List of labels.
Definition List.H:62
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
MeshedSurface< face > meshedSurface
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition FlatOutput.H:217
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
dictionary dict
volScalarField & e