19 #ifndef GEOS_LINEARALGEBRA_UTILITIES_INVERSENORMALOPERATOR_HPP_
20 #define GEOS_LINEARALGEBRA_UTILITIES_INVERSENORMALOPERATOR_HPP_
23 #include "common/PreconditionerBase.hpp"
32 template<
typename LAI,
template<
typename >
class SOLVER >
33 bool constexpr HasApplyTranspose = traits::VectorBasedTraits< typename LAI::ParallelVector >::template HasMemberFunction_applyTranspose< SOLVER< LAI > >;
35 template<
typename LAI,
template<
typename >
class SOLVER >
36 class ExplicitTransposeInverse
42 using Solver = SOLVER< LAI >;
44 ExplicitTransposeInverse( Matrix
const & matrix, Solver
const & solver ):
45 m_transposeSolver( solver.parameters() )
47 matrix.transpose( m_transposeMatrix );
48 m_transposeSolver.setup( m_transposeMatrix );
51 void apply( Solver
const &, Vector
const & src, Vector & dst )
const
53 m_transposeSolver.apply( src, dst );
58 Matrix m_transposeMatrix;
59 Solver m_transposeSolver;
62 template<
typename LAI,
template<
typename >
class SOLVER >
63 class ImplicitTransposeInverse
69 using Solver = SOLVER< LAI >;
71 ImplicitTransposeInverse( Matrix
const &, Solver
const & )
74 void apply( Solver
const & solver, Vector
const & src, Vector & dst )
const
76 solver.applyTranspose( src, dst );
80 template<
typename LAI,
template<
typename >
class SOLVER >
81 using TransposeInverse = std::conditional_t< HasApplyTranspose< LAI, SOLVER >,
82 ImplicitTransposeInverse< LAI, SOLVER >,
83 ExplicitTransposeInverse< LAI, SOLVER > >;
92 template<
typename LAI,
template<
typename >
class SOLVER >
118 m_transposeInverse( mat, solver )
135 m_solver.apply( src, dst );
136 m_transposeInverse.apply( m_solver, dst, dst );
144 return m_matrix.numGlobalCols();
152 return m_matrix.numGlobalCols();
160 return m_matrix.numLocalCols();
168 return m_matrix.numLocalCols();
176 return m_matrix.comm();
182 using TransposeInverse = internal::TransposeInverse< LAI, SOLVER >;
191 TransposeInverse m_transposeInverse;
Wraps a matrix A and represents A^{-1} * A^{-T} as a linear operator.
MPI_Comm comm() const override
InverseNormalOperator(Matrix const &mat, Solver const &solver)
Constructor.
typename Base::Vector Vector
Alias for vector type.
SOLVER< LAI > Solver
Alias for solver type.
globalIndex numGlobalRows() const override
globalIndex numGlobalCols() const override
localIndex numLocalCols() const override
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
localIndex numLocalRows() const override
virtual ~InverseNormalOperator() override=default
Destructor.
void apply(Vector const &src, Vector &dst) const override
Apply operator to a vector.
Abstract base class for linear operators.
VECTOR Vector
Alias for template parameter.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
LAInterface::ParallelMatrix ParallelMatrix
Alias for ParallelMatrix.
LAInterface::ParallelVector ParallelVector
Alias for ParallelVector.