コード例 #1
0
void Foam::displacementMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
    // pointMesh already updates pointFields

    motionSolver::updateMesh(mpm);

    // Map points0_. Bit special since we somehow have to come up with
    // a sensible points0 position for introduced points.
    // Find out scaling between points0 and current points

    // Get the new points either from the map or the mesh
    const pointgpuField& points =
    (
        mpm.hasMotionPoints()
      ? mpm.preMotionPoints()
      : mesh().points()
    );

    // Note: boundBox does reduce
    const vector span0 = boundBox(points0_).span();
    const vector span = boundBox(points).span();

    vector scaleFactors(cmptDivide(span0, span));

    pointField newPoints0(mpm.pointMap().size());

    forAll(newPoints0, pointI)
    {
        label oldPointI = mpm.pointMap()[pointI];

        if (oldPointI >= 0)
        {
            label masterPointI = mpm.reversePointMap()[oldPointI];

            if (masterPointI == pointI)
            {
                newPoints0[pointI] = points0_[oldPointI];
            }
            else
            {
                // New point - assume motion is scaling
                newPoints0[pointI] = points0_[oldPointI] + cmptMultiply
                (
                    scaleFactors,
                    points[pointI] - points[masterPointI]
                );
            }
        }
        else
        {
            FatalErrorIn
            (
                "displacementMotionSolver::updateMesh"
                "(const mapPolyMesh&)"
            )   << "Cannot determine co-ordinates of introduced vertices."
                << " New vertex " << pointI << " at co-ordinate "
                << points[pointI] << exit(FatalError);
        }
    }
コード例 #2
0
void Foam::componentDisplacementMotionSolver::updateMesh(const mapPolyMesh& mpm)
{
    // pointMesh already updates pointFields.

    motionSolver::updateMesh(mpm);

    // Map points0_. Bit special since we somehow have to come up with
    // a sensible points0 position for introduced points.
    // Find out scaling between points0 and current points

    // Get the new points either from the map or the mesh
    const scalarField points
    (
        mpm.hasMotionPoints()
      ? mpm.preMotionPoints().component(cmpt_)
      : mesh().points().component(cmpt_)
    );

    // Get extents of points0 and points and determine scale
    const scalar scale =
        (gMax(points0_)-gMin(points0_))
       /(gMax(points)-gMin(points));

    scalarField newPoints0(mpm.pointMap().size());

    forAll(newPoints0, pointI)
    {
        label oldPointI = mpm.pointMap()[pointI];

        if (oldPointI >= 0)
        {
            label masterPointI = mpm.reversePointMap()[oldPointI];

            if (masterPointI == pointI)
            {
                newPoints0[pointI] = points0_[oldPointI];
            }
            else
            {
                // New point. Assume motion is scaling.
                newPoints0[pointI] =
                    points0_[oldPointI]
                  + scale*(points[pointI]-points[masterPointI]);
            }
        }
        else
        {
            FatalErrorIn
            (
                "displacementLaplacianFvMotionSolver::updateMesh"
                "(const mapPolyMesh& mpm)"
            )   << "Cannot work out coordinates of introduced vertices."
                << " New vertex " << pointI << " at coordinate "
                << points[pointI] << exit(FatalError);
        }
    }
コード例 #3
0
void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
{
    // Update zones.  Since boundary depends on zones, they need to be
    // updated first.  HJ, 20/May/2014
    pointZones_.updateMesh();
    faceZones_.updateMesh();
    cellZones_.updateMesh();

    // Update boundaryMesh (note that patches themselves are already ok)
    boundary_.updateMesh();

    // Clear out parallel data.  HJ, 27/Nov/2009
    deleteDemandDrivenData(globalMeshDataPtr_);

    setInstance(time().timeName());

    // Map the old motion points if present
    if (oldAllPointsPtr_)
    {
        // Make a copy of the original points
        pointField oldMotionPoints = *oldAllPointsPtr_;

        pointField& newMotionPoints = *oldAllPointsPtr_;

        // Resize the list to new size
        newMotionPoints.setSize(allPoints_.size());

        // Map the list
        newMotionPoints.map(oldMotionPoints, mpm.pointMap());

        // Reset old points if present
        if (oldPointsPtr_)
        {
            oldPointsPtr_->reset(*oldAllPointsPtr_, nPoints());
        }
    }

    // Reset valid directions (could change by faces put into empty patches)
    geometricD_ = Vector<label>::zero;
    solutionD_ = Vector<label>::zero;

    // Update all function objects
    // Moved from fvMesh.C in 1.6.x merge.  HJ, 29/Aug/2010
    meshObjectBase::allUpdateTopology<polyMesh>(*this, mpm);
}
void Foam::displacementSBRStressFvMotionSolver::updateMesh
(
    const mapPolyMesh& mpm
)
{
    fvMotionSolver::updateMesh(mpm);

    // Map points0_
    // Map points0_. Bit special since we somehow have to come up with
    // a sensible points0 position for introduced points.
    // Find out scaling between points0 and current points

    // Get the new points either from the map or the mesh
    const pointField& points =
    (
        mpm.hasMotionPoints()
      ? mpm.preMotionPoints()
      : fvMesh_.points()
    );

    // Note: boundBox does reduce
    const boundBox bb0(points0_, true);
    const vector span0(bb0.max()-bb0.min());
    const boundBox bb(points, true);
    const vector span(bb.max()-bb.min());

    vector scaleFactors(cmptDivide(span0, span));

    pointField newPoints0(mpm.pointMap().size());

    forAll(newPoints0, pointI)
    {
        label oldPointI = mpm.pointMap()[pointI];

        if (oldPointI >= 0)
        {
            label masterPointI = mpm.reversePointMap()[oldPointI];

            if (masterPointI == pointI)
            {
                newPoints0[pointI] = points0_[oldPointI];
            }
            else
            {
                // New point. Assume motion is scaling.
                newPoints0[pointI] =
                    points0_[oldPointI]
                  + cmptMultiply
                    (
                        scaleFactors,
                        points[pointI]-points[masterPointI]
                    );
            }
        }
        else
        {
            FatalErrorIn
            (
                "displacementSBRStressFvMotionSolver::updateMesh"
                "(const mapPolyMesh& mpm)"
            )   << "Cannot work out coordinates of introduced vertices."
                << " New vertex " << pointI << " at coordinate "
                << points[pointI] << exit(FatalError);
        }
    }