From 686422a2b10c46268159008eba1c5f392e7b02a9 Mon Sep 17 00:00:00 2001 From: peterkuriyama-NOAA Date: Wed, 22 Nov 2023 17:18:13 +0000 Subject: [PATCH] style: run clang format --- .../rcpp/rcpp_objects/rcpp_recruitment.hpp | 15 +++--- .../population/population.hpp | 6 +-- .../recruitment/functors/recruitment_base.hpp | 7 ++- inst/include/utilities/fims_json.hpp | 48 +++++++++---------- tests/gtest/test_population_test_fixture.hpp | 24 +++++----- 5 files changed, 49 insertions(+), 51 deletions(-) diff --git a/inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp b/inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp index 1b7fe205c..4fa886007 100644 --- a/inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp +++ b/inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp @@ -30,7 +30,8 @@ class RecruitmentInterfaceBase : public FIMSRcppInterfaceBase { // static std::vector 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++; @@ -69,12 +70,12 @@ std::map */ 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() {} diff --git a/inst/include/population_dynamics/population/population.hpp b/inst/include/population_dynamics/population/population.hpp index fa7c95a68..1d3f50ff5 100644 --- a/inst/include/population_dynamics/population/population.hpp +++ b/inst/include/population_dynamics/population/population.hpp @@ -398,10 +398,10 @@ struct Population : public fims_model_object::FIMSObject { /*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; } /** diff --git a/inst/include/population_dynamics/recruitment/functors/recruitment_base.hpp b/inst/include/population_dynamics/recruitment/functors/recruitment_base.hpp index 65e00bbf1..66b2b7ecc 100644 --- a/inst/include/population_dynamics/recruitment/functors/recruitment_base.hpp +++ b/inst/include/population_dynamics/recruitment/functors/recruitment_base.hpp @@ -32,7 +32,7 @@ struct RecruitmentBase : public fims_model_object::FIMSObject { static uint32_t id_g; /**< reference id for recruitment object*/ typename fims::ModelTraits::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 */ @@ -40,9 +40,8 @@ struct RecruitmentBase : public fims_model_object::FIMSObject { 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. */ diff --git a/inst/include/utilities/fims_json.hpp b/inst/include/utilities/fims_json.hpp index c3718928a..8537cbabb 100644 --- a/inst/include/utilities/fims_json.hpp +++ b/inst/include/utilities/fims_json.hpp @@ -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 @@ -13,29 +13,29 @@ class JsonValue; -/** +/** * Alias for a JSON object, mapping strings to JSON values. */ using JsonObject = std::map; -/** +/** * Alias for a JSON array, containing a sequence of JSON values. */ using JsonArray = std::vector; -/** +/** * 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 { @@ -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 { @@ -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. @@ -150,7 +150,7 @@ void JsonParser::SkipWhitespace() { } } -/** +/** * Parse a JSON value. * @return The parsed JSON value. */ @@ -173,7 +173,7 @@ JsonValue JsonParser::ParseValue() { } } -/** +/** * Parse a numeric JSON value. * @return The parsed JSON value. */ @@ -204,7 +204,7 @@ JsonValue JsonParser::ParseNumber() { } } -/** +/** * Parse a string JSON value. * @return The parsed JSON value. */ diff --git a/tests/gtest/test_population_test_fixture.hpp b/tests/gtest/test_population_test_fixture.hpp index 9c3963cbd..a365708ae 100644 --- a/tests/gtest/test_population_test_fixture.hpp +++ b/tests/gtest/test_population_test_fixture.hpp @@ -144,24 +144,22 @@ class PopulationEvaluateTestFixture : public testing::Test { population.growth = growth; population.Prepare(); - auto maturity = std::make_shared>(); maturity->inflection_point = 6; maturity->slope = 0.15; population.maturity = maturity; - - auto recruitment = std::make_shared>(); - 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>(); + 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;