Merge branch 'catch_test' into ewald_dbg_rebased2

This commit is contained in:
Marek Nečada 2022-06-01 16:19:28 +03:00
commit 09e140a4bf
2 changed files with 61 additions and 0 deletions

37
qpms/lattices_types.h Normal file
View File

@ -0,0 +1,37 @@
/*! \file lattices_types.h
* \brief Auxiliary lattice point generator and related enum declarations.
*
* This file contains necessary declarations needed in other header files.
* In contrast to lattices.h, this one is C++ compatible.
*
* \see lattices.h
*/
#ifndef LATTICES_TYPES_H
#define LATTICES_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum LatticeDimensionality {
LAT1D = 1,
LAT2D = 2,
LAT3D = 4,
SPACE1D = 8,
SPACE2D = 16,
SPACE3D = 32,
LAT_1D_IN_3D = 33,
LAT_2D_IN_3D = 34,
LAT_3D_IN_3D = 40,
// special coordinate arrangements (indicating possible optimisations)
LAT_ZONLY = 64,
LAT_XYONLY = 128,
LAT_1D_IN_3D_ZONLY = 97, // LAT1D | SPACE3D | 64
LAT_2D_IN_3D_XYONLY = 162 // LAT2D | SPACE3D | 128
} LatticeDimensionality;
struct PGen;
#ifdef __cplusplus
}
#endif
#endif // LATTICES_TYPES_H

24
tests/catch/catch_aux.C Normal file
View File

@ -0,0 +1,24 @@
#include "catch_aux.h"
#include "complex.h"
namespace qpmstest{
/// Creates a new vector<double> from complex number array
std::vector<double> pointer2dvec(const _Complex double *arr, size_t siz){
std::vector<double> vec(2*siz);
for(size_t i = 0; i < siz; ++i) {
vec[2*i] = creal(arr[i]);
vec[2*i+1] = cimag(arr[i]);
}
return vec;
}
std::vector<double> pointer2dvec(const double *arr, size_t siz){
std::vector<double> vec(siz);
for(size_t i = 0; i < siz; ++i)
vec[i] = arr[i];
return vec;
}
std::vector<double> pointer2dvec(const csphvec_t *arr, size_t siz) {
return pointer2dvec(&arr->rc, 3*siz);
}
}