42 #ifndef ALGORITHM_STATE_H
43 #define ALGORITHM_STATE_H
52 #include "IterationPack_IterQuantity.hpp"
55 namespace IterationPack {
104 enum { DOES_NOT_EXIST = INT_MAX };
108 {
public:
DoesNotExist(
const std::string& what_arg) : std::logic_error(what_arg) {}};
112 {
public:
AlreadyExists(
const std::string& what_arg) : std::logic_error(what_arg) {}};
259 typedef std::vector<IQ_ptr> iq_t;
260 typedef std::map<std::string,iq_id_type> iq_name_to_id_t;
276 #ifdef DOXYGEN_COMPILE
280 iq_name_to_id_t iq_name_to_id_;
287 iq_name_to_id_t::iterator find_and_assert(
const std::string& iq_name);
289 iq_name_to_id_t::const_iterator find_and_assert(
const std::string& iq_name)
const;
299 { iq_.reserve(reserve_size); }
319 return iq_name_to_id_.size();
324 const std::string& iq_name)
const
326 const iq_name_to_id_t::const_iterator itr = iq_name_to_id_.find(iq_name);
327 return itr == iq_name_to_id_.end() ? DOES_NOT_EXIST : (*itr).second;
332 return iq_.at(iq_id);
339 return iq_.at(iq_id);
344 return *iq_[(*find_and_assert(iq_name)).second];
349 return *iq_[(*find_and_assert(iq_name)).second];
354 #endif // ALGORITHM_STATE_H
Teuchos::RCP< IterQuantity > IQ_ptr
AlgorithmState(size_t reserve_size=0)
Construct with an initial guess for the number of iteration quantities.
virtual size_t num_iter_quant() const
Return the number of iteration quantities.
virtual void erase_iter_quant(const std::string &iq_name)
Removes the iteration quantity with name 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_ptr & get_iter_quant(iq_id_type iq_id)
Returns the RCP<...> for the iteration quantiy with iq_id.
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 ~AlgorithmState()
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.
virtual iq_id_type get_iter_quant_id(const std::string &iq_name) const
Return the iteration quantity id (iq_id) for the iteration quantity.
Thrown if name already exists.
virtual void next_iteration(bool incr_k=true)
iteration quantity forwarding.