当前位置: 首页>>代码示例>>C++>>正文


C++ lduMatrix::lower方法代码示例

本文整理汇总了C++中lduMatrix::lower方法的典型用法代码示例。如果您正苦于以下问题:C++ lduMatrix::lower方法的具体用法?C++ lduMatrix::lower怎么用?C++ lduMatrix::lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lduMatrix的用法示例。


在下文中一共展示了lduMatrix::lower方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void Foam::DILUPreconditioner::calcReciprocalD
(
    scalarField& rD,
    const lduMatrix& matrix
)
{
    scalar* __restrict__ rDPtr = rD.begin();

    const label* const __restrict__ uPtr = matrix.lduAddr().upperAddr().begin();
    const label* const __restrict__ lPtr = matrix.lduAddr().lowerAddr().begin();

    const scalar* const __restrict__ upperPtr = matrix.upper().begin();
    const scalar* const __restrict__ lowerPtr = matrix.lower().begin();

    label nFaces = matrix.upper().size();
    for (label face=0; face<nFaces; face++)
    {
        Pout<< "Adapting diagonal for cell:" << uPtr[face]
            << " contributions from cell " << lPtr[face]
            << " from " << rDPtr[uPtr[face]];

        rDPtr[uPtr[face]] -= upperPtr[face]*lowerPtr[face]/rDPtr[lPtr[face]];

        Pout<< " to " << rDPtr[uPtr[face]] << endl;
    }


    // Calculate the reciprocal of the preconditioned diagonal
    label nCells = rD.size();

    for (label cell=0; cell<nCells; cell++)
    {
        rDPtr[cell] = 1.0/rDPtr[cell];
    }
}
开发者ID:mattijsjanssens,项目名称:mattijs-extensions,代码行数:35,代码来源:DILUPreconditioner.C

示例2:

