本文整理汇总了C++中volScalarField::average方法的典型用法代码示例。如果您正苦于以下问题:C++ volScalarField::average方法的具体用法?C++ volScalarField::average怎么用?C++ volScalarField::average使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volScalarField
的用法示例。
在下文中一共展示了volScalarField::average方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: markedFace
// Construct from components
Foam::evaluateError::evaluateError
(
const volScalarField& cellError,
const volVectorField& gradTheta,
const surfaceScalarField& faceError,
const labelList& candidateFaces
)
:
unsplitFaces_(candidateFaces.size()),
refCells_()
{
const polyMesh& mesh = cellError.mesh();
// picks up the error field and the gradient of the variable
// and appends lists of cells to refine/unrefine based on the width of
// standard deviation of the error distribution
// calculate the average error
scalar avgError = cellError.average().value();
scalar squareError = sqr(cellError)().average().value();
scalar deviation = sqrt(squareError - sqr(avgError));
Info<< "avgError:" << avgError
<< " squareError:" << squareError
<< " deviation:" << deviation
<< endl;
scalar ref = avgError + deviation;
scalar unref = avgError - deviation;
Info<< "evaluateError : refinement criterion : " << ref << endl
<< " unrefinement criterion : " << unref << endl;
// Coarsen mesh first.
// Find out set of candidateFaces where error is above crit.
// Construct to filter unrefinement pattern
// removeFaces faceRemover(mesh);
// Keep track of unrefinement pattern.
boolList markedFace(mesh.nFaces(), false);
label unsplitFaceI = 0;
// Subset candidate faces and update refinement pattern interference pattern
forAll(candidateFaces, candidateFaceI)
{
label faceI = candidateFaces[candidateFaceI];
if (markedFace[faceI])
{
Info<< "evaluateError : protected candidate face:" << faceI
<< endl;
}
else
{
// if (faceError[faceI] < unref)
if (unsplitFaceI < (candidateFaces.size()/2 + 1))
{
unsplitFaces_[unsplitFaceI++] = faceI;
// faceRemover.markAffectedFaces(faceI, markedFace);
}
}
}