Thyra Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EpetraLinearOpParallel_UnitTests.cpp
Go to the documentation of this file.
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 #include "Thyra_EpetraLinearOp.hpp"
11 #include "Thyra_LinearOpTester.hpp"
12 #include "Thyra_DefaultBlockedLinearOp.hpp"
13 #include "Thyra_MultiVectorBase.hpp"
14 #include "Thyra_MultiVectorStdOps.hpp"
16 
18 
19 
20 namespace Thyra {
21 
22 
23 //
24 // Unit Tests
25 //
26 
27 
28 TEUCHOS_UNIT_TEST( EpetraLinearOpParallel, blocked_op )
29 {
30 
31  using Teuchos::describe;
32 
33  const int scale=30;
34 
35  // build sub operators
36  RCP<const LinearOpBase<double> > A00 = epetraLinearOp(getEpetraMatrix(scale*4,scale*4,0));
37  RCP<const LinearOpBase<double> > A01 = epetraLinearOp(getEpetraMatrix(scale*4,scale*3,1));
38  RCP<const LinearOpBase<double> > A02 = epetraLinearOp(getEpetraMatrix(scale*4,scale*2,2));
39  RCP<const LinearOpBase<double> > A10 = epetraLinearOp(getEpetraMatrix(scale*3,scale*4,3));
40  RCP<const LinearOpBase<double> > A11 = epetraLinearOp(getEpetraMatrix(scale*3,scale*3,4));
41  RCP<const LinearOpBase<double> > A12 = epetraLinearOp(getEpetraMatrix(scale*3,scale*2,5));
42  RCP<const LinearOpBase<double> > A20 = epetraLinearOp(getEpetraMatrix(scale*2,scale*4,6));
43  RCP<const LinearOpBase<double> > A21 = epetraLinearOp(getEpetraMatrix(scale*2,scale*3,8));
44  RCP<const LinearOpBase<double> > A22 = epetraLinearOp(getEpetraMatrix(scale*2,scale*2,8));
45 
46  out << "Sub operators built" << std::endl;
47 
48  typedef double S;
49  const RCP<PhysicallyBlockedLinearOpBase<S> > M00 = defaultBlockedLinearOp<S>();
50  M00->beginBlockFill(2,2);
51  M00->setBlock(0,0,A00);
52  M00->setBlock(0,1,A02);
53  M00->setBlock(1,0,A20);
54  M00->setBlock(1,1,A22);
55  M00->endBlockFill();
56 
57  out << "Built M00" << std::endl;
58 
59  const RCP<PhysicallyBlockedLinearOpBase<S> > M10 = defaultBlockedLinearOp<S>();
60  M10->beginBlockFill(2,1);
61  M10->setBlock(0,0,A01);
62  M10->setBlock(1,0,A21);
63  M10->endBlockFill();
64 
65  out << "Built M10" << std::endl;
66 
67  const RCP<PhysicallyBlockedLinearOpBase<S> > M01 = defaultBlockedLinearOp<S>();
68  M01->beginBlockFill(1,2);
69  M01->setBlock(0,0,A10);
70  M01->setBlock(0,1,A12);
71  M01->endBlockFill();
72 
73  out << "Built M01" << std::endl;
74 
75  const RCP<PhysicallyBlockedLinearOpBase<S> > M = defaultBlockedLinearOp<S>();
76  M->beginBlockFill(2,2);
77  M->setBlock(0,0,A11);
78  M->setBlock(0,1,M01);
79  M->setBlock(1,0,M10);
80  M->setBlock(1,1,M00);
81  M->endBlockFill();
82 
83  out << "Built M" << std::endl;
84 
85  out << "M = " << describe(*M, Teuchos::VERB_MEDIUM);
86  out << "M->range() = " << describe(*M->range(), Teuchos::VERB_MEDIUM);
87  out << "M->domain() = " << describe(*M->range(), Teuchos::VERB_MEDIUM);
88 
89  out << "Test complete" << std::endl;
90 
91 }
92 
93 
94 } // namespace Thyra
TEUCHOS_UNIT_TEST(EpetraOperatorWrapper, basic)