singleDirectionUniformBin Class Reference

Calculates binned data in a specified direction. More...

Inheritance diagram for singleDirectionUniformBin:
Collaboration diagram for singleDirectionUniformBin:

Public Member Functions

 TypeName ("singleDirectionUniformBin")
 Runtime type information. More...
 
 singleDirectionUniformBin (const dictionary &dict, const fvMesh &mesh, const word &outputPrefix)
 Construct from components. More...
 
 singleDirectionUniformBin (const singleDirectionUniformBin &)=delete
 No copy construct. More...
 
void operator= (const singleDirectionUniformBin &)=delete
 No copy assignment. More...
 
virtual ~singleDirectionUniformBin ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read the dictionary. More...
 
virtual void apply ()
 Apply bins. More...
 
- Public Member Functions inherited from binModel
 TypeName ("binModel")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, binModel, dictionary,(const dictionary &dict, const fvMesh &mesh, const word &outputPrefix),(dict, mesh, outputPrefix))
 
 binModel (const dictionary &dict, const fvMesh &mesh, const word &outputPrefix)
 Construct from components. More...
 
 binModel (const binModel &)=delete
 No copy construct. More...
 
void operator= (const binModel &)=delete
 No copy assignment. More...
 
virtual ~binModel ()=default
 Destructor. More...
 
label nBin () const noexcept
 Return the total number of bins. More...
 
virtual void updateMesh (const mapPolyMesh &mpm)
 Update for changes of mesh. More...
 
virtual void movePoints (const polyMesh &mesh)
 Update for changes of mesh. More...
 
template<>
bool decomposePatchValues (List< List< vector >> &data, const label bini, const vector &v, const vector &n) const
 
template<class Type >
Foam::string writeComponents (const word &stem) const
 
- Public Member Functions inherited from writeFile
 writeFile (const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true)
 Construct from objectRegistry, prefix, fileName. More...
 
 writeFile (const objectRegistry &obr, const fileName &prefix, const word &name, const dictionary &dict, const bool writeToFile=true)
 Construct from objectRegistry, prefix, fileName and read options from dictionary. More...
 
 writeFile (const writeFile &wf)
 Construct copy. More...
 
virtual ~writeFile ()=default
 Destructor. More...
 
virtual OFstreamfile ()
 Return access to the file (if only 1) More...
 
virtual bool writeToFile () const
 Flag to allow writing to file. More...
 
virtual bool canWriteToFile () const
 Flag to allow writing to the file. More...
 
virtual bool canResetFile () const
 Flag to allow resetting the file. More...
 
virtual bool canWriteHeader () const
 Flag to allow writing the header. More...
 
virtual label charWidth () const
 Return width of character stream output. More...
 
virtual void writeCommented (Ostream &os, const string &str) const
 Write a commented string to stream. More...
 
virtual void writeTabbed (Ostream &os, const string &str) const
 Write a tabbed string to stream. More...
 
virtual void writeHeader (Ostream &os, const string &str) const
 Write a commented header to stream. More...
 
virtual void writeCurrentTime (Ostream &os) const
 Write the current time to stream. More...
 
virtual void writeBreak (Ostream &os) const
 Write a break marker to the stream. More...
 
template<class Type >
void writeHeaderValue (Ostream &os, const string &property, const Type &value) const
 Write a (commented) header property and value pair. More...
 
template<class Type >
void writeValue (Ostream &os, const Type &val) const
 Write a given value to stream with the space delimiter. More...
 

Protected Member Functions

template<class Type >
void writeFileHeader (OFstream &os) const
 Write header for a binned-data file. More...
 
virtual void initialise ()
 Initialise bin properties. More...
 
template<class Type >
bool processField (const label fieldi)
 Apply the binning to field fieldi. More...
 
- Protected Member Functions inherited from binModel
void setCoordinateSystem (const dictionary &dict, const word &e3Name=word::null, const word &e1Name=word::null)
 Set the co-ordinate system from dictionary and axes names. More...
 
template<class Type >
bool decomposePatchValues (List< List< Type >> &data, const label bini, const Type &v, const vector &n) const
 Helper function to decompose patch values into normal and tangential components. More...
 
template<class Type >
string writeComponents (const word &stem) const
 Helper function to construct a string description for a given type. More...
 
template<class Type >
void writeBinnedData (List< List< Type >> &data, Ostream &os) const
 Write binned data to stream. More...
 
- Protected Member Functions inherited from writeFile
void initStream (Ostream &os) const
 Initialise the output stream for writing. More...
 
fileName baseFileDir () const
 Return the base directory for output. More...
 
fileName baseTimeDir () const
 Return the base directory for the current time value. More...
 
fileName filePath (const fileName &fName) const
 Return the full path for the supplied file name. More...
 
virtual autoPtr< OFstreamnewFile (const fileName &fName) const
 Return autoPtr to a new file using file name. More...
 
virtual autoPtr< OFstreamnewFileAtTime (const word &name, scalar timeValue) const
 Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamnewFileAtStartTime (const word &name) const
 Return autoPtr to a new file using the simulation start time. More...
 
virtual void resetFile (const word &name)
 Reset internal file pointer to new file with new name. More...
 
Omanip< int > valueWidth (const label offset=0) const
 Return the value width when writing to stream with optional offset. More...
 
void operator= (const writeFile &)=delete
 No copy assignment. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name, scalar timeValue) const
 Deprecated(2022-09) Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Deprecated(2022-09) Return autoPtr to a new file using the simulation start time. More...
 

