11 #ifndef BELOS_STATUS_TEST_USER_OUTPUT_HPP
12 #define BELOS_STATUS_TEST_USER_OUTPUT_HPP
37 template <
class ScalarType,
class MV,
class OP>
170 std::vector<Teuchos::RCP<StatusTest<ScalarType,MV,OP> > > tmpVec = comboTest->
getStatusTests();
173 int numTests = tmpVec.size();
176 for (
int i=0; i<numTests; ++i) {
202 TEUCHOS_TEST_FOR_EXCEPTION(tmpComboTest ==
Teuchos::null,
StatusTestError,
"StatusTestUserOutput(): test must be Belos::StatusTest[MaxIters|ResNorm|Combo].");
208 typename std::map<std::string,Teuchos::RCP<StatusTest<ScalarType,MV,OP> > >::iterator it;
209 for (
size_t j=0; j<tmpVec.size(); ++j) {
216 if(tmpVec[j] == it->second) { bFound =
true;
break; }
278 void print(std::ostream& os,
int indent = 0)
const {
279 std::string ind(indent,
' ');
280 std::string starLine(55,
'*');
281 std::string starFront(5,
'*');
283 std::ios_base::fmtflags osFlags(os.flags());
285 os.setf(std::ios::scientific, std::ios::floatfield);
290 os << std::endl << ind << starLine << std::endl;
291 os << ind << starFront <<
" Belos Iterative Solver: " <<
solverDesc_ << std::endl;
293 os << ind << starFront <<
" Preconditioner: " <<
precondDesc_ << std::endl;
294 os << ind << starFront <<
" Maximum Iterations: " <<
iterTest_->getMaxIters() << std::endl;
295 os << ind << starFront <<
" Block Size: " <<
blockSize_ << std::endl;
296 os << ind << starFront <<
" Status tests: " << std::endl;
297 test_->print(os,indent + 3);
298 os << ind << starLine << std::endl;
299 os.setf(std::ios_base::right, std::ios_base::adjustfield);
305 os << ind << indheader;
317 os.setf(std::ios_base::right, std::ios_base::adjustfield);
331 os << std::setw(15) << (*tempResTest->
getTestValue())[currIdx_[i]];
334 os << std::setw(15) <<
"Passed";
336 os << std::setw(15) <<
"Failed";
337 else os << std::setw(15) <<
"Undefined";
340 os << std::setw(15) <<
"---";
365 std::vector<Teuchos::RCP<StatusTest<ScalarType,MV,OP> > >
resTestVec_;
Collection of types and exceptions used within the Belos solvers.
Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
void reset()
Informs the status test that it should reset its internal configuration to the uninitialized state...
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test_
virtual int getBlockSize() const =0
Get the blocksize to be used by the iterative solver in solving this linear problem.
Belos::StatusTestResNorm< ScalarType, MV, OP > StatusTestResNorm_t
Exception thrown to signal error in a status test during Belos::StatusTest::checkStatus().
void print(std::ostream &os, int indent=0) const
Output formatted description of stopping test to output stream.
std::vector< std::string > resTestNamesVec_
Name tags for status tests.
A special StatusTest for printing other status tests in a simple format.
Virtual base class for StatusTest that printing status tests.
Pure virtual base class for defining the status testing capabilities of Belos.
ComboType getComboType() const
Return the type of combination (OR, AND, or SEQ).
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
An abstract class of StatusTest for stopping criteria using residual norms.
void setSolverDesc(const std::string &solverDesc)
Set a short solver description for output clarity.
Belos::StatusTest class for specifying a maximum number of iterations.
Pure virtual base class which describes the basic interface to the linear solver iteration.
Teuchos::RCP< OutputManager< ScalarType > > printer_
Teuchos::RCP< const MV > getRHS() const
A pointer to the right-hand side B.
A pure virtual class for defining the status tests for the Belos iterative solvers.
StatusType
Whether the StatusTest wants iteration to stop.
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
Traits class which defines basic operations on multivectors.
Belos::StatusTest for logically combining several status tests.
A Belos::StatusTest class for specifying a maximum number of iterations.
const std::vector< int > & getLSIndex() const
(Zero-based) indices of the linear system(s) currently being solved.
void resetNumCalls()
Informs the outputting status test that it should reset the number of calls to zero.
std::vector< Teuchos::RCP< StatusTest< ScalarType, MV, OP > > > resTestVec_
Vector of residual status tests.
A linear system to solve, and its associated information.
int getLSNumber() const
The number of linear systems that have been set.
virtual ~StatusTestUserOutput()
Destructor.
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > getChild() const
Get child test.
StatusTestUserOutput(const Teuchos::RCP< OutputManager< ScalarType > > &printer, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test, Teuchos::RCP< std::map< std::string, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > > > taggedTests, int mod=1, int printStates=Passed)
Constructor.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const =0
Get a constant reference to the linear problem.
virtual const std::vector< MagnitudeType > * getTestValue() const =0
Returns the test value, , computed in most recent call to CheckStatus.
Belos::StatusTest abstract class for specifying a residual norm stopping criteria.
Teuchos::RCP< StatusTestMaxIters< ScalarType, MV, OP > > iterTest_
void setPrecondDesc(const std::string &precondDesc)
Set a short preconditioner description for output clarity.
void setChild(Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test)
Set child test, which must be a combination of a Belos::StatusTestMaxIters AND a combination of Belos...
void setOutputManager(const Teuchos::RCP< OutputManager< ScalarType > > &printer)
Set the output manager.
Belos::StatusTestCombo< ScalarType, MV, OP > StatusTestCombo_t
StatusType getStatus() const
Return the result of the most recent checkStatus call, or undefined if it has not been run...
Belos::StatusTestMaxIters< ScalarType, MV, OP > StatusTestMaxIters_t
StatusType checkStatus(Iteration< ScalarType, MV, OP > *solver)
A class for extending the status testing capabilities of Belos via logical combinations.
MultiVecTraits< ScalarType, MV > MVT
st_vector getStatusTests()
Return the vector of status tests.
std::vector< int > currIdx_
Belos header file which uses auto-configuration information to include necessary C++ headers...
A virtual base class for StatusTest that print other status tests.
Teuchos::RCP< std::map< std::string, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > > > taggedTests_
void setOutputFrequency(int mod)
Set how often the child test is printed.