Skip to content

Commit 2dddea8

Browse files
committed
gcc warnings removed
1 parent 2aa1ea9 commit 2dddea8

18 files changed

+128
-279
lines changed

examples/Example_apr_iterate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ int main(int argc, char **argv) {
246246

247247
for (int level = apr_iterator.level_min(); level <= apr_iterator.level_max(); ++level) {
248248

249-
int z = 0;
249+
unsigned int z = 0;
250250
#ifdef HAVE_OPENMP
251251
#pragma omp parallel for schedule(static) private(particle_number,z) firstprivate(apr_iterator) reduction(+:counter)
252252
#endif

src/algorithm/APRConverter.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ void APRConverter<ImageType>::get_local_particle_cell_set(MeshData<T>& grad_imag
211211
float min_dim = std::min(this->par.dy,std::min(this->par.dx,this->par.dz));
212212
float level_factor = pow(2,(*apr).level_max())*min_dim;
213213

214-
unsigned int l_max = (*apr).level_max() - 1;
215-
unsigned int l_min = (*apr).level_min();
214+
int l_max = (*apr).level_max() - 1;
215+
int l_min = (*apr).level_min();
216216

217217
fine_grained_timer.start_timer("compute_level_second");
218218
//incorporate other factors and compute the level of the Particle Cell, effectively construct LPC L_n
@@ -308,12 +308,12 @@ void APRConverter<ImageType>::get_local_intensity_scale(const MeshData<T>& input
308308
std::vector<int> var_win;
309309
get_window(var_rescale,var_win,this->par);
310310

311-
int win_y = var_win[0];
312-
int win_x = var_win[1];
313-
int win_z = var_win[2];
314-
int win_y2 = var_win[3];
315-
int win_x2 = var_win[4];
316-
int win_z2 = var_win[5];
311+
size_t win_y = var_win[0];
312+
size_t win_x = var_win[1];
313+
size_t win_z = var_win[2];
314+
size_t win_y2 = var_win[3];
315+
size_t win_x2 = var_win[4];
316+
size_t win_z2 = var_win[5];
317317

318318
fine_grained_timer.start_timer("calc_sat_mean_y");
319319
calc_sat_mean_y(local_scale_temp,win_y);
@@ -418,7 +418,7 @@ void APRConverter<ImageType>::auto_parameters(const MeshData<T>& input_img){
418418
uint64_t min_j = 0;
419419

420420
// set to start at one to ignore potential constant regions thresholded out. (Common in some images)
421-
for (int j = 1; j < num_bins; ++j) {
421+
for (unsigned int j = 1; j < num_bins; ++j) {
422422
prop_total += freq[j]/(counter*1.0);
423423

424424
if(prop_total > prop_total_th){
@@ -471,7 +471,7 @@ void APRConverter<ImageType>::auto_parameters(const MeshData<T>& input_img){
471471

472472
patches.resize(std::min(local_max,(uint64_t)10000));
473473

474-
for (int l = 0; l < patches.size(); ++l) {
474+
for (unsigned int l = 0; l < patches.size(); ++l) {
475475
patches[l].resize(27, 0);
476476
}
477477

src/algorithm/ComputeGradient.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -264,39 +264,39 @@ void ComputeGradient::bspline_filt_rec_z(MeshData<T>& image,float lambda,float t
264264
//////////////////////////////////////////////////////////////
265265

266266
std::vector<float> impulse_resp_vec_f(k0+3); //forward
267-
for (int64_t k = 0; k < (k0+3);k++){
267+
for (size_t k = 0; k < (k0+3);k++){
268268
impulse_resp_vec_f[k] = impulse_resp(k,rho,omg);
269269
}
270270

271271
std::vector<float> impulse_resp_vec_b(k0+3); //backward
272-
for (int64_t k = 0; k < (k0+3);k++){
272+
for (size_t k = 0; k < (k0+3);k++){
273273
impulse_resp_vec_b[k] = impulse_resp_back(k,rho,omg,gamma,c0);
274274
}
275275

276276
std::vector<float> bc1_vec(k0, 0); //forward
277277
//y(1) init
278278
bc1_vec[1] = impulse_resp_vec_f[0];
279-
for( int64_t k = 0; k < k0; k++){
279+
for(size_t k = 0; k < k0; k++){
280280
bc1_vec[k] += impulse_resp_vec_f[k+1];
281281
}
282282

283283
std::vector<float> bc2_vec(k0, 0); //backward
284284
//y(0) init
285-
for( int64_t k = 0; k < k0; k++){
285+
for(size_t k = 0; k < k0; k++){
286286
bc2_vec[k] = impulse_resp_vec_f[k];
287287
}
288288

289289
std::vector<float> bc3_vec(k0, 0); //forward
290290
//y(N-1) init
291291
bc3_vec[0] = impulse_resp_vec_b[1];
292-
for( int64_t k = 0; k < (k0-1); k++){
292+
for(size_t k = 0; k < (k0-1); k++){
293293
bc3_vec[k+1] += impulse_resp_vec_b[k] + impulse_resp_vec_b[k+2];
294294
}
295295

296296
std::vector<float> bc4_vec(k0, 0); //backward
297297
//y(N) init
298298
bc4_vec[0] = impulse_resp_vec_b[0];
299-
for( int64_t k = 1; k < k0; k++){
299+
for(size_t k = 1; k < k0; k++){
300300
bc4_vec[k] += 2*impulse_resp_vec_b[k];
301301
}
302302

@@ -419,39 +419,39 @@ void ComputeGradient::bspline_filt_rec_x(MeshData<T>& image,float lambda,float t
419419
//////////////////////////////////////////////////////////////
420420

421421
std::vector<float> impulse_resp_vec_f(k0+3); //forward
422-
for (int64_t k = 0; k < (k0+3);k++){
422+
for (size_t k = 0; k < (k0+3);k++){
423423
impulse_resp_vec_f[k] = impulse_resp(k,rho,omg);
424424
}
425425

426426
std::vector<float> impulse_resp_vec_b(k0+3); //backward
427-
for (int64_t k = 0; k < (k0+3);k++){
427+
for (size_t k = 0; k < (k0+3);k++){
428428
impulse_resp_vec_b[k] = impulse_resp_back(k,rho,omg,gamma,c0);
429429
}
430430

431431
std::vector<float> bc1_vec(k0, 0); //forward
432432
//y(1) init
433433
bc1_vec[1] = impulse_resp_vec_f[0];
434-
for( int64_t k = 0; k < k0;k++){
434+
for(size_t k = 0; k < k0;k++){
435435
bc1_vec[k] += impulse_resp_vec_f[k+1];
436436
}
437437

438438
std::vector<float> bc2_vec(k0, 0); //backward
439439
//y(0) init
440-
for( int64_t k = 0; k < k0;k++){
440+
for(size_t k = 0; k < k0;k++){
441441
bc2_vec[k] = impulse_resp_vec_f[k];
442442
}
443443

444444
std::vector<float> bc3_vec(k0, 0); //forward
445445
//y(N-1) init
446446
bc3_vec[0] = impulse_resp_vec_b[1];
447-
for( int64_t k = 0; k < (k0-1);k++){
447+
for(size_t k = 0; k < (k0-1);k++){
448448
bc3_vec[k+1] += impulse_resp_vec_b[k] + impulse_resp_vec_b[k+2];
449449
}
450450

451451
std::vector<float> bc4_vec(k0, 0); //backward
452452
//y(N) init
453453
bc4_vec[0] = impulse_resp_vec_b[0];
454-
for( int64_t k = 1; k < k0;k++){
454+
for(size_t k = 1; k < k0;k++){
455455
bc4_vec[k] += 2*impulse_resp_vec_b[k];
456456
}
457457

src/algorithm/LocalIntensityScale.hpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@ class LocalIntensityScale {
1414
void calc_abs_diff(const MeshData<T> &input_image, MeshData<T> &var);
1515

1616
template<typename T>
17-
void calc_sat_mean_z(MeshData<T> &input, const int offset);
17+
void calc_sat_mean_z(MeshData<T> &input, const size_t offset);
1818

1919
template<typename T>
20-
void calc_sat_mean_x(MeshData<T> &input, const int offset);
20+
void calc_sat_mean_x(MeshData<T> &input, const size_t offset);
2121

2222
template<typename T>
23-
void calc_sat_mean_y(MeshData<T> &input, const int offset);
23+
void calc_sat_mean_y(MeshData<T> &input, const size_t offset);
2424

2525
void get_window(float &var_rescale, std::vector<int> &var_win, const APRParameters &par);
2626
template<typename T>
2727
void rescale_var_and_threshold(MeshData<T>& var,const float var_rescale, const APRParameters& par);
28-
2928
};
3029

3130
template<typename T>
@@ -104,7 +103,7 @@ void LocalIntensityScale::get_window(float& var_rescale, std::vector<int>& var_w
104103
* @param offset
105104
*/
106105
template<typename T>
107-
void LocalIntensityScale::calc_sat_mean_y(MeshData<T>& input, const int offset){
106+
void LocalIntensityScale::calc_sat_mean_y(MeshData<T>& input, const size_t offset){
108107
const size_t z_num = input.z_num;
109108
const size_t x_num = input.x_num;
110109
const size_t y_num = input.y_num;
@@ -163,7 +162,7 @@ void LocalIntensityScale::calc_sat_mean_y(MeshData<T>& input, const int offset){
163162
}
164163

165164
template<typename T>
166-
void LocalIntensityScale::calc_sat_mean_x(MeshData<T>& input, const int offset) {
165+
void LocalIntensityScale::calc_sat_mean_x(MeshData<T>& input, const size_t offset) {
167166
const size_t z_num = input.z_num;
168167
const size_t x_num = input.x_num;
169168
const size_t y_num = input.y_num;
@@ -195,7 +194,7 @@ void LocalIntensityScale::calc_sat_mean_x(MeshData<T>& input, const int offset)
195194

196195
// middle
197196
size_t current_index = offset + 1;
198-
size_t index_modulo;
197+
size_t index_modulo = 0;
199198
for(size_t i = offset + 1; i < x_num - offset; i++){
200199
// the current cumsum
201200
index_modulo = (current_index + offset) % (2*offset + 1); // current_index - offset - 1
@@ -224,7 +223,7 @@ void LocalIntensityScale::calc_sat_mean_x(MeshData<T>& input, const int offset)
224223
}
225224

226225
template<typename T>
227-
void LocalIntensityScale::calc_sat_mean_z(MeshData<T>& input,const int offset) {
226+
void LocalIntensityScale::calc_sat_mean_z(MeshData<T>& input,const size_t offset) {
228227
const size_t z_num = input.z_num;
229228
const size_t x_num = input.x_num;
230229
const size_t y_num = input.y_num;
@@ -259,7 +258,7 @@ void LocalIntensityScale::calc_sat_mean_z(MeshData<T>& input,const int offset) {
259258

260259
// middle
261260
size_t current_index = offset + 1;
262-
size_t index_modulo;
261+
size_t index_modulo = 0;
263262
for(size_t j = offset + 1; j < z_num - offset; j++){
264263

265264
index_modulo = (current_index + offset) % (2*offset + 1); // current_index - offset - 1

src/algorithm/PullingScheme.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void PullingScheme::initialize_particle_cell_tree(APR<T>& apr) {
8787
//make so you can reference the array as l
8888
particle_cell_tree.resize(l_max + 1);
8989

90-
for (int l = l_min; l < (l_max + 1) ;l ++){
90+
for (unsigned int l = l_min; l < (l_max + 1) ;l ++){
9191
particle_cell_tree[l].init(ceil((1.0 * apr.apr_access.org_dims[0]) / pow(2.0, 1.0 * l_max - l + 1)),
9292
ceil((1.0 * apr.apr_access.org_dims[1]) / pow(2.0, 1.0 * l_max - l + 1)),
9393
ceil((1.0 * apr.apr_access.org_dims[2]) / pow(2.0, 1.0 * l_max - l + 1)), EMPTY);
@@ -107,8 +107,8 @@ void PullingScheme::pulling_scheme_main() {
107107

108108

109109
//loop over all levels from l_max to l_min
110-
for (int level = l_max; level >= l_min; --level) {
111-
if (level != l_max) {
110+
for (int level = l_max; level >= (int)l_min; --level) {
111+
if (level != (int)l_max) {
112112
set_ascendant_neighbours(level); //step 1 and step 2.
113113
set_filler(level); // step 3.
114114
}
@@ -197,23 +197,23 @@ void PullingScheme::set_ascendant_neighbours(int level) {
197197

198198
void PullingScheme::set_filler(int level) {
199199
short children_boundaries[3] = {2,2,2};
200-
const size_t x_num = particle_cell_tree[level].x_num;
201-
const size_t y_num = particle_cell_tree[level].y_num;
202-
const size_t z_num = particle_cell_tree[level].z_num;
200+
const int64_t x_num = particle_cell_tree[level].x_num;
201+
const int64_t y_num = particle_cell_tree[level].y_num;
202+
const int64_t z_num = particle_cell_tree[level].z_num;
203203

204-
size_t prev_x_num = particle_cell_tree[level + 1].x_num;
205-
size_t prev_y_num = particle_cell_tree[level + 1].y_num;
206-
size_t prev_z_num = particle_cell_tree[level + 1].z_num;
204+
int64_t prev_x_num = particle_cell_tree[level + 1].x_num;
205+
int64_t prev_y_num = particle_cell_tree[level + 1].y_num;
206+
int64_t prev_z_num = particle_cell_tree[level + 1].z_num;
207207

208208
#ifdef HAVE_OPENMP
209209
#pragma omp parallel for default(shared) if (z_num * x_num * y_num > 10000) firstprivate(level, children_boundaries)
210210
#endif
211-
for (size_t j = 0; j < z_num; ++j) {
211+
for (int64_t j = 0; j < z_num; ++j) {
212212
if ( j == z_num - 1 && prev_z_num % 2 ) {
213213
children_boundaries[0] = 1;
214214
}
215215

216-
for (size_t i = 0; i < x_num; ++i) {
216+
for (int64_t i = 0; i < x_num; ++i) {
217217

218218
if ( i == x_num - 1 && prev_x_num % 2 ) {
219219
children_boundaries[1] = 1;
@@ -224,7 +224,7 @@ void PullingScheme::set_filler(int level) {
224224

225225
size_t index = j*x_num*y_num + i*y_num;
226226

227-
for (size_t k = 0; k < y_num; ++k) {
227+
for (int64_t k = 0; k < y_num; ++k) {
228228
if ( k == y_num - 1 && prev_y_num % 2 ) {
229229
children_boundaries[2] = 1;
230230
}

src/data_structures/APR/APR.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ class APR {
7373
template< typename S>
7474
void write_particles_only( std::string save_loc,std::string file_name,ExtraParticleData<S>& parts_extra){
7575
apr_writer.write_particles_only(save_loc, file_name, parts_extra);
76-
};
76+
}
7777

7878
//read in ExtraPartCellData
7979
template<typename T>
8080
void read_parts_only(std::string file_name,ExtraParticleData<T>& extra_parts){
8181
apr_writer.read_parts_only(file_name,extra_parts);
82-
};
82+
}
8383

8484
////////////////////////
8585
///

src/data_structures/APR/APRAccess.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,6 @@ class APRAccess {
494494
const size_t offset_pc_data3 = std::min(x_num_us*(2*z_+1) + (2*x_), x_num_us*z_num_us - 1);
495495
const size_t offset_pc_data4 = std::min(x_num_us*(2*z_+1) + (2*x_+1), x_num_us*z_num_us - 1);
496496

497-
YGap_map gap;
498-
gap.global_index_begin = 0;
499-
500497
size_t size_v = y_begin.data[i+1][offset_pc_data1].size();
501498

502499
y_begin.data[i+1][offset_pc_data2].resize(size_v);

src/data_structures/APR/APRIterator.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class APRIterator {
108108
current_particle_cell.z = (current_particle_cell.pc_offset)/spatial_index_x_max(current_particle_cell.level);
109109
current_particle_cell.x = (current_particle_cell.pc_offset) - current_particle_cell.z*(spatial_index_x_max(current_particle_cell.level));
110110

111-
current_gap.iterator = current_gap.iterator= apr_access->gap_map.data[current_particle_cell.level][current_particle_cell.pc_offset][0].map.begin();
111+
current_gap.iterator = apr_access->gap_map.data[current_particle_cell.level][current_particle_cell.pc_offset][0].map.begin();
112112
//then find the gap.
113113
while((particle_number > apr_access->global_index_end(current_gap))){
114114
current_gap.iterator++;
@@ -152,7 +152,6 @@ class APRIterator {
152152
// Used for finding the starting particle on a given level
153153
//
154154
return apr_access->global_index_by_level_and_z_end[level_][z_]+1l;
155-
156155
}
157156

158157
inline uint64_t particles_zx_begin(const uint16_t& level_,const uint64_t& z_,const uint64_t& x_){

src/data_structures/APR/ExtraPartCellData.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class ExtraPartCellData {
2525

2626
ExtraPartCellData() {}
2727
template<typename S>
28-
ExtraPartCellData(const ExtraPartCellData<S> &part_data) { initialize_structure_parts(part_data); };
28+
ExtraPartCellData(const ExtraPartCellData<S> &part_data) { initialize_structure_parts(part_data); }
2929
template<typename S>
30-
ExtraPartCellData(const APR<S> &apr) { initialize_structure_parts_empty(apr); };
30+
ExtraPartCellData(const APR<S> &apr) { initialize_structure_parts_empty(apr); }
3131

3232

3333
template<typename S>

src/data_structures/Mesh/MeshData.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ void downsamplePyrmaid(MeshData<T> &original_image, std::vector<MeshData<T>> &do
432432
// calculate downsampled in range (l_max, l_min]
433433
auto sum = [](const float x, const float y) -> float { return x + y; };
434434
auto divide_by_8 = [](const float x) -> float { return x/8.0; };
435-
for (int level = l_max; level > l_min; --level) {
435+
for (size_t level = l_max; level > l_min; --level) {
436436
downsample(downsampled[level], downsampled[level - 1], sum, divide_by_8, true);
437437
}
438438
}

0 commit comments

Comments
 (0)