Thyra Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
adapters
epetra
test
UnitTests
EpetraLinearOpParallel_UnitTests.cpp
Go to the documentation of this file.
1
/*
2
// @HEADER
3
// ***********************************************************************
4
//
5
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
6
// Copyright (2004) Sandia Corporation
7
//
8
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9
// license for use of this work by or on behalf of the U.S. Government.
10
//
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
13
// met:
14
//
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
//
38
// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
39
//
40
// ***********************************************************************
41
// @HEADER
42
*/
43
44
#include "
Thyra_EpetraLinearOp.hpp
"
45
#include "Thyra_LinearOpTester.hpp"
46
#include "Thyra_DefaultBlockedLinearOp.hpp"
47
#include "Thyra_MultiVectorBase.hpp"
48
#include "Thyra_MultiVectorStdOps.hpp"
49
#include "
EpetraLinearOpTestHelpers.hpp
"
50
51
#include "
Teuchos_UnitTestHarness.hpp
"
52
53
54
namespace
Thyra
{
55
56
57
//
58
// Unit Tests
59
//
60
61
62
TEUCHOS_UNIT_TEST
( EpetraLinearOpParallel, blocked_op )
63
{
64
65
using
Teuchos::describe;
66
67
const
int
scale=30;
68
69
// build sub operators
70
RCP<const LinearOpBase<double>
> A00 =
epetraLinearOp
(getEpetraMatrix(scale*4,scale*4,0));
71
RCP<const LinearOpBase<double>
> A01 =
epetraLinearOp
(getEpetraMatrix(scale*4,scale*3,1));
72
RCP<const LinearOpBase<double>
> A02 =
epetraLinearOp
(getEpetraMatrix(scale*4,scale*2,2));
73
RCP<const LinearOpBase<double>
> A10 =
epetraLinearOp
(getEpetraMatrix(scale*3,scale*4,3));
74
RCP<const LinearOpBase<double>
> A11 =
epetraLinearOp
(getEpetraMatrix(scale*3,scale*3,4));
75
RCP<const LinearOpBase<double>
> A12 =
epetraLinearOp
(getEpetraMatrix(scale*3,scale*2,5));
76
RCP<const LinearOpBase<double>
> A20 =
epetraLinearOp
(getEpetraMatrix(scale*2,scale*4,6));
77
RCP<const LinearOpBase<double>
> A21 =
epetraLinearOp
(getEpetraMatrix(scale*2,scale*3,8));
78
RCP<const LinearOpBase<double>
> A22 =
epetraLinearOp
(getEpetraMatrix(scale*2,scale*2,8));
79
80
out <<
"Sub operators built"
<< std::endl;
81
82
typedef
double
S;
83
const
RCP<PhysicallyBlockedLinearOpBase<S>
> M00 = defaultBlockedLinearOp<S>();
84
M00->beginBlockFill(2,2);
85
M00->setBlock(0,0,A00);
86
M00->setBlock(0,1,A02);
87
M00->setBlock(1,0,A20);
88
M00->setBlock(1,1,A22);
89
M00->endBlockFill();
90
91
out <<
"Built M00"
<< std::endl;
92
93
const
RCP<PhysicallyBlockedLinearOpBase<S>
> M10 = defaultBlockedLinearOp<S>();
94
M10->beginBlockFill(2,1);
95
M10->setBlock(0,0,A01);
96
M10->setBlock(1,0,A21);
97
M10->endBlockFill();
98
99
out <<
"Built M10"
<< std::endl;
100
101
const
RCP<PhysicallyBlockedLinearOpBase<S>
> M01 = defaultBlockedLinearOp<S>();
102
M01->beginBlockFill(1,2);
103
M01->setBlock(0,0,A10);
104
M01->setBlock(0,1,A12);
105
M01->endBlockFill();
106
107
out <<
"Built M01"
<< std::endl;
108
109
const
RCP<PhysicallyBlockedLinearOpBase<S>
> M = defaultBlockedLinearOp<S>();
110
M->beginBlockFill(2,2);
111
M->setBlock(0,0,A11);
112
M->setBlock(0,1,M01);
113
M->setBlock(1,0,M10);
114
M->setBlock(1,1,M00);
115
M->endBlockFill();
116
117
out <<
"Built M"
<< std::endl;
118
119
out <<
"M = "
<< describe(*M,
Teuchos::VERB_MEDIUM
);
120
out <<
"M->range() = "
<< describe(*M->range(),
Teuchos::VERB_MEDIUM
);
121
out <<
"M->domain() = "
<< describe(*M->range(),
Teuchos::VERB_MEDIUM
);
122
123
out <<
"Test complete"
<< std::endl;
124
125
}
126
127
128
}
// namespace Thyra
EpetraLinearOpTestHelpers.hpp
Teuchos_UnitTestHarness.hpp
Thyra_EpetraLinearOp.hpp
Teuchos::RCP
Thyra::EpetraLinearOp::epetraLinearOp
RCP< const EpetraLinearOp > epetraLinearOp(const RCP< const Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Dynamically allocate a nonconst EpetraLinearOp to wrap a const Epetra_Operator object.
Teuchos::VERB_MEDIUM
VERB_MEDIUM
Thyra
Definition
Thyra_DiagonalEpetraLinearOpWithSolveFactory.cpp:53
Thyra::TEUCHOS_UNIT_TEST
TEUCHOS_UNIT_TEST(EpetraOperatorWrapper, basic)
Definition
EpetraOperatorWrapper_UnitTests.cpp:83
Generated by
1.17.0