diff --git a/inst/include/common/data_object.hpp b/inst/include/common/data_object.hpp index f5d10b2a0..0f1656ec9 100644 --- a/inst/include/common/data_object.hpp +++ b/inst/include/common/data_object.hpp @@ -55,7 +55,7 @@ struct DataObject : public fims::FIMSObject { /** * Constructs a one-dimensional data object. */ - DataObject(size_t imax) : imax(imax), dimensions(1) { + DataObject(size_t imax) : dimensions(1), imax(imax) { data.resize(imax); this->id = DataObject::id_g++; @@ -64,7 +64,7 @@ struct DataObject : public fims::FIMSObject { /** * Constructs a two-dimensional data object. */ - DataObject(size_t imax, size_t jmax) : imax(imax), jmax(jmax), dimensions(2) { + DataObject(size_t imax, size_t jmax) : dimensions(2), imax(imax), jmax(jmax) { data.resize(imax * jmax); this->id = DataObject::id_g++; } @@ -73,7 +73,7 @@ struct DataObject : public fims::FIMSObject { * Constructs a three-dimensional data object. */ DataObject(size_t imax, size_t jmax, size_t kmax) - : imax(imax), jmax(jmax), kmax(kmax), dimensions(3) { + : dimensions(3), imax(imax), jmax(jmax), kmax(kmax) { data.resize(imax * jmax * kmax); this->id = DataObject::id_g++; } @@ -82,7 +82,7 @@ struct DataObject : public fims::FIMSObject { * Constructs a four-dimensional data object. */ DataObject(size_t imax, size_t jmax, size_t kmax, size_t lmax) - : imax(imax), jmax(jmax), kmax(kmax), lmax(lmax), dimensions(4) { + : dimensions(4), imax(imax), jmax(jmax), kmax(kmax), lmax(lmax) { data.resize(imax * jmax * kmax * lmax); this->id = DataObject::id_g++; } diff --git a/inst/include/interface/rcpp/rcpp_objects/rcpp_population.hpp b/inst/include/interface/rcpp/rcpp_objects/rcpp_population.hpp index ed937746b..a9e7593b3 100644 --- a/inst/include/interface/rcpp/rcpp_objects/rcpp_population.hpp +++ b/inst/include/interface/rcpp/rcpp_objects/rcpp_population.hpp @@ -125,20 +125,20 @@ class PopulationInterface : public PopulationInterfaceBase { b0->maturity_id = this->maturity_id; b0->log_M.resize(this->log_M.size()); b0->log_init_naa.resize(this->log_init_naa.size()); - for (size_t i = 0; i < log_M.size(); i++) { + for (int i = 0; i < log_M.size(); i++) { b0->log_M[i] = this->log_M[i]; if (estimate_M) { d0->RegisterParameter(b0->log_M[i]); } } - for (size_t i = 0; i < log_init_naa.size(); i++) { + for (int i = 0; i < log_init_naa.size(); i++) { b0->log_init_naa[i] = this->log_init_naa[i]; if (estimate_initNAA) { d0->RegisterParameter(b0->log_init_naa[i]); } } - for (size_t i = 0; i < ages.size(); i++) { + for (int i = 0; i < ages.size(); i++) { b0->ages[i] = this->ages[i]; } @@ -166,19 +166,19 @@ class PopulationInterface : public PopulationInterfaceBase { b1->log_M.resize(this->log_M.size()); b1->log_init_naa.resize(this->log_init_naa.size()); - for (size_t i = 0; i < log_M.size(); i++) { + for (int i = 0; i < log_M.size(); i++) { b1->log_M[i] = this->log_M[i]; if (estimate_M) { d1->RegisterParameter(b1->log_M[i]); } } - for (size_t i = 0; i < log_init_naa.size(); i++) { + for (int i = 0; i < log_init_naa.size(); i++) { b1->log_init_naa[i] = this->log_init_naa[i]; if (estimate_initNAA) { d1->RegisterParameter(b1->log_init_naa[i]); } } - for (size_t i = 0; i < ages.size(); i++) { + for (int i = 0; i < ages.size(); i++) { b1->ages[i] = this->ages[i]; } @@ -206,20 +206,20 @@ class PopulationInterface : public PopulationInterfaceBase { b2->maturity_id = this->maturity_id; b2->log_init_naa.resize(this->log_init_naa.size()); - for (size_t i = 0; i < log_M.size(); i++) { + for (int i = 0; i < log_M.size(); i++) { b2->log_M[i] = this->log_M[i]; if (estimate_M) { d2->RegisterParameter(b2->log_M[i]); } } - for (size_t i = 0; i < log_init_naa.size(); i++) { + for (int i = 0; i < log_init_naa.size(); i++) { b2->log_init_naa[i] = this->log_init_naa[i]; if (estimate_initNAA) { d2->RegisterParameter(b2->log_init_naa[i]); } } - for (size_t i = 0; i < ages.size(); i++) { + for (int i = 0; i < ages.size(); i++) { b2->ages[i] = this->ages[i]; } @@ -247,20 +247,20 @@ class PopulationInterface : public PopulationInterfaceBase { b3->recruitment_id = this->recruitment_id; b3->maturity_id = this->maturity_id; - for (size_t i = 0; i < log_M.size(); i++) { + for (int i = 0; i < log_M.size(); i++) { b3->log_M[i] = this->log_M[i]; if (estimate_M) { d3->RegisterParameter(b3->log_M[i]); } } - for (size_t i = 0; i < log_init_naa.size(); i++) { + for (int i = 0; i < log_init_naa.size(); i++) { b3->log_init_naa[i] = this->log_init_naa[i]; if (estimate_initNAA) { d3->RegisterParameter(b3->log_init_naa[i]); } } - for (size_t i = 0; i < ages.size(); i++) { + for (int i = 0; i < ages.size(); i++) { b3->ages[i] = this->ages[i]; } diff --git a/inst/include/population_dynamics/population/population.hpp b/inst/include/population_dynamics/population/population.hpp index 9ed63bfb4..d33b60c06 100644 --- a/inst/include/population_dynamics/population/population.hpp +++ b/inst/include/population_dynamics/population/population.hpp @@ -665,8 +665,8 @@ struct Population : public FIMSObject { } } FIMS_LOG << "NAA\n"; - for (int i = 0; i < nyears; i++) { - for (int j = 0; j < nages; j++) { + for (size_t i = 0; i < nyears; i++) { + for (size_t j = 0; j < nages; j++) { FIMS_LOG << numbers_at_age[i * nages + j] << "\t"; } FIMS_LOG << "\n"; @@ -675,8 +675,8 @@ struct Population : public FIMSObject { FIMS_LOG << "CAA\n"; for (size_t fleet_ = 0; fleet_ < this->nfleets; fleet_++) { FIMS_LOG << "Fleet " << fleet_ + 1 << "\n"; - for (int i = 0; i < nyears; i++) { - for (int j = 0; j < nages; j++) { + for (size_t i = 0; i < nyears; i++) { + for (size_t j = 0; j < nages; j++) { FIMS_LOG << fleets[fleet_]->catch_numbers_at_age[i * nages + j] << "\t"; } diff --git a/src/FIMS.cpp b/src/FIMS.cpp index 9ffd0a759..01bb1c239 100644 --- a/src/FIMS.cpp +++ b/src/FIMS.cpp @@ -28,7 +28,7 @@ Type objective_function::operator()() { fims::Information::GetInstance(); //update the parameter values - for(int i =0; i < information->fixed_effects_parameters.size(); i++){ + for(size_t i =0; i < information->fixed_effects_parameters.size(); i++){ *information->fixed_effects_parameters[i] = p[i]; } model -> of = this;