void Foam::DILUPreconditioner::calcReciprocalD
(
    scalarField& rD,
    const lduMatrix& matrix
)
{
    scalar* __restrict__ rDPtr = rD.begin();

    const label* const __restrict__ uPtr =
        matrix.lduAddr().upperAddr().begin();
    const label* const __restrict__ lPtr =
        matrix.lduAddr().lowerAddr().begin();

    const scalar* const __restrict__ upperPtr = matrix.upper().begin();
    const scalar* const __restrict__ lowerPtr = matrix.lower().begin();

    register label nFaces = matrix.upper().size();
    for (register label face=0; face<nFaces; face++)
    {
        rDPtr[uPtr[face]] -= upperPtr[face]*lowerPtr[face]/rDPtr[lPtr[face]];
    }


    // Calculate the reciprocal of the preconditioned diagonal
    register label nCells = rD.size();

    for (register label cell=0; cell<nCells; cell++)
    {
        rDPtr[cell] = 1.0/rDPtr[cell];
    }
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:31,代码来源:DILUPreconditioner.C

示例3: if

void Foam::lduMatrix::operator=(const lduMatrix& A)
{
    if (this == &A)
    {
        FatalError
            << "lduMatrix::operator=(const lduMatrix&) : "
            << "attempted assignment to self"
            << abort(FatalError);
    }

    if (A.lowerPtr_)
    {
        lower() = A.lower();
    }
    else if (lowerPtr_)
    {
        delete lowerPtr_;
        lowerPtr_ = NULL;
    }

    if (A.upperPtr_)
    {
        upper() = A.upper();
    }
    else if (upperPtr_)
    {
        delete upperPtr_;
        upperPtr_ = NULL;
    }

    if (A.diagPtr_)
    {
        diag() = A.diag();
    }
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:35,代码来源:lduMatrixOperations.C

示例4:

void Foam::coupledGaussSeidelPrecon::reverseSweepTranspose
(
    const lduMatrix& matrix,
    scalarField& x,
    scalarField& bPrime
) const
{
    const scalarField& diag = matrix.diag();
    const scalarField& lower = matrix.lower();
    const scalarField& upper = matrix.upper();

    const labelList& upperAddr = matrix.lduAddr().upperAddr();
    const labelList& ownStartAddr = matrix.lduAddr().ownerStartAddr();

    const label nRows = x.size();
    label fStart, fEnd;

    for (register label rowI = nRows - 1; rowI >= 0; rowI--)
    {
        // lRow is equal to rowI
        scalar& curX = x[rowI];

        // Grab the accumulated neighbour side
        curX = bPrime[rowI];

        // Start and end of this row
        fStart = ownStartAddr[rowI];
        fEnd = ownStartAddr[rowI + 1];

        // Accumulate the owner product side
        for (register label curCoeff = fStart; curCoeff < fEnd; curCoeff++)
        {
            // Transpose multiplication.  HJ, 19/Jan/2009
            curX -= lower[curCoeff]*x[upperAddr[curCoeff]];
        }

        // Finish current x
        curX /= diag[rowI];

        // Distribute the neighbour side using current x
        for (register label curCoeff = fStart; curCoeff < fEnd; curCoeff++)
        {
            // Transpose multiplication.  HJ, 19/Jan/2009
            bPrime[upperAddr[curCoeff]] -= upper[curCoeff]*curX;
        }
    }
}
开发者ID:GoldenMan123,项目名称:openfoam-extend-foam-extend-3.1,代码行数:47,代码来源:coupledGaussSeidelPrecon.C

示例5: forAll

Foam::procLduMatrix::procLduMatrix
(
    const lduMatrix& ldum,
    const FieldField<Field, scalar>& interfaceCoeffs,
    const lduInterfaceFieldPtrsList& interfaces
)
:
    upperAddr_(ldum.lduAddr().upperAddr()),
    lowerAddr_(ldum.lduAddr().lowerAddr()),
    diag_(ldum.diag()),
    upper_(ldum.upper()),
    lower_(ldum.lower())
{
    label nInterfaces = 0;

    forAll(interfaces, i)
    {
        if (interfaces.set(i))
        {
            nInterfaces++;
        }
    }

    interfaces_.setSize(nInterfaces);

    nInterfaces = 0;

    forAll(interfaces, i)
    {
        if (interfaces.set(i))
        {
            interfaces_.set
            (
                nInterfaces++,
                new procLduInterface
                (
                    interfaces[i],
                    interfaceCoeffs[i]
                )
            );
        }
    }

}
开发者ID:000861,项目名称:OpenFOAM-2.1.x,代码行数:44,代码来源:procLduMatrix.C

示例6: pairGAMGAgglomeration

Foam::algebraicPairGAMGAgglomeration::algebraicPairGAMGAgglomeration
(
    const lduMatrix& matrix,
    const dictionary& controlDict
)
:
    pairGAMGAgglomeration(matrix.mesh(), controlDict)
{
    const lduMesh& mesh = matrix.mesh();

    if (matrix.hasLower())
    {
        agglomerate(mesh, max(mag(matrix.upper()), mag(matrix.lower())));
    }
    else
    {
        agglomerate(mesh, mag(matrix.upper()));
    }
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:19,代码来源:algebraicPairGAMGAgglomeration.C

示例7: if

void Foam::lduMatrix::operator-=(const lduMatrix& A)
{
    if (A.diagPtr_)
    {
        diag() -= A.diag();
    }

    if (symmetric() && A.symmetric())
    {
        upper() -= A.upper();
    }
    else if (symmetric() && A.asymmetric())
    {
        if (upperPtr_)
        {
            lower();
        }
        else
        {
            upper();
        }

        upper() -= A.upper();
        lower() -= A.lower();
    }
    else if (asymmetric() && A.symmetric())
    {
        if (A.upperPtr_)
        {
            lower() -= A.upper();
            upper() -= A.upper();
        }
        else
        {
            lower() -= A.lower();
            upper() -= A.lower();
        }

    }
    else if (asymmetric() && A.asymmetric())
    {
        lower() -= A.lower();
        upper() -= A.upper();
    }
    else if (diagonal())
    {
        if (A.upperPtr_)
        {
            upper() = -A.upper();
        }

        if (A.lowerPtr_)
        {
            lower() = -A.lower();
        }
    }
    else if (A.diagonal())
    {
    }
    else
    {
        if (debug > 1)
        {
            WarningIn("lduMatrix::operator-=(const lduMatrix& A)")
                << "Unknown matrix type combination" << nl
                << "    this :"
                << " diagonal:" << diagonal()
                << " symmetric:" << symmetric()
                << " asymmetric:" << asymmetric() << nl
                << "    A    :"
                << " diagonal:" << A.diagonal()
                << " symmetric:" << A.symmetric()
                << " asymmetric:" << A.asymmetric()
                << endl;
        }
    }
}
开发者ID:CFD-worker,项目名称:OpenFOAM-2.3.x,代码行数:77,代码来源:lduMatrixOperations.C

示例8: bPrime

void Foam::symGaussSeidelSmoother::smooth
(
    const word& fieldName_,
    scalarField& psi,
    const lduMatrix& matrix_,
    const scalarField& source,
    const FieldField<Field, scalar>& interfaceBouCoeffs_,
    const lduInterfaceFieldPtrsList& interfaces_,
    const direction cmpt,
    const label nSweeps
)
{
    scalar* __restrict__ psiPtr = psi.begin();

    const label nCells = psi.size();

    scalarField bPrime(nCells);
    scalar* __restrict__ bPrimePtr = bPrime.begin();

    const scalar* const __restrict__ diagPtr = matrix_.diag().begin();
    const scalar* const __restrict__ upperPtr =
        matrix_.upper().begin();
    const scalar* const __restrict__ lowerPtr =
        matrix_.lower().begin();

    const label* const __restrict__ uPtr =
        matrix_.lduAddr().upperAddr().begin();

    const label* const __restrict__ ownStartPtr =
        matrix_.lduAddr().ownerStartAddr().begin();


    // Parallel boundary initialisation.  The parallel boundary is treated
    // as an effective jacobi interface in the boundary.
    // Note: there is a change of sign in the coupled
    // interface update.  The reason for this is that the
    // internal coefficients are all located at the l.h.s. of
    // the matrix whereas the "implicit" coefficients on the
    // coupled boundaries are all created as if the
    // coefficient contribution is of a source-kind (i.e. they
    // have a sign as if they are on the r.h.s. of the matrix.
    // To compensate for this, it is necessary to turn the
    // sign of the contribution.

    FieldField<Field, scalar>& mBouCoeffs =
        const_cast<FieldField<Field, scalar>&>
        (
            interfaceBouCoeffs_
        );

    forAll(mBouCoeffs, patchi)
    {
        if (interfaces_.set(patchi))
        {
            mBouCoeffs[patchi].negate();
        }
    }


    for (label sweep=0; sweep<nSweeps; sweep++)
    {
        bPrime = source;

        matrix_.initMatrixInterfaces
        (
            mBouCoeffs,
            interfaces_,
            psi,
            bPrime,
            cmpt
        );

        matrix_.updateMatrixInterfaces
        (
            mBouCoeffs,
            interfaces_,
            psi,
            bPrime,
            cmpt
        );

        scalar psii;
        label fStart;
        label fEnd = ownStartPtr[0];

        for (label celli=0; celli<nCells; celli++)
        {
            // Start and end of this row
            fStart = fEnd;
            fEnd = ownStartPtr[celli + 1];

            // Get the accumulated neighbour side
            psii = bPrimePtr[celli];

            // Accumulate the owner product side
            for (label facei=fStart; facei<fEnd; facei++)
            {
                psii -= upperPtr[facei]*psiPtr[uPtr[facei]];
            }

//.........这里部分代码省略.........
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:101,代码来源:symGaussSeidelSmoother.C


注:本文中的lduMatrix::lower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。