From 77416d03429fb2b3c4a81d88c54779dc646171ad Mon Sep 17 00:00:00 2001 From: Bai-Li-NOAA Date: Wed, 16 Aug 2023 15:35:21 -0400 Subject: [PATCH] fix: remove set() Co-authored-by: E.J. Dick Kyle Shertzer --- .../distributions/test_fleet_acomp_nll.hpp | 2 +- .../distributions/test_fleet_index_nll.hpp | 2 +- inst/include/common/data_object.hpp | 28 +------------------ 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp b/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp index b932b5a9d..5705b8618 100644 --- a/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp +++ b/inst/extdata/TMB_tests/distributions/test_fleet_acomp_nll.hpp @@ -67,7 +67,7 @@ obs.resize(n); p_set.resize(n); for(int i =0; i < n; i++){ - nll_fac.observed_agecomp_data->set(0, i, x[i]); + nll_fac.observed_agecomp_data->at(0, i); nll_fac.catch_numbers_at_age[i] = p[i]; obs[i] = nll_fac.observed_agecomp_data->at(0,i); diff --git a/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp b/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp index 697182dac..6cbd7e32d 100644 --- a/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp +++ b/inst/extdata/TMB_tests/distributions/test_fleet_index_nll.hpp @@ -66,7 +66,7 @@ Vector temp; temp.resize(n); for(int i =0; i < n; i++){ - nll_fleet_index.observed_index_data->set(i,y[i]); + nll_fleet_index.observed_index_data->at(i); temp[i] = nll_fleet_index.observed_index_data->at(i); nll = nll_fleet_index.evaluate(); } diff --git a/inst/include/common/data_object.hpp b/inst/include/common/data_object.hpp index 0f1656ec9..24511fbde 100644 --- a/inst/include/common/data_object.hpp +++ b/inst/include/common/data_object.hpp @@ -107,18 +107,6 @@ struct DataObject : public fims::FIMSObject { return data[i]; } - /** - * @brief Set value of element - * @param i - * @param x - * - */ - inline void set(size_t i, Type x) { - if (i >= this->data.size()) { - throw std::overflow_error("DataObject error: index out of bounds"); - } - data[i] = x; - } /** * Retrieve element from 2d data set. @@ -144,20 +132,6 @@ struct DataObject : public fims::FIMSObject { return data[i * jmax + j]; } - /** - * @brief Set value of element - * @param i - * @param j - * @param x - * - */ - inline void set(size_t i, size_t j, Type x) { - if ((i * jmax + j) >= this->data.size()) { - throw std::overflow_error("DataObject error: index out of bounds"); - } - data[i * jmax + j] = x; - } - /** * Retrieve element from 3d data set. * @param i 1st dimension of 3d data set @@ -185,7 +159,7 @@ struct DataObject : public fims::FIMSObject { } /** - * Retrieve element from 3d data set. + * Retrieve element from 4d data set. * @param i 1st dimension of 4d data set * @param j 2nd dimension of 4d data set * @param k 3rd dimension of 4d data set