void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
clearOut()
{
    clearGeom();
    clearTopology();
    clearPatchMeshAddr();
}
void Foam::sampledPatch::createGeometry()
{
    clearGeom();
    points_.clear();
    faces_.clear();
    patchFaceLabels_.clear();

    if (patchIndex() != -1)
    {
        const polyPatch& patch = mesh().boundaryMesh()[patchIndex()];
        const faceList& localFaces = patch.localFaces();

        points_ = patch.localPoints();

        if (triangulate())
        {
            // Count triangles
            label nTri = 0;
            forAll(localFaces, faceI)
            {
                const face& f = localFaces[faceI];

                nTri += f.nTriangles(patch.localPoints());
            }

            faces_.setSize(nTri);
            patchFaceLabels_.setSize(nTri);

            // split and fill mesh face references
            nTri = 0;
            forAll(localFaces, faceI)
            {
                const face& f = localFaces[faceI];

                label fillIndex = nTri;

                f.triangles(patch.localPoints(), nTri, faces_);
                while (fillIndex < nTri)
                {
                    patchFaceLabels_[fillIndex++] = faceI;
                }
            }
        }
        else
        {
            faces_  = localFaces;
            patchFaceLabels_.setSize(faces_.size());
            forAll(localFaces, i)
            {
                patchFaceLabels_[i] = i;
            }
        }
    }
Exemplo n.º 3
0
void Foam::fvMesh::clearOut()
{
    clearGeom();
    surfaceInterpolation::clearOut();

    clearAddressing();

    // Clear mesh motion flux
    deleteDemandDrivenData(phiPtr_);

    polyMesh::clearOut();
}
Exemplo n.º 4
0
Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate()
{
    if (debug)
    {
        Info<< "polyMesh::readUpdateState fvMesh::readUpdate() : "
            << "Updating fvMesh.  ";
    }

    // Note: issues with update: should meshObject update happen
    // in polyMesh or fvMesh?  HJ, 18/Feb/2011
    polyMesh::readUpdateState state = polyMesh::readUpdate();

    if (state == polyMesh::TOPO_PATCH_CHANGE)
    {
        if (debug)
        {
            Info << "Boundary and topological update" << endl;
        }

        boundary_.readUpdate(boundaryMesh());

        clearOut();

    }
    else if (state == polyMesh::TOPO_CHANGE)
    {
        if (debug)
        {
            Info << "Topological update" << endl;
        }

        clearOut();
    }
    else if (state == polyMesh::POINTS_MOVED)
    {
        if (debug)
        {
            Info << "Point motion update" << endl;
        }

        clearGeom();
    }
    else
    {
        if (debug)
        {
            Info << "No update" << endl;
        }
    }

    return state;
}
Exemplo n.º 5
0
Foam::polyMesh::readUpdateState Foam::fvMesh::readUpdate()
{
    if (debug)
    {
        Info<< "polyMesh::readUpdateState fvMesh::readUpdate() : "
            << "Updating fvMesh.  ";
    }

    polyMesh::readUpdateState state = polyMesh::readUpdate();

    if (state == polyMesh::TOPO_PATCH_CHANGE)
    {
        if (debug)
        {
            Info<< "Boundary and topological update" << endl;
        }

        boundary_.readUpdate(boundaryMesh());

        clearOut();

    }
    else if (state == polyMesh::TOPO_CHANGE)
    {
        if (debug)
        {
            Info<< "Topological update" << endl;
        }

        clearOut();
    }
    else if (state == polyMesh::POINTS_MOVED)
    {
        if (debug)
        {
            Info<< "Point motion update" << endl;
        }

        clearGeom();
    }
    else
    {
        if (debug)
        {
            Info<< "No update" << endl;
        }
    }

    return state;
}
void PrimitivePatch<Face, FaceList, PointField, PointType>::movePoints
(
    const Field<PointType>&
)
{
    if (debug)
    {
        Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
            << "movePoints() : "
            << "recalculating PrimitivePatch geometry following mesh motion"
            << endl;
    }

    clearGeom();
}
bool Foam::swakRegistryProxySurface::update()
{
    bool originalUpdate=realSurface().update();

    if(
        this->Sf().size() != realSurface().Sf().size()
        ||
        this->Cf().size() != realSurface().Cf().size()
        ||
        this->magSf().size() != realSurface().magSf().size()
    ) {
        if(debug) {
            Pout << "Foam::swakRegistryProxySurface::update(): Clearin Geometry" << endl;
        }
        clearGeom();
    }

    if(debug) {
        Pout << "Foam::swakRegistryProxySurface::update(): " << originalUpdate << endl;
    }
    return originalUpdate;
}
Exemplo n.º 8
0
void Foam::surfMesh::clearOut()
{
    clearGeom();
    clearAddressing();
}
Exemplo n.º 9
0
void Foam::primitiveMesh::clearOut()
{
    clearGeom();
    clearAddressing();
}
bool Foam::sampledIsoSurface::updateGeometry() const
{
    const fvMesh& fvm = static_cast<const fvMesh&>(mesh());

    // No update needed
    if (fvm.time().timeIndex() == prevTimeIndex_)
    {
        return false;
    }

    // Get any subMesh
    if (zoneID_.index() != -1 && !subMeshPtr_.valid())
    {
        const polyBoundaryMesh& patches = mesh().boundaryMesh();

        // Patch to put exposed internal faces into
        const label exposedPatchI = patches.findPatchID(exposedPatchName_);

        if (debug)
        {
            Info<< "Allocating subset of size "
                << mesh().cellZones()[zoneID_.index()].size()
                << " with exposed faces into patch "
                << patches[exposedPatchI].name() << endl;
        }

        subMeshPtr_.reset
        (
            new fvMeshSubset(fvm)
        );
        subMeshPtr_().setLargeCellSubset
        (
            labelHashSet(mesh().cellZones()[zoneID_.index()]),
            exposedPatchI
        );
    }


    prevTimeIndex_ = fvm.time().timeIndex();
    getIsoFields();

    // Clear any stored topo
    surfPtr_.clear();
    facesPtr_.clear();

    // Clear derived data
    clearGeom();

    if (subMeshPtr_.valid())
    {
        surfPtr_.reset
        (
            new isoSurface
            (
                *volSubFieldPtr_,
                *pointSubFieldPtr_,
                isoVal_,
                regularise_,
                mergeTol_
            )
        );
    }
    else
    {
        surfPtr_.reset
        (
            new isoSurface
            (
                *volFieldPtr_,
                *pointFieldPtr_,
                isoVal_,
                regularise_,
                mergeTol_
            )
        );
    }


    if (debug)
    {
        Pout<< "sampledIsoSurface::updateGeometry() : constructed iso:"
            << nl
            << "    regularise     : " << regularise_ << nl
            << "    average        : " << average_ << nl
            << "    isoField       : " << isoField_ << nl
            << "    isoValue       : " << isoVal_ << nl;
        if (subMeshPtr_.valid())
        {
            Pout<< "    zone size      : " << subMeshPtr_().subMesh().nCells()
                << nl;
        }
        Pout<< "    points         : " << points().size() << nl
            << "    tris           : " << surface().size() << nl
            << "    cut cells      : " << surface().meshCells().size()
            << endl;
    }

    return true;
}
Exemplo n.º 11
0
void Foam::polyMesh::clearOut()
{
    clearGeom();
    clearAddressing();
}
Exemplo n.º 12
0
void Foam::ggiPolyPatch::movePoints(const pointField& p)
{
    polyPatch::movePoints(p);
    clearGeom();
}
Exemplo n.º 13
0
void Foam::ggiPolyPatch::clearOut()
{
    clearGeom();

    deleteDemandDrivenData(localParallelPtr_);
}
Exemplo n.º 14
0
void Foam::distanceSurface::createGeometry()
{
    if (debug)
    {
        Pout<< "distanceSurface::createGeometry :updating geometry." << endl;
    }

    // Clear any stored topologies
    facesPtr_.clear();
    isoSurfCellPtr_.clear();
    isoSurfPtr_.clear();

    // Clear derived data
    clearGeom();

    const fvMesh& fvm = static_cast<const fvMesh&>(mesh());

    // Distance to cell centres
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    cellDistancePtr_.reset
    (
        new volScalarField
        (
            IOobject
            (
                "cellDistance",
                fvm.time().timeName(),
                fvm.time(),
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            ),
            fvm,
            dimensionedScalar("zero", dimLength, 0)
        )
    );
    volScalarField& cellDistance = cellDistancePtr_();

    // Internal field
    {
        const pointField& cc = fvm.C();
        scalarField& fld = cellDistance.primitiveFieldRef();

        List<pointIndexHit> nearest;
        surfPtr_().findNearest
        (
            cc,
            scalarField(cc.size(), GREAT),
            nearest
        );

        if (signed_)
        {
            List<volumeType> volType;

            surfPtr_().getVolumeType(cc, volType);

            forAll(volType, i)
            {
                volumeType vT = volType[i];

                if (vT == volumeType::OUTSIDE)
                {
                    fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
                }
                else if (vT == volumeType::INSIDE)
                {
                    fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
                }
                else
                {
                    FatalErrorInFunction
                        << "getVolumeType failure, neither INSIDE or OUTSIDE"
                        << exit(FatalError);
                }
            }
        }
        else
        {