示例#1
0
void writeSet(const cellSet& cells, const string& msg)
{
    Info<< "Writing " << msg << " (" << cells.size() << ") to cellSet "
        << cells.instance()/cells.local()/cells.name()
        << endl << endl;
    cells.write();
}
    CellSetValueExpressionDriver::CellSetValueExpressionDriver(const cellSet &set,const CellSetValueExpressionDriver& orig)
:
        SetSubsetValueExpressionDriver(orig),
        cellSet_(
            new cellSet(
                dynamic_cast<const fvMesh&>(set.db()),
                //            dynamicCast<const fvMesh&>(set.db()), // doesn't work with f++ 4.2
                //            set.name()+"_copy",
                set.name(),
                set
            )
        )
{}
 //Insert illegal cells in set
 forAll(skew, cellI)
 {
     if(skew[cellI] > 4)
     {
         skewedCells.insert(cellI);
     }
 }
 //Insert illegal cells in set
 forAll(nonOrth, cellI)
 {
     if(nonOrth[cellI] > 60)
     {
         nonOrthCells.insert(cellI);
     }
 }
// Return true if any cells had to be split to keep a difference between
// neighbouring refinement levels < limitDiff. Puts cells into refCells and
// update refLevel to account for refinement.
bool limitRefinementLevel
(
    const primitiveMesh& mesh,
    labelList& refLevel,
    cellSet& refCells
)
{
    const labelListList& cellCells = mesh.cellCells();

    label oldNCells = refCells.size();

    forAll(cellCells, celli)
    {
        const labelList& cCells = cellCells[celli];

        forAll(cCells, i)
        {
            if (refLevel[cCells[i]] > (refLevel[celli]+1))
            {
                // Found neighbour with >=2 difference in refLevel.
                refCells.insert(celli);
                refLevel[celli]++;
                break;
            }
        }
    }

    if (refCells.size() > oldNCells)
    {
        Info<< "Added an additional " << refCells.size() - oldNCells
            << " cells to satisfy 1:2 refinement level"
            << endl;

        return true;
    }
    else
    {
        return false;
    }
}