Commit 79b58a9c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

no more typedefs

parent 513c1b5b
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
using namespace std; using namespace std;
typedef complex<double> dcmplx; using dcmplx = complex<double>;
typedef complex<float> fcmplx; using fcmplx = complex<float>;
static const double sqrt_one_half = 0.707106781186547572737310929369; static const double sqrt_one_half = 0.707106781186547572737310929369;
static const double sqrt_two = 1.414213562373095145474621858739; static const double sqrt_two = 1.414213562373095145474621858739;
......
...@@ -33,35 +33,35 @@ ...@@ -33,35 +33,35 @@
/*! \internal /*! \internal
Helper type containing information about a single ring. */ Helper type containing information about a single ring. */
typedef struct struct sharp_ringinfo
{ {
double theta, phi0, weight, cth, sth; double theta, phi0, weight, cth, sth;
ptrdiff_t ofs; ptrdiff_t ofs;
int nph, stride; int nph, stride;
} sharp_ringinfo; };
/*! \internal /*! \internal
Helper type containing information about a pair of rings with colatitudes Helper type containing information about a pair of rings with colatitudes
symmetric around the equator. */ symmetric around the equator. */
typedef struct struct sharp_ringpair
{ {
sharp_ringinfo r1,r2; sharp_ringinfo r1,r2;
} sharp_ringpair; };
/*! \internal /*! \internal
Type holding all required information about a map geometry. */ Type holding all required information about a map geometry. */
typedef struct struct sharp_geom_info
{ {
std::vector<sharp_ringpair> pair; std::vector<sharp_ringpair> pair;
int nphmax; int nphmax;
} sharp_geom_info; };
/*! \defgroup almgroup Helpers for dealing with a_lm */ /*! \defgroup almgroup Helpers for dealing with a_lm */
/*! \{ */ /*! \{ */
/*! \internal /*! \internal
Helper type for index calculation in a_lm arrays. */ Helper type for index calculation in a_lm arrays. */
typedef struct struct sharp_alm_info
{ {
/*! Maximum \a l index of the array */ /*! Maximum \a l index of the array */
int lmax; int lmax;
...@@ -76,10 +76,10 @@ typedef struct ...@@ -76,10 +76,10 @@ typedef struct
std::vector<ptrdiff_t> mvstart; std::vector<ptrdiff_t> mvstart;
/*! Stride between a_lm and a_(l+1),m */ /*! Stride between a_lm and a_(l+1),m */
ptrdiff_t stride; ptrdiff_t stride;
} sharp_alm_info; };
/*! alm_info flags */ /*! alm_info flags */
typedef enum { SHARP_PACKED = 1, enum sharp_almflags { SHARP_PACKED = 1,
/*!< m=0-coefficients are packed so that the (zero) imaginary part is /*!< m=0-coefficients are packed so that the (zero) imaginary part is
not present. mvstart is in units of *real* float/double for all not present. mvstart is in units of *real* float/double for all
m; stride is in units of reals for m=0 and complex for m!=0 */ m; stride is in units of reals for m=0 and complex for m!=0 */
...@@ -94,7 +94,7 @@ typedef enum { SHARP_PACKED = 1, ...@@ -94,7 +94,7 @@ typedef enum { SHARP_PACKED = 1,
corresponding complex coefficient (when accessed corresponding complex coefficient (when accessed
as complex). as complex).
*/ */
} sharp_almflags; };
...@@ -170,17 +170,17 @@ void sharp_destroy_geom_info (sharp_geom_info *info); ...@@ -170,17 +170,17 @@ void sharp_destroy_geom_info (sharp_geom_info *info);
/*! \{ */ /*! \{ */
/*! Enumeration of SHARP job types. */ /*! Enumeration of SHARP job types. */
typedef enum { SHARP_YtW=0, /*!< analysis */ enum sharp_jobtype { SHARP_YtW=0, /*!< analysis */
SHARP_MAP2ALM=SHARP_YtW, /*!< analysis */ SHARP_MAP2ALM=SHARP_YtW, /*!< analysis */
SHARP_Y=1, /*!< synthesis */ SHARP_Y=1, /*!< synthesis */
SHARP_ALM2MAP=SHARP_Y, /*!< synthesis */ SHARP_ALM2MAP=SHARP_Y, /*!< synthesis */
SHARP_Yt=2, /*!< adjoint synthesis */ SHARP_Yt=2, /*!< adjoint synthesis */
SHARP_WY=3, /*!< adjoint analysis */ SHARP_WY=3, /*!< adjoint analysis */
SHARP_ALM2MAP_DERIV1=4 /*!< synthesis of first derivatives */ SHARP_ALM2MAP_DERIV1=4 /*!< synthesis of first derivatives */
} sharp_jobtype; };
/*! Job flags */ /*! Job flags */
typedef enum { SHARP_DP = 1<<4, enum sharp_jobflags { SHARP_DP = 1<<4,
/*!< map and a_lm are in double precision */ /*!< map and a_lm are in double precision */
SHARP_ADD = 1<<5, SHARP_ADD = 1<<5,
/*!< results are added to the output arrays, instead of /*!< results are added to the output arrays, instead of
...@@ -192,7 +192,7 @@ typedef enum { SHARP_DP = 1<<4, ...@@ -192,7 +192,7 @@ typedef enum { SHARP_DP = 1<<4,
SHARP_NO_FFT = 1<<7, SHARP_NO_FFT = 1<<7,
SHARP_USE_WEIGHTS = 1<<20, /* internal use only */ SHARP_USE_WEIGHTS = 1<<20, /* internal use only */
} sharp_jobflags; };
/*! Performs a libsharp2 SHT job. The interface deliberately does not use /*! Performs a libsharp2 SHT job. The interface deliberately does not use
the C99 "complex" data type, in order to be callable from C89 and C++. the C99 "complex" data type, in order to be callable from C89 and C++.
......
...@@ -31,12 +31,12 @@ ...@@ -31,12 +31,12 @@
#undef GENERIC_ARCH #undef GENERIC_ARCH
#undef ARCH #undef ARCH
typedef void (*t_inner_loop) (sharp_job *job, const int *ispair, using t_inner_loop = void (*) (sharp_job *job, const int *ispair,
const double *cth_, const double *sth_, int llim, int ulim, const double *cth_, const double *sth_, int llim, int ulim,
sharp_Ylmgen &gen, int mi, const int *mlim); sharp_Ylmgen &gen, int mi, const int *mlim);
typedef int (*t_veclen) (void); using t_veclen = int (*) (void);
typedef int (*t_max_nvec) (int spin); using t_max_nvec = int (*) (int spin);
typedef const char *(*t_architecture) (void); using t_architecture = const char *(*) (void);
static t_inner_loop inner_loop_ = NULL; static t_inner_loop inner_loop_ = NULL;
static t_veclen veclen_ = NULL; static t_veclen veclen_ = NULL;
......
...@@ -82,50 +82,50 @@ static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d, ...@@ -82,50 +82,50 @@ static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d,
// Unfortunately, most compilers don't act on this pragma yet. // Unfortunately, most compilers don't act on this pragma yet.
#pragma STDC FP_CONTRACT ON #pragma STDC FP_CONTRACT ON
typedef complex<double> dcmplx; using dcmplx = complex<double>;
#define nv0 (128/VLEN) #define nv0 (128/VLEN)
#define nvx (64/VLEN) #define nvx (64/VLEN)
typedef Tv Tbv0[nv0]; using Tbv0 = Tv[nv0];
typedef double Tbs0[nv0*VLEN]; using Tbs0 = double[nv0*VLEN];
typedef struct struct s0data_v
{ {
Tbv0 sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i; Tbv0 sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i;
} s0data_v; };
typedef struct struct s0data_s
{ {
Tbs0 sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i; Tbs0 sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i;
} s0data_s; };
typedef union union s0data_u
{ {
s0data_v v; s0data_v v;
s0data_s s; s0data_s s;
} s0data_u; };
typedef Tv Tbvx[nvx]; using Tbvx = Tv[nvx];
typedef double Tbsx[nvx*VLEN]; using Tbsx = double[nvx*VLEN];
typedef struct struct sxdata_v
{ {
Tbvx sth, cfp, cfm, scp, scm, l1p, l2p, l1m, l2m, cth, Tbvx sth, cfp, cfm, scp, scm, l1p, l2p, l1m, l2m, cth,
p1pr, p1pi, p2pr, p2pi, p1mr, p1mi, p2mr, p2mi; p1pr, p1pi, p2pr, p2pi, p1mr, p1mi, p2mr, p2mi;
} sxdata_v; };
typedef struct struct sxdata_s
{ {
Tbsx sth, cfp, cfm, scp, scm, l1p, l2p, l1m, l2m, cth, Tbsx sth, cfp, cfm, scp, scm, l1p, l2p, l1m, l2m, cth,
p1pr, p1pi, p2pr, p2pi, p1mr, p1mi, p2mr, p2mi; p1pr, p1pi, p2pr, p2pi, p1mr, p1mi, p2mr, p2mi;
} sxdata_s; };
typedef union union sxdata_u
{ {
sxdata_v v; sxdata_v v;
sxdata_s s; sxdata_s s;
} sxdata_u; };
static inline void Tvnormalize (Tv * MRUTIL_RESTRICT val, Tv * MRUTIL_RESTRICT scale, static inline void Tvnormalize (Tv * MRUTIL_RESTRICT val, Tv * MRUTIL_RESTRICT scale,
double maxval) double maxval)
...@@ -191,8 +191,8 @@ static void mypow(Tv val, int npow, const vector<double> &powlimit, ...@@ -191,8 +191,8 @@ static void mypow(Tv val, int npow, const vector<double> &powlimit,
static inline void getCorfac(Tv scale, Tv * MRUTIL_RESTRICT corfac, static inline void getCorfac(Tv scale, Tv * MRUTIL_RESTRICT corfac,
const vector<double> &cf) const vector<double> &cf)
{ {
typedef union union Tvu
{ Tv v; double s[VLEN]; } Tvu; { Tv v; double s[VLEN]; };
Tvu sc, corf; Tvu sc, corf;
sc.v=scale; sc.v=scale;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
using std::complex; using std::complex;
typedef struct struct sharp_job
{ {
sharp_jobtype type; sharp_jobtype type;
int spin; int spin;
...@@ -50,7 +50,7 @@ typedef struct ...@@ -50,7 +50,7 @@ typedef struct
const sharp_alm_info *ainfo; const sharp_alm_info *ainfo;
double time; double time;
unsigned long long opcnt; unsigned long long opcnt;
} sharp_job; };
void inner_loop (sharp_job *job, const int *ispair,const double *cth, void inner_loop (sharp_job *job, const int *ispair,const double *cth,
const double *sth, int llim, int ulim, sharp_Ylmgen &gen, int mi, const double *sth, int llim, int ulim, sharp_Ylmgen &gen, int mi,
......
...@@ -208,7 +208,7 @@ class Distribution ...@@ -208,7 +208,7 @@ class Distribution
size_t chunksize_; size_t chunksize_;
double fact_max_; double fact_max_;
vector<size_t> nextstart; vector<size_t> nextstart;
typedef enum { SINGLE, STATIC, DYNAMIC } SchedMode; enum SchedMode { SINGLE, STATIC, DYNAMIC };
SchedMode mode; SchedMode mode;
bool single_done; bool single_done;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment