コード例 #1
0
// Is the point in the cell bounding box
bool Foam::primitiveMesh::pointInCellBB(const point& p, label celli) const
{
    const pointField& points = this->points();
    const faceList& f = faces();
    const vectorField& centres = cellCentres();
    const cellList& cf = cells();

    labelList cellVertices = cf[celli].labels(f);

    vector bbmax = -GREAT*vector::one;
    vector bbmin = GREAT*vector::one;

    forAll (cellVertices, vertexI)
    {
        bbmax = max(bbmax, points[cellVertices[vertexI]]);
        bbmin = min(bbmin, points[cellVertices[vertexI]]);
    }
コード例 #2
0
void Foam::fvMesh::makeC() const
{
    if (debug)
    {
        InfoInFunction << "Assembling cell centres" << endl;
    }

    // It is an error to attempt to recalculate
    // if the pointer is already set
    if (CPtr_)
    {
        FatalErrorInFunction
            << "cell centres already exist"
            << abort(FatalError);
    }

    // Construct as slices. Only preserve processor (not e.g. cyclic)

    CPtr_ = new slicedVolVectorField
    (
        IOobject
        (
            "C",
            pointsInstance(),
            meshSubDir,
            *this,
            IOobject::NO_READ,
            IOobject::NO_WRITE,
            false
        ),
        *this,
        dimLength,
        cellCentres(),
        faceCentres(),
        true,               //preserveCouples
        true                //preserveProcOnly
    );
}