libdistopia C++ layer

template<typename T>
void CalcBondsOrtho(const T *coords0, const T *coords1, const T *box, std::size_t n, T *out)

Calculates the distance between two sets of points in two contiguous arrays under orthorhombic periodic boundary conditions.

Template Parameters:

T – the type of the coordinates (float or double)

Parameters:
  • coords0 – array of coordinates

  • coords1 – array of coordinates

  • box – the bounding box of the simulation

  • n – the number of distances to calculate

  • out – result array into which the distances are returned

template<typename T>
void CalcBondsNoBox(const T *coords0, const T *coords1, std::size_t n, T *out)

Calculates the distance between two sets of points in two contiguous arrays without periodic boundary conditions.

Template Parameters:

T – the type of the coordinates (float or double)

Parameters:
  • coords0 – array of coordinates

  • coords1 – array of coordinates

  • n – the number of distances to calculate

  • out – result array into which the distances are returned

template<typename T>
void CalcBondsIdxOrtho(const T *coords, const std::size_t *idxs, const T *box, std::size_t n, T *out)

Calculates the distance between sets of two points in a single array indexed by the idxs parameter under orthorhombic periodic boundary conditions.

Template Parameters:

T – the type of the coordinates (float or double)

Parameters:
  • coords – array of coordinates

  • idxs – the indicies of the distances to calculate

  • box – the bounding box of the simulation

  • n – the number of distances to calculate

  • out – result array into which the distances are returned

template<typename T>
void CalcBondsIdxNoBox(const T *coords, const std::size_t *idxs, std::size_t n, T *out)

Calculates the distance between sets of two points in a single array indexed by the idxs parameter without periodic boundary conditions.

Template Parameters:

T – the type of the coordinates (float or double)

Parameters:
  • coords – array of coordinates

  • idxs – the indicies of the distances to calculate

  • n – the number of distances to calculate

  • out – result array into which the distances are returned

template<typename VectorT>
class VectorTriple

Class that packs sets of 3 coordinates into a single unit for operations on interleaved or deinterleaved data. The number of coordinates held is determined by the SIMD width.

Template Parameters:

VectorT – (SIMD datatype)

Public Functions

inline void load(const ScalarT *source)

load into the VectorTriple by loading from an array of ScalarT eg float* or double *.

Parameters:

source – scalar array to load from

inline void load_and_deinterleave(const ScalarT *source)

load into the VectorTriple by loading from an array of ScalarT eg float* or double * with a deinterleave being applied.

Parameters:

source – scalar array to load from

inline void load_partial_and_deinterleave(const ScalarT *source, const std::size_t n)

load into the VectorTriple by loading from an array of ScalarT eg float* or double * with a deinterleave being applied.

Parameters:
  • source – scalar array to load from

  • n – number of coordinates to load

template<int stride>
inline void idxload_and_deinterleave(const ScalarT *source, const std::size_t *idxs)

construct by loading discontiguously from an array of ScalarT eg float* or double* using the indices in idxs with a deinterleave applied.

Template Parameters:

stride – the stride at which to use the indices, take every nth index

Parameters:
  • source – scalar array to load from

  • idxs – indices to the coordinate array

template<int stride>
inline void idxload_and_deinterleave_partial(const ScalarT *source, const std::size_t *idxs, const std::size_t n)

construct by loading discontiguously from an array of ScalarT eg float* or double* using the indices in idxs with a deinterleave applied.

Template Parameters:

stride – the stride at which to use the indices, take every nth index

Parameters:
  • source – scalar array to load from

  • idxs – indices to the coordinate array

  • n – number of indices to load

inline void debug_print(const char *nm)

print the contents of the vector

Public Members

VectorT x

SIMD type that contains x coordinates

VectorT y

SIMD type that contains y coordinates

VectorT z

SIMD type that contains z coordinates

Public Static Attributes

static constexpr std::size_t size = ValuesPerPack<VectorT>

number of values per vector