Commit 9c949eb9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

after_sptrans.cc: cleanup.

parent 9be0a974
......@@ -29,10 +29,6 @@
#include "mpmo.h"
#include "array.h"
#define OPENMP4 201307
#if defined(_OPENMP) && defined(OPENMP4) && _OPENMP >= OPENMP4
#define HAVE_OPENMP4 1
#endif
extern "C" void gaussianLatitudes(double *latitudes, double *weights, size_t nlat);
......@@ -399,11 +395,6 @@ after_legini(long ntr, long nlat, double *restrict poli, double *restrict pold,
void
sp2fctest(const double *sa, double *fa, const double *poli, long nlev, long nlat, long nfc, long nt)
{
long lats, is;
double sar, sai;
double saris, saiis;
double *restrict far, *restrict fai;
long nsp2 = (nt + 1) * (nt + 2);
for (long lev = 0; lev < nlev; lev++)
......@@ -417,19 +408,19 @@ sp2fctest(const double *sa, double *fa, const double *poli, long nlev, long nlat
{
for (long jn = 0; jn <= nt - jm; jn++)
{
is = (jn + 1) % 2 * 2 - 1;
sar = *sal++;
sai = *sal++;
saris = sar * is;
saiis = sai * is;
far = fal;
fai = fal + nlat;
const long is = (jn + 1) % 2 * 2 - 1;
const double sar = *sal++;
const double sai = *sal++;
const double saris = sar * is;
const double saiis = sai * is;
double *restrict far = fal;
double *restrict fai = fal + nlat;
#ifdef HAVE_OPENMP4
#pragma omp simd
#endif
for (long latn = 0; latn < nlat / 2; latn++)
{
lats = nlat - latn - 1;
const long lats = nlat - latn - 1;
far[latn] += pol[latn] * sar;
fai[latn] += pol[latn] * sai;
far[lats] += pol[latn] * saris;
......@@ -457,17 +448,14 @@ sp2fc(const double *sa, double *fa, const double *poli, long nlev, long nlat, lo
double *fal = fa + lev * nfc * nlat;
memset(fal, 0, nfc * nlat * sizeof(double));
double *restrict far, *restrict fai;
double sar, sai;
for (long jmm = 0; jmm <= nt; jmm++)
{
for (long jfc = jmm; jfc <= nt; jfc++)
{
sar = *sal++;
sai = *sal++;
far = fal;
fai = fal + nlat;
const double sar = *sal++;
const double sai = *sal++;
double *restrict far = fal;
double *restrict fai = fal + nlat;
/* unaligned loop start
#ifdef HAVE_OPENMP4
#pragma omp simd
......@@ -499,23 +487,18 @@ fc2sp(double *fa, double *sa, const double *poli, long nlev, long nlat, long nfc
double *fal = fa + lev * nfc * nlat;
double *sal = sa + lev * nsp2;
const double *restrict far;
const double *restrict fai;
double sar, sai;
long jmm, jfc, lat;
for (jmm = 0; jmm <= nt; jmm++)
for (long jmm = 0; jmm <= nt; jmm++)
{
for (jfc = jmm; jfc <= nt; jfc++)
for (long jfc = jmm; jfc <= nt; jfc++)
{
far = fal;
fai = fal + nlat;
sar = 0.0;
sai = 0.0;
const double *far = fal;
const double *fai = fal + nlat;
double sar = 0.0;
double sai = 0.0;
#ifdef HAVE_OPENMP4
#pragma omp simd reduction(+ : sar) reduction(+ : sai)
#endif
for (lat = 0; lat < nlat; lat++)
for (long lat = 0; lat < nlat; lat++)
{
sar += pol[lat] * far[lat];
sai += pol[lat] * fai[lat];
......
Markdown is supported
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