Commit c1cd060d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set type of initialized variables to auto.

parent faa887e5
......@@ -378,7 +378,6 @@ gridGenAreaReg2D(const int gridID, double *area, bool lweights)
double lons[4], lats[4];
getLonLatCorner(nlon, i, grid_corner_lon.data(), grid_corner_lat.data(), lons, lats);
// area[i] = mod_cell_area(nv, grid_corner_lon+i*nv, grid_corner_lat+i*nv);
area[i] = mod_huiliers_area(nv, lons, lats);
}
......@@ -499,7 +498,6 @@ gridGenAreaUnstruct(int gridID, double *area)
findex++;
if (cdo_omp_get_thread_num() == 0) Progress::update(0, 1, findex / gridsize);
// area[i] = mod_cell_area(nv, grid_corner_lon+i*nv, grid_corner_lat+i*nv);
if (nv <= 4)
area[i] = mod_huiliers_area(nv, &grid_corner_lon[i * nv], &grid_corner_lat[i * nv]);
else
......@@ -518,7 +516,7 @@ gridGenArea(const int gridID, double *area)
int status = 0;
const auto gridsize = gridInqSize(gridID);
const int gridtype = gridInqType(gridID);
const auto gridtype = gridInqType(gridID);
const int projtype = (gridtype == GRID_PROJECTION) ? gridInqProjType(gridID) : -1;
if (gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN)
......
......@@ -16,13 +16,12 @@
*/
#include <cdi.h>
#include <cstring>
#include "dmemory.h"
#include "process_int.h"
#include "cdo_cdiWrapper.h"
#include <mpim_grid.h>
#include <cstring>
/*
@Function cdo_define_destagered_grid
@Title Define a de-staggered grid for U and V
......
......@@ -15,8 +15,6 @@
GNU General Public License for more details.
*/
#include <valarray>
#include <cdi.h>
#include "process_int.h"
......
......@@ -206,13 +206,12 @@ circum_center(struct cart *v0, struct cart *v1, struct cart *v2)
static struct cart
gc2cc(struct geo *position)
{
struct cart x;
double sln = std::sin(position->lon);
double cln = std::cos(position->lon);
double slt = std::sin(position->lat);
double clt = std::cos(position->lat);
const auto sln = std::sin(position->lon);
const auto cln = std::cos(position->lon);
const auto slt = std::sin(position->lat);
const auto clt = std::cos(position->lat);
struct cart x;
x.x[0] = cln * clt;
x.x[1] = sln * clt;
x.x[2] = slt;
......@@ -227,50 +226,27 @@ cc2gc(struct cart *x)
{
struct geo position;
double tln;
double tlt;
if (fabs(x->x[0]) <= 0.0)
{
if (x->x[1] >= 0.0)
{
position.lon = 0.5 * M_PI;
}
else
{
position.lon = 1.5 * M_PI;
}
position.lon = (x->x[1] >= 0.0) ? 0.5 * M_PI : 1.5 * M_PI;
}
else
{
tln = x->x[1] / x->x[0];
const auto tln = x->x[1] / x->x[0];
position.lon = std::atan(tln);
if (x->x[0] < 0.0)
{
position.lon = position.lon + M_PI;
}
if (position.lon < 0.0)
{
position.lon = position.lon + 2 * M_PI;
}
if (x->x[0] < 0.0) position.lon += M_PI;
if (position.lon < 0.0) position.lon += 2 * M_PI;
}
double r = std::sqrt(x->x[0] * x->x[0] + x->x[1] * x->x[1]);
const auto r = std::sqrt(x->x[0] * x->x[0] + x->x[1] * x->x[1]);
if (fabs(r) <= 0.0)
{
if (x->x[2] > 0.0)
{
position.lat = 0.5 * M_PI;
}
else
{
position.lat = -0.5 * M_PI;
}
position.lat = (x->x[2] > 0.0) ? 0.5 * M_PI : -0.5 * M_PI;
}
else
{
tlt = x->x[2] / r;
const auto tlt = x->x[2] / r;
position.lat = std::atan(tlt);
}
......
......@@ -20,7 +20,6 @@
#include <cstdio>
#include "process_int.h"
#include "cdo_math.h"
#include "cdo_options.h"
......@@ -144,10 +143,10 @@ gridPointSearchCreateReg2d(bool xIsCyclic, size_t dims[2], const double *lons, c
gps->is_reg2d = true;
gps->dims[0] = dims[0];
gps->dims[1] = dims[1];
size_t nx = dims[0];
size_t ny = dims[1];
const auto nx = dims[0];
const auto ny = dims[1];
size_t nxm = xIsCyclic ? nx + 1 : nx;
const auto nxm = xIsCyclic ? nx + 1 : nx;
double *reg2d_center_lon = (double *) Malloc(nxm * sizeof(double));
double *reg2d_center_lat = (double *) Malloc(ny * sizeof(double));
......
......@@ -50,7 +50,8 @@ public:
poldim = nsp / 2 * nlat;
vtrig.resize(nlon);
fft_set(vtrig.data(), ifax, nlon);
int status = fft_set(vtrig.data(), ifax, nlon);
if (status < 0) cdoAbort("FFT error!");
vpoli.resize(poldim);
vpold.resize(poldim);
......
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