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 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
43 #define THYRA_DEFAULT_BLOCKED_TRIANGULAR_LINEAR_OP_WITH_SOLVE_DECL_HPP
44 
45 
46 #include "Thyra_PhysicallyBlockedLinearOpWithSolveBase.hpp"
47 #include "Thyra_PhysicallyBlockedLinearOpBase.hpp"
48 #include "Thyra_ProductVectorSpaceBase.hpp"
49 #include "Teuchos_ConstNonconstObjectContainer.hpp"
50 #include "Teuchos_Array.hpp"
51 
52 
53 namespace Thyra {
54 
55 
111 template<class Scalar>
113  : virtual public PhysicallyBlockedLinearOpWithSolveBase<Scalar>
114 {
115 public:
116 
119 
122 
125 
127  void setBlocks( const RCP<const PhysicallyBlockedLinearOpBase<Scalar> > &blocks );
128 
131 
134 
136 
139 
141  bool acceptsLOWSBlock(const int i, const int j) const;
144  const int i, const int j,
145  const RCP<LinearOpWithSolveBase<Scalar> > &block
146  );
148  void setLOWSBlock(
149  const int i, const int j,
150  const RCP<const LinearOpWithSolveBase<Scalar> > &block
151  );
152 
154 
157 
159  void beginBlockFill();
161  void beginBlockFill(
162  const int numRowBlocks, const int numColBlocks
163  );
165  void beginBlockFill(
168  );
170  bool blockFillIsActive() const;
172  bool acceptsBlock(const int i, const int j) const;
174  void setNonconstBlock(
175  const int i, const int j,
176  const RCP<LinearOpBase<Scalar> > &block
177  );
179  void setBlock(
180  const int i, const int j,
181  const RCP<const LinearOpBase<Scalar> > &block
182  );
184  void endBlockFill();
186  void uninitialize();
187 
189 
192 
195  getNonconstLOWSBlock(const int i, const int j);
198  getLOWSBlock(const int i, const int j) const;
199 
201 
204 
207  productRange() const;
210  productDomain() const;
212  bool blockExists(const int i, const int j) const;
214  bool blockIsConst(const int i, const int j) const;
217  getNonconstBlock(const int i, const int j);
220  getBlock(const int i, const int j) const;
221 
223 
226 
233 
235 
238 
243  std::string description() const;
244 
252  void describe(
254  const Teuchos::EVerbosityLevel verbLevel
255  ) const;
256 
258 
259 protected:
260 
264  bool opSupportedImpl(EOpTransp M_trans) const;
266  void applyImpl(
267  const EOpTransp M_trans,
268  const MultiVectorBase<Scalar> &X,
269  const Ptr<MultiVectorBase<Scalar> > &Y,
270  const Scalar alpha,
271  const Scalar beta
272  ) const;
274 
278  bool solveSupportsImpl(EOpTransp M_trans) const;
281  EOpTransp M_trans, const SolveMeasureType& solveMeasureType) const;
284  const EOpTransp transp,
285  const MultiVectorBase<Scalar> &B,
286  const Ptr<MultiVectorBase<Scalar> > &X,
287  const Ptr<const SolveCriteria<Scalar> > solveCriteria
288  ) const;
290 
291 private:
292 
293  // //////////////////////////
294  // Private types
295 
297  CNCLOWS;
298 
300  CNCPBLOB;
301 
302  // /////////////////////////
303  // Private data members
304 
305  bool blockFillIsActive_;
306 
309  int numDiagBlocks_;
310 
311  Array<CNCLOWS> diagonalBlocks_;
312 
313  // All blocks (including LOB form of diagonals)
314  CNCPBLOB blocks_;
315 
316  // /////////////////////////
317  // Private member functions
318 
319  void assertBlockFillIsActive(bool) const;
320 
321  void assertBlockRowCol(const int i, const int j) const;
322 
323  template<class LinearOpWithSolveType>
324  void setLOWSBlockImpl( const int i, const int j,
325  const RCP<LinearOpWithSolveType> &block );
326 
327  void assertAndSetBlockStructure(const PhysicallyBlockedLinearOpBase<Scalar>& blocks);
328 
329  // Not defined and not to be called
330 
333 
336 
337 };
338 
339 
344 template<class Scalar>
347 {
349 }
350 
351 
352 } // namespace Thyra
353 
354 
355 #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)