Go to the documentation of this file.
58 if (isA<wallPolyPatch>(
patches[patchI]))
60 nFaces +=
patches[patchI].size();
71 if (isA<wallPolyPatch>(
patches[patchI]))
77 addressing[nFaces++] = pp.
start()+i;
119 objects.
add(*allObjects[fields_[i]]);
123 vsInterp.setSize(vsFlds.
size());
131 interpolationScheme_,
137 vvInterp.setSize(vvFlds.
size());
145 interpolationScheme_,
169 <<
"Cannot find field " << fields_[i] <<
nl
170 <<
"Valid scalar fields are:"
172 <<
"Valid vector fields are:"
177 vsInterp.setSize(nScalar);
179 vvInterp.setSize(nVector);
195 interpolationScheme_,
207 if (
f.name() == UName_)
217 interpolationScheme_,
226 scalarNames_.setSize(vsInterp.size());
229 scalarNames_[i] = vsInterp[i].psi().name();
231 vectorNames_.setSize(vvInterp.size());
234 vectorNames_[i] = vvInterp[i].psi().name();
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."
253 allTracks_.setCapacity(nSeeds);
254 allScalars_.setSize(vsInterp.size());
257 allScalars_[i].clear();
258 allScalars_[i].setCapacity(nSeeds);
260 allVectors_.setSize(vvInterp.size());
263 allVectors_[i].clear();
264 allVectors_[i].setCapacity(nSeeds);
282 label sz = newTrack.size();
286 newTrack.
append((1.0-
w)*track[leftI] +
w*track[rightI]);
293 forAll(allScalars_, scalarI)
295 const scalarList& trackVals = allScalars_[scalarI][trackI];
296 newVals[scalarI] = (1.0-
w)*trackVals[leftI] +
w*trackVals[rightI];
305 forAll(allVectors_, vectorI)
307 const vectorList& trackVals = allVectors_[vectorI][trackI];
308 newVals[vectorI] = (1.0-
w)*trackVals[leftI] +
w*trackVals[rightI];
330 segmentI < track.
size();
334 const point& startPt = track[segmentI-1];
335 const point& endPt = track[segmentI];
337 const vector d(endPt-startPt);
338 scalar magD =
mag(d);
339 if (magD > ROOTVSMALL)
368 mag(clipPt-startPt)/magD,
377 newTracks.last().shrink();
378 newScalars.last().
shrink();
379 newVectors.last().
shrink();
409 mag(clipPt-startPt)/magD,
432 mag(clipPt-startPt)/magD,
441 newTracks.last().shrink();
442 newScalars.last().
shrink();
443 newVectors.last().
shrink();
478 forAll(allTracks_, trackI)
490 trimToBox(bb, trackI, newTracks, newScalars, newVectors);
495 allTracks_.setSize(newTracks.
size());
496 forAll(allTracks_, trackI)
498 allTracks_[trackI].transfer(newTracks[trackI]);
501 forAll(allScalars_, scalarI)
508 scalarList& trackVals = allScalars_[scalarI][trackI];
509 trackVals.
setSize(newScalars[trackI].size());
510 forAll(trackVals, sampleI)
512 trackVals[sampleI] = newScalars[trackI][sampleI][scalarI];
517 forAll(allVectors_, vectorI)
523 vectorList& trackVals = allVectors_[vectorI][trackI];
524 trackVals.
setSize(newVectors[trackI].size());
525 forAll(trackVals, sampleI)
527 trackVals[sampleI] = newVectors[trackI][sampleI][vectorI];
541 const bool loadFromFiles
547 loadFromFiles_(loadFromFiles),
564 log_.readIfPresent(
"log",
dict);
566 if (log_)
Info<<
type() <<
" " << name_ <<
":" <<
nl;
579 <<
"Using deprecated entry \"U\"."
580 <<
" Please use \"UName\" instead."
589 <<
"Velocity field for tracking " << UName_
590 <<
" should be present in the list of fields " << fields_
600 <<
"Illegal value " << lifeTime_ <<
" for lifeTime"
605 trackLength_ = VGREAT;
612 Info<<
type() <<
" : fixed track length specified : "
613 << trackLength_ <<
nl <<
endl;
621 if (log_)
Info<<
" clipping all segments to " << bounds_ <<
nl <<
endl;
627 "interpolationScheme",
648 coeffsDict.
lookup(
"axis") >> sampledSetAxis_;
672 if (log_)
Info<<
type() <<
" " << name_ <<
" output:" <<
nl;
705 fromProc[i] = trackI++;
719 globalTrackIDs.
size(),
740 allTracks_.setCapacity(allTracks_.size());
743 forAll(allScalars_, scalarI)
745 allScalars_[scalarI].shrink();
755 allScalars_[scalarI],
758 allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
761 forAll(allVectors_, vectorI)
763 allVectors_[vectorI].shrink();
773 allVectors_[vectorI],
776 allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
792 forAll(allTracks_, trackI)
794 if (allTracks_[trackI].size())
797 n += allTracks_[trackI].size();
803 Info<<
" Tracks:" << nTracks <<
nl
804 <<
" Total samples:" <<
n
817 ? runTime.
path()/
".."/
"postProcessing"/
"sets"/
name()
818 : runTime.
path()/
"postProcessing"/
"sets"/
name()
832 labelList oldToNewTrack(allTracks_.size(), -1);
834 forAll(allTracks_, trackI)
836 if (allTracks_[trackI].size())
847 oldToNewTrack[trackI] = nTracks;
848 tracks[nTracks].
transfer(allTracks_[trackI]);
855 if (allScalars_.size() > 0)
859 forAll(allScalars_, scalarI)
862 allScalars_[scalarI];
863 scalarValues[scalarI].
setSize(nTracks);
865 forAll(allTrackVals, trackI)
870 label newTrackI = oldToNewTrack[trackI];
871 scalarValues[scalarI][newTrackI].
transfer(vals);
879 / scalarFormatterPtr_().getFileName
887 <<
" Writing data to " << vtkFile.
path() <<
endl;
889 scalarFormatterPtr_().
write
898 forAll(scalarNames_, nameI)
902 const word& fieldName = scalarNames_[nameI];
909 if (allVectors_.size() > 0)
913 forAll(allVectors_, vectorI)
916 allVectors_[vectorI];
917 vectorValues[vectorI].
setSize(nTracks);
919 forAll(allTrackVals, trackI)
924 label newTrackI = oldToNewTrack[trackI];
925 vectorValues[vectorI][newTrackI].
transfer(vals);
933 / vectorFormatterPtr_().getFileName
942 vectorFormatterPtr_().write
951 forAll(vectorNames_, nameI)
955 const word& fieldName = vectorNames_[nameI];
const objectRegistry & obr_
Database this class is registered to.
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
const labelListList & subMap() const
From subsetted data back to original data.
List< scalar > scalarList
A List of scalars.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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))
A class for handling words, derived from string.
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.
A class for handling file names.
void append(T *)
Append an element at the end of the list.
Base class for function objects, adding functionality to read/write state information (data required ...
static word defaultRegion
Return the default region name.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
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.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
bool read(const char *, int32_t &)
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.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
virtual void execute()
Execute the averaging.
Standard boundBox + extra functionality for use in octree.
const Time & time() const
Return time.
static bool & parRun()
Is this a parallel run?
Class containing functor to negate primitives. Dummy for all other types.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
fileName path() const
Return directory path name (part before last /)
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
virtual void write()
Track and write.
label localSize() const
My local size.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void read(const dictionary &)
Read the field average data.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
static const meshSearchMeshObject & New(const polyMesh &mesh)
Registry of regIOobjects.
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.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
bool set(const label) const
Is element set.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
virtual Ostream & write(const token &)=0
Write next token to stream.
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,.
A patch is a list of labels that address the faces in the global face list.
Class containing processor-to-processor mapping information.
A List with indirect addressing.
IOdictionary propsDict(IOobject("particleTrackProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED))
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool add(IOobject &)
Add an IOobject to the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
A list of keyword definitions, which are a keyword followed by any number of values (e....
autoPtr< indirectPrimitivePatch > wallPatch() const
Construct patch out of all wall patch faces.
Holds list of sampling positions.
Mesh data needed to do the Finite Volume discretisation.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label start() const
Return start label of this patch in the polyMesh face list.
List of IOobjects with searching and retrieving facilities.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static bool master(const label communicator=0)
Am I the master process.
virtual ~streamLineBase()
Destructor.
label constructSize() const
Constructed data size.
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
List< vector > vectorList
A List of vectors.
bool foundObject(const word &name) const
Is the named Type found?
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Helper routine to read fields.
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
fileName path() const
Return path.
wordList names() const
Return the list of names of the IOobjects.
virtual void end()
Execute the averaging at the final time-loop, currently does nothing.
static const boundBox greatBox
A very large boundBox: min/max == -/+ VGREAT.
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
label size() const
Global sum of localSizes.
streamLineBase(const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
Construct for given objectRegistry and dictionary.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label size() const
Return the number of elements in the PtrList.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
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.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const Time & time() const
Return the top-level database.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
void size(const label)
Override size to be inconsistent with allocated storage.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
vector point
Point is a vector.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
static List< labelPair > schedule(const labelListList &subMap, const labelListList &constructMap, const int tag)
Calculate a schedule. See above.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Generic GeometricField class.
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
defineTypeNameAndDebug(combustionModel, 0)
void setSize(const label)
Alter the addressed list size.
word name(const complex &)
Return a string representation of a complex.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
const word & name() const
Return reference to name.
A list of faces which address into the list of points.
static autoPtr< writer > New(const word &writeFormat)
Return a reference to the selected writer.