Go to the documentation of this file.
69 const vector& location = operator[](probei);
71 const label celli =
mesh.findCell(location);
78 const vector& cellCentre =
mesh.cellCentres()[celli];
79 scalar minDistance = GREAT;
83 label facei = cellFaces[i];
84 vector dist =
mesh.faceCentres()[facei] - cellCentre;
85 if (
mag(dist) < minDistance)
87 minDistance =
mag(dist);
100 Pout<<
"probes : found point " << location
110 const vector& location = operator[](probei);
126 <<
"Did not find location " << location
127 <<
" in any cell. Skipping location." <<
endl;
130 else if (facei == -1)
135 <<
"Did not find location " << location
136 <<
" in any face. Skipping location." <<
endl;
145 <<
"Location " << location
146 <<
" seems to be on multiple domains:"
149 <<
" and cell " << celli <<
" on some other domain."
151 <<
"This might happen if the probe location is on"
152 <<
" a processor patch. Change the location slightly"
153 <<
" to prevent this." <<
endl;
159 <<
"Location " << location
160 <<
" seems to be on multiple domains:"
163 <<
" and face " << facei <<
" on some other domain."
165 <<
"This might happen if the probe location is on"
166 <<
" a processor patch. Change the location slightly"
167 <<
" to prevent this." <<
endl;
176 const label nFields = classifyFields();
183 currentFields.
insert(scalarFields_);
184 currentFields.
insert(vectorFields_);
185 currentFields.
insert(sphericalTensorFields_);
186 currentFields.
insert(symmTensorFields_);
187 currentFields.
insert(tensorFields_);
189 currentFields.
insert(surfaceScalarFields_);
190 currentFields.
insert(surfaceVectorFields_);
191 currentFields.
insert(surfaceSphericalTensorFields_);
192 currentFields.
insert(surfaceSymmTensorFields_);
193 currentFields.
insert(surfaceTensorFields_);
196 <<
"Probing fields: " << currentFields <<
nl
197 <<
"Probing locations: " << *
this <<
nl
205 probeSubDir = probeSubDir/mesh_.
name();
213 mesh_.time().globalPath()
216 / mesh_.time().timeName()
224 if (!currentFields.
erase(iter.key()))
226 DebugInfo<<
"close probe stream: " << iter()->name() <<
endl;
228 probeFilePtrs_.remove(iter);
233 for (
const word& fieldName : currentFields)
243 probeFilePtrs_.insert(fieldName, fPtr);
249 fout<<
"# Probe " << probei <<
' ' << operator[](probei);
251 if (processor_[probei] == -1)
253 fout<<
" # Not Found";
263 if (includeOutOfBounds_ || processor_[probei] != -1)
265 fout<<
' ' <<
setw(w) << probei;
286 const bool loadFromFiles,
294 refCast<const fvMesh>
302 loadFromFiles_(loadFromFiles),
304 fixedLocations_(
true),
305 interpolationScheme_(
"cell"),
306 includeOutOfBounds_(
true)
325 if (!fixedLocations_ && interpolationScheme_ !=
"cell")
328 <<
"Only cell interpolation can be applied when "
329 <<
"not using fixedLocations. InterpolationScheme "
330 <<
"entry will be ignored"
353 if (size() && prepare())
355 sampleAndWrite(scalarFields_);
356 sampleAndWrite(vectorFields_);
357 sampleAndWrite(sphericalTensorFields_);
358 sampleAndWrite(symmTensorFields_);
359 sampleAndWrite(tensorFields_);
361 sampleAndWriteSurfaceFields(surfaceScalarFields_);
362 sampleAndWriteSurfaceFields(surfaceVectorFields_);
363 sampleAndWriteSurfaceFields(surfaceSphericalTensorFields_);
364 sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
365 sampleAndWriteSurfaceFields(surfaceTensorFields_);
376 if (&mpm.
mesh() != &mesh_)
396 label celli = elementList_[i];
399 label newCelli = reverseMap[celli];
404 else if (newCelli < -1)
407 elems.
append(-newCelli - 2);
412 elems.append(newCelli);
422 elementList_.transfer(elems);
430 for (
const label facei : faceList_)
434 label newFacei = reverseMap[facei];
439 else if (newFacei < -1)
442 elems.
append(-newFacei - 2);
447 elems.append(newFacei);
457 faceList_.transfer(elems);
467 if (fixedLocations_ && &
mesh == &mesh_)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
vectorField pointField
pointField is a vectorField.
virtual bool execute()
Execute, currently does nothing.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
A class for handling file names.
static word defaultRegion
Return the default region name.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Base class for function objects, adding functionality to read/write state information (data required ...
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
Registry of regIOobjects.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
virtual bool read(const dictionary &)
Read the probes.
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
word name(const complex &c)
Return string representation of complex.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Istream and Ostream manipulators taking arguments.
labelList faceList_
Faces to be probed.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
labelList elementList_
Cells to be probed (obtained from the locations)
const Type & lookupObject(const word &name, const bool recursive=false) const
static word outputPrefix
Directory prefix.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
label prepare()
Classify field type and open/close file streams,.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Mesh data needed to do the Finite Volume discretisation.
Omanip< int > setw(const int i)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
const labelList & reverseFaceMap() const
Reverse face map.
const labelList & reverseCellMap() const
Reverse cell map.
#define DebugInfo
Report an information message using Foam::Info.
static int debug
Flag to execute debug content.
static unsigned int defaultPrecision()
Return the default precision.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void clear()
Clear the list, i.e. set size to zero.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
virtual bool write()
Sample and write.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
static bool clean(std::string &str)
Cleanup filename.
virtual void findElements(const fvMesh &mesh)
Find cells and faces containing probes.
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
void setSize(const label newSize)
Alias for resize(const label)
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
const polyMesh & mesh() const
Return polyMesh.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
labelList processor_
Processor holding the cell or face (-1 if point not found.