FreeFOAM The Cross-Platform CFD Toolkit
IOobject Class Reference

IOobject defines the attributes of an object for which implicit objectRegistry management is supported, and provides the infrastructure for performing stream I/O. More...

#include <OpenFOAM/IOobject.H>


Detailed Description

IOobject defines the attributes of an object for which implicit objectRegistry management is supported, and provides the infrastructure for performing stream I/O.

An IOobject is constructed with an object name, a class name, an instance path, a reference to a objectRegistry, and parameters determining its storage status.

Read options

Define what is done on object construction and explicit reads:

Parameters:
MUST_READObject must be read from Istream on construction.
Error if Istream does not exist or can't be read.
READ_IF_PRESENTRead object from Istream if Istream exists, otherwise don't.
Error only if Istream exists but can't be read.
NO_READDon't read
Write options

Define what is done on object destruction and explicit writes:

Parameters:
AUTO_WRITEObject is written automatically when requested to by the objectRegistry.
NO_WRITENo automatic write on destruction but can be written explicitly
Source files

Definition at line 85 of file IOobject.H.

+ Inheritance diagram for IOobject:

List of all members.

Public Types

enum  objectState { GOOD, BAD }
 Enumeration defining the valid states of an IOobject. More...
enum  readOption { MUST_READ, READ_IF_PRESENT, NO_READ }
 Enumeration defining the read options. More...
enum  writeOption { AUTO_WRITE = 0, NO_WRITE = 1 }
 Enumeration defining the write options. More...

