Anasazi
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
AnasaziStatusTestOutput.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Anasazi: Block Eigensolvers Package
4
//
5
// Copyright 2004 NTESS and the Anasazi contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
//
10
11
#ifndef ANASAZI_STATUS_TEST_OUTPUT_HPP
12
#define ANASAZI_STATUS_TEST_OUTPUT_HPP
13
18
19
20
#include "
AnasaziConfigDefs.hpp
"
21
#include "
AnasaziTypes.hpp
"
22
#include "
AnasaziEigensolver.hpp
"
23
24
#include "
AnasaziStatusTest.hpp
"
25
26
27
28
namespace
Anasazi
{
29
39
template
<
class
ScalarType,
class
MV,
class
OP>
40
class
StatusTestOutput
:
public
StatusTest
<ScalarType,MV,OP> {
41
42
public
:
44
45
63
StatusTestOutput
(
const
Teuchos::RCP<
OutputManager<ScalarType>
> &printer,
64
Teuchos::RCP<
StatusTest<ScalarType,MV,OP>
> test,
65
int
mod = 1,
66
int
printStates =
Passed
)
67
: printer_(printer), test_(test), state_(
Undefined
), stateTest_(printStates), modTest_(mod), numCalls_(0)
68
{ }
69
71
virtual
~StatusTestOutput
() {};
73
75
76
93
TestStatus
checkStatus
(
Eigensolver<ScalarType,MV,OP>
* solver ) {
94
TEUCHOS_TEST_FOR_EXCEPTION(test_ == Teuchos::null,
StatusTestError
,
"StatusTestOutput::checkStatus(): child pointer is null."
);
95
state_ = test_->checkStatus(solver);
96
97
if
(numCalls_++ % modTest_ == 0) {
98
if
( (state_ & stateTest_) == state_) {
99
if
( printer_->isVerbosity(
StatusTestDetails
) ) {
100
print
( printer_->stream(
StatusTestDetails
) );
101
}
102
else
if
( printer_->isVerbosity(
Debug
) ) {
103
print
( printer_->stream(
Debug
) );
104
}
105
}
106
}
107
108
return
state_;
109
}
110
112
TestStatus
getStatus
()
const
{
113
return
state_;
114
}
115
117
std::vector<int>
whichVecs
()
const
{
118
return
std::vector<int>(0);
119
}
120
122
int
howMany
()
const
{
123
return
0;
124
}
125
127
128
130
131
136
void
setChild
(Teuchos::RCP<
StatusTest<ScalarType,MV,OP>
> test) {
137
test_ = test;
138
state_ =
Undefined
;
139
}
140
142
Teuchos::RCP<StatusTest<ScalarType,MV,OP> >
getChild
()
const
{
143
return
test_;
144
}
145
147
148
150
151
156
void
reset
() {
157
state_ =
Undefined
;
158
if
(test_ != Teuchos::null) {
159
test_->reset();
160
}
161
numCalls_ = 0;
162
}
163
166
void
clearStatus
() {
167
state_ =
Undefined
;
168
if
(test_ != Teuchos::null) {
169
test_->clearStatus();
170
}
171
}
172
174
176
177
179
std::ostream&
print
(std::ostream& os,
int
indent = 0)
const
{
180
std::string ind(indent,
' '
);
181
os << ind <<
"- StatusTestOutput: "
;
182
switch
(state_) {
183
case
Passed
:
184
os <<
"Passed"
<< std::endl;
185
break
;
186
case
Failed
:
187
os <<
"Failed"
<< std::endl;
188
break
;
189
case
Undefined
:
190
os <<
"Undefined"
<< std::endl;
191
break
;
192
}
193
os << ind <<
" (Num calls,Mod test,State test): "
<<
"("
<< numCalls_ <<
", "
<< modTest_ <<
","
;
194
if
(stateTest_ == 0) {
195
os <<
" none )"
<< std::endl;
196
}
197
else
{
198
if
( (stateTest_ &
Passed
) ==
Passed
) os <<
" Passed"
;
199
if
( (stateTest_ &
Failed
) ==
Failed
) os <<
" Failed"
;
200
if
( (stateTest_ &
Undefined
) ==
Undefined
) os <<
" Undefined"
;
201
os <<
" )"
<< std::endl;
202
}
203
// print child, with extra indention
204
test_->print(os,indent+3);
205
return
os;
206
}
207
209
210
private
:
211
Teuchos::RCP<OutputManager<ScalarType> > printer_;
212
Teuchos::RCP<StatusTest<ScalarType,MV,OP> > test_;
213
TestStatus
state_;
214
int
stateTest_;
215
int
modTest_;
216
int
numCalls_;
217
};
218
219
}
// end of Anasazi namespace
220
221
#endif
/* ANASAZI_STATUS_TEST_OUTPUT_HPP */
AnasaziConfigDefs.hpp
Anasazi header file which uses auto-configuration information to include necessary C++ headers.
AnasaziEigensolver.hpp
Pure virtual base class which describes the basic interface to the iterative eigensolver.
AnasaziStatusTest.hpp
Declaration and definition of Anasazi::StatusTest.
AnasaziTypes.hpp
Types and exceptions used within Anasazi solvers and interfaces.
Anasazi::Eigensolver
The Eigensolver is a templated virtual base class that defines the basic interface that any eigensolv...
Definition
AnasaziEigensolver.hpp:35
Anasazi::OutputManager
Output managers remove the need for the eigensolver to know any information about the required output...
Definition
AnasaziOutputManager.hpp:36
Anasazi::StatusTestError
Exception thrown to signal error in a status test during Anasazi::StatusTest::checkStatus().
Definition
AnasaziStatusTest.hpp:29
Anasazi::StatusTest::StatusTest
StatusTest()
Constructor.
Definition
AnasaziStatusTest.hpp:50
Anasazi::StatusTestOutput::howMany
int howMany() const
Get the number of vectors that passed the test.
Definition
AnasaziStatusTestOutput.hpp:122
Anasazi::StatusTestOutput::StatusTestOutput
StatusTestOutput(const Teuchos::RCP< OutputManager< ScalarType > > &printer, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test, int mod=1, int printStates=Passed)
Constructor.
Definition
AnasaziStatusTestOutput.hpp:63
Anasazi::StatusTestOutput::setChild
void setChild(Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test)
Set child test.
Definition
AnasaziStatusTestOutput.hpp:136
Anasazi::StatusTestOutput::whichVecs
std::vector< int > whichVecs() const
Get the indices for the vectors that passed the test.
Definition
AnasaziStatusTestOutput.hpp:117
Anasazi::StatusTestOutput::reset
void reset()
Informs the status test that it should reset its internal configuration to the uninitialized state.
Definition
AnasaziStatusTestOutput.hpp:156
Anasazi::StatusTestOutput::checkStatus
TestStatus checkStatus(Eigensolver< ScalarType, MV, OP > *solver)
Definition
AnasaziStatusTestOutput.hpp:93
Anasazi::StatusTestOutput::print
std::ostream & print(std::ostream &os, int indent=0) const
Output formatted description of stopping test to output stream.
Definition
AnasaziStatusTestOutput.hpp:179
Anasazi::StatusTestOutput::~StatusTestOutput
virtual ~StatusTestOutput()
Destructor.
Definition
AnasaziStatusTestOutput.hpp:71
Anasazi::StatusTestOutput::clearStatus
void clearStatus()
Definition
AnasaziStatusTestOutput.hpp:166
Anasazi::StatusTestOutput::getStatus
TestStatus getStatus() const
Return the result of the most recent checkStatus call, or undefined if it has not been run.
Definition
AnasaziStatusTestOutput.hpp:112
Anasazi::StatusTestOutput::getChild
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > getChild() const
Get child test.
Definition
AnasaziStatusTestOutput.hpp:142
Anasazi
Namespace Anasazi contains the classes, structs, enums and utilities used by the Anasazi package.
Anasazi::Debug
@ Debug
Definition
AnasaziTypes.hpp:138
Anasazi::StatusTestDetails
@ StatusTestDetails
Definition
AnasaziTypes.hpp:137
Anasazi::TestStatus
TestStatus
Enumerated type used to pass back information from a StatusTest.
Definition
AnasaziTypes.hpp:110
Anasazi::Undefined
@ Undefined
Definition
AnasaziTypes.hpp:113
Anasazi::Passed
@ Passed
Definition
AnasaziTypes.hpp:111
Anasazi::Failed
@ Failed
Definition
AnasaziTypes.hpp:112
Generated by
1.17.0