Stratimikos Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
adapters
aztecoo
test
test_single_aztecoo_thyra_solver_driver.cpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Stratimikos: Thyra-based strategies for linear solvers
5
// Copyright (2006) 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 (rabartl@sandia.gov)
38
//
39
// ***********************************************************************
40
// @HEADER
41
42
#include "
test_single_aztecoo_thyra_solver.hpp
"
43
#include "Teuchos_GlobalMPISession.hpp"
44
#include "Teuchos_CommandLineProcessor.hpp"
45
#include "Teuchos_ParameterList.hpp"
46
47
int
main
(
int
argc,
char
* argv[])
48
{
49
50
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
51
52
using
Teuchos::CommandLineProcessor;
53
54
bool
success =
true
;
55
bool
verbose =
true
;
56
57
Teuchos::FancyOStream out(Teuchos::rcp(&std::cout,
false
));
58
59
try
{
60
61
//
62
// Read options from command-line
63
//
64
65
std::string matrixFile =
""
;
66
bool
testTranspose =
true
;
67
int
numRandomVectors = 1;
68
double
maxFwdError = 1e-14;
69
int
maxIterations = 400;
70
double
maxResid = 1e-6;
71
double
maxSolutionError = 1e-6;
72
bool
showAllTests =
false
;
73
bool
dumpAll =
false
;
74
std::string aztecOutputLevel =
"freq"
;
75
int
aztecOutputFreq = 0;
76
std::string aztecPrec =
"none"
;
77
std::string aztecSubdomainSolve =
"ilu"
;
78
79
CommandLineProcessor clp(
false
);
// Don't throw exceptions
80
clp.setOption(
"matrix-file"
, &matrixFile,
"Matrix input file [Required]."
);
81
clp.setOption(
"test-transpose"
,
"no-test-transpose"
, &testTranspose,
"Test the transpose solve or not."
);
82
clp.setOption(
"num-random-vectors"
, &numRandomVectors,
"Number of times a test is performed with different random vectors."
);
83
clp.setOption(
"max-fwd-error"
, &maxFwdError,
"The maximum relative error in the forward operator."
);
84
clp.setOption(
"max-iters"
, &maxIterations,
"The maximum number of linear solver iterations to take."
);
85
clp.setOption(
"max-resid"
, &maxResid,
"The maximum relative error in the residual."
);
86
clp.setOption(
"max-solution-error"
, &maxSolutionError,
"The maximum relative error in the solution of the linear system."
);
87
clp.setOption(
"verbose"
,
"quiet"
, &verbose,
"Set if output is printed or not."
);
88
clp.setOption(
"show-all-tests"
,
"no-show-all-tests"
, &showAllTests,
"Set if all the tests are shown or not."
);
89
clp.setOption(
"dump-all"
,
"no-dump-all"
, &dumpAll,
"Determines if vectors are printed or not."
);
90
clp.setOption(
"aztec-output-level"
, &aztecOutputLevel,
"Aztec output level (freq,last,summary,warnings,all)"
);
91
clp.setOption(
"aztec-output-freq"
, &aztecOutputFreq,
"Aztec output freqency (> 0)"
);
92
clp.setOption(
"aztec-prec"
, &aztecPrec,
"Type of aztec preconditioner (none,sym_GS,Neumann,Jacobi,ls,dom_decomp)"
);
93
clp.setOption(
"aztec-subdomain-solve"
, &aztecSubdomainSolve,
"Type of subdomain solve for --aztec-prec==dom_decomp only (ilu,ilut)"
);
94
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
95
if
( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return
parse_return;
96
97
TEUCHOS_TEST_FOR_EXCEPT( matrixFile ==
""
);
98
99
Teuchos::ParameterList
100
paramList(
"AztecOOLinearOpWithSolve"
);
101
Teuchos::ParameterList
102
&fwdSolveParamList = paramList.sublist(
"Forward Solve"
),
103
&adjSolveParamList = paramList.sublist(
"Adjoint Solve"
);
104
fwdSolveParamList.set(
"Max Iterations"
,maxIterations);
105
adjSolveParamList.set(
"Max Iterations"
,maxIterations);
106
/*
107
Teuchos::ParameterList
108
&fwdAztecOOParamList = fwdSolveParamList.sublist("AztecOO"),
109
&adjAztecOOParamList = fwdSolveParamList.sublist("AztecOO");
110
if( aztecOutputLevel != "freq" ) {
111
fwdAztecOOParamList.set("Output Frequency",aztecOutputLevel);
112
adjAztecOOParamList.set("Output Frequency",aztecOutputLevel);
113
}
114
else {
115
fwdAztecOOParamList.set("Output Frequency",aztecOutputFreq);
116
adjAztecOOParamList.set("Output Frequency",aztecOutputFreq);
117
}
118
if( aztecPrec != "none" ) {
119
fwdAztecOOParamList.set("Aztec Preconditioner",aztecPrec);
120
adjAztecOOParamList.set("Aztec Preconditioner",aztecPrec);
121
if(aztecPrec=="dom_decomp") {
122
fwdAztecOOParamList.set("AZ_subdomain_solve",aztecSubdomainSolve);
123
adjAztecOOParamList.set("AZ_subdomain_solve",aztecSubdomainSolve);
124
}
125
}
126
*/
127
128
success
129
=
Thyra::test_single_aztecoo_thyra_solver
(
130
matrixFile,testTranspose,numRandomVectors
131
,maxFwdError,maxResid,maxSolutionError,showAllTests,dumpAll
132
,¶mList
133
,verbose?&out:0
134
);
135
136
}
137
catch
(
const
std::exception &excpt ) {
138
std::cerr <<
"*** Caught standard exception : "
<< excpt.what() << std::endl;
139
success =
false
;
140
}
141
catch
( ... ) {
142
std::cerr <<
"*** Caught an unknown exception\n"
;
143
success =
false
;
144
}
145
146
if
(verbose) {
147
if
(success) out <<
"\nCongratulations! All of the tests checked out!\n"
;
148
else
out <<
"\nOh no! At least one of the tests failed!\n"
;
149
}
150
151
return
( success ? 0 : 1 );
152
}
Thyra::test_single_aztecoo_thyra_solver
bool test_single_aztecoo_thyra_solver(const std::string matrixFile, const bool testTranspose, const int numRandomVectors, const double maxFwdError, const double maxResid, const double maxSolutionError, const bool showAllTests, const bool dumpAll, Teuchos::ParameterList *paramList, Teuchos::FancyOStream *out)
Testing function for a single aztecoo solver with a single matrix.
Definition
test_single_aztecoo_thyra_solver.cpp:66
test_single_aztecoo_thyra_solver.hpp
main
int main(int argc, char *argv[])
Definition
test_single_aztecoo_thyra_solver_driver.cpp:47
Generated by
1.17.0