本文整理汇总了C++中lduMatrix::Amul方法的典型用法代码示例。如果您正苦于以下问题:C++ lduMatrix::Amul方法的具体用法?C++ lduMatrix::Amul怎么用?C++ lduMatrix::Amul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lduMatrix
的用法示例。
在下文中一共展示了lduMatrix::Amul方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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];
}
示例2: 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
//.........这里部分代码省略.........