MADNESS 0.10.1
test_lbdeux.cc File Reference
#include <madness/mra/mra.h>
#include <madness/mra/lbdeux.h>
#include <madness/world/test_utilities.h>
#include <algorithm>
#include <cmath>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for test_lbdeux.cc:

Classes

struct  NaNCost
struct  NegativeRootCost
struct  ZeroCost
 A guard, not a regression test: a zero root cost passed the old cost >= 0 filter too. More...

Typedefs

template<std::size_t NDIM>
using Assignment = std::vector<std::pair<Key<NDIM>, ProcessID>>

Functions

template<typename costT>
static bool all_children_split_off (World &world, const real_function_3d &f, const costT &cost, const double root_cost, const double fac)
template<std::size_t NDIM>
static bool constructor_throws (const Assignment< NDIM > &assignment)
 True only for MadnessException. An old-style throw "..." or a clean return is a failure.
static double gaussian (const coord_3d &r)
static Key< 1 > key1 (Level n, Translation l)
static Key< 3 > key3 (Level n, Translation x, Translation y, Translation z)
int main (int argc, char **argv)
template<typename costT>
static int test_driver_keeps_root (World &world, const std::string &name, const costT &cost, const double fac)
 Runs the real driver, then asks the returned map for the root and for every local function key.
static int test_driver_rejects_nonfinite_cost (World &world)
 A non-finite cost must stop load_balance() on every rank, before it reaches the sort.
static int test_duplicate_key_throws (World &world)
static int test_key_below_deepest_level (World &world)
static int test_missing_root_throws (World &world)
static int test_nearest_ancestor (World &world)
static int test_rank_out_of_range_throws (World &world)
static int test_unmatched_level_zero_key_throws (World &world)

Variables

static constexpr ProcessID nproc = 3
 Rank bound for the hand-written maps, which use the ranks 0, 1 and 2.

Typedef Documentation

◆ Assignment

template<std::size_t NDIM>
using Assignment = std::vector<std::pair<Key<NDIM>, ProcessID>>

Function Documentation

◆ all_children_split_off()

template<typename costT>
bool all_children_split_off ( World & world,
const real_function_3d & f,
const costT & cost,
const double root_cost,
const double fac )
static

True if load_balance(fac) splits every child off the root, so that only the root's own cost stays as its residual. partition() tests the remaining cost against 1.1 times the average before it subtracts each child, in descending order, so the last test sees the smallest child.

References c, f, madness::World::gop, madness::Key< NDIM >::level(), madness::Key< NDIM >::parent(), madness::World::size(), madness::WorldGopInterface::sum(), and madness::Key< NDIM >::translation().

Referenced by test_driver_keeps_root().

◆ constructor_throws()

template<std::size_t NDIM>
bool constructor_throws ( const Assignment< NDIM > & assignment)
static

True only for MadnessException. An old-style throw "..." or a clean return is a failure.

References madness::FunctionDefaults< NDIM >::pmap, and nproc.

Referenced by test_duplicate_key_throws(), test_missing_root_throws(), and test_rank_out_of_range_throws().

◆ gaussian()

double gaussian ( const coord_3d & r)
static

◆ key1()

Key< 1 > key1 ( Level n,
Translation l )
static

References madness::vec().

Referenced by madness::Key< D >::break_apart(), madness::FunctionImpl< T, NDIM >::Vphi_ij_u_op_NS< opT, LDIM >::compute_error_from_inaccurate_refinement(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::compute_error_from_inaccurate_refinement(), madness::FunctionImpl< T, LDIM >::dirac_convolution_op(), madness::FunctionImpl< T, LDIM >::do_dirac_convolution(), TestCalculationParameters::make_all_parameter_doubles(), TestCalculationParameters::make_all_parameters_for_two_keys(), madness::FunctionImpl< T, NDIM >::hartree_op< LDIM, leaf_opT >::make_child(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::recursive_apply_op_vec< opT, LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::Vphi_ij_u_op_NS< opT, LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_child(), madness::FunctionImpl< T, NDIM >::Vphi_ij_u_op_NS< opT, LDIM >::make_sum_coeffs(), madness::FunctionImpl< T, NDIM >::Vphi_op_NS< opT, LDIM >::make_sum_coeffs(), madness::ElectronCuspyBox_op< T, NDIM >::operator()(), madness::FunctionImpl< T, NDIM >::do_inner_local_on_demand< R >::operator()(), madness::FunctionImpl< T, NDIM >::hartree_op< LDIM, leaf_opT >::operator()(), madness::FunctionImpl< T, NDIM >::multiply_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::pointwise_multiplier< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::project_out_op< LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::recursive_apply_op< opT, LDIM >::operator()(), madness::FunctionImpl< T, NDIM >::recursive_apply_op_vec< opT, LDIM >::operator()(), madness::NuclearCuspyBox_op< T, NDIM >::operator()(), YetAnotherWrapperClass::operator()(), madness::FunctionImpl< T, LDIM >::project_out2(), test0(), test_duplicate_key_throws(), test_missing_root_throws(), test_nearest_ancestor(), test_rank_out_of_range_throws(), and test_unmatched_level_zero_key_throws().

◆ key3()

Key< 3 > key3 ( Level n,
Translation x,
Translation y,
Translation z )
static

References madness::vec().

Referenced by test_key_below_deepest_level().

◆ main()

◆ test_driver_keeps_root()

template<typename costT>
int test_driver_keeps_root ( World & world,
const std::string & name,
const costT & cost,
const double fac )
static

◆ test_driver_rejects_nonfinite_cost()

int test_driver_rejects_nonfinite_cost ( World & world)
static

◆ test_duplicate_key_throws()

int test_duplicate_key_throws ( World & world)
static

◆ test_key_below_deepest_level()

int test_key_below_deepest_level ( World & world)
static

Each level-20 key below has the translation of its level-3 ancestor in the high 3 bits. The two level-3 entries are siblings, so a lookup that stops one level too high finds neither.

References madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionDefaults< NDIM >::pmap, key3(), nproc, and madness::World::rank().

Referenced by main().

◆ test_missing_root_throws()

int test_missing_root_throws ( World & world)
static

◆ test_nearest_ancestor()

int test_nearest_ancestor ( World & world)
static

Mapped tree, with a distinct rank for each entry:

(0,0) -> 0
  (1,1) -> 1
    (2,2) -> 2 

References madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionDefaults< NDIM >::pmap, key1(), nproc, and madness::World::rank().

Referenced by main().

◆ test_rank_out_of_range_throws()

int test_rank_out_of_range_throws ( World & world)
static

◆ test_unmatched_level_zero_key_throws()

int test_unmatched_level_zero_key_throws ( World & world)
static

A level-0 key with a nonzero translation is not in the box, and only such a key can reach this branch, because the constructor requires the root.

References madness::test_output::checkpoint(), madness::test_output::end(), madness::FunctionDefaults< NDIM >::pmap, key1(), nproc, and madness::World::rank().

Referenced by main().

Variable Documentation

◆ nproc