uniformBin Class Reference

Calculates binned data in multiple segments according to a specified Cartesian or cylindrical coordinate system. More...

Inheritance diagram for uniformBin:
[legend]
Collaboration diagram for uniformBin:
[legend]

Public Member Functions

 TypeName ("uniformBin")
 Runtime type information. More...
 
 uniformBin (const dictionary &dict, const fvMesh &mesh, const word &outputPrefix)
 Construct from components. More...
 
 uniformBin (const uniformBin &)=delete
 No copy construct. More...
 
void operator= (const uniformBin &)=delete
 No copy assignment. More...
 
virtual ~uniformBin ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read the dictionary. More...
 
virtual void apply ()
 Apply 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...
 
- 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...
 
virtual bool read (const dictionary &dict)
 Read the dictionary. More...
 
label nBin () const noexcept
 Return the total number of bins. More...
 
virtual void initialise ()=0
 Initialise bin properties. More...
 
virtual void apply ()=0
 Apply 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)
 
 writeFile (const writeFile &wf)
 Construct copy. More...
 
virtual ~writeFile ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read. 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 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 an binned-data file. More...
 
virtual void initialise ()
 Initialise bin properties. More...
 
virtual labelList binAddr (const vectorField &d) const
 Return list of bin indices corresponding to positions given by d. More...
 
virtual void setBinsAddressing ()
 Set/cache the bin addressing. 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
 
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...
 
virtual autoPtr< OFstreamcreateFile (const word &name, scalar timeValue) const
 Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamcreateFile (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...
 

Protected Attributes

Vector< label > nBins_
 Numbers of bins in binning directions. More...
 
vector binW_
 Equidistant bin widths in binning directions. More...
 
Vector< vector2DbinMinMax_
 Min-max bounds of bins in binning directions. More...
 
labelList faceToBin_
 Face index to bin index addressing. More...
 
labelList cellToBin_
 Cell index to bin index addressing. 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_
 
autoPtr< coordinateSystemcoordSysPtr_
 Local coordinate system of bins. More...
 
label nBin_
 Total number of bins. More...
 
labelHashSet patchSet_
 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_
 
bool writtenHeader_
 Flag to identify whether the header has been written. More...
 
bool useUserTime_
 
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 multiple segments according to a specified Cartesian or cylindrical coordinate system.

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

    // Mandatory entries
    binModel          uniformBin;

    binData
    {
        // Mandatory entries
        nBin          <Vector<label>>;

        // Optional entries
        cumulative    <bool>;
        minMax
        {
            e1        (<scalar> <scalar>); // (min max);
            e2        (<scalar> <scalar>);
            e3        (<scalar> <scalar>);
        }
    }
}

where the entries mean:

Property Description Type Reqd Deflt
binModel Type name: uniformBin word yes -
binData Entries of the chosen bin model dict yes -
nBin Numbers of bins in specified directions

Vector<label>

yes -
cumulative

Flag to bin data accumulated with increasing distance

in binning direction

bool no false
minMax

Min-max bounds in binning directions with respect to

the coordinateSystem's origin

dict no -
Note
  • The order of bin numbering is (e1, e2, e3), where the first varies the fastest. For example, for a cylindrical bin with \( nBin = (radial, azimuth, height) = (2, 4, 2) \), the bin indices may look like as follows - note the counterclockwise increments:
                           |-------------------|
                           | 12 |         | 14 |
                                | 11 | 13 |
                                | 9  | 15 |
                           | 10 |         | 16 |
                           |-------------------|
                          /    /         /    /
                         /    /         /    /
                        |-------------------|
                        | 4  |         | 6  |
                             | 3  | 5  |
                             | 1  | 7  |
                        | 2  |         | 8  |
                        |-------------------|
    
Source files

Definition at line 161 of file uniformBin.H.

Constructor & Destructor Documentation

◆ uniformBin() [1/2]

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

Construct from components.

Definition at line 196 of file uniformBin.C.

References dict, and uniformBin::read().

Here is the call graph for this function:

◆ uniformBin() [2/2]

uniformBin ( const uniformBin )
delete

No copy construct.

◆ ~uniformBin()

virtual ~uniformBin ( )
virtualdefault

Destructor.

Member Function Documentation

◆ writeFileHeader()

void writeFileHeader ( OFstream os) const
protected

Write header for an binned-data file.

Definition at line 31 of file uniformBinTemplates.C.

