Skip to content

Commit

Permalink
Merge pull request #451 from NOAA-FIMS/371-refactor-remove-set-from-d…
Browse files Browse the repository at this point in the history
…ataobject-class

fix: remove set()
  • Loading branch information
ChristineStawitz-NOAA authored Aug 22, 2023
2 parents d7815a4 + 77416d0 commit bf9932a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
28 changes: 1 addition & 27 deletions inst/include/common/data_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,6 @@ struct DataObject : public fims::FIMSObject<Type> {
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.
Expand All @@ -144,20 +132,6 @@ struct DataObject : public fims::FIMSObject<Type> {
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
Expand Down Expand Up @@ -185,7 +159,7 @@ struct DataObject : public fims::FIMSObject<Type> {
}

/**
* 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
Expand Down

0 comments on commit bf9932a

Please sign in to comment.