Commit 9d198013 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

refactored types of centroids in remapConservWeightScrip into std::vector<double>

parent 65a3a187
......@@ -22,7 +22,6 @@
#include "cdo_options.h"
#include "progress.h"
#include "cimdOmp.h"
#include "dmemory.h"
#define ZERO 0.0
#define ONE 1.0
......@@ -1008,8 +1007,8 @@ line_integral(double *weights, double in_phi1, double in_phi2, double theta1, do
} /* line_integral */
static void
correct_pole(RemapGrid *src_grid, RemapGrid *tgt_grid, RemapVars &rv, double *src_centroid_lat, double *src_centroid_lon,
double *tgt_centroid_lat, double *tgt_centroid_lon, GridStore &grid_store)
correct_pole(RemapGrid *src_grid, RemapGrid *tgt_grid, RemapVars &rv, std::vector<double> &src_centroid_lat, std::vector<double> &src_centroid_lon,
std::vector<double> &tgt_centroid_lat, std::vector<double> &tgt_centroid_lon, GridStore &grid_store)
{
/*
Correct for situations where N/S pole not explicitly included in
......@@ -1137,7 +1136,7 @@ norm_weight(double norm_factor, double *weights, double src_centroid_lat, double
}
static void
normalize_weights(RemapGrid *tgt_grid, RemapVars &rv, double *src_centroid_lat, double *src_centroid_lon)
normalize_weights(RemapGrid *tgt_grid, RemapVars &rv, std::vector<double> &src_centroid_lat, std::vector<double> &src_centroid_lon)
{
/* Include centroids in weights and normalize using destination area if requested */
long num_links = rv.num_links;
......@@ -1263,10 +1262,14 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
/* Initialize centroid arrays */
double *src_centroid_lat = (double *) Malloc(src_grid_size * sizeof(double));
double *src_centroid_lon = (double *) Malloc(src_grid_size * sizeof(double));
double *tgt_centroid_lat = (double *) Malloc(tgt_grid_size * sizeof(double));
double *tgt_centroid_lon = (double *) Malloc(tgt_grid_size * sizeof(double));
//double *src_centroid_lat = (double *) Malloc(src_grid_size * sizeof(double));
//double *src_centroid_lon = (double *) Malloc(src_grid_size * sizeof(double));
//double *tgt_centroid_lat = (double *) Malloc(tgt_grid_size * sizeof(double));
//double *tgt_centroid_lon = (double *) Malloc(tgt_grid_size * sizeof(double));
std::vector<double> src_centroid_lat (src_grid_size);
std::vector<double> src_centroid_lon (src_grid_size);
std::vector<double> tgt_centroid_lat (tgt_grid_size);
std::vector<double> tgt_centroid_lon (tgt_grid_size);
for (long n = 0; n < src_grid_size; ++n)
{
......@@ -1815,10 +1818,5 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
}
} // lcheck
Free(src_centroid_lat);
Free(src_centroid_lon);
Free(tgt_centroid_lat);
Free(tgt_centroid_lon);
if (Options::cdoVerbose) cdoPrint("Cells search: %.2f seconds", cdo_get_wtime() - start);
} // remapConservWeightsScrip
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