MADNESS  0.10.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | 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>

Collaboration diagram for madness::Key< NDIM >:
Collaboration graph
[legend]

Public Member Functions

 Key ()
 Default constructor makes an uninitialized key. More...
 
 Key (int n)
 Constructor with given n and l=0. More...
 
 Key (Level n, const Vector< Translation, NDIM > &l)
 Constructor with given n, l. 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...
 
uint64_t distsq () const
 
template<std::size_t VDIM>
Key< NDIM-VDIM > extract_complement_key (const std::array< int, VDIM > &v) const
 extract a new key with the Translations complementary to the ones indicated in the v array More...
 
template<std::size_t VDIM>
Key< VDIM > extract_key (const std::array< int, VDIM > &v) const
 extract a new key with the Translations indicated in the v array More...
 
hashT hash () const
 
bool is_child_of (const Key &key) const
 
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...
 
bool is_invalid () const
 Checks if a key is invalid. More...
 
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...
 
bool is_parent_of (const Key &key) const
 
bool is_valid () const
 Checks if a key is valid. More...
 
Level level () const
 
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...
 
Key neighbor (const Key< NDIM > &disp) const
 given a displacement, generate a neighbor key; ignore boundary conditions and disp's level More...
 
bool operator!= (const Key &other) const
 
bool operator< (const Key &other) const
 Comparison operator less than to enable storage in STL map. More...
 
bool operator== (const Key &other) const
 Equality test. More...
 
Key parent (int generation=1) const
 Returns the key of the parent. More...
 
void rehash ()
 Recomputes hashval ... presently only done when reading from external storage. 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...
 
const Vector< Translation, NDIM > & translation () const
 

Static Public Member Functions

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

Static Public Attributes

static const std::size_t static_size = NDIM
 

Private Attributes

hashT hashval
 
Vector< Translation, NDIMl
 
Level n
 

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

◆ Key() [1/3]

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

Default constructor makes an uninitialized key.

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

◆ Key() [2/3]

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

Constructor with given n, l.

References madness::Key< NDIM >::rehash().

◆ Key() [3/3]

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

Constructor with given n and l=0.

References madness::Key< NDIM >::rehash().

Member Function Documentation

◆ break_apart()

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

break key into two low-dimensional keys

References KeyChildIterator::i, madness::Key< NDIM >::l, MADNESS_ASSERT, MADNESS_PRAGMA_GCC, madness::Key< NDIM >::n, NDIM, and madness::pop().

