|
MADNESS 0.10.1
|
Holds displacements for applying operators to avoid replicating for all operators. More...
#include <displacements.h>

Classes | |
| struct | DispEntry |
| struct | PeriodicLists |
| the displacements for kernels lattice-summed along one set of axes, per level, in the two orders consumers use More... | |
Public Member Functions | |
| Displacements () | |
| const std::vector< Key< NDIM > > & | get_disp () |
| return the standard displacements appropriate for operators w/o lattice summation | |
| const std::vector< Key< NDIM > > & | get_disp (Level n, const array_of_bools< NDIM > &kernel_lattice_sum_axes) |
| const std::vector< Key< NDIM > > & | get_disp_images (Level n, const array_of_bools< NDIM > &kernel_lattice_sum_axes) |
Static Public Member Functions | |
| static int | bmax_default () |
| static void | make_disp (int bmax) |
| static void | make_disp_images (PeriodicLists &lists) |
| fills lists.by_image_distance (requires the lock) | |
| static void | make_disp_periodic (int bmax, Level n, PeriodicLists &lists) |
| fills lists.by_distance[n] for lists.axes | |
| static PeriodicLists & | periodic (const array_of_bools< NDIM > &axes) |
the lists for kernels lattice-summed along axes, built on the first request | |
| static void | reset_periodic_axes (const array_of_bools< NDIM > &periodic_axes) |
builds the displacements for kernels lattice-summed along periodic_axes if they do not exist yet | |
| static void | set_width (const Tensor< double > &width) |
| static void | sort_displacements (std::vector< Key< NDIM > > &d, const Tensor< double > &w) |
| static void | sort_displacements_images (std::vector< Key< NDIM > > &d, const array_of_bools< NDIM > &paxes, const Tensor< double > &w) |
| static void | sort_displacements_periodic (std::vector< Key< NDIM > > &d, const array_of_bools< NDIM > &paxes, const Tensor< double > &w) |
Static Private Member Functions | |
| static std::size_t | axes_mask (const array_of_bools< NDIM > &axes) |
Static Private Attributes | |
| static std::vector< Key< NDIM > > | disp = {} |
| standard displacements to be used with standard kernels (range-unrestricted, no lattice sum) | |
| static constexpr Level | nlevels = 8 * sizeof(Translation) - 2 |
| levels for which lists are built | |
| static std::array< std::atomic< PeriodicLists * >,(std::size_t(1)<< NDIM)> | periodic_lists {} |
| static Mutex | periodic_lists_mutex {} |
| serializes building the lists and set_width() | |
| static std::vector< std::unique_ptr< PeriodicLists > > | periodic_lists_owner {} |
| owns what periodic_lists points to | |
| static Tensor< double > | widths {NDIM} |
| cell width, used to order displacements from least to most real space distance | |
Holds displacements for applying operators to avoid replicating for all operators.
|
inline |
The first call generates the standard displacements and, if the default boundary conditions have periodic axes, the displacements for kernels lattice-summed along those axes. Lists for any other set of lattice-summed axes are built on their first request (get_disp, get_disp_images), which SeparatedConvolution makes when it is constructed.
References madness::Displacements< NDIM >::bmax_default(), madness::Displacements< NDIM >::disp, e(), madness::FunctionDefaults< NDIM >::get_bc(), MADNESS_PRAGMA_CLANG, madness::Displacements< NDIM >::make_disp(), NDIM, madness::Tensor< T >::normf(), madness::Displacements< NDIM >::periodic(), madness::pop(), and madness::Displacements< NDIM >::widths.
|
inlinestaticprivate |
Referenced by madness::Displacements< NDIM >::periodic().
|
inlinestatic |
|
inline |
return the standard displacements appropriate for operators w/o lattice summation
References madness::Displacements< NDIM >::disp, MADNESS_PRAGMA_CLANG, and madness::pop().
|
inline |
the displacements for a kernel lattice-summed along kernel_lattice_sum_axes (the standard displacements if none), ordered by the real-space distance to the source modulo the lattice (Key::real_distsq_bc), as FunctionImpl::do_apply screens a kernel that decays away from the source
References madness::array_of_bools< N >::any(), madness::Displacements< NDIM >::PeriodicLists::by_distance, madness::Displacements< NDIM >::disp, MADNESS_CHECK, MADNESS_PRAGMA_CLANG, madness::Displacements< NDIM >::nlevels, madness::Displacements< NDIM >::periodic(), and madness::pop().
Referenced by madness::FunctionImpl< T, NDIM >::do_apply_directed_screening(), and madness::SeparatedConvolution< Q, NDIM >::get_disp().
|
inline |
the displacements of get_disp(n, kernel_lattice_sum_axes) ordered by the distance to the nearest lattice image other than the home cell (Key::real_distsq_images), for kernels that sum only those images (OperatorInfo::images_only); built on the first request for these axes
References madness::Displacements< NDIM >::PeriodicLists::by_image_distance, madness::Displacements< NDIM >::PeriodicLists::images_built, MADNESS_CHECK, MADNESS_PRAGMA_CLANG, madness::Displacements< NDIM >::make_disp_images(), madness::Displacements< NDIM >::nlevels, madness::Displacements< NDIM >::periodic(), madness::Displacements< NDIM >::periodic_lists_mutex, and madness::pop().
Referenced by madness::SeparatedConvolution< Q, NDIM >::get_disp().
|
inlinestatic |
|
inlinestatic |
fills lists.by_image_distance (requires the lock)
References madness::Displacements< NDIM >::PeriodicLists::axes, madness::Displacements< NDIM >::PeriodicLists::by_distance, madness::Displacements< NDIM >::PeriodicLists::by_image_distance, madness::Displacements< NDIM >::nlevels, madness::Displacements< NDIM >::sort_displacements_images(), and madness::Displacements< NDIM >::widths.
Referenced by madness::Displacements< NDIM >::get_disp_images(), and madness::Displacements< NDIM >::set_width().
|
inlinestatic |
fills lists.by_distance[n] for lists.axes
References madness::array_of_bools< N >::any(), madness::Displacements< NDIM >::PeriodicLists::axes, madness::Displacements< NDIM >::PeriodicLists::by_distance, d, MADNESS_ASSERT, MADNESS_PRAGMA_CLANG, NDIM, madness::pop(), madness::Displacements< NDIM >::sort_displacements_periodic(), and madness::Displacements< NDIM >::widths.
Referenced by madness::Displacements< NDIM >::periodic().
|
inlinestatic |
the lists for kernels lattice-summed along axes, built on the first request
References madness::array_of_bools< N >::any(), madness::Displacements< NDIM >::axes_mask(), madness::Displacements< NDIM >::bmax_default(), MADNESS_CHECK_THROW, MADNESS_PRAGMA_CLANG, madness::Displacements< NDIM >::make_disp_periodic(), NDIM, madness::Displacements< NDIM >::nlevels, p(), madness::Displacements< NDIM >::periodic_lists, madness::Displacements< NDIM >::periodic_lists_mutex, madness::Displacements< NDIM >::periodic_lists_owner, and madness::pop().
Referenced by madness::Displacements< NDIM >::Displacements(), madness::Displacements< NDIM >::get_disp(), madness::Displacements< NDIM >::get_disp_images(), and madness::Displacements< NDIM >::reset_periodic_axes().
|
inlinestatic |
builds the displacements for kernels lattice-summed along periodic_axes if they do not exist yet
Lists are built per set of lattice-summed axes on first request, so this is not needed for correctness; it moves the build (all levels, a few tens of milliseconds) out of the first apply.
| periodic_axes | the lattice-summed axes |
References madness::array_of_bools< N >::any(), MADNESS_ASSERT, and madness::Displacements< NDIM >::periodic().
|
inlinestatic |
Sets the cell widths used to order the displacements by real-space distance, and reorders them if the widths changed. Called by FunctionDefaults::recompute_cell_info whenever the cell is set.
References madness::copy(), madness::Displacements< NDIM >::disp, MADNESS_ASSERT, MADNESS_PRAGMA_CLANG, madness::Displacements< NDIM >::make_disp_images(), NDIM, madness::BaseTensor::ndim(), madness::Displacements< NDIM >::nlevels, madness::Displacements< NDIM >::periodic_lists_mutex, madness::Displacements< NDIM >::periodic_lists_owner, madness::pop(), madness::BaseTensor::size(), madness::Displacements< NDIM >::sort_displacements(), madness::Displacements< NDIM >::sort_displacements_periodic(), and madness::Displacements< NDIM >::widths.
Referenced by madness::FunctionDefaults< NDIM >::recompute_cell_info(), test_opdir(), and testgradG().
|
inlinestatic |
|
inlinestatic |
orders by the distance to the nearest non-home image: least distance between the boxes, then boxes, then the distance between the box centers. The last breaks the tie among the displacements one box from an image, which are all at least distance 0: the narrowest summed axis comes first, and its block is the operator's largest (SeparatedConvolution::norm_bound visits the leading image-adjacent run).
Referenced by madness::Displacements< NDIM >::make_disp_images().
|
inlinestatic |
|
inlinestaticprivate |
standard displacements to be used with standard kernels (range-unrestricted, no lattice sum)
Referenced by madness::Displacements< NDIM >::Displacements(), madness::Displacements< NDIM >::get_disp(), madness::Displacements< NDIM >::get_disp(), madness::Displacements< NDIM >::make_disp(), and madness::Displacements< NDIM >::set_width().
|
staticconstexprprivate |
levels for which lists are built
Referenced by madness::Displacements< NDIM >::get_disp(), madness::Displacements< NDIM >::get_disp_images(), madness::Displacements< NDIM >::make_disp_images(), madness::Displacements< NDIM >::periodic(), and madness::Displacements< NDIM >::set_width().
|
inlinestaticprivate |
the lists for each set of lattice-summed axes, indexed by the axes' bitmask; a slot is filled on the first request for its axes (see periodic()) and published through the atomic once complete, so lookups take no lock. Sorting the lists with the metric of the axes they are requested for is what makes the shell-wise screening of FunctionImpl::do_apply sound: a list sorted for a superset of the kernel's axes would place a displacement wrapped along an axis the kernel does not sum next to the source, where for that kernel it is a cell away. A set holds every level's list in each order it was asked for (for NDIM = 3 up to (4 bmax + 1)^3 keys per level, some ten MB per order), so a process that uses operators summed along several different axis sets pays that per set; before, one set served them all.
Referenced by madness::Displacements< NDIM >::periodic().
|
inlinestaticprivate |
serializes building the lists and set_width()
Referenced by madness::Displacements< NDIM >::get_disp_images(), madness::Displacements< NDIM >::periodic(), and madness::Displacements< NDIM >::set_width().
|
inlinestaticprivate |
owns what periodic_lists points to
Referenced by madness::Displacements< NDIM >::periodic(), and madness::Displacements< NDIM >::set_width().
|
inlinestaticprivate |
cell width, used to order displacements from least to most real space distance
Referenced by madness::Displacements< NDIM >::Displacements(), madness::Displacements< NDIM >::make_disp(), madness::Displacements< NDIM >::make_disp_images(), madness::Displacements< NDIM >::make_disp_periodic(), and madness::Displacements< NDIM >::set_width().