[转载]createMesh中用到的IOobject
Foam::IOobject(
Foam::fvMesh::defaultRegion,
runTime.timeName(),
runTime,
Foam::IOobject::MUST_READ
)
上述代码是摘抄自createMesh.H中进行fvMesh构造时用到的临时IOobject对象的构造代码。
Foam::fvMesh::defaultRegion的值为"region0",这一部分是作为该IOobject的name_成员;
runTime.timeName(),返回的是的runTime的量纲部分dimensioned<scalar>的name_,这一部分是作为该IOobject的instance_c成员;
runTime是作为该IOobject的db_成员;
在由该IOobject构造其它类时这些信息是非常有用的,比如objectRegistry类,regIOobject类等,现在举objectRegistry为例,其以IOobject为参数的构造如下:
Foam::objectRegistry::objectRegistry
(
const IOobject& io,
const label nIoObjects
)
:
regIOobject(io),
HashTable<regIOobject*>(nIoObjects),
time_(io.time()),
parent_(io.db()),
dbDir_(parent_.dbDir()/local()/name())
{
writeOpt() = IOobject::AUTO_WRITE;
}
从中可见,objectRegistry的三个成员变量:time_,parent_和dbDir_的初始化都是源自上面的IOobject,将代码展开,得到的三个成员变量的值分别如下:
time_ = runTime
parent_ = runTime
dbDir_ = runTime.dbDir()//region0
转自http://blog.pfan.cn/bioexplore/39559.html 可惜的是拷过来代码的格式都没了
页:
[1]