|
Belos Package Browser (Single Doxygen Collection)
Development
|
Go to the documentation of this file.
43 #ifndef BELOS_STATUS_TEST_LOGRESNORM_HPP
44 #define BELOS_STATUS_TEST_LOGRESNORM_HPP
66 template <
class ScalarType,
class MV,
class OP>
126 const std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>&
135 void print(std::ostream& os,
int indent = 0)
const;
148 std::ostringstream oss;
165 std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>
logResNorm_;
171 template <
class ScalarType,
class MV,
class OP>
177 maxIters_ = maxIters;
179 logResNorm_.reserve( maxIters_ );
184 template <
class ScalarType,
class MV,
class OP>
190 int numRHS = MVT::GetNumberVecs( *(lp.
getRHS()) );
194 if ( (numRHS==1) && (blkSize==1) && (currIters!=nIters_) )
196 std::vector<MagnitudeType> tmp_resvector( 1 );
201 MVT::MvNorm (*residMV, tmp_resvector,
TwoNorm);
204 logResNorm_.push_back( tmp_resvector[0] );
211 template <
class ScalarType,
class MV,
class OP>
216 logResNorm_.reserve( maxIters_ );
219 template <
class ScalarType,
class MV,
class OP>
222 for (
int j = 0; j < indent; j ++)
225 os <<
"Logging Absolute Residual 2-Norm" << std::endl;
228 template <
class ScalarType,
class MV,
class OP>
231 os << std::left << std::setw(13) << std::setfill(
'.');
233 os << std::left << std::setfill(
' ');
StatusType getStatus() const
Return the result of the most recent CheckStatus call.
Pure virtual base class for defining the status testing capabilities of Belos.
int getNumIters() const
Returns the current number of iterations from the most recent StatusTest call.
StatusTestLogResNorm(int maxIters)
Constructor.
void setMaxIters(int maxIters)
Sets the maximum number of iterations allowed so internal storage can be resized.
void print(std::ostream &os, int indent=0) const
Output formatted description of stopping test to output stream.
std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > logResNorm_
Log of absolute residual norm.
A linear system to solve, and its associated information.
int nIters_
Current number of iterations.
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
The type of the magnitude (absolute value) of a ScalarType.
StatusType
Whether the StatusTest wants iteration to stop.
StatusType checkStatus(Iteration< ScalarType, MV, OP > *iSolver)
Check convergence status of the iterative solver: Unconverged, Converged, Failed.
virtual ~StatusTestLogResNorm()
Destructor.
const std::vector< int > getLSIndex() const
(Zero-based) indices of the linear system(s) currently being solved.
Teuchos::RCP< const MV > getRHS() const
A pointer to the right-hand side B.
virtual Teuchos::RCP< const MV > getNativeResiduals(std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > *norms) const =0
Get the residuals native to the solver.
A Belos::StatusTest debugging class for storing the absolute residual norms generated during a solve.
int maxIters_
Maximum number of iterations allowed.
A pure virtual class for defining the status tests for the Belos iterative solvers.
void reset()
Resets the status test to the initial internal state.
const std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > & getLogResNorm() const
Returns the log of the absolute residual norm from the iteration.
MultiVecTraits< ScalarType, MV > MVT
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const =0
Get a constant reference to the linear problem.
std::string description() const
Method to return description of the debugging status test
void printStatus(std::ostream &os, StatusType type) const
Print message for each status specific to this stopping test.
int getMaxIters() const
Returns the maximum number of iterations set in the constructor.
bool is_null(const RCP< T > &p)
Traits class which defines basic operations on multivectors.
virtual int getNumIters() const =0
Get the current iteration count.