References uniformBin::binMinMax_, uniformBin::binW_, binModel::coordSysPtr_, binModel::decomposePatchValues_, Foam::endl(), Foam::name(), binModel::nBin_, uniformBin::nBins_, pTraits< bool >::nComponents, Foam::nl, os(), R, Foam::tab, writeFile::writeCommented(), writeFile::writeHeader(), writeFile::writeHeaderValue(), and writeFile::writeTabbed().

Here is the call graph for this function:

◆ initialise()

void initialise ( )
protectedvirtual

Initialise bin properties.

Compute bin widths in binning directions

Implements binModel.

Definition at line 44 of file uniformBin.C.

References uniformBin::binMinMax_, uniformBin::binW_, polyMesh::boundaryMesh(), fvMesh::C(), binModel::cellZoneIDs_, polyMesh::cellZones(), Field< Type >::component(), binModel::coordSysPtr_, Foam::exit(), polyPatch::faceCentres(), Foam::FatalError, FatalErrorInFunction, Foam::max(), binModel::mesh_, Foam::min(), uniformBin::nBins_, pTraits< bool >::nComponents, Foam::nl, binModel::patchSet_, Foam::reduce(), and uniformBin::setBinsAddressing().

Here is the call graph for this function:

◆ binAddr()

Foam::labelList binAddr ( const vectorField d) const
protectedvirtual

Return list of bin indices corresponding to positions given by d.

Definition at line 120 of file uniformBin.C.

References forAll, Foam::max(), Foam::min(), n, pTraits< bool >::nComponents, UList< T >::size(), and Foam::Zero.

Here is the call graph for this function:

◆ setBinsAddressing()

void setBinsAddressing ( )
protectedvirtual

Set/cache the bin addressing.

Definition at line 160 of file uniformBin.C.

References polyPatch::boundaryMesh(), polyPatch::faceCentres(), forAll, forAllIters, and polyPatch::start().

Referenced by uniformBin::initialise().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processField()

bool processField ( const label  fieldi)
protected

Apply the binning to field fieldi.

Definition at line 88 of file uniformBinTemplates.C.

References polyPatch::boundaryMesh(), fld(), forAll, forAllIters, splitCell::master(), polyPatch::start(), and Foam::Zero.

Here is the call graph for this function:

◆ TypeName()

TypeName ( "uniformBin"  )

Runtime type information.

◆ operator=()

void operator= ( const uniformBin )
delete

No copy assignment.

◆ read()

bool read ( const dictionary dict)
virtual

Read the dictionary.

Reimplemented from binModel.

Definition at line 219 of file uniformBin.C.

References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dictionary::found(), dictionary::get(), dictionary::getOrDefault(), Foam::Info, n, Foam::name(), pTraits< bool >::nComponents, Foam::nl, kEpsilonLopesdaCosta< BasicTurbulenceModel >::read(), dictionary::readIfPresent(), and dictionary::subDict().

Referenced by uniformBin::uniformBin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply()

void apply ( )
virtual

Apply bins.

Implements binModel.

Definition at line 282 of file uniformBin.C.

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

Here is the call graph for this function:

◆ updateMesh()

void updateMesh ( const mapPolyMesh mpm)
virtual

Update for changes of mesh.

Reimplemented from binModel.

Definition at line 305 of file uniformBin.C.

◆ movePoints()

void movePoints ( const polyMesh mesh)
virtual

Update for changes of mesh.

Reimplemented from binModel.

Definition at line 309 of file uniformBin.C.

Member Data Documentation

◆ nBins_

Vector<label> nBins_
protected

Numbers of bins in binning directions.

Definition at line 170 of file uniformBin.H.

Referenced by uniformBin::initialise(), and uniformBin::writeFileHeader().

◆ binW_

vector binW_
protected

Equidistant bin widths in binning directions.

Definition at line 173 of file uniformBin.H.

Referenced by uniformBin::initialise(), and uniformBin::writeFileHeader().

◆ binMinMax_

Vector<vector2D> binMinMax_
protected

Min-max bounds of bins in binning directions.

Definition at line 176 of file uniformBin.H.

Referenced by uniformBin::initialise(), and uniformBin::writeFileHeader().

◆ faceToBin_

labelList faceToBin_
protected

Face index to bin index addressing.

Definition at line 179 of file uniformBin.H.

◆ cellToBin_

labelList cellToBin_
protected

Cell index to bin index addressing.

Definition at line 182 of file uniformBin.H.


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