53 T my_max(
const T& v1,
const T& v2 ) {
return v1 > v2 ? v1 : v2; }
55 inline void output_spaces(std::ostream&
out,
int spaces)
56 {
for(
int i = 0; i < spaces; ++i) out <<
' '; }
59 namespace IterationPack {
62 const std::string& iq_name,
const IQ_ptr& iq)
65 iq.
get() == NULL, std::invalid_argument
66 ,
"AlgorithmState::set_iter_quant(...) : The iteration quantity witht the name = \'" << iq_name
67 <<
"\' being inserted has iq.get() == NULL!" );
69 std::pair<iq_name_to_id_t::iterator,bool>
74 ,
"AlgorithmState::set_iter_quant(...) : An iteration quantity with the name \""
75 << iq_name <<
"\" already exists with the iq_id = " << (*r.first).second );
96 catch(
const std::out_of_range& excpt) {
99 catch(
const std::range_error& excpt) {
104 ,
"AlgorithmState::iter_quant(iq_id) : Error, the iteration quantity iq_id = "
105 << iq_id <<
" does not exist. "
106 << ( iq_id <
iq_.size()
107 ?
"This iteration quantity was set and then erased."
108 :
"This iteration quantity was never set by the client." ) );
117 if(incr_k) this->
incr_k();
118 for(iq_t::iterator itr =
iq_.begin(); itr !=
iq_.end(); ++itr)
119 if(itr->get()) (*itr)->next_iteration();
128 {
for( iq_name_to_id_t::const_iterator itr =
iq_name_to_id_.begin();
131 name_w_max = my_max( (
int)name_w_max, (
int)(*itr).first.length() );
134 const int name_w = name_w_max + 4, id_w = 6;
135 const char gap[] =
" ";
138 <<
std::left << setw(name_w) <<
"iq_name"
140 << gap <<
std::left <<
"concrete type of iq / concrete type of object\n";
142 out << std::left << setw(name_w) <<
"-----"
144 << gap << std::left <<
"---------------------------------------------\n";
146 {
for( iq_name_to_id_t::const_iterator itr =
iq_name_to_id_.begin();
149 out << std::left << setw(name_w) << (*itr).first
151 << gap << std::left <<
typeName(*
iq_[(*itr).second]) << endl
152 << std::left << setw(name_w) <<
""
155 iq_[(*itr).second]->print_concrete_type(out);
163 const std::string& iq_name)
169 ,
"AlgorithmState::find_and_assert(iq_name) : The iteration "
170 "quantity with the name \"" << iq_name <<
"\" does not exist" );
175 const std::string& iq_name)
const
177 iq_name_to_id_t::const_iterator itr =
iq_name_to_id_.find(iq_name);
181 ,
"AlgorithmState::find_and_assert(iq_name) : The iteration "
182 "quantity with the name \"" << iq_name <<
"\" does not exist" );
std::string typeName(const T &t)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void erase_iter_quant(const std::string &iq_name)
Removes the iteration quantity with name iq_name.
iq_name_to_id_t::iterator find_and_assert(const std::string &iq_name)
Thrown if name or id does not exist.
virtual void dump_iter_quant(std::ostream &out) const
iteration quantity information dumping.
virtual iq_id_type set_iter_quant(const std::string &iq_name, const IQ_ptr &iq)
Inserts the iteration quantity through a RCP<...> object.
Iterface for information about Iteration Quantities.
virtual IterQuantity & iter_quant(const std::string &iq_name)
Iteration quantity encapsulation object access with via iq_name.
Abstacts a set of iteration quantities for an iterative algorithm.
AbstractLinAlgPack::value_type value_type
iq_name_to_id_t iq_name_to_id_
Thrown if name already exists.
virtual void next_iteration(bool incr_k=true)
iteration quantity forwarding.