Public Member Functions

 TypeName ("IOobject")
 Runtime type information.
 IOobject (const word &name, const fileName &instance, const objectRegistry &registry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
 Construct from name, instance, registry, io options.
 IOobject (const word &name, const fileName &instance, const fileName &local, const objectRegistry &registry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
 Construct from name, instance, local, registry, io options.
 IOobject (const fileName &path, const objectRegistry &registry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
 Construct from path, registry, io options.
Foam::autoPtr< IOobjectclone () const
 Clone.
virtual ~IOobject ()
const Timetime () const
 Return time.
const objectRegistrydb () const
 Return the local objectRegistry.
const wordname () const
 Return name.
const wordheaderClassName () const
 Return name of the class name read from header.
stringnote ()
 Return non-constant access to the optional note.
const stringnote () const
 Return the optional note.
virtual void rename (const word &newName)
 Rename.
bool registerObject () const
 Register object created from this IOobject with registry if true.
readOption readOpt () const
readOptionreadOpt ()
writeOption writeOpt () const
writeOptionwriteOpt ()
const fileNamerootPath () const
const fileNamecaseName () const
const fileNameinstance () const
fileNameinstance ()
const fileNamelocal () const
fileName path () const
 Return complete path.
fileName path (const word &instance, const fileName &local="") const
 Return complete path with alternative instance and local.
fileName objectPath () const
 Return complete path + object name.
fileName filePath () const
 Return complete path + object name if the file exists.
bool readHeader (Istream &)
 Read header.
bool headerOk ()
 Read and check header info.
bool writeHeader (Ostream &) const
 Write header.
bool good () const
bool bad () const
InfoProxy< IOobjectinfo () const
 Return info proxy.
void operator= (const IOobject &)

Static Public Member Functions

static bool fileNameComponents (const fileName &path, fileName &instance, fileName &local, word &name)
 Split path into instance, local, name components.
template<class Stream >
static Stream & writeBanner (Stream &os, bool noHint=false)
 Write the standard OpenFOAM file/dictionary banner.
template<class Stream >
static Stream & writeDivider (Stream &os)
 Write the standard file section divider.
template<class Stream >
static Stream & writeEndDivider (Stream &os)
 Write the standard end file divider.

Protected Member Functions

IstreamobjectStream ()
 Construct and return an IFstream for the object.
void setBad (const string &)
 Set the object state to bad.

Static Protected Member Functions

static const char * getBannerString (bool noHint)

Member Enumeration Documentation

Enumeration defining the valid states of an IOobject.

Enumerator:
GOOD 
BAD 

Definition at line 93 of file IOobject.H.

enum readOption

Enumeration defining the read options.

Enumerator:
MUST_READ 
READ_IF_PRESENT 
NO_READ 

Definition at line 100 of file IOobject.H.

Enumeration defining the write options.

Enumerator:
AUTO_WRITE 
NO_WRITE 

Definition at line 108 of file IOobject.H.


Constructor & Destructor Documentation

IOobject ( const word name,
const fileName instance,
const objectRegistry registry,
readOption  r = NO_READ,
writeOption  w = NO_WRITE,
bool  registerObject = true 
)

Construct from name, instance, registry, io options.

Definition at line 116 of file IOobject.C.

References Foam::endl(), and Foam::Info.

Referenced by IOobject::clone(), fvMesh::fvMesh(), and fvMesh::V00().

IOobject ( const word name,
const fileName instance,
const fileName local,
const objectRegistry registry,
readOption  r = NO_READ,
writeOption  w = NO_WRITE,
bool  registerObject = true 
)

Construct from name, instance, local, registry, io options.

Definition at line 146 of file IOobject.C.

References Foam::endl(), and Foam::Info.

IOobject ( const fileName path,
const objectRegistry registry,
readOption  r = NO_READ,
writeOption  w = NO_WRITE,
bool  registerObject = true 
)

Construct from path, registry, io options.

Uses fileNameComponents() to split path into components.

Definition at line 177 of file IOobject.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, and Foam::Info.

~IOobject ( )
virtual

Definition at line 217 of file IOobject.C.


Member Function Documentation

Foam::Istream * objectStream ( )
protected

Construct and return an IFstream for the object.

The results is NULL if the stream construction failed

Definition at line 317 of file IOobject.C.

References IOstream::good().

void setBad ( const string s)
protected

Set the object state to bad.

Definition at line 383 of file IOobject.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, Foam::Info, and messageStream::level.

const char * getBannerString ( bool  noHint)
staticprotected

Definition at line 401 of file IOobject.C.

References Foam::FOAMfullVersion.

Referenced by IOobject::writeBanner().

TypeName ( "IOobject"  )

Runtime type information.

static bool fileNameComponents ( const fileName path,
fileName instance,
fileName local,
word name 
)
static

Split path into instance, local, name components.

const Foam::objectRegistry & db ( ) const

Return the local objectRegistry.

Definition at line 223 of file IOobject.C.

Referenced by Foam::cmptAv(), surfaceInterpolationScheme< Type >::interpolate(), Foam::resError::laplacian(), PhiScheme< Type, PhiLimiter >::limiter(), Foam::mag(), Foam::magSqr(), reuseTmpDimensionedField< TypeR, Type1, GeoMesh >::New(), reuseTmpGeometricField< TypeR, Type1, PatchField, GeoMesh >::New(), reuseTmpDimensionedField< TypeR, TypeR, GeoMesh >::New(), reuseTmpGeometricField< TypeR, TypeR, PatchField, GeoMesh >::New(), engineMesh::New(), dynamicFvMesh::New(), laminarFlameSpeed::New(), SRFModel::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, Type2, GeoMesh >::New(), incompressible::turbulenceModel::New(), turbulenceModel::New(), incompressible::LESModel::New(), LESModel::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, Type2, PatchField, GeoMesh >::New(), incompressible::RASModel::New(), RASModel::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, TypeR, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, Type2, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, Type2, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, TypeR, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, TypeR, PatchField, GeoMesh >::New(), Foam::pow(), Foam::ReadFields(), searchableSurfaceCollection::searchableSurfaceCollection(), searchableSurfaceWithGaps::searchableSurfaceWithGaps(), Foam::sqr(), Foam::stabilise(), surfMesh::surfMesh(), and Foam::transform().

const word& name ( ) const
inline

Return name.

Reimplemented in fvMesh, phase, IOOutputFilter< OutputFilter >, UniformDimensionedField< Type >, and IOdictionary.

Definition at line 240 of file IOobject.H.

Referenced by multivariateSurfaceInterpolationScheme< Type >::fieldTable::add(), IOobjectList::add(), autoLayerDriver::addLayers(), polyTopoChange::addMesh(), faceZoneSet::addSet(), explicitSource::addSu(), setsToFaceZone::applyToSet(), attachPolyTopoChanger::attach(), Foam::fvc::average(), Foam::bound(), meshRefinement::checkCoupledFaceZones(), polyBoundaryMesh::checkDefinition(), Cloud< ParticleType >::checkFieldIOobject(), objectRegistry::checkIn(), Foam::checkMethod(), objectRegistry::checkOut(), polyBoundaryMesh::checkParallelSync(), faceZone::checkParallelSync(), Foam::cmptAv(), correctedSnGrad< Type >::correction(), cubic< Type >::correction(), linearUpwind< Type >::correction(), linearUpwindV< Type >::correction(), localBlended< Type >::correction(), Foam::correction(), Foam::fvc::curl(), Foam::fvc::d2dt2(), Foam::fvm::d2dt2(), Foam::fvm::ddt(), Foam::fvc::ddt(), Foam::fvc::ddtPhiCorr(), faceZoneSet::deleteSet(), Foam::fvc::div(), Foam::fvm::div(), Foam::fvc::domainIntegrate(), Foam::MULES::explicitSolve(), faceSource::filterField(), Foam::fvc::flux(), steadyStateD2dt2Scheme< Type >::fvcD2dt2(), EulerD2dt2Scheme< Type >::fvcD2dt2(), steadyStateDdtScheme< Type >::fvcDdt(), EulerDdtScheme< Type >::fvcDdt(), backwardDdtScheme< Type >::fvcDdt(), localEulerDdtScheme< Type >::fvcDdt(), boundedBackwardDdtScheme::fvcDdt(), CoEulerDdtScheme< Type >::fvcDdt(), SLTSDdtScheme< Type >::fvcDdt(), CrankNicholsonDdtScheme< Type >::fvcDdt(), steadyStateDdtScheme< Type >::fvcDdtPhiCorr(), EulerDdtScheme< Type >::fvcDdtPhiCorr(), backwardDdtScheme< Type >::fvcDdtPhiCorr(), localEulerDdtScheme< Type >::fvcDdtPhiCorr(), CoEulerDdtScheme< Type >::fvcDdtPhiCorr(), SLTSDdtScheme< Type >::fvcDdtPhiCorr(), CrankNicholsonDdtScheme< Type >::fvcDdtPhiCorr(), gaussConvectionScheme< Type >::fvcDiv(), gaussLaplacianScheme< Type, GType >::fvcLaplacian(), fvMatrix< Type >::fvMatrix(), CrankNicholsonDdtScheme< Type >::fvmDdt(), gaussLaplacianScheme< Type, GType >::fvmLaplacian(), GeometricField< Type, PatchField, GeoMesh >::GeometricField(), meshRefinement::getDuplicateFaces(), syncTools::getMasterEdges(), syncTools::getMasterPoints(), faceLimitedGrad< Type >::grad(), cellLimitedGrad< Type >::grad(), Foam::fvc::grad(), Foam::MULES::implicitSolve(), localMax< Type >::interpolate(), localMin< Type >::interpolate(), localBlended< Type >::interpolate(), volPointInterpolation::interpolate(), surfaceInterpolationScheme< Type >::interpolate(), Foam::fvc::interpolate(), meshToMesh::interpolate(), fvMeshSubset::interpolate(), isoSurface::isoSurface(), Foam::fvm::laplacian(), Foam::fvc::laplacian(), layerParameters::layerParameters(), LimitedScheme< Type, Limiter, LimitFunc >::limiter(), Foam::mag(), Foam::magSqr(), Foam::makeGraph(), Foam::mapClouds(), Foam::MapGeometricFields(), fvMeshAdder::MapVolFields(), Foam::fvc::meshPhi(), IOdictionary::name(), interpolation< Type >::New(), IOobject::objectPath(), Foam::operator&(), Foam::operator<<(), Foam::pow(), Foam::ReadFields(), IOobject::readHeader(), Foam::fvc::reconstruct(), IOobjectList::remove(), searchableSurfaces::searchableSurfaces(), explicitSource::setFieldData(), Foam::setRefCell(), removeCells::setRefinement(), removeFaces::setRefinement(), skewCorrected< Type >::skewCorrection(), Foam::fvc::snGrad(), snGradScheme< Type >::snGrad(), fvMatrix< Type >::solve(), Foam::sqr(), Foam::stabilise(), faceZoneSet::subset(), Foam::fvc::surfaceIntegrate(), Foam::fvc::surfaceSum(), surfMesh::surfMesh(), Foam::transform(), triSurfaceMesh::tree(), triSurfaceTools::triangulate(), triSurfaceTools::triangulateFaceCentre(), triSurfaceMesh::triSurfaceMesh(), epsilonWallFunctionFvPatchScalarField::updateCoeffs(), omegaWallFunctionFvPatchScalarField::updateCoeffs(), extendedFaceToCellStencil::weightedSum(), extendedCellToFaceStencil::weightedSum(), extendedUpwindCellToFaceStencil::weightedSum(), localBlended< Type >::weights(), MeshedSurfaceProxy< Face >::write(), addSubtract::writeAddSubtractField(), addSubtract::writeAddSubtractValue(), Foam::writeCellGraph(), components::writeComponentFields(), boundaryRegion::writeDict(), cellTable::writeDict(), div::writeDivField(), IOobject::writeHeader(), interpolate::writeInterpolateField(), mag::writeMagField(), magGrad::writeMagGradField(), magSqr::writeMagSqrField(), Foam::writePatchGraph(), and randomise::writeRandomField().

string& note ( )
inline

Return non-constant access to the optional note.

Definition at line 252 of file IOobject.H.

Referenced by boundaryRegion::writeDict(), cellTable::writeDict(), and IOobject::writeHeader().

const string& note ( ) const
inline

Return the optional note.

Definition at line 258 of file IOobject.H.

virtual void rename ( const word newName)
inlinevirtual

Rename.

Reimplemented in regIOobject, and objectRegistry.

Definition at line 264 of file IOobject.H.

Referenced by regIOobject::rename().

bool registerObject ( ) const
inline

Register object created from this IOobject with registry if true.

Definition at line 270 of file IOobject.H.

Referenced by Foam::ReadFields(), and regIOobject::regIOobject().

readOption& readOpt ( )
inline

Definition at line 283 of file IOobject.H.

writeOption& writeOpt ( )
inline

Definition at line 293 of file IOobject.H.

const Foam::fileName & rootPath ( ) const

Reimplemented in Time.

Definition at line 241 of file IOobject.C.

const Foam::fileName & caseName ( ) const

Reimplemented in Time.

Definition at line 235 of file IOobject.C.

const fileName& instance ( ) const
inline

Definition at line 305 of file IOobject.H.

Referenced by Foam::fvc::average(), Foam::cmptAv(), correctedSnGrad< Type >::correction(), volPointInterpolation::interpolate(), surfaceInterpolationScheme< Type >::interpolate(), Foam::fvc::laplacian(), Foam::fvm::laplacian(), Foam::mag(), Foam::magSqr(), Foam::MapGeometricFields(), reuseTmpDimensionedField< TypeR, Type1, GeoMesh >::New(), reuseTmpGeometricField< TypeR, Type1, PatchField, GeoMesh >::New(), reuseTmpDimensionedField< TypeR, TypeR, GeoMesh >::New(), reuseTmpGeometricField< TypeR, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, Type2, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, Type2, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, TypeR, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, Type2, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, Type2, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, TypeR, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, TypeR, PatchField, GeoMesh >::New(), Foam::operator&(), Foam::pow(), Foam::ReadFields(), Foam::fvc::reconstruct(), surfMesh::setInstance(), polyMesh::setInstance(), snGradScheme< Type >::snGrad(), Foam::sqr(), Foam::stabilise(), Foam::fvc::surfaceIntegrate(), Foam::fvc::surfaceSum(), surfMesh::surfMesh(), Foam::transform(), meshRefinement::write(), IOobject::writeHeader(), regIOobject::writeObject(), and distributedTriSurfaceMesh::writeObject().

fileName& instance ( )
inline

Definition at line 310 of file IOobject.H.

const fileName& local ( ) const
inline

Definition at line 315 of file IOobject.H.

Referenced by Foam::ReadFields(), surfMesh::surfMesh(), and IOobject::writeHeader().

Foam::fileName path ( ) const

Return complete path.

Reimplemented in Time.

Definition at line 247 of file IOobject.C.

Referenced by IOobjectList::IOobjectList(), Foam::makeGraph(), IOobject::objectPath(), Foam::operator<<(), surfMesh::surfMesh(), and Time::writeObject().

Foam::fileName path ( const word instance,
const fileName local = "" 
) const

Return complete path with alternative instance and local.

Definition at line 254 of file IOobject.C.

Foam::fileName filePath ( ) const

Return complete path + object name if the file exists.

either in the case/processor or case otherwise null

Definition at line 263 of file IOobject.C.

References Foam::isDir(), Foam::isFile(), Foam::name(), fileName::null, and Foam::system().

Referenced by fieldToCell::applyToSet().

Stream & writeBanner ( Stream &  os,
bool  noHint = false 
)
inlinestatic

Write the standard OpenFOAM file/dictionary banner.

Optionally without -*- C++ -*- editor hint (eg, for logs)

Definition at line 31 of file IOobjectI.H.

References IOobject::getBannerString().

Referenced by argList::argList(), and IOobject::writeHeader().

Stream & writeDivider ( Stream &  os)
inlinestatic

Write the standard file section divider.

Definition at line 39 of file IOobjectI.H.

Referenced by argList::argList(), and IOobject::writeHeader().

Stream & writeEndDivider ( Stream &  os)
inlinestatic

Write the standard end file divider.

Definition at line 48 of file IOobjectI.H.

Referenced by MeshedSurfaceProxy< Face >::write().

bool good ( ) const
inline
bool bad ( ) const
inline

Definition at line 376 of file IOobject.H.

References IOobject::BAD.

InfoProxy<IOobject> info ( ) const
inline

Return info proxy.

Used to print token information to a stream

Reimplemented in DsmcCloud< ParcelType >, KinematicCloud< ParcelType >, ReactingCloud< ParcelType >, ThermoCloud< ParcelType >, and ReactingMultiphaseCloud< ParcelType >.

Definition at line 386 of file IOobject.H.

void operator= ( const IOobject io)

Reimplemented in regIOobject.

Definition at line 454 of file IOobject.C.

Referenced by regIOobject::operator=().


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