コード例 #1
0
Foam::tmp<Foam::Field<Type> > Foam::lduMatrix::H(const Field<Type>& psi) const
{
    tmp<Field<Type> > tHpsi
    (
        new Field<Type>(lduAddr().size(), pTraits<Type>::zero)
    );

    if (lowerPtr_ || upperPtr_)
    {
        Field<Type> & Hpsi = tHpsi();

        Type*  HpsiPtr = Hpsi.begin();

        const Type*  psiPtr = psi.begin();

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

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

        register const label nFaces = upper().size();

        for (register label face=0; face<nFaces; face++)
        {
            HpsiPtr[uPtr[face]] -= lowerPtr[face]*psiPtr[lPtr[face]];
            HpsiPtr[lPtr[face]] -= upperPtr[face]*psiPtr[uPtr[face]];
        }
    }

    return tHpsi;
}
コード例 #2
0
Foam::tmp<Foam::gpuField<Type> > Foam::lduMatrix::H(const gpuField<Type>& psi) const
{
    tmp<gpuField<Type> > tHpsi
    (
        new gpuField<Type>(lduAddr().size(), pTraits<Type>::zero)
    );

    H(tHpsi(),psi);

    return tHpsi;
}
コード例 #3
0
Foam::tmp<Foam::Field<Type> >
Foam::lduMatrix::H(const tmp<Field<Type> >& tpsi) const
{
    tmp<Field<Type> > tHpsi(H(tpsi()));
    tpsi.clear();
    return tHpsi;
}
コード例 #4
0
Foam::tmp<Foam::gpuField<Type> > Foam::lduMatrix::H(const gpuField<Type>& psi) const
{
    tmp<gpuField<Type> > tHpsi
    (
        new gpuField<Type>(lduAddr().size(), pTraits<Type>::zero)
    );

    if (lowerPtr_ || upperPtr_)
    {
        gpuField<Type> & Hpsi = tHpsi();

        const scalargpuField& Lower = this->lower();
        const scalargpuField& Upper = this->upper();

        const labelgpuList& l = lduAddr().lowerAddr();
        const labelgpuList& u = lduAddr().upperAddr();
        
        matrixOperation
        (
            Hpsi.begin(),
            Hpsi,
            lduAddr(),
            matrixCoeffsMultiplyFunctor<Type,scalar,negateUnaryOperatorFunctor<Type,Type> >
            (
                psi.data(),
                Upper.data(),
                u.data(),
                negateUnaryOperatorFunctor<Type,Type>()
            ),
            matrixCoeffsMultiplyFunctor<Type,scalar,negateUnaryOperatorFunctor<Type,Type> >
            (
                psi.data(),
                Lower.data(),
                l.data(),
                negateUnaryOperatorFunctor<Type,Type>()
            )
        );                                        
    }

    return tHpsi;
}