Skip to content

Commit 634849f

Browse files
committed
Remove warnings
1 parent 596ddb8 commit 634849f

File tree

5 files changed

+30
-55
lines changed

5 files changed

+30
-55
lines changed

examples/Example_denoise.hpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,10 @@ bool denoise_example(cmdLineOptionsDenoise& options){
8888
//load in an APR
8989
APRDenoise aprDenoise;
9090

91-
// aprDenoise.iteration_others = 1; //default = 1 (Changed)
92-
93-
// aprDenoise.N_ = 2000;
94-
// aprDenoise.N_max = 2000;
95-
// aprDenoise.max_level = 2;
96-
// aprDenoise.others_level = 4;
97-
aprDenoise.estimate_center_flag = true;
98-
aprDenoise.tolerance = 0.05;
99-
// aprDenoise.iteration_max = 5000;
100-
// aprDenoise.iteration_others = 1000;
101-
10291
aprDenoise.train_denoise(apr,parts,aprStencils);
10392

104-
APRDenoise aprDenoise_test;
105-
10693
ParticleData<float> parts_denoised;
107-
aprDenoise_test.apply_denoise(apr,parts,parts_denoised,aprStencils);
94+
aprDenoise.apply_denoise(apr,parts,parts_denoised,aprStencils);
10895

10996
timer.start_timer("pc interp");
11097
//perform piece-wise constant interpolation
@@ -121,7 +108,6 @@ bool denoise_example(cmdLineOptionsDenoise& options){
121108
aprFile.write_particles("particles",parts_denoised);
122109
aprFile.close();
123110

124-
125111
return true;
126112
}
127113

src/data_structures/Mesh/PixelData.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ void const_upsample_img(PixelData<T>& input_us,PixelData<T>& input){
829829

830830
timer.start_timer("up_sample_const");
831831

832-
unsigned int j, i, k;
832+
int j, i, k;
833833

834834
#ifdef HAVE_OPENMP
835835
#pragma omp parallel for default(shared) private(j,i,k) firstprivate(temp_vec) if(z_num_ds*x_num_ds > 100)

src/numerics/APRDenoise.hpp

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class StencilSetUp {
5353

5454
std::vector<int> stencil_dims = {0, 0, 0};
5555

56-
int center_index;
56+
size_t center_index;
5757

5858
std::vector<uint64_t> l_index_1;
5959

@@ -79,9 +79,9 @@ class StencilSetUp {
7979

8080
l_index_1.resize(stencil_index_base.size() - 1, 0);
8181

82-
int counter = 0;
82+
size_t counter = 0;
8383

84-
for (int i = 0; i < l_index_1.size(); ++i) {
84+
for (size_t i = 0; i < l_index_1.size(); ++i) {
8585
if (i != center_index) {
8686
l_index_1[counter] = i;
8787
counter++;
@@ -138,7 +138,7 @@ class StencilSetUp {
138138

139139
index.resize(stencil_index_base.size());
140140

141-
for (int i = 0; i < stencil_index_base.size(); ++i) {
141+
for (size_t i = 0; i < stencil_index_base.size(); ++i) {
142142
index[i] = stencil_index_base[i][0] + stencil_index_base[i][1] * y_num +
143143
stencil_index_base[i][2] * y_num * x_num;
144144
}
@@ -210,15 +210,15 @@ class APRStencils {
210210
stencil.linear_coeffs.resize(num_pts_1, 0); //need to include the 0 center
211211
auto offset = 0;
212212

213-
for (int k1 = 0; k1 < stencil.linear_coeffs.size(); ++k1) {
213+
for (size_t k1 = 0; k1 < stencil.linear_coeffs.size(); ++k1) {
214214

215215
stencil.linear_coeffs[k1] = coeff_full[k1 + offset];
216216

217217
}
218218

219219
stencil.non_linear_coeffs.resize(num_pts_2, 0);
220220

221-
for (int k1 = 0; k1 < stencil.non_linear_coeffs.size(); ++k1) {
221+
for (size_t k1 = 0; k1 < stencil.non_linear_coeffs.size(); ++k1) {
222222

223223
stencil.non_linear_coeffs[k1] = coeff_full[k1 + num_pts_1];
224224

@@ -274,13 +274,13 @@ class APRStencils {
274274

275275
auto offset = 0;
276276

277-
for (int k1 = 0; k1 < stencil.linear_coeffs.size(); ++k1) {
277+
for (size_t k1 = 0; k1 < stencil.linear_coeffs.size(); ++k1) {
278278

279279
coeff_full[k1 + offset] = stencil.linear_coeffs[k1];
280280

281281
}
282282

283-
for (int k1 = 0; k1 < stencil.non_linear_coeffs.size(); ++k1) {
283+
for (size_t k1 = 0; k1 < stencil.non_linear_coeffs.size(); ++k1) {
284284

285285
coeff_full[k1 + num_pts_linear] = stencil.non_linear_coeffs[k1];
286286

@@ -386,7 +386,7 @@ std::vector<int> sample_without_replacement(int k, int N, std::default_random_en
386386
std::shuffle(result.begin(), result.end(), gen);
387387

388388
return result;
389-
};
389+
}
390390

391391
class APRDenoise {
392392

@@ -449,7 +449,7 @@ class APRDenoise {
449449

450450
}
451451

452-
int pts = std::pow(2*stencil_sz+1,it.number_dimensions())*train_factor;
452+
uint64_t pts = std::pow(2*stencil_sz+1,it.number_dimensions())*train_factor;
453453

454454
if(total_parts >= pts){
455455
viable_levels++;
@@ -760,7 +760,7 @@ class APRDenoise {
760760
template<typename T, typename S>
761761
void
762762
assemble_system_guided(APR &apr, ParticleData <T> &parts, ParticleData <T> &parts_g, StencilSetUp &stencilSetUp,
763-
Stencil<S> &stencil, int N, int num_rep, int level, float factor = 0.05,
763+
Stencil<S> &stencil, uint64_t N, int num_rep, int level, float factor = 0.05,
764764
bool verbose = false) {
765765

766766
timer.verbose_flag = verbose;
@@ -779,7 +779,7 @@ class APRDenoise {
779779
APRReconstruction::interp_img_us_smooth(apr, img, parts, false, delta);
780780
stencilSetUp.calculate_global_index(img);
781781

782-
if (total_parts < N) {
782+
if (total_parts < (uint64_t) N) {
783783
N = stencilSetUp.l_index_1.size()*this->train_factor;
784784
}
785785

@@ -805,7 +805,7 @@ class APRDenoise {
805805
std::vector<float> nl_local_vec;
806806
nl_local_vec.resize(stencilSetUp.nl_index_1.size(), 0);
807807

808-
auto n = (int) stencilSetUp.l_index_1.size() + stencilSetUp.nl_index_1.size();
808+
size_t n = stencilSetUp.l_index_1.size() + stencilSetUp.nl_index_1.size();
809809

810810
std::vector<uint64_t> random_index;
811811

@@ -879,7 +879,7 @@ class APRDenoise {
879879

880880
random_index[0] = std::rand() % total_p + 1;
881881

882-
for (int j = 1; j < random_index.size(); ++j) {
882+
for (size_t j = 1; j < random_index.size(); ++j) {
883883

884884
random_index[j] = random_index[j - 1] + std::rand() % total_p + 1;
885885
}
@@ -906,20 +906,20 @@ class APRDenoise {
906906
//Get the local stencil of points
907907
const uint64_t global_off_l = y + global_off;
908908

909-
for (int i = 0; i < stencilSetUp.index.size(); ++i) {
909+
for (size_t i = 0; i < stencilSetUp.index.size(); ++i) {
910910
local_vec[i] = pad_img.mesh[global_off_l + stencilSetUp.index[i]];
911911
}
912912

913913
//b_temp[k] = local_vec[stencilSetUp.center_index];
914914
b_temp[k] = parts_g[global_index[r_i]];
915915

916-
for (int i = 0; i < stencilSetUp.l_index_1.size(); ++i) {
916+
for (size_t i = 0; i < stencilSetUp.l_index_1.size(); ++i) {
917917
//A_temp(i, k, 0) = local_vec[stencilSetUp.l_index_1[i]];
918918
A(i, k) = local_vec[stencilSetUp.l_index_1[i]];
919919
}
920920

921921
//Apply the non-linear kernel
922-
for (int i = 0; i < stencilSetUp.nl_index_1.size(); ++i) {
922+
for (size_t i = 0; i < stencilSetUp.nl_index_1.size(); ++i) {
923923
//A_temp(i + l_num, k, 0) =
924924
// local_vec[stencilSetUp.nl_index_1[i]] * local_vec[stencilSetUp.nl_index_2[i]];
925925
A(i + l_num, k) =
@@ -957,7 +957,7 @@ class APRDenoise {
957957

958958
if (l == 0) {
959959
float eps = .01;
960-
for (int i = 0; i < n; ++i) {
960+
for (size_t i = 0; i < n; ++i) {
961961
coeff_store[l][i] = std::rand() * 2 * eps - eps;
962962
}
963963

@@ -996,7 +996,7 @@ class APRDenoise {
996996
}
997997

998998

999-
for (int i1 = 0; i1 < n; ++i1) {
999+
for (size_t i1 = 0; i1 < n; ++i1) {
10001000
coeff(i1) = coeff(i1) / norm_c_(i1);
10011001
}
10021002

@@ -1024,7 +1024,7 @@ class APRDenoise {
10241024

10251025
int include = std::floor(0.5 * num_rep);
10261026

1027-
for (int k1 = 0; k1 < stencil.linear_coeffs.size(); ++k1) {
1027+
for (size_t k1 = 0; k1 < stencil.linear_coeffs.size(); ++k1) {
10281028

10291029
if (k1 == stencilSetUp.center_index) {
10301030
offset = -1;
@@ -1046,8 +1046,7 @@ class APRDenoise {
10461046

10471047
stencil.non_linear_coeffs.resize(stencilSetUp.nl_index_1.size(), 0);
10481048

1049-
for (int k1 = 0; k1 < stencil.non_linear_coeffs.size(); ++k1) {
1050-
1049+
for (size_t k1 = 0; k1 < stencil.non_linear_coeffs.size(); ++k1) {
10511050

10521051
double sum = 0;
10531052
double counter = 0;
@@ -1068,14 +1067,14 @@ class APRDenoise {
10681067
float factor = 0;
10691068
float sum = 0;
10701069

1071-
for (int j = 0; j < stencil.linear_coeffs.size(); ++j) {
1070+
for (size_t j = 0; j < stencil.linear_coeffs.size(); ++j) {
10721071
factor = std::max(factor, std::abs(stencil.linear_coeffs[j]));
10731072
sum += stencil.linear_coeffs[j];
10741073
}
10751074

10761075
stencil.linear_coeffs[stencilSetUp.center_index] = factor;
10771076

1078-
for (int j = 0; j < stencil.linear_coeffs.size(); ++j) {
1077+
for (size_t j = 0; j < stencil.linear_coeffs.size(); ++j) {
10791078
stencil.linear_coeffs[j] = stencil.linear_coeffs[j]*(sum)/(sum+factor);
10801079
}
10811080

@@ -1088,7 +1087,7 @@ class APRDenoise {
10881087

10891088
float c_sum = 0;
10901089

1091-
for (int l1 = 0; l1 < stencil.linear_coeffs.size(); ++l1) {
1090+
for (size_t l1 = 0; l1 < stencil.linear_coeffs.size(); ++l1) {
10921091
if(std::isnan(stencil.linear_coeffs[l1])){
10931092
valid_check = false;
10941093
}

src/numerics/APRReconstruction.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class APRReconstruction {
250250
temp_imgs[apr.level_max()].swap(img);
251251

252252

253-
for (unsigned int level = apr_iterator.level_min(); level <= (apr_iterator.level_max()+delta); ++level) {
253+
for (uint16_t level = apr_iterator.level_min(); level <= (apr_iterator.level_max()+delta); ++level) {
254254
int z = 0;
255255
int x = 0;
256256

src/numerics/MeshNumerics.hpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,11 @@ class MeshNumerics {
6868
int stencil_z_half = (stencil.z_num-1)/2;
6969

7070

71-
// for (int l = stencil_z_b; l <= stencil_z_e; ++l) {
72-
// for (int q = stencil_x_b; q <= stencil_x_e; ++q) {
73-
// for (int w = stencil_y_b; w <= stencil_y_e; ++w) {
74-
//
75-
// neigh_sum += stencil.at(l+stencil_y_half,q+stencil_x_half,w+stencil_z_half)*input(l, q, w);
76-
// }
77-
// }
78-
// }
79-
80-
81-
int i=0;
71+
size_t i=0;
8272
#pragma omp parallel for default(shared) private(i)
8373
for (i = 0; i < input.z_num; ++i) {
84-
for (int j = 0; j < input.x_num; ++j) {
85-
for (int k = 0; k < input.y_num; ++k) {
74+
for (size_t j = 0; j < input.x_num; ++j) {
75+
for (size_t k = 0; k < input.y_num; ++k) {
8676
double neigh_sum = 0;
8777
double counter = 0;
8878

0 commit comments

Comments
 (0)