33#ifndef MADNESS_MRA_SIMPLECACHE_H__INCLUDED
34#define MADNESS_MRA_SIMPLECACHE_H__INCLUDED
45 template <
typename Q, std::
size_t NDIM>
49 typedef std::pair<Key<NDIM>,
Q>
pairT;
69 return &(
test->second);
93 auto [it, inserted] =
cache.insert(
pairT(key,val));
104 return set(key, val);
Definition worldhashmap.h:396
Hash_private::HashIterator< const hashT > const_iterator
Definition worldhashmap.h:403
Key is the index for a node of the 2^NDIM-tree.
Definition key.h:71
const Vector< Translation, NDIM > & translation() const
Definition key.h:175
const Q * getptr(Level n, const Key< NDIM > &disp) const
If key=(n,l) is present return pointer to cached value, otherwise return NULL.
Definition simplecache.h:85
ConcurrentHashMap< Key< NDIM >, Q > mapT
Definition simplecache.h:48
const Q * set(Level n, Translation l, const Q &val)
Definition simplecache.h:97
SimpleCache()
Definition simplecache.h:53
mapT cache
Definition simplecache.h:50
const Q * set(const Key< NDIM > &key, const Q &val)
Set value associated with key ... gives ownership of a new copy to the container.
Definition simplecache.h:92
const Q * set(Level n, const Key< NDIM > &disp, const Q &val)
Definition simplecache.h:102
SimpleCache & operator=(const SimpleCache &c)
Definition simplecache.h:57
const Q * getptr(Level n, Translation l) const
If key=(n,l) is present return pointer to cached value, otherwise return NULL.
Definition simplecache.h:76
std::pair< Key< NDIM >, Q > pairT
Definition simplecache.h:49
SimpleCache(const SimpleCache &c)
Definition simplecache.h:55
const Q * getptr(const Key< NDIM > &key) const
If key is present return pointer to cached value, otherwise return NULL.
Definition simplecache.h:66
A simple, fixed dimension vector.
Definition vector.h:64
void test(World &world, bool doloadbal=false)
Definition dataloadbal.cc:224
Multidimension Key for MRA tree and associated iterators.
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
int64_t Translation
Definition key.h:59
int Level
Definition key.h:60
double Q(double a)
Definition relops.cc:20
static const double c
Definition relops.cc:10
Defines and implements a concurrent hashmap.