Referenced by madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::compute_error_from_inaccurate_refinement(), madness::FunctionImpl< T, NDIM >::dirac_convolution_op(), madness::FunctionImpl< T, NDIM >::do_dirac_convolution(), madness::SeparatedConvolution< Q, NDIM >::get_source_key(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::hartree_op< LDIM, leaf_opT >::make_child(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_sum_coeffs(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::hartree_op< LDIM, leaf_opT >::operator()(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::operator()(), madness::ElectronCuspyBox_op< T, NDIM >::operator()(), madness::NuclearCuspyBox_op< T, NDIM >::operator()(), madness::FunctionImpl< T, NDIM >::pointwise_multiplier< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::do_inner_local_on_demand< R >::operator()(), madness::FunctionImpl< T, NDIM >::partial_inner_contract(), and madness::FunctionImpl< T, NDIM >::project_out2().

◆ distsq()

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

References d(), dist(), madness::Key< NDIM >::l, and NDIM.

◆ extract_complement_key()

template<std::size_t NDIM>
template<std::size_t VDIM>
Key<NDIM-VDIM> madness::Key< NDIM >::extract_complement_key ( const std::array< int, VDIM > &  v) const
inline

extract a new key with the Translations complementary to the ones indicated in the v array

References madness::Key< NDIM >::extract_key(), KeyChildIterator::i, NDIM, and v.

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

◆ extract_key()

template<std::size_t NDIM>
template<std::size_t VDIM>
Key<VDIM> madness::Key< NDIM >::extract_key ( const std::array< int, VDIM > &  v) const
inline

◆ hash()

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

◆ invalid()

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

Returns an invalid key.

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

◆ is_child_of()

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

◆ is_farther_out_than()

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

References KeyChildIterator::i, madness::Key< NDIM >::l, NDIM, and madness::Key< NDIM >::translation().

◆ is_invalid()

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

◆ is_neighbor_of()

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

References std::abs(), dist(), KeyChildIterator::i, KeyChildIterator::key(), madness::Key< NDIM >::l, max, madness::Key< NDIM >::n, and NDIM.

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

◆ is_parent_of()

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

◆ is_valid()

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

◆ level()

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

References madness::Key< NDIM >::n.

Referenced by madness::FunctionNode< T, NDIM >::accumulate(), madness::FunctionNode< T, NDIM >::accumulate2(), madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push_op(), madness::Specialbox_op< T, NDIM >::box_is_at_boundary(), madness::Specialbox_op< T, NDIM >::check_special_points(), madness::FunctionCommonFunctionality< T, NDIM >::coeffs2values(), madness::FunctionImpl< T, NDIM >::coeffs2values(), madness::Leaf_op< T, NDIM, opT, specialboxT >::compare_to_parent(), madness::FunctionImpl< T, NDIM >::do_apply(), madness::FunctionImpl< T, NDIM >::do_apply_directed_screening(), madness::FunctionImpl< T, NDIM >::do_binary_op(), madness::Derivative< T, NDIM >::do_diff2b(), madness::Derivative< T, NDIM >::do_diff2i(), madness::FunctionImpl< T, 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 >::do_print_tree_json(), madness::FunctionImpl< T, NDIM >::erase(), madness::FunctionImpl< T, NDIM >::err_box(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::eval_local_only(), madness::FunctionImpl< T, NDIM >::evaldepthpt(), madness::FunctionImpl< T, NDIM >::evalR(), madness::Key< NDIM >::extract_key(), madness::fcube(), madness::FunctionImpl< T, 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_contraction_node_lists(), madness::FunctionImpl< T, NDIM >::get_norm_tree_recursive(), madness::FunctionImpl< T, NDIM >::insert_zero_down_to_initial_level(), madness::CoeffTracker< T, NDIM >::make_child(), madness::TwoElectronInterface< T, NDIM >::make_coeff(), madness::Key< NDIM >::merge_with(), madness::Convolution1D< Q >::mod_nonstandard(), madness::FunctionImpl< T, NDIM >::mul(), madness::Key< NDIM >::neighbor(), madness::DerivativeBase< T, NDIM >::neighbor(), madness::MyPmap< D >::not_so_simple_hash(), madness::FunctionImpl< T, NDIM >::NS_fcube_for_mul(), madness::FunctionImpl< T, NDIM >::NScoeffs2values(), LBCost::operator()(), YetAnotherWrapperClass::operator()(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::operator()(), madness::ElectronCuspyBox_op< T, NDIM >::operator()(), madness::NuclearCuspyBox_op< T, NDIM >::operator()(), DirichletLBCost< NDIM >::operator()(), lbcost< T, NDIM >::operator()(), madness::lbcost< T, NDIM >::operator()(), madness::op_leaf_op< T, NDIM, opT >::operator()(), madness::hartree_leaf_op< T, NDIM >::operator()(), madness::hartree_convolute_leaf_op< T, NDIM, LDIM, opT >::operator()(), true_if_n_gt_op::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::do_mapdim::operator()(), madness::FunctionImpl< T, NDIM >::do_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_map_and_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_unary_op_value_inplace< opT >::operator()(), madness::FunctionImpl< T, NDIM >::do_standard::operator()(), madness::operator<<(), LevelPmap::owner(), LevelPmapX::owner(), PartitionPmap::owner(), madness::LBDeuxPmap< NDIM >::owner(), madness::FunctionImpl< T, NDIM >::parent_to_child(), madness::FunctionImpl< T, NDIM >::parent_to_child_NS(), madness::FunctionImpl< T, NDIM >::partial_inner_contract(), madness::Leaf_op< T, NDIM, opT, specialboxT >::post_screening(), madness::FunctionImpl< T, NDIM >::print_plane_local(), madness::FunctionImpl< T, NDIM >::project(), madness::FunctionImpl< T, NDIM >::project_refine_op(), madness::FunctionImpl< T, NDIM >::read_grid(), madness::FunctionImpl< T, NDIM >::read_grid2(), madness::FunctionImpl< T, NDIM >::reconstruct_op(), madness::FunctionImpl< T, NDIM >::recur_down_for_contraction_map(), madness::FunctionImpl< T, NDIM >::refine_op(), madness::FunctionNode< T, NDIM >::set_has_children_recursive(), madness::MyPmap< D >::simple_hash(), madness::Leaf_op< T, NDIM, opT, specialboxT >::special_refinement_needed(), madness::LoadBalanceDeux< NDIM >::sum(), madness::LBNodeDeux< NDIM >::sum(), madness::FunctionImpl< T, NDIM >::trace_local(), madness::FunctionImpl< T, NDIM >::truncate_op(), madness::FunctionImpl< T, NDIM >::truncate_reconstructed_op(), madness::FunctionImpl< T, NDIM >::truncate_spawn(), madness::FunctionImpl< T, NDIM >::truncate_tol(), madness::FunctionCommonFunctionality< T, NDIM >::values2coeffs(), madness::FunctionImpl< T, NDIM >::values2coeffs(), madness::FunctionImpl< T, NDIM >::values2NScoeffs(), and madness::FunctionImpl< T, NDIM >::vtransform_doit().

◆ merge_with()

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

◆ neighbor()

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

References madness::Key< NDIM >::Key(), madness::Key< NDIM >::l, madness::Key< NDIM >::level(), and madness::Key< NDIM >::translation().

◆ operator!=()

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

◆ operator<()

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

Comparison operator less than to enable storage in STL map.

References madness::Key< NDIM >::hashval, KeyChildIterator::i, madness::Key< NDIM >::l, madness::Key< NDIM >::n, and NDIM.

◆ operator==()

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

◆ parent()

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

◆ rehash()

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

◆ thisKeyContains()

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

References KeyChildIterator::i, madness::Key< NDIM >::l, MADNESS_ASSERT, madness::Key< NDIM >::n, NDIM, and pow().

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

◆ translation()

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

References madness::Key< NDIM >::l.

Referenced by madness::FunctionImpl< T, NDIM >::apply_1d_realspace_push_op(), madness::Specialbox_op< T, NDIM >::box_is_at_boundary(), madness::FunctionImpl< T, NDIM >::child_patch(), madness::DerivativeBase< T, NDIM >::do_diff1(), madness::Derivative< T, NDIM >::do_diff2b(), madness::FunctionImpl< T, NDIM >::do_print_grid(), madness::FunctionImpl< T, NDIM >::do_print_tree_graphviz(), madness::FunctionImpl< T, NDIM >::do_print_tree_json(), madness::FunctionImpl< T, NDIM >::eval(), madness::FunctionImpl< T, NDIM >::eval_local_only(), madness::FunctionImpl< T, NDIM >::evaldepthpt(), madness::FunctionImpl< T, NDIM >::evalR(), madness::Key< NDIM >::extract_key(), madness::fcube(), madness::FunctionImpl< T, NDIM >::fcube_for_mul(), madness::FunctionImpl< T, NDIM >::get_contraction_node_lists(), madness::SeparatedConvolution< Q, NDIM >::getmuop(), madness::SeparatedConvolution< Q, NDIM >::getmuop_modified(), madness::SimpleCache< Q, NDIM >::getptr(), madness::LBNodeDeux< NDIM >::index(), madness::Key< NDIM >::is_farther_out_than(), madness::TwoElectronInterface< T, NDIM >::make_coeff(), madness::Key< NDIM >::merge_with(), madness::Convolution1D< Q >::mod_nonstandard(), madness::Key< NDIM >::neighbor(), madness::FunctionImpl< T, NDIM >::neighbor(), madness::DerivativeBase< T, NDIM >::neighbor(), madness::MyPmap< D >::not_so_simple_hash(), madness::FunctionImpl< T, NDIM >::NS_fcube_for_mul(), YetAnotherWrapperClass::operator()(), madness::FunctionImpl< T, NDIM >::do_check_symmetry_local::operator()(), madness::FunctionImpl< T, NDIM >::do_mapdim::operator()(), madness::FunctionImpl< T, NDIM >::do_mirror::operator()(), madness::FunctionImpl< T, NDIM >::do_map_and_mirror::operator()(), madness::operator<<(), madness::SeparatedConvolution< Q, NDIM >::partial_upsample(), madness::FunctionImpl< T, NDIM >::print_plane_local(), madness::FunctionImpl< T, NDIM >::read_grid(), madness::FunctionImpl< T, NDIM >::read_grid2(), madness::SimpleCache< Q, NDIM >::set(), madness::SeparatedConvolution< Q, NDIM >::upsample(), and madness::FunctionImpl< T, NDIM >::upsample().

Friends And Related Function Documentation

◆ KeyChildIterator< NDIM >

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

Member Data Documentation

◆ hashval

template<std::size_t NDIM>
hashT Key::hashval
private

◆ l

template<std::size_t NDIM>
Vector<Translation, NDIM> madness::Key< NDIM >::l
private

◆ n

template<std::size_t NDIM>
ulong Key::n
private

◆ static_size

template<std::size_t NDIM>
const std::size_t madness::Key< NDIM >::static_size = NDIM
static

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