• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ lduMatrix类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了lduMatrix类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


示例3:

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


示例4: pairGAMGAgglomeration

Foam::algebraicPairGAMGAgglomeration::algebraicPairGAMGAgglomeration
(
    const lduMatrix& matrix,
    const dictionary& dict
)
:
    pairGAMGAgglomeration(matrix.mesh(), dict)
{
    agglomerate(matrix.mesh(), mag(matrix.upper()));
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:10,代码来源:algebraicPairGAMGAgglomeration.C


示例5: forAll

void Foam::GAMGSolver::scale
(
    scalarField& field,
    scalarField& Acf,
    const lduMatrix& A,
    const FieldField<Field, scalar>& interfaceLevelBouCoeffs,
    const lduInterfaceFieldPtrsList& interfaceLevel,
    const scalarField& source,
    const direction cmpt
) const
{
    A.Amul
    (
        Acf,
        field,
        interfaceLevelBouCoeffs,
        interfaceLevel,
        cmpt
    );

    scalar scalingFactorNum = 0.0;
    scalar scalingFactorDenom = 0.0;

    forAll(field, i)
    {
        scalingFactorNum += source[i]*field[i];
        scalingFactorDenom += Acf[i]*field[i];
    }
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:28,代码来源:GAMGSolverScale.C


示例6: forAll

Foam::symGaussSeidelPrecon::symGaussSeidelPrecon
(
    const lduMatrix& matrix,
    const FieldField<Field, scalar>& coupleBouCoeffs,
    const FieldField<Field, scalar>& coupleIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const dictionary& dict
)
:
    lduPreconditioner
    (
        matrix,
        coupleBouCoeffs,
        coupleIntCoeffs,
        interfaces
    ),
    mBouCoeffs_(coupleBouCoeffs.size()),
    bPrime_(matrix.lduAddr().size())
{
    forAll(mBouCoeffs_, i)
    {
        if (interfaces_.set(i))
        {
            mBouCoeffs_.set(i, -coupleBouCoeffs_[i]);
        }
    }
}
开发者ID:leehowe,项目名称:OpenFOAM-2.1.0,代码行数:27,代码来源:symGaussSeidelPrecon.C


示例7:

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


示例8: 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


示例9: readControls

Foam::GAMGSolver::GAMGSolver
(
    const word& fieldName,
    const lduMatrix& matrix,
    const FieldField<gpuField, scalar>& interfaceBouCoeffs,
    const FieldField<gpuField, scalar>& interfaceIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const dictionary& solverControls
)
:
    lduMatrix::solver
    (
        fieldName,
        matrix,
        interfaceBouCoeffs,
        interfaceIntCoeffs,
        interfaces,
        solverControls
    ),

    cacheAgglomeration_(true),
    nPreSweeps_(0),
    preSweepsLevelMultiplier_(1),
    maxPreSweeps_(4),
    nPostSweeps_(2),
    postSweepsLevelMultiplier_(1),
    maxPostSweeps_(4),
    nFinestSweeps_(2),
    interpolateCorrection_(false),
    scaleCorrection_(matrix.symmetric()),
    agglomeration_(GAMGAgglomeration::New(matrix_, controlDict_)),

    matrixLevels_(agglomeration_.size()),
    primitiveInterfaceLevels_(agglomeration_.size()),
    interfaceLevels_(agglomeration_.size()),
    interfaceLevelsBouCoeffs_(agglomeration_.size()),
    interfaceLevelsIntCoeffs_(agglomeration_.size())
{
    readControls();

    forAll(agglomeration_, fineLevelIndex)
    {
        // Agglomerate on to coarse level mesh
        agglomerateMatrix
        (
            fineLevelIndex,
            agglomeration_.meshLevel(fineLevelIndex + 1),
            agglomeration_.interfaceLevel(fineLevelIndex + 1)
        );
    }
开发者ID:Kiiree,项目名称:RapidCFD-dev,代码行数:50,代码来源:GAMGSolver.C


示例10: readLabel

Foam::amgPrecon::amgPrecon
(
    const lduMatrix& matrix,
    const FieldField<Field, scalar>& coupleBouCoeffs,
    const FieldField<Field, scalar>& coupleIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaceFields,
    const dictionary& dict
)
:
    lduPreconditioner
    (
        matrix,
        coupleBouCoeffs,
        coupleIntCoeffs,
        interfaceFields
    ),
    cycle_(amgCycle::cycleNames_.read(dict.lookup("cycle"))),
    nPreSweeps_(readLabel(dict.lookup("nPreSweeps"))),
    nPostSweeps_(readLabel(dict.lookup("nPostSweeps"))),
    nMaxLevels_(readLabel(dict.lookup("nMaxLevels"))),
    scale_(dict.lookup("scale")),
    amgPtr_
    (
        new amgCycle
        (
            autoPtr<amgLevel>
            (
                new fineAmgLevel
                (
                    matrix,
                    coupleBouCoeffs,
                    coupleIntCoeffs,
                    interfaceFields,
                    dict,
                    dict.lookup("policy"),
                    readLabel(dict.lookup("groupSize")),
                    readLabel(dict.lookup("minCoarseEqns")),
                    dict.lookup("smoother")
                )
            )
        )
    ),
    xBuffer_(matrix.lduAddr().size())
{
    // Make coarse levels
    amgPtr_->makeCoarseLevels(nMaxLevels_);
}
开发者ID:leehowe,项目名称:OpenFOAM-2.1.0,代码行数:47,代码来源:amgPrecon.C


示例11:

Foam::symGaussSeidelPrecon::symGaussSeidelPrecon
(
    const lduMatrix& matrix,
    const FieldField<Field, scalar>& coupleBouCoeffs,
    const FieldField<Field, scalar>& coupleIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces
)
:
    lduPreconditioner
    (
        matrix,
        coupleBouCoeffs,
        coupleIntCoeffs,
        interfaces
    ),
    bPrime_(matrix.lduAddr().size())
{}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:17,代码来源:symGaussSeidelPrecon.C


示例12: calcReciprocalD

Foam::DILUPreconditioner::DILUPreconditioner
(
    const lduMatrix& matrix,
    const FieldField<Field, scalar>& coupleBouCoeffs,
    const FieldField<Field, scalar>& coupleIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const dictionary& 
)
:
    lduPreconditioner
    (
        matrix,
        coupleBouCoeffs,
        coupleIntCoeffs,
        interfaces
    ),
    rD_(matrix.diag())
{
    calcReciprocalD(rD_, matrix);
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:20,代码来源:DILUPreconditioner.C


示例13: 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


示例14: 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


示例15: name

Foam::autoPtr<Foam::lduMatrix::solver> Foam::lduMatrix::solver::New
(
    const word& fieldName,
    const lduMatrix& matrix,
    const FieldField<Field, scalar>& interfaceBouCoeffs,
    const FieldField<Field, scalar>& interfaceIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const dictionary& solverControls
)
{
    const word name(solverControls.lookup("solver"));

    if (matrix.diagonal())
    {
        return autoPtr<lduMatrix::solver>
        (
            new diagonalSolver
            (
                fieldName,
                matrix,
                interfaceBouCoeffs,
                interfaceIntCoeffs,
                interfaces,
                solverControls
            )
        );
    }
    else if (matrix.symmetric())
    {
        symMatrixConstructorTable::iterator constructorIter =
            symMatrixConstructorTablePtr_->find(name);

        if (constructorIter == symMatrixConstructorTablePtr_->end())
        {
            FatalIOErrorIn
            (
                "lduMatrix::solver::New", solverControls
            )   << "Unknown symmetric matrix solver " << name << nl << nl
                << "Valid symmetric matrix solvers are :" << endl
                << symMatrixConstructorTablePtr_->sortedToc()
                << exit(FatalIOError);
        }

        return autoPtr<lduMatrix::solver>
        (
            constructorIter()
            (
                fieldName,
                matrix,
                interfaceBouCoeffs,
                interfaceIntCoeffs,
                interfaces,
                solverControls
            )
        );
    }
    else if (matrix.asymmetric())
    {
        asymMatrixConstructorTable::iterator constructorIter =
            asymMatrixConstructorTablePtr_->find(name);

        if (constructorIter == asymMatrixConstructorTablePtr_->end())
        {
            FatalIOErrorIn
            (
                "lduMatrix::solver::New", solverControls
            )   << "Unknown asymmetric matrix solver " << name << nl << nl
                << "Valid asymmetric matrix solvers are :" << endl
                << asymMatrixConstructorTablePtr_->sortedToc()
                << exit(FatalIOError);
        }

        return autoPtr<lduMatrix::solver>
        (
            constructorIter()
            (
                fieldName,
                matrix,
                interfaceBouCoeffs,
                interfaceIntCoeffs,
                interfaces,
                solverControls
            )
        );
    }
    else
    {
        FatalIOErrorIn
        (
            "lduMatrix::solver::New", solverControls
        )   << "cannot solve incomplete matrix, "
               "no diagonal or off-diagonal coefficient"
            << exit(FatalIOError);

        return autoPtr<lduMatrix::solver>(NULL);
    }
}
开发者ID:000861,项目名称:OpenFOAM-2.1.x,代码行数:97,代码来源:lduMatrixSolver.C


示例16: scalingVector

void Foam::GAMGSolver::scale
(
    scalargpuField& field,
    scalargpuField& Acf,
    const lduMatrix& A,
    const FieldField<gpuField, scalar>& interfaceLevelBouCoeffs,
    const lduInterfaceFieldPtrsList& interfaceLevel,
    const scalargpuField& source,
    const direction cmpt
) const
{
    A.Amul
    (
        Acf,
        field,
        interfaceLevelBouCoeffs,
        interfaceLevel,
        cmpt
    );

    scalar scalingFactorNum = 0.0;
    scalar scalingFactorDenom = 0.0;

    scalingFactorNum  = 
        thrust::reduce
        (
            thrust::make_transform_iterator
            (
                thrust::make_zip_iterator(thrust::make_tuple
                (
                    source.begin(),
                    field.begin()
                )),
                multiplyTupleFunctor()
            ),
            thrust::make_transform_iterator
            (
                thrust::make_zip_iterator(thrust::make_tuple
                (
                    source.end(),
                    field.end()
                )),
                multiplyTupleFunctor()
            ),
            0.0,
            thrust::plus<scalar>()
        );

    scalingFactorDenom  = 
        thrust::reduce
        (
            thrust::make_transform_iterator
            (
                thrust::make_zip_iterator(thrust::make_tuple
                (
                    Acf.begin(),
                    field.begin()
                )),
                multiplyTupleFunctor()
            ),
            thrust::make_transform_iterator
            (
                thrust::make_zip_iterator(thrust::make_tuple
                (
                    Acf.end(),
                    field.end()
                )),
                multiplyTupleFunctor()
            ),
            0.0,
            thrust::plus<scalar>()
        );

/*
    forAll(field, i)
    {
        scalingFactorNum += source[i]*field[i];
        scalingFactorDenom += Acf[i]*field[i];
    }
*/
    vector2D scalingVector(scalingFactorNum, scalingFactorDenom);
    A.mesh().reduce(scalingVector, sumOp<vector2D>());

    scalar sf = scalingVector.x()/stabilise(scalingVector.y(), VSMALL);

    if (debug >= 2)
    {
        Pout<< sf << " ";
    }

    const scalargpuField& D = A.diag();

/*
    forAll(field, i)
    {
        field[i] = sf*field[i] + (source[i] - sf*Acf[i])/D[i];
    }
*/

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


示例17: comm_

Foam::LUscalarMatrix::LUscalarMatrix
(
    const lduMatrix& ldum,
    const FieldField<Field, scalar>& interfaceCoeffs,
    const lduInterfaceFieldPtrsList& interfaces
)
:
    comm_(ldum.mesh().comm())
{
    if (Pstream::parRun())
    {
        PtrList<procLduMatrix> lduMatrices(Pstream::nProcs(comm_));

        label lduMatrixi = 0;

        lduMatrices.set
        (
            lduMatrixi++,
            new procLduMatrix
            (
                ldum,
                interfaceCoeffs,
                interfaces
            )
        );

        if (Pstream::master(comm_))
        {
            for
            (
                int slave=Pstream::firstSlave();
                slave<=Pstream::lastSlave(comm_);
                slave++
            )
            {
                lduMatrices.set
                (
                    lduMatrixi++,
                    new procLduMatrix
                    (
                        IPstream
                        (
                            Pstream::commsTypes::scheduled,
                            slave,
                            0,          // bufSize
                            Pstream::msgType(),
                            comm_
                        )()
                    )
                );
            }
        }
        else
        {
            OPstream toMaster
            (
                Pstream::commsTypes::scheduled,
                Pstream::masterNo(),
                0,              // bufSize
                Pstream::msgType(),
                comm_
            );
            procLduMatrix cldum
            (
                ldum,
                interfaceCoeffs,
                interfaces
            );
            toMaster<< cldum;

        }

        if (Pstream::master(comm_))
        {
            label nCells = 0;
            forAll(lduMatrices, i)
            {
                nCells += lduMatrices[i].size();
            }

            scalarSquareMatrix m(nCells, 0.0);
            transfer(m);
            convert(lduMatrices);
        }
    }
    else
    {
开发者ID:petebachant,项目名称:OpenFOAM-dev,代码行数:87,代码来源:LUscalarMatrix.C


示例18: diag

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
    {
        FatalErrorIn("lduMatrix::operator-=(const lduMatrix& A)")
            << "Unknown matrix type combination"
            << abort(FatalError);
    }
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:66,代码来源:lduMatrixOperations.C


示例19: sqr

Foam::FDICPreconditioner::FDICPreconditioner
(
    const lduMatrix& matrix,
    const FieldField<Field, scalar>& coupleBouCoeffs,
    const FieldField<Field, scalar>& coupleIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const dictionary& 
)
:
    lduPreconditioner
    (
        matrix,
        coupleBouCoeffs,
        coupleIntCoeffs,
        interfaces
    ),
    rD_(matrix.diag()),
    rDuUpper_(matrix.upper().size()),
    rDlUpper_(matrix.upper().size())
{
    scalar* __restrict__ rDPtr = rD_.begin();
    scalar* __restrict__ rDuUpperPtr = rDuUpper_.begin();
    scalar* __restrict__ rDlUpperPtr = rDlUpper_.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();

    register label nCells = rD_.size();
    register label nFaces = matrix_.upper().size();

    for (register label face=0; face<nFaces; face++)
    {
        #ifdef ICC_IA64_PREFETCH
        __builtin_prefetch (&uPtr[face+96],0,0);
        __builtin_prefetch (&lPtr[face+96],0,0);
        __builtin_prefetch (&upperPtr[face+96],0,1);
        __builtin_prefetch (&rDPtr[lPtr[face+24]],0,1);
        __builtin_prefetch (&rDPtr[uPtr[face+24]],1,1);
        #endif

        rDPtr[uPtr[face]] -= sqr(upperPtr[face])/rDPtr[lPtr[face]];
    }

    #ifdef ICC_IA64_PREFETCH
    #pragma ivdep
    #endif

    // Generate reciprocal FDIC
    for (register label cell=0; cell<nCells; cell++)
    {
        #ifdef ICC_IA64_PREFETCH
        __builtin_prefetch (&rDPtr[cell+96],0,1);
        #endif

        rDPtr[cell] = 1.0/rDPtr[cell];
    }

    #ifdef ICC_IA64_PREFETCH
    #pragma ivdep
    #endif

    for (register label face=0; face<nFaces; face++)
    {
        #ifdef ICC_IA64_PREFETCH
        __builtin_prefetch (&uPtr[face+96],0,0);
        __builtin_prefetch (&lPtr[face+96],0,0);
        __builtin_prefetch (&upperPtr[face+96],0,0);
        __builtin_prefetch (&rDuUpperPtr[face+96],0,0);
        __builtin_prefetch (&rDlUpperPtr[face+96],0,0);
        __builtin_prefetch (&rDPtr[uPtr[face+32]],0,1);
        __builtin_prefetch (&rDPtr[lPtr[face+32]],0,1);
        #endif

        rDuUpperPtr[face] = rDPtr[uPtr[face]]*upperPtr[face];
        rDlUpperPtr[face] = rDPtr[lPtr[face]]*upperPtr[face];
    }
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:80,代码来源:FDICPreconditioner.C


示例20: diag

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ line类代码示例发布时间:2022-05-31
下一篇:
C++ lazy_entry类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap