MADNESS  version 0.9
Public Member Functions | Static Public Member Functions | Friends | List of all members
madness::Key< NDIM > Class Template Reference

Key is the index for a node of the 2^NDIM-tree. More...

#include <key.h>

Public Member Functions

 Key ()
 Default constructor makes an uninitialized key. More...
 
 Key (Level n, const Vector< Translation, NDIM > &l)
 Constructor with given n, l. More...
 
 Key (int n)
 Constructor with given n and l=0. More...
 
 Key (Level n, Translation p)
 Constructor from lexical index in depth first order. More...
 
 Key (const int n, const int l0)
 easy constructor More...
 
 Key (const int n, const int l0, const int l1, const int l2)
 easy constructor More...
 
bool is_invalid () const
 Checks if a key is invalid. More...
 
bool is_valid () const
 Checks if a key is valid. More...
 
bool operator== (const Key &other) const
 Equality test. More...
 
bool operator!= (const Key &other) const
 
bool operator< (const Key &other) const
 Comparison based upon depth first lexical order. More...
 
hashT hash () const
 
Level level () const
 
const Vector< Translation, NDIM > & translation () const
 
uint64_t distsq () const
 
Key parent (int generation=1) const
 Returns the key of the parent. More...
 
bool is_child_of (const Key &key) const
 
bool is_parent_of (const Key &key) const
 
bool is_neighbor_of (const Key &key, const std::vector< bool > &bperiodic) const
 Assuming keys are at the same level, returns true if displaced by no more than 1 in any direction. More...
 
Key neighbor (const Key< NDIM > &disp) const
 given a displacement, generate a neighbor key; ignore boundary conditions and disp's level More...
 
bool thisKeyContains (const Vector< double, NDIM > &x, const unsigned int &dim0, const unsigned int &dim1) const
 check if this MultiIndex contains point x, disregarding these two dimensions More...
 
template<std::size_t LDIM, std::size_t KDIM>
void break_apart (Key< LDIM > &key1, Key< KDIM > &key2) const
 break key into two low-dimensional keys More...
 
template<std::size_t LDIM>
Key< NDIM+LDIM > merge_with (const Key< LDIM > &rhs) const
 merge with other key (ie concatenate), use level of rhs, not of this More...
 
bool is_farther_out_than (const Key< NDIM > &other) const
 return if the other key is pointing in the same direction and is farther out More...
 
void rehash ()
 Recomputes hashval ... presently only done when reading from external storage. More...
 

Static Public Member Functions

static Key< NDIMinvalid ()
 Returns an invalid key. More...
 

Friends

class KeyChildIterator< NDIM >
 

Detailed Description

template<std::size_t NDIM>
class madness::Key< NDIM >

Key is the index for a node of the 2^NDIM-tree.

See KeyChildIterator for facile generation of children, and foreach_child(parent,op) for facile applicaiton of operators to child keys.

Constructor & Destructor Documentation

template<std::size_t NDIM>
madness::Key< NDIM >::Key ( )
inline

Default constructor makes an uninitialized key.

Referenced by madness::Key< OPDIM >::neighbor(), and madness::Key< OPDIM >::parent().

template<std::size_t NDIM>
madness::Key< NDIM >::Key ( Level  n,
const Vector< Translation, NDIM > &  l 
)
inline

Constructor with given n, l.

template<std::size_t NDIM>
madness::Key< NDIM >::Key ( int  n)
inline

Constructor with given n and l=0.

template<std::size_t NDIM>
madness::Key< NDIM >::Key ( Level  n,
Translation  p 
)
inline

Constructor from lexical index in depth first order.

template<std::size_t NDIM>
madness::Key< NDIM >::Key ( const int  n,
const int  l0 
)
inline

easy constructor

template<std::size_t NDIM>
madness::Key< NDIM >::Key ( const int  n,
const int  l0,
const int  l1,
const int  l2 
)
inline

easy constructor

Member Function Documentation

template<std::size_t NDIM>
template<std::size_t LDIM, std::size_t KDIM>
void madness::Key< NDIM >::break_apart ( Key< LDIM > &  key1,
Key< KDIM > &  key2 
) const
inline
template<std::size_t NDIM>
uint64_t madness::Key< NDIM >::distsq ( ) const
inline
template<std::size_t NDIM>
hashT madness::Key< NDIM >::hash ( ) const
inline

Referenced by LevelPmap::owner().

template<std::size_t NDIM>
static Key<NDIM> madness::Key< NDIM >::invalid ( )
inlinestatic

Returns an invalid key.

Referenced by madness::DerivativeBase< T, NDIM >::neighbor().

template<std::size_t NDIM>
bool madness::Key< NDIM >::is_child_of ( const Key< NDIM > &  key) const
inline
template<std::size_t NDIM>
bool madness::Key< NDIM >::is_farther_out_than ( const Key< NDIM > &  other) const
inline

return if the other key is pointing in the same direction and is farther out

unlike in distsq() the direction is taken into account, and other must be longer than this in each dimension

Parameters
[in]othera key
Returns
if other is farther out
template<std::size_t NDIM>
bool madness::Key< NDIM >::is_invalid ( ) const
inline
template<std::size_t NDIM>
bool madness::Key< NDIM >::is_neighbor_of ( const Key< NDIM > &  key,
const std::vector< bool > &  bperiodic 
) const
inline

Assuming keys are at the same level, returns true if displaced by no more than 1 in any direction.

Assumes key and this are at the same level

Referenced by madness::FunctionImpl< T, NDIM >::project_refine_op().

template<std::size_t NDIM>
bool madness::Key< NDIM >::is_parent_of ( const Key< NDIM > &  key) const
inline
template<std::size_t NDIM>
bool madness::Key< NDIM >::is_valid ( ) const
inline
template<std::size_t NDIM>
Level madness::Key< NDIM >::level ( ) const
inline

Referenced by madness::FunctionNode< T, NDIM >::accumulate(), madness::FunctionNode< T, NDIM >::accumulate2(), madness::SeparatedConvolution< T, NDIM >::apply(), madness::SeparatedConvolution< T, NDIM >::apply2(), madness::SeparatedConvolution< T, NDIM >::apply2_lowdim(), madness::FunctionImpl< Q, NDIM >::apply_1d_realspace_push_op(), madness::FunctionImpl< T, NDIM >::broaden(), madness::SlaterF12Interface::coeff(), madness::FunctionImpl< Q, NDIM >::coeffs2values(), madness::FunctionImpl< T, NDIM >::compress_op(), madness::displacement(), madness::FunctionImpl< Q, NDIM >::do_apply(), madness::FunctionImpl< Q, NDIM >::do_apply_directed_screening(), madness::FunctionImpl< Q, NDIM >::do_binary_op(), madness::FunctionImpl< Q, NDIM >::do_mul(), madness::FunctionImpl< T, NDIM >::do_print_grid(), madness::FunctionImpl< T, NDIM >::do_print_tree(), madness::FunctionImpl< T, NDIM >::do_print_tree_graphviz(), madness::FunctionImpl< T, NDIM >::erase(), madness::FunctionImpl< Q, NDIM >::err_box(), madness::SeparatedConvolution< T, NDIM >::estimate_costs(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::eval_local_only(), madness::FunctionImpl< T, NDIM >::evaldepthpt(), madness::FunctionImpl< T, NDIM >::evalR(), madness::fcube(), madness::FunctionImpl< Q, NDIM >::fcube_for_mul(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::finalize(), madness::FunctionImpl< T, NDIM >::recursive_apply_op2< opT >::finalize(), madness::FunctionImpl< T, NDIM >::get_norm_tree_recursive(), madness::FunctionImpl< T, NDIM >::insert_zero_down_to_initial_level(), madness::CoeffTracker< T, LDIM >::make_child(), madness::TwoElectronInterface< double, 6 >::make_coeff(), madness::Key< OPDIM >::merge_with(), madness::Convolution1D< Q >::mod_nonstandard(), madness::FunctionImpl< Q, NDIM >::mul(), madness::DerivativeBase< T, NDIM >::neighbor(), madness::Key< OPDIM >::neighbor(), madness::FunctionImpl< T, NDIM >::neighbor(), madness::FunctionImpl< Q, NDIM >::NS_fcube_for_mul(), madness::FunctionImpl< Q, NDIM >::NScoeffs2values(), DirichletLBCost< NDIM >::operator()(), madness::lbcost< T, NDIM >::operator()(), madness::error_leaf_op< T, NDIM >::operator()(), madness::hartree_leaf_op< T, NDIM >::operator()(), madness::op_leaf_op< T, NDIM, opT >::operator()(), madness::hartree_convolute_leaf_op< T, NDIM, LDIM, opT >::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::do_mapdim::operator()(), madness::FunctionImpl< T, NDIM >::do_unary_op_value_inplace< opT >::operator()(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::do_standard::operator()(), LevelPmap::owner(), madness::LBDeuxPmap< NDIM >::owner(), madness::FunctionImpl< T, NDIM >::parent_to_child_NS(), madness::FunctionImpl< T, NDIM >::plot_cube_kernel(), madness::FunctionImpl< T, NDIM >::print_plane_local(), madness::FunctionImpl< T, NDIM >::project(), madness::FunctionImpl< T, NDIM >::project_refine_op(), madness::FunctionImpl< Q, NDIM >::read_grid(), madness::FunctionImpl< Q, NDIM >::read_grid2(), madness::FunctionImpl< T, NDIM >::reconstruct_op(), madness::FunctionImpl< Q, NDIM >::refine_op(), madness::FunctionNode< T, NDIM >::set_has_children_recursive(), madness::LBNodeDeux< NDIM >::sum(), madness::FunctionImpl< T, NDIM >::trace_local(), madness::FunctionImpl< T, NDIM >::trickle_down_op(), madness::FunctionImpl< T, NDIM >::truncate_op(), madness::FunctionImpl< T, NDIM >::truncate_spawn(), madness::FunctionImpl< T, NDIM >::truncate_tol(), madness::FunctionImpl< Q, NDIM >::values2coeffs(), madness::FunctionImpl< Q, NDIM >::values2NScoeffs(), madness::FunctionImpl< T, NDIM >::verify_tree(), and madness::FunctionImpl< Q, NDIM >::vtransform_doit().

template<std::size_t NDIM>
template<std::size_t LDIM>
Key<NDIM+LDIM> madness::Key< NDIM >::merge_with ( const Key< LDIM > &  rhs) const
inline

merge with other key (ie concatenate), use level of rhs, not of this

Referenced by madness::FunctionImpl< Q, NDIM >::do_apply(), and madness::FunctionImpl< Q, NDIM >::do_apply_directed_screening().

template<std::size_t NDIM>
Key madness::Key< NDIM >::neighbor ( const Key< NDIM > &  disp) const
inline

given a displacement, generate a neighbor key; ignore boundary conditions and disp's level

Parameters
[in]dispthe displacement
Returns
a new key
template<std::size_t NDIM>
bool madness::Key< NDIM >::operator!= ( const Key< NDIM > &  other) const
inline
template<std::size_t NDIM>
bool madness::Key< NDIM >::operator< ( const Key< NDIM > &  other) const
inline

Comparison based upon depth first lexical order.

template<std::size_t NDIM>
bool madness::Key< NDIM >::operator== ( const Key< NDIM > &  other) const
inline

Equality test.

template<std::size_t NDIM>
Key madness::Key< NDIM >::parent ( int  generation = 1) const
inline
template<std::size_t NDIM>
void madness::Key< NDIM >::rehash ( )
inline

Recomputes hashval ... presently only done when reading from external storage.

Referenced by madness::Key< OPDIM >::Key(), and madness::archive::ArchiveLoadImpl< BinaryFstreamInputArchive, Key< NDIM > >::load().

template<std::size_t NDIM>
bool madness::Key< NDIM >::thisKeyContains ( const Vector< double, NDIM > &  x,
const unsigned int &  dim0,
const unsigned int &  dim1 
) const
inline

check if this MultiIndex contains point x, disregarding these two dimensions

Referenced by madness::FunctionImpl< T, NDIM >::print_plane_local().

template<std::size_t NDIM>
const Vector<Translation, NDIM>& madness::Key< NDIM >::translation ( ) const
inline

Referenced by madness::FunctionImpl< Q, NDIM >::apply_1d_realspace_push_op(), madness::FunctionImpl< T, NDIM >::broaden(), madness::FunctionImpl< T, NDIM >::child_patch(), madness::FunctionImpl< T, NDIM >::coeffs_for_jun(), madness::displacement(), madness::DerivativeBase< T, NDIM >::do_diff1(), madness::FunctionImpl< T, NDIM >::do_print_grid(), madness::FunctionImpl< T, NDIM >::do_print_tree_graphviz(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::eval_local_only(), madness::FunctionImpl< T, NDIM >::evaldepthpt(), madness::FunctionImpl< T, NDIM >::evalR(), madness::fcube(), madness::FunctionImpl< Q, NDIM >::fcube_for_mul(), madness::SimpleCache< madness::SeparatedConvolutionData< Q, NDIM >, 2 *NDIM >::getptr(), madness::Key< OPDIM >::is_farther_out_than(), madness::TwoElectronInterface< double, 6 >::make_coeff(), madness::Key< OPDIM >::merge_with(), madness::Convolution1D< Q >::mod_nonstandard(), madness::DerivativeBase< T, NDIM >::neighbor(), madness::Key< OPDIM >::neighbor(), madness::FunctionImpl< T, NDIM >::neighbor(), madness::FunctionImpl< Q, NDIM >::NS_fcube_for_mul(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::do_mapdim::operator()(), madness::FunctionImpl< T, NDIM >::plot_cube_kernel(), madness::FunctionImpl< T, NDIM >::print_plane_local(), madness::FunctionImpl< Q, NDIM >::read_grid(), madness::FunctionImpl< Q, NDIM >::read_grid2(), madness::SimpleCache< madness::SeparatedConvolutionData< Q, NDIM >, 2 *NDIM >::set(), and madness::FunctionImpl< T, NDIM >::upsample().

Friends And Related Function Documentation

template<std::size_t NDIM>
friend class KeyChildIterator< NDIM >
friend

The documentation for this class was generated from the following file: