Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultBlockedTriangularLinearOpWithSolve_decl.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
11 #define THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
12 
13 
14 #include "Thyra_PhysicallyBlockedLinearOpWithSolveBase.hpp"
15 #include "Thyra_PhysicallyBlockedLinearOpBase.hpp"
16 #include "Thyra_ProductVectorSpaceBase.hpp"
17 #include "Teuchos_ConstNonconstObjectContainer.hpp"
18 #include "Teuchos_Array.hpp"
19 
20 
21 namespace Thyra {
22 
23 
79 template<class Scalar>
81  : virtual public PhysicallyBlockedLinearOpWithSolveBase<Scalar>
82 {
83 public:
84 
87 
90 
93 
95  void setBlocks( const RCP<const PhysicallyBlockedLinearOpBase<Scalar> > &blocks );
96 
99 
102 
104 
107 
109  bool acceptsLOWSBlock(const int i, const int j) const;
112  const int i, const int j,
113  const RCP<LinearOpWithSolveBase<Scalar> > &block
114  );
116  void setLOWSBlock(
117  const int i, const int j,
118  const RCP<const LinearOpWithSolveBase<Scalar> > &block
119  );
120 
122 
125 
127  void beginBlockFill();
129  void beginBlockFill(
130  const int numRowBlocks, const int numColBlocks
131  );
133  void beginBlockFill(
136  );
138  bool blockFillIsActive() const;
140  bool acceptsBlock(const int i, const int j) const;
142  void setNonconstBlock(
143  const int i, const int j,
144  const RCP<LinearOpBase<Scalar> > &block
145  );
147  void setBlock(
148  const int i, const int j,
149  const RCP<const LinearOpBase<Scalar> > &block
150  );
152  void endBlockFill();
154  void uninitialize();
155 
157 
160 
163  getNonconstLOWSBlock(const int i, const int j);
166  getLOWSBlock(const int i, const int j) const;
167 
169 
172 
175  productRange() const;
178  productDomain() const;
180  bool blockExists(const int i, const int j) const;
182  bool blockIsConst(const int i, const int j) const;
185  getNonconstBlock(const int i, const int j);
188  getBlock(const int i, const int j) const;
189 
191 
194 
201 
203 
206 
211  std::string description() const;
212 
220  void describe(
222  const Teuchos::EVerbosityLevel verbLevel
223  ) const;
224 
226 
227 protected:
228 
232  bool opSupportedImpl(EOpTransp M_trans) const;
234  void applyImpl(
235  const EOpTransp M_trans,
236  const MultiVectorBase<Scalar> &X,
237  const Ptr<MultiVectorBase<Scalar> > &Y,
238  const Scalar alpha,
239  const Scalar beta
240  ) const;
242 
246  bool solveSupportsImpl(EOpTransp M_trans) const;
249  EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const;
252  const EOpTransp transp,
253  const MultiVectorBase<Scalar> &B,
254  const Ptr<MultiVectorBase<Scalar> > &X,
255  const Ptr<const SolveCriteria<Scalar> > solveCriteria
256  ) const;
258 
259 private:
260 
261  // //////////////////////////
262  // Private types
263 
265  CNCLOWS;
266 
268  CNCPBLOB;
269 
270  // /////////////////////////
271  // Private data members
272 
273  bool blockFillIsActive_;
274 
277  int numDiagBlocks_;
278 
279  Array<CNCLOWS> diagonalBlocks_;
280 
281  // All blocks (including LOB form of diagonals)
282  CNCPBLOB blocks_;
283 
284  // /////////////////////////
285  // Private member functions
286 
287  void assertBlockFillIsActive(bool) const;
288 
289  void assertBlockRowCol(const int i, const int j) const;
290 
291  template<class LinearOpWithSolveType>
292  void setLOWSBlockImpl( const int i, const int j,
293  const RCP<LinearOpWithSolveType> &block );
294 
295  void assertAndSetBlockStructure(const PhysicallyBlockedLinearOpBase<Scalar>& blocks);
296 
297  // Not defined and not to be called
298 
301 
304 
305 };
306 
307 
312 template<class Scalar>
315 {
317 }
318 
319 
320 } // namespace Thyra
321 
322 
323 #endif // THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
RCP< LinearOpWithSolveBase< Scalar > > getNonconstLOWSBlock(const int i, const int j)
SolveStatus< Scalar > solveImpl(const EOpTransp transp, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
void setBlocks(const RCP< const PhysicallyBlockedLinearOpBase< Scalar > > &blocks)
Base class for all linear operators that can support a high-level solve operation.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
void setNonconstBlock(const int i, const int j, const RCP< LinearOpBase< Scalar > > &block)
RCP< const LinearOpBase< Scalar > > getBlock(const int i, const int j) const
Concrete composite LinearOpWithSolveBase subclass that creates single upper or lower block triangular...
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
void setBlock(const int i, const int j, const RCP< const LinearOpBase< Scalar > > &block)
RCP< LinearOpBase< Scalar > > getNonconstBlock(const int i, const int j)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Interface for a collection of column vectors called a multi-vector.
void setLOWSBlock(const int i, const int j, const RCP< const LinearOpWithSolveBase< Scalar > > &block)
Base interface for physically blocked linear operators.
Simple struct for the return status from a solve.
std::string description() const
Prints just the name DefaultBlockedTriangularLinearOpWithSolve along with the overall dimensions and ...
RCP< DefaultBlockedTriangularLinearOpWithSolve< Scalar > > defaultBlockedTriangularLinearOpWithSolve()
Nonmember constructor.
Base class for all linear operators.
RCP< const LinearOpWithSolveBase< Scalar > > getLOWSBlock(const int i, const int j) const
void setNonconstLOWSBlock(const int i, const int j, const RCP< LinearOpWithSolveBase< Scalar > > &block)
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent linear operators.
Base interface for linear operators with a solve that are composed out of individual LOB and LOWSB ob...
Simple struct that defines the requested solution criteria for a solve.
void setNonconstBlocks(const RCP< PhysicallyBlockedLinearOpBase< Scalar > > &blocks)