streamLineBase.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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "streamLineBase.H"
27 #include "fvMesh.H"
28 #include "ReadFields.H"
29 #include "sampledSet.H"
30 #include "globalIndex.H"
31 #include "mapDistribute.H"
32 #include "interpolationCellPoint.H"
33 #include "wallPolyPatch.H"
34 #include "meshSearchMeshObject.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  defineTypeNameAndDebug(streamLineBase, 0);
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
48 {
49  const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
50 
51  const polyBoundaryMesh& patches = mesh.boundaryMesh();
52 
53  label nFaces = 0;
54 
55  forAll(patches, patchI)
56  {
57  //if (!polyPatch::constraintType(patches[patchI].type()))
58  if (isA<wallPolyPatch>(patches[patchI]))
59  {
60  nFaces += patches[patchI].size();
61  }
62  }
63 
64  labelList addressing(nFaces);
65 
66  nFaces = 0;
67 
68  forAll(patches, patchI)
69  {
70  //if (!polyPatch::constraintType(patches[patchI].type()))
71  if (isA<wallPolyPatch>(patches[patchI]))
72  {
73  const polyPatch& pp = patches[patchI];
74 
75  forAll(pp, i)
76  {
77  addressing[nFaces++] = pp.start()+i;
78  }
79  }
80  }
81 
83  (
85  (
87  (
88  mesh.faces(),
89  addressing
90  ),
91  mesh.points()
92  )
93  );
94 }
95 
96 
98 (
99  const label nSeeds,
100  label& UIndex,
101  PtrList<volScalarField>& vsFlds,
102  PtrList<interpolation<scalar> >& vsInterp,
103  PtrList<volVectorField>& vvFlds,
104  PtrList<interpolation<vector> >& vvInterp
105 )
106 {
107  const Time& runTime = obr_.time();
108  const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
109 
110  // Read or lookup fields
111 
112  if (loadFromFiles_)
113  {
114  IOobjectList allObjects(mesh, runTime.timeName());
115 
116  IOobjectList objects(2*fields_.size());
117  forAll(fields_, i)
118  {
119  objects.add(*allObjects[fields_[i]]);
120  }
121 
122  ReadFields(mesh, objects, vsFlds);
123  vsInterp.setSize(vsFlds.size());
124  forAll(vsFlds, i)
125  {
126  vsInterp.set
127  (
128  i,
130  (
131  interpolationScheme_,
132  vsFlds[i]
133  )
134  );
135  }
136  ReadFields(mesh, objects, vvFlds);
137  vvInterp.setSize(vvFlds.size());
138  forAll(vvFlds, i)
139  {
140  vvInterp.set
141  (
142  i,
144  (
145  interpolationScheme_,
146  vvFlds[i]
147  )
148  );
149  }
150  }
151  else
152  {
153  label nScalar = 0;
154  label nVector = 0;
155 
156  forAll(fields_, i)
157  {
158  if (mesh.foundObject<volScalarField>(fields_[i]))
159  {
160  nScalar++;
161  }
162  else if (mesh.foundObject<volVectorField>(fields_[i]))
163  {
164  nVector++;
165  }
166  else
167  {
169  << "Cannot find field " << fields_[i] << nl
170  << "Valid scalar fields are:"
171  << mesh.names(volScalarField::typeName) << nl
172  << "Valid vector fields are:"
173  << mesh.names(volVectorField::typeName)
174  << exit(FatalError);
175  }
176  }
177  vsInterp.setSize(nScalar);
178  nScalar = 0;
179  vvInterp.setSize(nVector);
180  nVector = 0;
181 
182  forAll(fields_, i)
183  {
184  if (mesh.foundObject<volScalarField>(fields_[i]))
185  {
187  (
188  fields_[i]
189  );
190  vsInterp.set
191  (
192  nScalar++,
194  (
195  interpolationScheme_,
196  f
197  )
198  );
199  }
200  else if (mesh.foundObject<volVectorField>(fields_[i]))
201  {
203  (
204  fields_[i]
205  );
206 
207  if (f.name() == UName_)
208  {
209  UIndex = nVector;
210  }
211 
212  vvInterp.set
213  (
214  nVector++,
216  (
217  interpolationScheme_,
218  f
219  )
220  );
221  }
222  }
223  }
224 
225  // Store the names
226  scalarNames_.setSize(vsInterp.size());
227  forAll(vsInterp, i)
228  {
229  scalarNames_[i] = vsInterp[i].psi().name();
230  }
231  vectorNames_.setSize(vvInterp.size());
232  forAll(vvInterp, i)
233  {
234  vectorNames_[i] = vvInterp[i].psi().name();
235  }
236 
237  // Check that we know the index of U in the interpolators.
238 
239  if (UIndex == -1)
240  {
242  << "Cannot find field to move particles with : " << UName_ << nl
243  << "This field has to be present in the sampled fields " << fields_
244  << " and in the objectRegistry."
245  << exit(FatalError);
246  }
247 
248  // Sampled data
249  // ~~~~~~~~~~~~
250 
251  // Size to maximum expected sizes.
252  allTracks_.clear();
253  allTracks_.setCapacity(nSeeds);
254  allScalars_.setSize(vsInterp.size());
255  forAll(allScalars_, i)
256  {
257  allScalars_[i].clear();
258  allScalars_[i].setCapacity(nSeeds);
259  }
260  allVectors_.setSize(vvInterp.size());
261  forAll(allVectors_, i)
262  {
263  allVectors_[i].clear();
264  allVectors_[i].setCapacity(nSeeds);
265  }
266 }
267 
268 
270 (
271  const label trackI,
272 
273  const scalar w,
274  const label leftI,
275  const label rightI,
276 
277  DynamicList<point>& newTrack,
278  DynamicList<scalarList>& newScalars,
279  DynamicList<vectorList>& newVectors
280 ) const
281 {
282  label sz = newTrack.size();
283 
284  const List<point>& track = allTracks_[trackI];
285 
286  newTrack.append((1.0-w)*track[leftI] + w*track[rightI]);
287 
288  // Scalars
289  {
290  newScalars.append(scalarList(allScalars_.size()));
291  scalarList& newVals = newScalars[sz];
292 
293  forAll(allScalars_, scalarI)
294  {
295  const scalarList& trackVals = allScalars_[scalarI][trackI];
296  newVals[scalarI] = (1.0-w)*trackVals[leftI] + w*trackVals[rightI];
297  }
298  }
299 
300  // Vectors
301  {
302  newVectors.append(vectorList(allVectors_.size()));
303  vectorList& newVals = newVectors[sz];
304 
305  forAll(allVectors_, vectorI)
306  {
307  const vectorList& trackVals = allVectors_[vectorI][trackI];
308  newVals[vectorI] = (1.0-w)*trackVals[leftI] + w*trackVals[rightI];
309  }
310  }
311 }
312 
313 
314 // Can split a track into multiple tracks
316 (
317  const treeBoundBox& bb,
318  const label trackI,
319  PtrList<DynamicList<point> >& newTracks,
320  PtrList<DynamicList<scalarList> >& newScalars,
321  PtrList<DynamicList<vectorList> >& newVectors
322 ) const
323 {
324  const List<point>& track = allTracks_[trackI];
325  if (track.size())
326  {
327  for
328  (
329  label segmentI = 1;
330  segmentI < track.size();
331  segmentI++
332  )
333  {
334  const point& startPt = track[segmentI-1];
335  const point& endPt = track[segmentI];
336 
337  const vector d(endPt-startPt);
338  scalar magD = mag(d);
339  if (magD > ROOTVSMALL)
340  {
341  if (bb.contains(startPt))
342  {
343  // Store 1.0*track[segmentI-1]+0*track[segmentI]
344  storePoint
345  (
346  trackI,
347 
348  0.0,
349  segmentI-1,
350  segmentI,
351 
352  newTracks.last(),
353  newScalars.last(),
354  newVectors.last()
355  );
356 
357  if (!bb.contains(endPt))
358  {
359  point clipPt;
360  if (bb.intersects(endPt, startPt, clipPt))
361  {
362  // End of track. Store point and interpolated
363  // values
364  storePoint
365  (
366  trackI,
367 
368  mag(clipPt-startPt)/magD,
369  segmentI-1,
370  segmentI,
371 
372  newTracks.last(),
373  newScalars.last(),
374  newVectors.last()
375  );
376 
377  newTracks.last().shrink();
378  newScalars.last().shrink();
379  newVectors.last().shrink();
380  }
381  }
382  }
383  else
384  {
385  // startPt outside box. New track. Get starting point
386 
387  point clipPt;
388  if (bb.intersects(startPt, endPt, clipPt))
389  {
390  // New track
391  newTracks.append
392  (
393  new DynamicList<point>(track.size()/10)
394  );
395  newScalars.append
396  (
397  new DynamicList<scalarList>(track.size()/10)
398  );
399  newVectors.append
400  (
401  new DynamicList<vectorList>(track.size()/10)
402  );
403 
404  // Store point and interpolated values
405  storePoint
406  (
407  trackI,
408 
409  mag(clipPt-startPt)/magD,
410  segmentI-1,
411  segmentI,
412 
413  newTracks.last(),
414  newScalars.last(),
415  newVectors.last()
416  );
417 
418  if (!bb.contains(endPt))
419  {
420  bb.intersects
421  (
422  endPt,
423  point(clipPt),
424  clipPt
425  );
426 
427  // Store point and interpolated values
428  storePoint
429  (
430  trackI,
431 
432  mag(clipPt-startPt)/magD,
433  segmentI-1,
434  segmentI,
435 
436  newTracks.last(),
437  newScalars.last(),
438  newVectors.last()
439  );
440 
441  newTracks.last().shrink();
442  newScalars.last().shrink();
443  newVectors.last().shrink();
444  }
445  }
446  }
447  }
448  }
449 
450  // Last point
451  if (bb.contains(track.last()))
452  {
453  storePoint
454  (
455  trackI,
456 
457  1.0,
458  track.size()-2,
459  track.size()-1,
460 
461  newTracks.last(),
462  newScalars.last(),
463  newVectors.last()
464  );
465  }
466  }
467 }
468 
469 
471 {
472  // Storage for new tracks. Per track, per sample the coordinate (newTracks)
473  // or values for all the sampled fields (newScalars, newVectors)
474  PtrList<DynamicList<point> > newTracks;
475  PtrList<DynamicList<scalarList> > newScalars;
476  PtrList<DynamicList<vectorList> > newVectors;
477 
478  forAll(allTracks_, trackI)
479  {
480  const List<point>& track = allTracks_[trackI];
481 
482  if (track.size())
483  {
484  // New track. Assume it consists of the whole track
485  newTracks.append(new DynamicList<point>(track.size()));
486  newScalars.append(new DynamicList<scalarList>(track.size()));
487  newVectors.append(new DynamicList<vectorList>(track.size()));
488 
489  // Trim, split and append to newTracks
490  trimToBox(bb, trackI, newTracks, newScalars, newVectors);
491  }
492  }
493 
494  // Transfer newTracks to allTracks_
495  allTracks_.setSize(newTracks.size());
496  forAll(allTracks_, trackI)
497  {
498  allTracks_[trackI].transfer(newTracks[trackI]);
499  }
500  // Replace track scalars
501  forAll(allScalars_, scalarI)
502  {
503  DynamicList<scalarList>& fieldVals = allScalars_[scalarI];
504  fieldVals.setSize(newTracks.size());
505 
506  forAll(fieldVals, trackI)
507  {
508  scalarList& trackVals = allScalars_[scalarI][trackI];
509  trackVals.setSize(newScalars[trackI].size());
510  forAll(trackVals, sampleI)
511  {
512  trackVals[sampleI] = newScalars[trackI][sampleI][scalarI];
513  }
514  }
515  }
516  // Replace track vectors
517  forAll(allVectors_, vectorI)
518  {
519  DynamicList<vectorList>& fieldVals = allVectors_[vectorI];
520  fieldVals.setSize(newTracks.size());
521  forAll(fieldVals, trackI)
522  {
523  vectorList& trackVals = allVectors_[vectorI][trackI];
524  trackVals.setSize(newVectors[trackI].size());
525  forAll(trackVals, sampleI)
526  {
527  trackVals[sampleI] = newVectors[trackI][sampleI][vectorI];
528  }
529  }
530  }
531 }
532 
533 
534 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
535 
537 (
538  const word& name,
539  const objectRegistry& obr,
540  const dictionary& dict,
541  const bool loadFromFiles
542 )
543 :
545  dict_(dict),
546  obr_(obr),
547  loadFromFiles_(loadFromFiles),
548  log_(true)
549 {}
550 
551 
552 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
553 
555 {}
556 
557 
558 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
559 
561 {
562  if (active_)
563  {
564  log_.readIfPresent("log", dict);
565 
566  if (log_) Info<< type() << " " << name_ << ":" << nl;
567 
568  dict.lookup("fields") >> fields_;
569  if (dict.found("UName"))
570  {
571  dict.lookup("UName") >> UName_;
572  }
573  else
574  {
575  UName_ = "U";
576  if (dict.found("U"))
577  {
579  << "Using deprecated entry \"U\"."
580  << " Please use \"UName\" instead."
581  << endl;
582  dict.lookup("U") >> UName_;
583  }
584  }
585 
586  if (findIndex(fields_, UName_) == -1)
587  {
589  << "Velocity field for tracking " << UName_
590  << " should be present in the list of fields " << fields_
591  << exit(FatalIOError);
592  }
593 
594 
595  dict.lookup("trackForward") >> trackForward_;
596  dict.lookup("lifeTime") >> lifeTime_;
597  if (lifeTime_ < 1)
598  {
600  << "Illegal value " << lifeTime_ << " for lifeTime"
601  << exit(FatalError);
602  }
603 
604 
605  trackLength_ = VGREAT;
606  if (dict.found("trackLength"))
607  {
608  dict.lookup("trackLength") >> trackLength_;
609 
610  if (log_)
611  {
612  Info<< type() << " : fixed track length specified : "
613  << trackLength_ << nl << endl;
614  }
615  }
616 
617 
618  bounds_ = boundBox::greatBox;
619  if (dict.readIfPresent("bounds", bounds_))
620  {
621  if (log_) Info<< " clipping all segments to " << bounds_ << nl << endl;
622  }
623 
624 
625  interpolationScheme_ = dict.lookupOrDefault
626  (
627  "interpolationScheme",
629  );
630 
631  //if (log_) Info<< " using interpolation " << interpolationScheme_
632  // << endl;
633 
634  cloudName_ = dict.lookupOrDefault<word>("cloudName", type());
635  dict.lookup("seedSampleSet") >> seedSet_;
636 
637  const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
638 
639  const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
640 
641  sampledSetPtr_ = sampledSet::New
642  (
643  seedSet_,
644  mesh,
646  coeffsDict
647  );
648  coeffsDict.lookup("axis") >> sampledSetAxis_;
649 
650  scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
651  vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
652  }
653 }
654 
655 
657 {}
658 
659 
661 {}
662 
663 
665 {}
666 
667 
669 {
670  if (active_)
671  {
672  if (log_) Info<< type() << " " << name_ << " output:" << nl;
673 
674  const Time& runTime = obr_.time();
675  const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
676 
677 
678  // Do all injection and tracking
679  track();
680 
681 
682  if (Pstream::parRun())
683  {
684  // Append slave tracks to master ones
685  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
686 
687  globalIndex globalTrackIDs(allTracks_.size());
688 
689  // Construct a distribution map to pull all to the master.
690  labelListList sendMap(Pstream::nProcs());
691  labelListList recvMap(Pstream::nProcs());
692 
693  if (Pstream::master())
694  {
695  // Master: receive all. My own first, then consecutive
696  // processors.
697  label trackI = 0;
698 
699  forAll(recvMap, procI)
700  {
701  labelList& fromProc = recvMap[procI];
702  fromProc.setSize(globalTrackIDs.localSize(procI));
703  forAll(fromProc, i)
704  {
705  fromProc[i] = trackI++;
706  }
707  }
708  }
709 
710  labelList& toMaster = sendMap[0];
711  toMaster.setSize(globalTrackIDs.localSize());
712  forAll(toMaster, i)
713  {
714  toMaster[i] = i;
715  }
716 
717  const mapDistribute distMap
718  (
719  globalTrackIDs.size(),
720  sendMap.xfer(),
721  recvMap.xfer()
722  );
723 
724 
725  // Distribute the track positions. Note: use scheduled comms
726  // to prevent buffering.
727  allTracks_.shrink();
729  (
731  distMap.schedule(),
732  distMap.constructSize(),
733  distMap.subMap(),
734  false,
735  distMap.constructMap(),
736  false,
737  allTracks_,
738  flipOp()
739  );
740  allTracks_.setCapacity(allTracks_.size());
741 
742  // Distribute the scalars
743  forAll(allScalars_, scalarI)
744  {
745  allScalars_[scalarI].shrink();
747  (
749  distMap.schedule(),
750  distMap.constructSize(),
751  distMap.subMap(),
752  false,
753  distMap.constructMap(),
754  false,
755  allScalars_[scalarI],
756  flipOp()
757  );
758  allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
759  }
760  // Distribute the vectors
761  forAll(allVectors_, vectorI)
762  {
763  allVectors_[vectorI].shrink();
765  (
767  distMap.schedule(),
768  distMap.constructSize(),
769  distMap.subMap(),
770  false,
771  distMap.constructMap(),
772  false,
773  allVectors_[vectorI],
774  flipOp()
775  );
776  allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
777  }
778  }
779 
780 
781  if (Pstream::master())
782  {
783  if (bounds_ != boundBox::greatBox)
784  {
785  // Clip to bounding box
786  trimToBox(treeBoundBox(bounds_));
787  }
788 
789 
790  label nTracks = 0;
791  label n = 0;
792  forAll(allTracks_, trackI)
793  {
794  if (allTracks_[trackI].size())
795  {
796  nTracks++;
797  n += allTracks_[trackI].size();
798  }
799  }
800 
801  if (log_)
802  {
803  Info<< " Tracks:" << nTracks << nl
804  << " Total samples:" << n
805  << endl;
806  }
807 
808 
809  // Massage into form suitable for writers
810  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
811 
812  // Make output directory
813 
814  fileName vtkPath
815  (
817  ? runTime.path()/".."/"postProcessing"/"sets"/name()
818  : runTime.path()/"postProcessing"/"sets"/name()
819  );
821  {
822  vtkPath = vtkPath/mesh.name();
823  }
824  vtkPath = vtkPath/mesh.time().timeName();
825 
826  mkDir(vtkPath);
827 
828  // Convert track positions (and compact out empty tracks)
829 
830  PtrList<coordSet> tracks(nTracks);
831  nTracks = 0;
832  labelList oldToNewTrack(allTracks_.size(), -1);
833 
834  forAll(allTracks_, trackI)
835  {
836  if (allTracks_[trackI].size())
837  {
838  tracks.set
839  (
840  nTracks,
841  new coordSet
842  (
843  "track" + Foam::name(nTracks),
844  sampledSetAxis_ //"xyz"
845  )
846  );
847  oldToNewTrack[trackI] = nTracks;
848  tracks[nTracks].transfer(allTracks_[trackI]);
849  nTracks++;
850  }
851  }
852 
853  // Convert scalar values
854 
855  if (allScalars_.size() > 0)
856  {
857  List<List<scalarField> > scalarValues(allScalars_.size());
858 
859  forAll(allScalars_, scalarI)
860  {
861  DynamicList<scalarList>& allTrackVals =
862  allScalars_[scalarI];
863  scalarValues[scalarI].setSize(nTracks);
864 
865  forAll(allTrackVals, trackI)
866  {
867  scalarList& vals = allTrackVals[trackI];
868  if (vals.size())
869  {
870  label newTrackI = oldToNewTrack[trackI];
871  scalarValues[scalarI][newTrackI].transfer(vals);
872  }
873  }
874  }
875 
876  fileName vtkFile
877  (
878  vtkPath
879  / scalarFormatterPtr_().getFileName
880  (
881  tracks[0],
882  scalarNames_
883  )
884  );
885 
886  if (log_) Info
887  << " Writing data to " << vtkFile.path() << endl;
888 
889  scalarFormatterPtr_().write
890  (
891  true, // writeTracks
892  tracks,
893  scalarNames_,
894  scalarValues,
895  OFstream(vtkFile)()
896  );
897 
898  forAll(scalarNames_, nameI)
899  {
901  propsDict.add("file", vtkFile);
902  const word& fieldName = scalarNames_[nameI];
903  setProperty(fieldName, propsDict);
904  }
905  }
906 
907  // Convert vector values
908 
909  if (allVectors_.size() > 0)
910  {
911  List<List<vectorField> > vectorValues(allVectors_.size());
912 
913  forAll(allVectors_, vectorI)
914  {
915  DynamicList<vectorList>& allTrackVals =
916  allVectors_[vectorI];
917  vectorValues[vectorI].setSize(nTracks);
918 
919  forAll(allTrackVals, trackI)
920  {
921  vectorList& vals = allTrackVals[trackI];
922  if (vals.size())
923  {
924  label newTrackI = oldToNewTrack[trackI];
925  vectorValues[vectorI][newTrackI].transfer(vals);
926  }
927  }
928  }
929 
930  fileName vtkFile
931  (
932  vtkPath
933  / vectorFormatterPtr_().getFileName
934  (
935  tracks[0],
936  vectorNames_
937  )
938  );
939 
940  //if (log_) Info<< " Writing vector data to " << vtkFile << endl;
941 
942  vectorFormatterPtr_().write
943  (
944  true, // writeTracks
945  tracks,
946  vectorNames_,
947  vectorValues,
948  OFstream(vtkFile)()
949  );
950 
951  forAll(vectorNames_, nameI)
952  {
954  propsDict.add("file", vtkFile);
955  const word& fieldName = vectorNames_[nameI];
956  setProperty(fieldName, propsDict);
957  }
958  }
959  }
960  }
961 }
962 
963 
965 {
966  read(dict_);
967 }
968 
969 
971 {
972  // Moving mesh affects the search tree
973  read(dict_);
974 }
975 
976 
977 // ************************************************************************* //
Foam::streamLineBase::obr_
const objectRegistry & obr_
Database this class is registered to.
Definition: streamLineBase.H:72
Foam::sampledSet::New
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
Definition: sampledSet.C:440
Foam::mapDistributeBase::subMap
const labelListList & subMap() const
From subsetted data back to original data.
Definition: mapDistributeBase.H:256
Foam::scalarList
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:50
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::streamLineBase::initInterpolations
void initInterpolations(const label nSeeds, label &UIndex, PtrList< volScalarField > &vsFlds, PtrList< interpolation< scalar > > &vsInterp, PtrList< volVectorField > &vvFlds, PtrList< interpolation< vector > > &vvInterp)
Initialise fields, interpolators and track storage.
Definition: streamLineBase.C:98
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::PtrList::append
void append(T *)
Append an element at the end of the list.
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::functionObjectState
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: functionObjectState.H:54
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:306
Foam::UPstream::scheduled
@ scheduled
Definition: UPstream.H:67
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
meshSearchMeshObject.H
Foam::findIndex
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::mapDistributeBase::distribute
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
Definition: mapDistributeBaseTemplates.C:119
Foam::List::xfer
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
Definition: ListI.H:90
Foam::dictionary::readIfPresent
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Definition: dictionaryTemplates.C:94
Foam::read
bool read(const char *, int32_t &)
Definition: int32IO.C:87
Foam::ReadFields
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, const bool syncPar=true, const bool readOldTime=false)
Helper routine to read Geometric fields.
globalIndex.H
Foam::UPstream::nProcs
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Definition: UPstream.H:387
Foam::streamLineBase::execute
virtual void execute()
Execute the averaging.
Definition: streamLineBase.C:656
Foam::treeBoundBox
Standard boundBox + extra functionality for use in octree.
Definition: treeBoundBox.H:75
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:117
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::flipOp
Class containing functor to negate primitives. Dummy for all other types.
Definition: flipOp.H:50
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::fileName::path
fileName path() const
Return directory path name (part before last /)
Definition: fileName.C:293
wallPolyPatch.H
Foam::List::transfer
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Definition: dictionaryTemplates.C:33
Foam::streamLineBase::write
virtual void write()
Track and write.
Definition: streamLineBase.C:668
Foam::globalIndex::localSize
label localSize() const
My local size.
Definition: globalIndexI.H:60
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::streamLineBase::read
virtual void read(const dictionary &)
Read the field average data.
Definition: streamLineBase.C:560
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::MeshObject< polyMesh, GeometricMeshObject, meshSearchMeshObject >::New
static const meshSearchMeshObject & New(const polyMesh &mesh)
Definition: MeshObject.C:44
interpolationCellPoint.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::streamLineBase::trimToBox
void trimToBox(const treeBoundBox &bb, const label trackI, PtrList< DynamicList< point > > &newTracks, PtrList< DynamicList< scalarList > > &newScalars, PtrList< DynamicList< vectorList > > &newVectors) const
Trim and possibly split a track.
Definition: streamLineBase.C:316
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::streamLineBase::movePoints
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
Definition: streamLineBase.C:970
Foam::PtrList::set
bool set(const label) const
Is element set.
streamLineBase.H
sampledSet.H
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:59
Foam::dictionary::found
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:304
Foam::interpolationCellPoint
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Definition: interpolationCellPoint.H:48
Foam::Ostream::write
virtual Ostream & write(const token &)=0
Write next token to stream.
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::treeBoundBox::intersects
bool intersects(const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const
Intersects segment; set point to intersection position and face,.
Definition: treeBoundBox.C:253
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:152
Foam::IndirectList
A List with indirect addressing.
Definition: IndirectList.H:102
propsDict
IOdictionary propsDict(IOobject("particleTrackProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED))
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::IOobjectList::add
bool add(IOobject &)
Add an IOobject to the list.
Definition: IOobjectList.C:106
Foam::DynamicList::shrink
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Definition: DynamicListI.H:258
Foam::PtrList::transfer
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
Definition: PtrList.C:200
Foam::interpolation< scalar >
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::streamLineBase::wallPatch
autoPtr< indirectPrimitivePatch > wallPatch() const
Construct patch out of all wall patch faces.
Definition: streamLineBase.C:47
Foam::coordSet
Holds list of sampling positions.
Definition: coordSet.H:49
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:312
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
Foam::DynamicList::append
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::OFstream
Output to file stream.
Definition: OFstream.H:81
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:399
Foam::streamLineBase::~streamLineBase
virtual ~streamLineBase()
Destructor.
Definition: streamLineBase.C:554
Foam::mapDistributeBase::constructSize
label constructSize() const
Constructed data size.
Definition: mapDistributeBase.H:244
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::vectorList
List< vector > vectorList
A List of vectors.
Definition: vectorList.H:50
Foam::objectRegistry::foundObject
bool foundObject(const word &name) const
Is the named Type found?
Definition: objectRegistryTemplates.C:142
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
ReadFields.H
Helper routine to read fields.
Foam::treeBoundBox::contains
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
Definition: treeBoundBox.C:395
Foam::Time::path
fileName path() const
Return path.
Definition: Time.H:281
Foam::objectRegistry::names
wordList names() const
Return the list of names of the IOobjects.
Definition: objectRegistry.C:115
Foam::streamLineBase::end
virtual void end()
Execute the averaging at the final time-loop, currently does nothing.
Definition: streamLineBase.C:660
Foam::boundBox::greatBox
static const boundBox greatBox
A very large boundBox: min/max == -/+ VGREAT.
Definition: boundBox.H:76
Foam::streamLineBase::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: streamLineBase.C:664
mapDistribute.H
f
labelList f(nPoints)
Foam::globalIndex::size
label size() const
Global sum of localSizes.
Definition: globalIndexI.H:66
Foam::streamLineBase::streamLineBase
streamLineBase(const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
Construct for given objectRegistry and dictionary.
Definition: streamLineBase.C:537
Foam::Vector< scalar >
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::streamLineBase::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: streamLineBase.C:964
Foam::streamLineBase::storePoint
void storePoint(const label trackI, const scalar w, const label leftI, const label rightI, DynamicList< point > &newTrack, DynamicList< List< scalar > > &newScalars, DynamicList< List< vector > > &newVectors) const
Generate point and values by interpolating from existing values.
Definition: streamLineBase.C:270
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
patches
patches[0]
Definition: createSingleCellMesh.H:36
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:330
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Definition: objectRegistryTemplates.C:165
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
IOWarningInFunction
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Definition: messageStream.H:271
Foam::point
vector point
Point is a vector.
Definition: point.H:41
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::mapDistributeBase::schedule
static List< labelPair > schedule(const labelListList &subMap, const labelListList &constructMap, const int tag)
Calculate a schedule. See above.
Definition: mapDistributeBase.C:43
Foam::dictionary::subDict
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:631
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::mapDistributeBase::constructMap
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
Definition: mapDistributeBase.H:268
Foam::mkDir
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:419
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::DynamicList::setSize
void setSize(const label)
Alter the addressed list size.
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
Foam::fvMesh::name
const word & name() const
Return reference to name.
Definition: fvMesh.H:257
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
Foam::writer::New
static autoPtr< writer > New(const word &writeFormat)
Return a reference to the selected writer.
Definition: writer.C:35