49bool Foam::pointHistory::writeData()
57 position =
mesh.points()[historyPointID_];
60 reduce(position, sumOp<vector>());
67 << time_.time().value() <<
tab
68 << position.x() <<
tab
69 << position.y() <<
tab
70 << position.z() <<
endl;
78Foam::pointHistory::pointHistory
88 regionName_(polyMesh::defaultRegion),
90 refHistoryPoint_(
dict.lookup(
"refHistoryPoint")),
92 fileName_(
dict.get<word>(
"fileName")),
93 historyFilePtr_(nullptr)
95 Info<<
"Creating " << this->
name() <<
" function object." <<
endl;
97 dict.readIfPresent(
"region", regionName_);
98 dict.readIfPresent(
"historyPointID", historyPointID_);
106 if (historyPointID_ == -1)
110 scalar dist =
mag(refHistoryPoint_ -
points[pointI]);
115 historyPointID_ = pointI;
127 if (minDist[procI] <
min)
129 min = minDist[procI];
136 Pout<<
"History point ID: " << historyPointID_ <<
nl
137 <<
"History point coordinates: "
139 <<
"Reference point coordinates: " << refHistoryPoint_
144 if (!historyFilePtr_)
149 const word startTimeName =
150 time_.timeName(
mesh.time().startTime().value());
152 const fileName historyDir =
153 time_.globalPath()/
"history"/startTimeName;
164 historyFilePtr_.reset
166 new OFstream(historyDir/fileName_)
173 <<
"# Time" <<
tab <<
"X" <<
tab <<
"Y" <<
tab <<
"Z"
194 dict.readIfPresent(
"region", regionName_);
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Mesh data needed to do the Finite Volume discretisation.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
virtual bool read(const dictionary &dict)
Read and set the function object if its data has changed.
virtual bool execute()
execute is called at each ++ or += of the time-loop
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
Lookup type of boundary radiation properties.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Omanip< int > setprecision(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static void writeData(Ostream &os, const Type &val)
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
#define forAll(list, i)
Loop across all elements in list.