本文整理汇总了C++中volScalarField::needReference方法的典型用法代码示例。如果您正苦于以下问题:C++ volScalarField::needReference方法的具体用法?C++ volScalarField::needReference怎么用?C++ volScalarField::needReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volScalarField
的用法示例。
在下文中一共展示了volScalarField::needReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Foam::setRefCell
(
const volScalarField& field,
const volScalarField& fieldRef,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference
)
{
if (fieldRef.needReference() || forceReference)
{
word refCellName = field.name() + "RefCell";
word refPointName = field.name() + "RefPoint";
word refValueName = field.name() + "RefValue";
if (dict.found(refCellName))
{
if (Pstream::master())
{
refCelli = readLabel(dict.lookup(refCellName));
if (refCelli < 0 || refCelli >= field.mesh().nCells())
{
FatalIOErrorIn
(
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
")",
dict
) << "Illegal master cellID " << refCelli
<< ". Should be 0.." << field.mesh().nCells()
<< exit(FatalIOError);
}
}
else
{
refCelli = -1;
}
}
else if (dict.found(refPointName))
{
point refPointi(dict.lookup(refPointName));
refCelli = field.mesh().findCell(refPointi);
label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
if (sumHasRef != 1)
{
FatalIOErrorIn
(
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
")",
dict
) << "Unable to set reference cell for field " << field.name()
<< nl << " Reference point " << refPointName
<< " " << refPointi
<< " found on " << sumHasRef << " domains (should be one)"
<< nl << exit(FatalIOError);
}
}
else
{
FatalIOErrorIn
(
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
")",
dict
) << "Unable to set reference cell for field " << field.name()
<< nl
<< " Please supply either " << refCellName
<< " or " << refPointName << nl << exit(FatalIOError);
}
refValue = readScalar(dict.lookup(refValueName));
}
}
示例2: if
void Foam::setRefCell
(
const volScalarField& field,
const volScalarField& fieldRef,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference
)
{
if (fieldRef.needReference() || forceReference)
{
word refCellName = field.name() + "RefCell";
word refPointName = field.name() + "RefPoint";
word refValueName = field.name() + "RefValue";
if (dict.found(refCellName))
{
if (Pstream::master())
{
refCelli = readLabel(dict.lookup(refCellName));
if (refCelli < 0 || refCelli >= field.mesh().nCells())
{
FatalIOErrorInFunction
(
dict
) << "Illegal master cellID " << refCelli
<< ". Should be 0.." << field.mesh().nCells()
<< exit(FatalIOError);
}
}
else
{
refCelli = -1;
}
}
else if (dict.found(refPointName))
{
point refPointi(dict.lookup(refPointName));
// Try fast approximate search avoiding octree construction
refCelli = field.mesh().findCell(refPointi, polyMesh::FACE_PLANES);
label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
// If reference cell no found use octree search
// with cell tet-decompositoin
if (sumHasRef != 1)
{
refCelli = field.mesh().findCell(refPointi);
hasRef = (refCelli >= 0 ? 1 : 0);
sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
}
if (sumHasRef != 1)
{
FatalIOErrorInFunction
(
dict
) << "Unable to set reference cell for field " << field.name()
<< nl << " Reference point " << refPointName
<< " " << refPointi
<< " found on " << sumHasRef << " domains (should be one)"
<< nl << exit(FatalIOError);
}
}
else
{
FatalIOErrorInFunction
(
dict
) << "Unable to set reference cell for field " << field.name()
<< nl
<< " Please supply either " << refCellName
<< " or " << refPointName << nl << exit(FatalIOError);
}
refValue = readScalar(dict.lookup(refValueName));
}
}