Skip to content

Commit

Permalink
style: run clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristineStawitz-NOAA authored Nov 15, 2023
1 parent 36fe2ad commit a266b0f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 51 deletions.
15 changes: 8 additions & 7 deletions inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class RecruitmentInterfaceBase : public FIMSRcppInterfaceBase {

// static std::vector<double> log_recruit_devs; /**< vector of log recruitment
// deviations*/
// static bool constrain_deviations; /**< whether or not the rec devs are constrained*/
// static bool constrain_deviations; /**< whether or not the rec devs are
// constrained*/

RecruitmentInterfaceBase() {
this->id = RecruitmentInterfaceBase::id_g++;
Expand Down Expand Up @@ -69,12 +70,12 @@ std::map<uint32_t, RecruitmentInterfaceBase*>
*/
class BevertonHoltRecruitmentInterface : public RecruitmentInterfaceBase {
public:
Parameter logit_steep; /**< steepness or the productivity of the stock*/
Parameter log_rzero; /**< recruitment at unfished biomass */
Parameter log_sigma_recruit; /**< the log of the stock recruit standard deviation */
Rcpp::NumericVector log_devs; /**< log recruitment deviations*/
bool estimate_log_devs =
false; /**< boolean describing whether to estimate */
Parameter logit_steep; /**< steepness or the productivity of the stock*/
Parameter log_rzero; /**< recruitment at unfished biomass */
Parameter
log_sigma_recruit; /**< the log of the stock recruit standard deviation */
Rcpp::NumericVector log_devs; /**< log recruitment deviations*/
bool estimate_log_devs = false; /**< boolean describing whether to estimate */

BevertonHoltRecruitmentInterface() : RecruitmentInterfaceBase() {}

Expand Down
6 changes: 3 additions & 3 deletions inst/include/population_dynamics/population/population.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ struct Population : public fims_model_object::FIMSObject<Type> {
/*the log_recruit_dev vector does not include a value for year == 0
and is of length nyears - 1 where the first position of the vector
corresponds to the second year of the time series.*/
fims_math::exp(this->recruitment->log_recruit_devs[i_dev-1]);
fims_math::exp(this->recruitment->log_recruit_devs[i_dev - 1]);
this->expected_recruitment[year] = this->numbers_at_age[i_age_year];
POPULATION_LOG << " numbers at age at index i_age_year " << i_age_year << " is "
<< this->numbers_at_age[i_age_year] << std::endl;
POPULATION_LOG << " numbers at age at index i_age_year " << i_age_year
<< " is " << this->numbers_at_age[i_age_year] << std::endl;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ struct RecruitmentBase : public fims_model_object::FIMSObject<Type> {
static uint32_t id_g; /**< reference id for recruitment object*/

typename fims::ModelTraits<Type>::ParameterVector
log_recruit_devs; /*!< A vector of log recruitment deviations */
log_recruit_devs; /*!< A vector of log recruitment deviations */
bool constrain_deviations = false; /*!< A flag to indicate if recruitment
deviations are summing to zero or not */

Type log_sigma_recruit; /**< Log standard deviation of log recruitment
deviations */
Type log_rzero; /**< Log of unexploited recruitment.*/

bool estimate_log_recruit_devs =
true; /*!< A flag to indicate if recruitment deviations are estimated or
not */
bool estimate_log_recruit_devs = true; /*!< A flag to indicate if recruitment
deviations are estimated or not */

/** @brief Constructor.
*/
Expand Down
48 changes: 24 additions & 24 deletions inst/include/utilities/fims_json.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* @file fims_json.hpp
* @brief A simple JSON parsing and generation library.
* @details This library provides classes and functions for parsing JSON
Expand All @@ -13,29 +13,29 @@

class JsonValue;

/**
/**
* Alias for a JSON object, mapping strings to JSON values.
*/
using JsonObject = std::map<std::string, JsonValue>;

/**
/**
* Alias for a JSON array, containing a sequence of JSON values.
*/
using JsonArray = std::vector<JsonValue>;

/**
/**
* Represents different types of JSON values.
*/
enum JsonValueType {
Null = 0, /**< Null JSON value. */
Number, /**< Numeric JSON value. */
String, /**< String JSON value. */
Bool, /**< Boolean JSON value. */
Object, /**< JSON object. */
Array /**< JSON array. */
Null = 0, /**< Null JSON value. */
Number, /**< Numeric JSON value. */
String, /**< String JSON value. */
Bool, /**< Boolean JSON value. */
Object, /**< JSON object. */
Array /**< JSON array. */
};

/**
/**
* Represents a JSON value.
*/
class JsonValue {
Expand Down Expand Up @@ -83,15 +83,15 @@ class JsonValue {
JsonArray& GetArray() { return array; }

private:
JsonValueType type; /**< Type of the JSON value. */
double number; /**< Numeric value. */
std::string str; /**< String value. */
bool boolean; /**< Boolean value. */
JsonObject object; /**< JSON object. */
JsonArray array; /**< JSON array. */
JsonValueType type; /**< Type of the JSON value. */
double number; /**< Numeric value. */
std::string str; /**< String value. */
bool boolean; /**< Boolean value. */
JsonObject object; /**< JSON object. */
JsonArray array; /**< JSON array. */
};

/**
/**
* Parses JSON strings and generates JSON values.
*/
class JsonParser {
Expand Down Expand Up @@ -129,11 +129,11 @@ class JsonParser {
/** Indentation helper for printing JSON values in an output stream. */
void Indent(std::ofstream& outputFile, int level);

std::string data; /**< Input JSON data. */
size_t position; /**< Current position in the data. */
std::string data; /**< Input JSON data. */
size_t position; /**< Current position in the data. */
};

/**
/**
* Parse a JSON string and return the corresponding JSON value.
* @param json The JSON string to parse.
* @return The parsed JSON value.
Expand All @@ -150,7 +150,7 @@ void JsonParser::SkipWhitespace() {
}
}

/**
/**
* Parse a JSON value.
* @return The parsed JSON value.
*/
Expand All @@ -173,7 +173,7 @@ JsonValue JsonParser::ParseValue() {
}
}

/**
/**
* Parse a numeric JSON value.
* @return The parsed JSON value.
*/
Expand Down Expand Up @@ -204,7 +204,7 @@ JsonValue JsonParser::ParseNumber() {
}
}

/**
/**
* Parse a string JSON value.
* @return The parsed JSON value.
*/
Expand Down
24 changes: 11 additions & 13 deletions tests/gtest/test_population_test_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,24 +144,22 @@ class PopulationEvaluateTestFixture : public testing::Test {
population.growth = growth;
population.Prepare();


auto maturity = std::make_shared<fims_popdy::LogisticMaturity<double>>();
maturity->inflection_point = 6;
maturity->slope = 0.15;
population.maturity = maturity;


auto recruitment = std::make_shared<fims_popdy::SRBevertonHolt<double>>();
recruitment->logit_steep = fims_math::logit(0.2, 1.0, 0.75);
recruitment->log_rzero = fims_math::log(1000000.0);
/*the log_recruit_dev vector does not include a value for year == 0
and is of length nyears - 1 where the first position of the vector
corresponds to the second year of the time series.*/
recruitment->log_recruit_devs.resize(nyears-1);
for (int i = 0; i < recruitment->log_recruit_devs.size(); i++) {
recruitment->log_recruit_devs[i] = 0.0;
}
population.recruitment = recruitment;
auto recruitment = std::make_shared<fims_popdy::SRBevertonHolt<double>>();
recruitment->logit_steep = fims_math::logit(0.2, 1.0, 0.75);
recruitment->log_rzero = fims_math::log(1000000.0);
/*the log_recruit_dev vector does not include a value for year == 0
and is of length nyears - 1 where the first position of the vector
corresponds to the second year of the time series.*/
recruitment->log_recruit_devs.resize(nyears - 1);
for (int i = 0; i < recruitment->log_recruit_devs.size(); i++) {
recruitment->log_recruit_devs[i] = 0.0;
}
population.recruitment = recruitment;

int year = 4;
int age = 6;
Expand Down

0 comments on commit a266b0f

Please sign in to comment.