20 #ifndef TILEDARRAY_DISTRIBUTED_STORAGE_H__INCLUDED 21 #define TILEDARRAY_DISTRIBUTED_STORAGE_H__INCLUDED 55 typedef typename container_type::accessor
accessor;
61 std::shared_ptr<pmap_interface> pmap_;
89 void get_handler(
const size_type i,
const typename future::remote_refT& ref) {
96 WorldObject_::task(
owner(i), & DistributedStorage_::set_handler,
97 i, value, madness::TaskAttributes::hipri());
100 struct DelayedSet :
public madness::CallbackInterface {
109 ds_(ds), index_(i), future_(f)
112 virtual ~DelayedSet() { }
114 virtual void notify() {
115 ds_.set_remote(index_, future_);
132 const std::shared_ptr<pmap_interface>&
pmap) :
142 WorldObject_::process_pending();
147 using WorldObject_::get_world;
153 const std::shared_ptr<pmap_interface>&
pmap()
const {
return pmap_; }
161 return pmap_->owner(i);
173 return pmap_->is_local(i);
203 WorldObject_::task(
owner(i), & DistributedStorage_::get_handler, i,
204 result.remote_ref(get_world()), madness::TaskAttributes::hipri());
219 set_handler(i, value);
221 set_remote(i, value);
237 if(! data_.insert(acc,
typename container_type::datumT(i, f))) {
239 future existing_f = acc->second;
244 if(existing_f.probe())
254 DelayedSet* set_callback =
new DelayedSet(*
this, i, f);
255 const_cast<future&
>(f).register_callback(set_callback);
265 #endif // TILEDARRAY_DISTRIBUTED_STORAGE_H__INCLUDED DistributedStorage< T > DistributedStorage_
This object type.
Distributed storage container.
madness::WorldObject< DistributedStorage_ > WorldObject_
Base object type.
const std::shared_ptr< pmap_interface > & pmap() const
Process map accessor.
Pmap pmap_interface
Process map interface type.
ProcessID owner(size_type i) const
Element owner.
madness::ConcurrentHashMap< key_type, future > container_type
Local container type.
DistributedStorage(World &world, size_type max_size, const std::shared_ptr< pmap_interface > &pmap)
Makes an initialized, empty container with default data distribution (no communication) ...
bool is_local(size_type i) const
Local element query.
T value_type
Element type.
virtual ~DistributedStorage()
container_type::const_accessor const_accessor
Local element const accessor type.
container_type::accessor accessor
Local element accessor type.
size_type key_type
element key type
size_type max_size() const
Max size accessor.
size_type size() const
Number of local elements.
std::size_t size_type
Size type.
Future< value_type > future
Element container type.
std::size_t size_type
size type