ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
field_layout_helpers.hpp File Reference
#include "for_each_3d.hpp"
#include <utils/Vector.hpp>
#include <utils/index.hpp>
#include <algorithm>
#include <cassert>
#include <complex>
#include <cstddef>
#include <iterator>
#include <memory>
#include <new>
#include <span>
#include <type_traits>
#include <utility>
#include <vector>
+ Include dependency graph for field_layout_helpers.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<Utils::MemoryOrder memory_order, Utils::MemoryOrder output_memory_order, typename Container , typename OutValue >
void extract_block_into (OutValue *out, Container const &in_array, Utils::Vector3i const &dimensions, Utils::Vector3i const &start, Utils::Vector3i const &stop)
 Extract a 3D block from the halo field into a caller-provided buffer.
 
template<Utils::MemoryOrder memory_order, Utils::MemoryOrder output_memory_order, typename T , typename OutValue >
void pad_with_zeros_discard_imag_into (OutValue *out, std::span< T > cropped_array, Utils::Vector3i const &cropped_dim, Utils::Vector3i const &pad_left, Utils::Vector3i const &pad_right)
 Pad a 3D matrix with zeros to restore halo regions, writing into a caller-provided buffer of product(cropped_dim+pad_left+pad_right) elements.
 

Function Documentation

◆ extract_block_into()

template<Utils::MemoryOrder memory_order, Utils::MemoryOrder output_memory_order, typename Container , typename OutValue >
void extract_block_into ( OutValue out,
Container const in_array,
Utils::Vector3i const dimensions,
Utils::Vector3i const start,
Utils::Vector3i const stop 
)

Extract a 3D block from the halo field into a caller-provided buffer.

out must hold at least product(stop - start) elements; the block is written in full, so its prior contents are irrelevant.

Definition at line 47 of file field_layout_helpers.hpp.

References Utils::Vector< T, N >::data(), Utils::ROW_MAJOR, and stream.

Referenced by DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::long_range_kernel().

◆ pad_with_zeros_discard_imag_into()

template<Utils::MemoryOrder memory_order, Utils::MemoryOrder output_memory_order, typename T , typename OutValue >
void pad_with_zeros_discard_imag_into ( OutValue out,
std::span< T >  cropped_array,
Utils::Vector3i const cropped_dim,
Utils::Vector3i const pad_left,
Utils::Vector3i const pad_right 
)

Pad a 3D matrix with zeros to restore halo regions, writing into a caller-provided buffer of product(cropped_dim+pad_left+pad_right) elements.

Every element is written exactly once (halo shells are zeroed, the interior is copied), so the buffer's prior contents are irrelevant and a persistent buffer can be reused across calls without an allocation or a full-volume zero-fill.

Definition at line 97 of file field_layout_helpers.hpp.

References Utils::product(), Utils::ROW_MAJOR, and stream.

Referenced by DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::long_range_kernel().