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()
223 if (!currentFields.erase(iter.key()))
225 DebugInfo<<
"close probe stream: " << iter()->name() <<
endl;
227 probeFilePtrs_.remove(iter);
232 for (
const word& fieldName : currentFields)
242 probeFilePtrs_.insert(fieldName, fPtr);
248 fout<<
"# Probe " << probei <<
' ' << operator[](probei);
250 if (processor_[probei] == -1)
252 fout<<
" # Not Found";
255 else if (probei < patchIDList_.size())
257 const label patchi = patchIDList_[probei];
267 fout<<
" at patch " << bm[patchi].
name();
269 fout<<
" with a distance of "
270 <<
mag(
operator[](probei)-oldPoints_[probei])
271 <<
" m to the original point "
272 << oldPoints_[probei];
284 if (includeOutOfBounds_ || processor_[probei] != -1)
286 fout<<
' ' <<
setw(w) << probei;
307 const bool loadFromFiles,
315 refCast<const fvMesh>
323 loadFromFiles_(loadFromFiles),
325 fixedLocations_(
true),
326 interpolationScheme_(
"cell"),
327 includeOutOfBounds_(
true)
346 if (!fixedLocations_ && interpolationScheme_ !=
"cell")
349 <<
"Only cell interpolation can be applied when "
350 <<
"not using fixedLocations. InterpolationScheme "
351 <<
"entry will be ignored"
374 if (size() && prepare())
376 sampleAndWrite(scalarFields_);
377 sampleAndWrite(vectorFields_);
378 sampleAndWrite(sphericalTensorFields_);
379 sampleAndWrite(symmTensorFields_);
380 sampleAndWrite(tensorFields_);
382 sampleAndWriteSurfaceFields(surfaceScalarFields_);
383 sampleAndWriteSurfaceFields(surfaceVectorFields_);
384 sampleAndWriteSurfaceFields(surfaceSphericalTensorFields_);
385 sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
386 sampleAndWriteSurfaceFields(surfaceTensorFields_);
397 if (&mpm.
mesh() != &mesh_)
417 label celli = elementList_[i];
420 label newCelli = reverseMap[celli];
425 else if (newCelli < -1)
428 elems.
append(-newCelli - 2);
433 elems.append(newCelli);
443 elementList_.transfer(elems);
451 for (
const label facei : faceList_)
455 label newFacei = reverseMap[facei];
460 else if (newFacei < -1)
463 elems.
append(-newFacei - 2);
468 elems.append(newFacei);
478 faceList_.transfer(elems);
488 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.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
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 ...
static bool master(const label communicator=worldComm)
Am I the master process.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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.
void setSize(const label n)
Alias for resize()
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)
const labelList & reverseFaceMap() const
Reverse face map.
label nNonProcessor() const
The number of patches before the first processor patch.
const word & name() const noexcept
Return name.
static unsigned int defaultPrecision() noexcept
Return the default precision.
const labelList & reverseCellMap() const
Reverse cell map.
#define DebugInfo
Report an information message using Foam::Info.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
static int debug
Flag to execute debug content.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static bool clean(std::string &str)
virtual void findElements(const fvMesh &mesh)
Find cells and faces containing probes.
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
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.