Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolved issues causing warnings #430

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions inst/include/common/data_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct DataObject : public fims::FIMSObject<Type> {
/**
* 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<Type>::id_g++;
Expand All @@ -64,7 +64,7 @@ struct DataObject : public fims::FIMSObject<Type> {
/**
* 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<Type>::id_g++;
}
Expand All @@ -73,7 +73,7 @@ struct DataObject : public fims::FIMSObject<Type> {
* 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<Type>::id_g++;
}
Expand All @@ -82,7 +82,7 @@ struct DataObject : public fims::FIMSObject<Type> {
* 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<Type>::id_g++;
}
Expand Down
24 changes: 12 additions & 12 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_population.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down Expand Up @@ -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];
}

Expand Down Expand Up @@ -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];
}

Expand Down Expand Up @@ -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];
}

Expand Down
8 changes: 4 additions & 4 deletions inst/include/population_dynamics/population/population.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@ struct Population : public FIMSObject<Type> {
}
}
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";
Expand All @@ -675,8 +675,8 @@ struct Population : public FIMSObject<Type> {
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";
}
Expand Down
2 changes: 1 addition & 1 deletion src/FIMS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Type objective_function<Type>::operator()() {
fims::Information<Type>::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;
Expand Down