Protected Attributes

scalar binWidth_
 Distance between bin divisions. More...
 
MinMax< scalar > binLimits_
 The min/max bounds for the bins. More...
 
vector binDir_
 Binning direction. More...
 
- Protected Attributes inherited from binModel
const fvMeshmesh_
 Reference to the mesh. More...
 
bool decomposePatchValues_
 Decompose patch values into normal and tangential components. More...
 
bool cumulative_
 Flag to accumulate bin data with increasing distance in binning direction. More...
 
autoPtr< coordinateSystemcoordSysPtr_
 Local coordinate system of bins. More...
 
label nBin_
 Total number of bins. More...
 
labelList patchIDs_
 Indices of operand patches. More...
 
wordList fieldNames_
 Names of operand fields. More...
 
labelList cellZoneIDs_
 Indices of operand cell zones. More...
 
PtrList< OFstreamfilePtrs_
 List of file pointers; 1 file per field. More...
 
- Protected Attributes inherited from writeFile
const objectRegistryfileObr_
 Reference to the region objectRegistry. More...
 
const fileName prefix_
 Prefix. More...
 
word fileName_
 Name of file. More...
 
autoPtr< OFstreamfilePtr_
 File pointer. More...
 
label writePrecision_
 Write precision. More...
 
bool writeToFile_
 Flag to enable/disable writing to file. More...
 
bool updateHeader_
 Flag to update the header, e.g. on mesh changes. Default is true. More...
 
bool writtenHeader_
 Flag to identify whether the header has been written. More...
 
bool useUserTime_
 Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true. More...
 
scalar startTime_
 Start time value. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from binModel
static autoPtr< binModelNew (const dictionary &dict, const fvMesh &mesh, const word &outputPrefix)
 Return a reference to the selected bin model. More...
 
- Static Public Attributes inherited from writeFile
static label addChars = 8
 Additional characters for writing. More...
 

Detailed Description

Calculates binned data in a specified direction.

For example, a 10cm-long patch extending only in the x-direction can be binned into 5 bins in the same direction, so that local information can be output for each 2cm-long segment.

Usage
Minimal example by using system/controlDict.functions:
binField1
{
    // Other binField entries
    ...

    // Mandatory entries
    binModel          singleDirectionUniformBin;

    binData
    {
        // Mandatory entries
        nBin          <label>;
        direction     <vector>;

        // Optional entries
        cumulative    <bool>;
        min           <scalar>;
        max           <scalar>;
    }
}

where the entries mean:

Property Description Type Reqd Deflt
binModel Type name: singleDirectionUniformBin word yes -
binData Entries of the chosen bin model dict yes -
nBin Number of bins in binning direction label yes -
direction Binning direction vector yes -
cumulative Flag to bin data accumulated with increasing distance in binning direction bool no false
min Min-bound in the binning direction with respect to the global coordinate system's origin scalar no GREAT
max Max-bound in the binning direction with respect to the global coordinate system's origin scalar no GREAT
Source files

Definition at line 148 of file singleDirectionUniformBin.H.

Constructor & Destructor Documentation

◆ singleDirectionUniformBin() [1/2]

singleDirectionUniformBin ( const dictionary dict,
const fvMesh mesh,
const word outputPrefix 
)

Construct from components.

Definition at line 113 of file singleDirectionUniformBin.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ singleDirectionUniformBin() [2/2]

No copy construct.

◆ ~singleDirectionUniformBin()

virtual ~singleDirectionUniformBin ( )
virtualdefault

Destructor.

Member Function Documentation

◆ writeFileHeader()

void writeFileHeader ( OFstream os) const
protected

Write header for a binned-data file.

Definition at line 23 of file singleDirectionUniformBinTemplates.C.

References Foam::endl(), forAll, Foam::name(), Foam::nl, os(), Foam::tab, and Foam::writeHeader().

Here is the call graph for this function:

◆ initialise()

◆ processField()

bool processField ( const label  fieldi)
protected

Apply the binning to field fieldi.

Definition at line 83 of file singleDirectionUniformBinTemplates.C.

References fld, forAll, Foam::max(), Foam::min(), pp(), pts, Foam::reduce(), and Foam::Zero.

Here is the call graph for this function:

◆ TypeName()

TypeName ( "singleDirectionUniformBin"  )

Runtime type information.

◆ operator=()

void operator= ( const singleDirectionUniformBin )
delete

No copy assignment.

◆ read()

bool read ( const dictionary dict)
virtual

◆ apply()

void apply ( )
virtual

Apply bins.

Implements binModel.

Definition at line 176 of file singleDirectionUniformBin.C.

References Foam::endl(), forAll, and WarningInFunction.

Here is the call graph for this function:

Member Data Documentation

◆ binWidth_

scalar binWidth_
protected

Distance between bin divisions.

Definition at line 159 of file singleDirectionUniformBin.H.

Referenced by singleDirectionUniformBin::initialise().

◆ binLimits_

MinMax<scalar> binLimits_
protected

The min/max bounds for the bins.

Definition at line 164 of file singleDirectionUniformBin.H.

Referenced by singleDirectionUniformBin::initialise().

◆ binDir_

vector binDir_
protected

Binning direction.

Definition at line 169 of file singleDirectionUniformBin.H.

Referenced by singleDirectionUniformBin::initialise().


The documentation for this class was generated from the following files: