|
MOOCHO (Single Doxygen Collection)
Version of the Day
|
Abstacts a set of iteration quantities for an iterative algorithm. More...
#include <IterationPack_AlgorithmState.hpp>

Classes | |
| class | AlreadyExists |
| Thrown if name already exists. More... | |
| class | DoesNotExist |
| Thrown if name or id does not exist. More... | |
Public Member Functions | |
| virtual | ~AlgorithmState () |
Private Types | |
| typedef std::vector< IQ_ptr > | iq_t |
| typedef std::map< std::string, iq_id_type > | iq_name_to_id_t |
Private Member Functions | |
| iq_name_to_id_t::iterator | find_and_assert (const std::string &iq_name) |
| iq_name_to_id_t::const_iterator | find_and_assert (const std::string &iq_name) const |
Private Attributes | |
| int | k_ |
| iq_t | iq_ |
| IterQuantity * | iteration_quantities |
| iq_name_to_id_t | iq_name_to_id_ |
Public types | |
| enum | { DOES_NOT_EXIST = INT_MAX } |
| typedef size_t | iq_id_type |
| typedef Teuchos::RCP < IterQuantity > | IQ_ptr |
Constructors | |
| AlgorithmState (size_t reserve_size=0) | |
| Construct with an initial guess for the number of iteration quantities. More... | |
Iteration counter | |
| void | k (int k) |
| int | k () const |
| int | incr_k () |
Iteration quantity setup | |
| virtual size_t | num_iter_quant () const |
| Return the number of iteration quantities. More... | |
| virtual iq_id_type | set_iter_quant (const std::string &iq_name, const IQ_ptr &iq) |
| Inserts the iteration quantity through a RCP<...> object. More... | |
| virtual void | erase_iter_quant (const std::string &iq_name) |
| Removes the iteration quantity with name iq_name. More... | |
| 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. More... | |
| virtual IQ_ptr & | get_iter_quant (iq_id_type iq_id) |
| Returns the RCP<...> for the iteration quantiy with iq_id. More... | |
| virtual const IQ_ptr & | get_iter_quant (iq_id_type iq_id) const |
Iteration quantity access | |
| virtual IterQuantity & | iter_quant (const std::string &iq_name) |
| Iteration quantity encapsulation object access with via iq_name. More... | |
| virtual const IterQuantity & | iter_quant (const std::string &iq_name) const |
| virtual IterQuantity & | iter_quant (iq_id_type iq_id) |
| Iteration quantity encapsulation object access via iq_id. More... | |
| virtual const IterQuantity & | iter_quant (iq_id_type iq_id) const |
Iteration incrementation | |
| virtual void | next_iteration (bool incr_k=true) |
| iteration quantity forwarding. More... | |
Miscellaneous | |
| virtual void | dump_iter_quant (std::ostream &out) const |
| iteration quantity information dumping. More... | |
Abstacts a set of iteration quantities for an iterative algorithm.
This object encapsulates a set of iteration quantity access objects. The concrete types of the IterQuantity objects are expected to be subclasses of IterQuantityAccess. It is therefore up the the clients to determine the concrete types of these iteration quantity access objects and to use dynamic_cast<...> (or static_cast<...> if you are sure) to access the IterQuantityAccess<...> object and therefore the iteration quantities themselves. Each iteration quantity (IQ) access object must have a unique name associated with it. IQ objects are given to the state object by clients through the set_iter_quant() method at which point the IQ object will be given a unique id that will never change change until the IQ object is removed using erase_iter_quant(). Memory management is performed using the Teuchos::RCP smart reference counting poiner class. The id of any IQ object (iq_id) can be obtained from its name by calling iq_id = get_iter_quant_id(iq_name). If an IQ object with the name iq_name does not exist then get_iter_quant_id(iq_name) will return DOES_NOT_EXIST. The IQ objects themselves can be accesed in O(log(num_iter_quant())) time using iter_quant(iq_name) or in O(1) time using iter_quant(iq_id). Therefore, the access of IQ objects using iq_id is an optimization for faster access and the client should never have to lookup iq_name given iq_id. The mapping only works from iq_name to iq_id, not the other way around. It is guaranteed that as long as erase_iter_quant(iq_id) is not called that each iq_id that &iter_quant(iq_id) == &iter_quant( get_iter_quant(iq_name) ) will true. For iq_name, if get_iter_quant_id(iq_name) == DOES_NOT_EXIST then iter_quant(iq_name) will throw the exception DoesNotExist.
The next_iteration() operation is called by the algorithm to call next_iteration() on each of the IQ objects.
The dump_iter_quant(out) operation prints out a list of all of the IQ objects of thier iq_name, iq_name and concrete type.
The default copy constructor, and assignment operator functions are allowed since they have the proper semantics.
Definition at line 93 of file IterationPack_AlgorithmState.hpp.
| typedef size_t IterationPack::AlgorithmState::iq_id_type |
Definition at line 100 of file IterationPack_AlgorithmState.hpp.
Definition at line 102 of file IterationPack_AlgorithmState.hpp.
|
private |
Definition at line 259 of file IterationPack_AlgorithmState.hpp.
|
private |
Definition at line 260 of file IterationPack_AlgorithmState.hpp.
| anonymous enum |
| Enumerator | |
|---|---|
| DOES_NOT_EXIST | |
Definition at line 104 of file IterationPack_AlgorithmState.hpp.
|
inlinevirtual |
Definition at line 117 of file IterationPack_AlgorithmState.hpp.
|
inlineexplicit |
Construct with an initial guess for the number of iteration quantities.
The iteration counter k is default constructed to zero.
Definition at line 297 of file IterationPack_AlgorithmState.hpp.
|
inline |
Definition at line 304 of file IterationPack_AlgorithmState.hpp.
|
inline |
Definition at line 308 of file IterationPack_AlgorithmState.hpp.
|
inline |
Definition at line 312 of file IterationPack_AlgorithmState.hpp.
|
inlinevirtual |
Return the number of iteration quantities.
Definition at line 318 of file IterationPack_AlgorithmState.hpp.
|
virtual |
Inserts the iteration quantity through a RCP<...> object.
Time = O(log(num_iter_quant)), Space = O(1).
If an iteration quantity already exists with the name iq_name then a AlreadyExists exception will be thrown. Otherwise the function will return the iq_id assigned to the inserted interation quantity.
Preconditions:
iq.get() != NULL (thorw std::invalid_argument) get_iter_quant_id(iq_name) == DOES_NOT_EXIST (throw AlreadyExists) Definition at line 61 of file IterationPack_AlgorithmState.cpp.
|
virtual |
Removes the iteration quantity with name iq_name.
Time = O(log(num_iter_quant)), Space = O(1).
If get_iter_quant(iq_name).count() == 1 then the IterQuantity object pointed to will be deleted. Subsequently, the iq_id returned from set_iter_quant(...) when iq_name was set is no longer valid.
Preconditions:
get_iter_quant_id(iq_name) != DOES_NOT_EXIST (throw DoesNotExist) Definition at line 80 of file IterationPack_AlgorithmState.cpp.
|
inlinevirtual |
Return the iteration quantity id (iq_id) for the iteration quantity.
If an iteration quantity with the name iq_name does not exist, then the value DOES_NOT_EXIST is returned.
Time = O(log(num_iter_quant)), Space = O(1).
Definition at line 323 of file IterationPack_AlgorithmState.hpp.
|
inlinevirtual |
Returns the RCP<...> for the iteration quantiy with iq_id.
If this iq_id does not correspond to a valid iteration quantity object then a DoesNotExist exception will be thrown. If iq_id was returned from get_iter_quant_id(iq_name), this iq_id may become invalid if a client called erase_iter_quant(iq_name) in the mean time.
Time = O(1), Space = O(1).
Definition at line 331 of file IterationPack_AlgorithmState.hpp.
|
inlinevirtual |
Definition at line 336 of file IterationPack_AlgorithmState.hpp.
|
inlinevirtual |
Iteration quantity encapsulation object access with via iq_name.
Time = O(log(num_iter_quant())), Space = O(1).
Preconditions:
get_iter_quant_id(iq_name) != DOES_NOT_EXIST (throw DoesNotExist) Definition at line 343 of file IterationPack_AlgorithmState.hpp.
|
inlinevirtual |
Definition at line 348 of file IterationPack_AlgorithmState.hpp.
|
virtual |
Iteration quantity encapsulation object access via iq_id.
Time = O(1), Space = O(1).
If the IQ object with iq_id does not exist then a DoesNotExist exception will be thrown.
Definition at line 87 of file IterationPack_AlgorithmState.cpp.
|
virtual |
Definition at line 112 of file IterationPack_AlgorithmState.cpp.
|
virtual |
iteration quantity forwarding.
Definition at line 116 of file IterationPack_AlgorithmState.cpp.
|
virtual |
iteration quantity information dumping.
This function outputs a list with columns:
iq_name iq_id concrete type
for each iteration quantity object.
Definition at line 122 of file IterationPack_AlgorithmState.cpp.
|
private |
Definition at line 162 of file IterationPack_AlgorithmState.cpp.
|
private |
Definition at line 174 of file IterationPack_AlgorithmState.cpp.
|
private |
Definition at line 265 of file IterationPack_AlgorithmState.hpp.
|
private |
Definition at line 267 of file IterationPack_AlgorithmState.hpp.
|
private |
Definition at line 277 of file IterationPack_AlgorithmState.hpp.
|
private |
Definition at line 280 of file IterationPack_AlgorithmState.hpp.
1.8.6