FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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:
Collaboration 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< IOobject >  clone () const
 Clone.
virtual  ~IOobject ()
const Time &  time () const
 Return time.
const objectRegistry &  db () const
 Return the local objectRegistry.
const word &  name () const
 Return name.
const word &  headerClassName () const
 Return name of the class name read from header.
string &  note ()
 Return non-constant access to the optional note.
const string &  note () 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
readOption &  readOpt ()
writeOption  writeOpt () const
writeOption &  writeOpt ()
const fileName &  rootPath () const
const fileName &  caseName () const
const fileName &  instance () const
fileName &  instance ()
const fileName &  local () 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< IOobject >  info () 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

Istream *  objectStream ()
 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  ) [static, protected]

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(), incompressible::turbulenceModel::New(), turbulenceModel::New(), incompressible::RASModel::New(), RASModel::New(), incompressible::LESModel::New(), LESModel::New(), laminarFlameSpeed::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, Type2, PatchField, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, Type2, PatchField, GeoMesh >::New(), reuseTmpGeometricField< TypeR, TypeR, PatchField, GeoMesh >::New(), reuseTmpGeometricField< TypeR, Type1, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, TypeR, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, Type2, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, TypeR, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, Type2, GeoMesh >::New(), reuseTmpDimensionedField< TypeR, TypeR, GeoMesh >::New(), reuseTmpDimensionedField< TypeR, Type1, GeoMesh >::New(), SRFModel::New(), engineMesh::New(), dynamicFvMesh::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, IOOutputFilter< OutputFilter >, IOdictionary, UniformDimensionedField< Type >, and phase.

Definition at line 240 of file IOobject.H.

Referenced by IOobjectList::add(), multivariateSurfaceInterpolationScheme< Type >::fieldTable::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(), faceZone::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), Foam::cmptAv(), localBlended< Type >::correction(), cubic< Type >::correction(), linearUpwindV< Type >::correction(), linearUpwind< Type >::correction(), Foam::correction(), correctedSnGrad< Type >::correction(), Foam::fvc::curl(), Foam::fvm::d2dt2(), Foam::fvc::d2dt2(), Foam::fvm::ddt(), Foam::fvc::ddt(), Foam::fvc::ddtPhiCorr(), faceZoneSet::deleteSet(), Foam::fvm::div(), Foam::fvc::div(), Foam::fvc::domainIntegrate(), Foam::MULES::explicitSolve(), faceSource::filterField(), Foam::fvc::flux(), steadyStateD2dt2Scheme< Type >::fvcD2dt2(), EulerD2dt2Scheme< Type >::fvcD2dt2(), steadyStateDdtScheme< Type >::fvcDdt(), SLTSDdtScheme< Type >::fvcDdt(), localEulerDdtScheme< Type >::fvcDdt(), EulerDdtScheme< Type >::fvcDdt(), CrankNicholsonDdtScheme< Type >::fvcDdt(), CoEulerDdtScheme< Type >::fvcDdt(), boundedBackwardDdtScheme::fvcDdt(), backwardDdtScheme< Type >::fvcDdt(), steadyStateDdtScheme< Type >::fvcDdtPhiCorr(), SLTSDdtScheme< Type >::fvcDdtPhiCorr(), localEulerDdtScheme< Type >::fvcDdtPhiCorr(), EulerDdtScheme< Type >::fvcDdtPhiCorr(), CrankNicholsonDdtScheme< Type >::fvcDdtPhiCorr(), CoEulerDdtScheme< Type >::fvcDdtPhiCorr(), backwardDdtScheme< 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(), meshToMesh::interpolate(), volPointInterpolation::interpolate(), surfaceInterpolationScheme< Type >::interpolate(), Foam::fvc::interpolate(), localMin< Type >::interpolate(), localMax< Type >::interpolate(), localBlended< Type >::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(), removeFaces::setRefinement(), removeCells::setRefinement(), skewCorrected< Type >::skewCorrection(), snGradScheme< Type >::snGrad(), Foam::fvc::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(), omegaWallFunctionFvPatchScalarField::updateCoeffs(), epsilonWallFunctionFvPatchScalarField::updateCoeffs(), extendedFaceToCellStencil::weightedSum(), extendedUpwindCellToFaceStencil::weightedSum(), extendedCellToFaceStencil::weightedSum(), localBlended< Type >::weights(), MeshedSurfaceProxy< Face >::write(), addSubtract::writeAddSubtractField(), addSubtract::writeAddSubtractValue(), Foam::writeCellGraph(), components::writeComponentFields(), cellTable::writeDict(), boundaryRegion::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 cellTable::writeDict(), boundaryRegion::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  ) [inline, virtual]

Rename.

Reimplemented in objectRegistry, and regIOobject.

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::fvm::laplacian(), Foam::fvc::laplacian(), Foam::mag(), Foam::magSqr(), Foam::MapGeometricFields(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, TypeR, TypeR, Type2, PatchField, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, TypeR, PatchField, GeoMesh >::New(), reuseTmpTmpGeometricField< TypeR, Type1, Type12, Type2, PatchField, GeoMesh >::New(), reuseTmpGeometricField< TypeR, TypeR, PatchField, GeoMesh >::New(), reuseTmpGeometricField< TypeR, Type1, PatchField, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, TypeR, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, TypeR, TypeR, Type2, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, TypeR, GeoMesh >::New(), reuseTmpTmpDimensionedField< TypeR, Type1, Type12, Type2, GeoMesh >::New(), reuseTmpDimensionedField< TypeR, TypeR, GeoMesh >::New(), reuseTmpDimensionedField< TypeR, Type1, 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  
) [inline, static]

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  ) [inline, static]

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  ) [inline, static]

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 >, ReactingMultiphaseCloud< ParcelType >, and ThermoCloud< 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: