本文整理汇总了C++中IOobject::path方法的典型用法代码示例。如果您正苦于以下问题:C++ IOobject::path方法的具体用法?C++ IOobject::path怎么用?C++ IOobject::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOobject
的用法示例。
在下文中一共展示了IOobject::path方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: surfaceRegistry
Foam::surfMesh::surfMesh
(
const IOobject& io,
const Xfer<MeshedSurface<face> >& surf,
const word& surfName
)
:
surfaceRegistry(io.db(), (surfName.size() ? surfName : io.name())),
Allocator
(
IOobject
(
"points",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pointField(),
IOobject
(
"faces",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
faceList(),
IOobject
(
"surfZones",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
surfZoneList()
),
MeshReference(this->storedIOFaces(), this->storedIOPoints())
{
if (debug)
{
Info<<"IOobject: " << io.path() << nl
<<" name: " << io.name()
<<" instance: " << io.instance()
<<" local: " << io.local()
<<" dbDir: " << io.db().dbDir() << endl;
Info<<"creating surfMesh at instance " << instance() << endl;
Info<<"timeName: " << instance() << endl;
}
// We can also send Xfer<..>::null just to initialize without allocating
if (notNull(surf))
{
transfer(surf());
}
}
示例2: FatalErrorIn
void Foam::sampledIsoSurface::getIsoFields() const
{
const fvMesh& fvm = static_cast<const fvMesh&>(mesh());
// Get volField
// ~~~~~~~~~~~~
if (fvm.foundObject<volScalarField>(isoField_))
{
if (debug)
{
Info<< "sampledIsoSurface::getIsoFields() : lookup volField "
<< isoField_ << endl;
}
storedVolFieldPtr_.clear();
volFieldPtr_ = &fvm.lookupObject<volScalarField>(isoField_);
}
else
{
// Bit of a hack. Read field and store.
if (debug)
{
Info<< "sampledIsoSurface::getIsoFields() : checking "
<< isoField_ << " for same time " << fvm.time().timeName()
<< endl;
}
if
(
storedVolFieldPtr_.empty()
|| (fvm.time().timeName() != storedVolFieldPtr_().instance())
)
{
if (debug)
{
Info<< "sampledIsoSurface::getIsoFields() : reading volField "
<< isoField_ << " from time " << fvm.time().timeName()
<< endl;
}
IOobject vfHeader
(
isoField_,
fvm.time().timeName(),
fvm,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (vfHeader.headerOk())
{
storedVolFieldPtr_.reset
(
new volScalarField
(
vfHeader,
fvm
)
);
volFieldPtr_ = storedVolFieldPtr_.operator->();
}
else
{
FatalErrorIn("sampledIsoSurface::getIsoFields()")
<< "Cannot find isosurface field " << isoField_
<< " in database or directory " << vfHeader.path()
<< exit(FatalError);
}
}
}
// Get pointField
// ~~~~~~~~~~~~~~
if (!subMeshPtr_.valid())
{
word pointFldName = "volPointInterpolate(" + isoField_ + ')';
if (fvm.foundObject<pointScalarField>(pointFldName))
{
if (debug)
{
Info<< "sampledIsoSurface::getIsoFields() : lookup pointField "
<< pointFldName << endl;
}
pointFieldPtr_ = &fvm.lookupObject<pointScalarField>(pointFldName);
}
else
{
// Not in registry. Interpolate.
if (debug)
{
Info<< "sampledIsoSurface::getIsoFields() : "
<< "checking pointField " << pointFldName
<< " for same time " << fvm.time().timeName()
<< endl;
//.........这里部分代码省略.........
示例3: processorsPath
Foam::fileName Foam::fileOperations::masterFileOperation::objectPath
(
const IOobject& io,
const pathType& searchType,
const word& instancePath
)
{
// Replacement for IOobject::objectPath()
switch (searchType)
{
case fileOperation::ABSOLUTE:
{
return io.instance()/io.name();
}
break;
case fileOperation::OBJECT:
{
return io.path()/io.name();
}
break;
case fileOperation::PROCESSORSOBJECT:
{
return processorsPath(io, io.instance())/io.name();
}
break;
case fileOperation::PARENTOBJECT:
{
return
io.rootPath()/io.time().globalCaseName()
/io.instance()/io.db().dbDir()/io.local()/io.name();
}
break;
case fileOperation::FINDINSTANCE:
{
return
io.rootPath()/io.caseName()
/instancePath/io.db().dbDir()/io.local()/io.name();
}
break;
case fileOperation::PROCESSORSFINDINSTANCE:
{
return processorsPath(io, instancePath)/io.name();
}
break;
case fileOperation::NOTFOUND:
{
return fileName::null;
}
break;
default:
{
NotImplemented;
return fileName::null;
}
}
}
示例4:
Foam::fileName Foam::fileOperations::masterFileOperation::filePath
(
const bool checkGlobal,
const IOobject& io,
pathType& searchType,
word& newInstancePath
)
{
newInstancePath = word::null;
if (io.instance().isAbsolute())
{
fileName objectPath = io.instance()/io.name();
if (Foam::isFile(objectPath))
{
searchType = fileOperation::ABSOLUTE;
return objectPath;
}
else
{
searchType = fileOperation::NOTFOUND;
return fileName::null;
}
}
else
{
fileName path = io.path();
fileName objectPath = path/io.name();
if (Foam::isFile(objectPath))
{
searchType = fileOperation::OBJECT;
return objectPath;
}
else
{
if
(
checkGlobal
&& io.time().processorCase()
&& (
io.instance() == io.time().system()
|| io.instance() == io.time().constant()
)
)
{
fileName parentObjectPath =
io.rootPath()/io.time().globalCaseName()
/io.instance()/io.db().dbDir()/io.local()/io.name();
if (Foam::isFile(parentObjectPath))
{
searchType = fileOperation::PARENTOBJECT;
return parentObjectPath;
}
}
//- The big problem with findInstance is that it itself needs file
// access through the fileHandler. Since this routine is only called on the
// master we'll get a deadlock.
// if (!Foam::isDir(path))
// {
// newInstancePath = io.time().findInstancePath
// (
// instant(io.instance())
// );
//
// if (newInstancePath.size())
// {
// fileName fName
// (
// io.rootPath()/io.caseName()
// /newInstancePath/io.db().dbDir()/io.local()/io.name()
// );
//
// if (Foam::isFile(fName))
// {
// searchType = fileOperation::FINDINSTANCE;
// return fName;
// }
// }
// }
// Try constant & local
{
newInstancePath = io.time().constant();
fileName fName
(
io.rootPath()
/io.caseName()
/newInstancePath
/io.db().dbDir()
/io.local()
/io.name()
);
//DebugVar(fName);
if (Foam::isFile(fName))
{
searchType = fileOperation::FINDINSTANCE;
//.........这里部分代码省略.........
示例5: exit
void Foam::sampledIsoSurface::getIsoFields() const
{
const fvMesh& fvm = static_cast<const fvMesh&>(mesh());
// Get volField
// ~~~~~~~~~~~~
if (fvm.foundObject<volScalarField>(isoField_))
{
if (debug)
{
InfoInFunction
<< "Lookup volField " << isoField_ << endl;
}
storedVolFieldPtr_.clear();
volFieldPtr_ = &fvm.lookupObject<volScalarField>(isoField_);
}
else
{
// Bit of a hack. Read field and store.
if (debug)
{
InfoInFunction
<< "Checking " << isoField_
<< " for same time " << fvm.time().timeName()
<< endl;
}
if
(
storedVolFieldPtr_.empty()
|| (fvm.time().timeName() != storedVolFieldPtr_().instance())
)
{
if (debug)
{
InfoInFunction
<< "Reading volField " << isoField_
<< " from time " << fvm.time().timeName()
<< endl;
}
IOobject vfHeader
(
isoField_,
fvm.time().timeName(),
fvm,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (vfHeader.typeHeaderOk<volScalarField>(true))
{
storedVolFieldPtr_.reset
(
new volScalarField
(
vfHeader,
fvm
)
);
volFieldPtr_ = storedVolFieldPtr_.operator->();
}
else
{
FatalErrorInFunction
<< "Cannot find isosurface field " << isoField_
<< " in database or directory " << vfHeader.path()
<< exit(FatalError);
}
}
}
// Get pointField
// ~~~~~~~~~~~~~~
// In case of multiple iso values we don't want to calculate multiple e.g.
// "volPointInterpolate(p)" so register it and re-use it. This is the
// same as the 'cache' functionality from volPointInterpolate but
// unfortunately that one does not guarantee that the field pointer
// remain: e.g. some other functionObject might delete the cached version.
// (volPointInterpolation::interpolate with cache=false deletes any
// registered one or if mesh.changing())
if (!subMeshPtr_.valid())
{
const word pointFldName =
"volPointInterpolate_"
+ type()
+ "("
+ isoField_
+ ')';
if (fvm.foundObject<pointScalarField>(pointFldName))
{
if (debug)
{
//.........这里部分代码省略.........