From ca20ef31f1663aab78127222c2093f56f81c940c Mon Sep 17 00:00:00 2001 From: ChristineStawitz-NOAA Date: Tue, 28 Nov 2023 18:34:02 +0000 Subject: [PATCH] style: run clang format --- inst/include/interface/interface.hpp | 1 + .../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 +++++----- 6 files changed, 50 insertions(+), 51 deletions(-) diff --git a/inst/include/interface/interface.hpp b/inst/include/interface/interface.hpp index 71c530a5..09f750af 100644 --- a/inst/include/interface/interface.hpp +++ b/inst/include/interface/interface.hpp @@ -20,6 +20,7 @@ // use isnan macro in math.h instead of TMB's isnan for fixing the r-cmd-check // issue #include + #include // define REPORT, ADREPORT, and SIMULATE diff --git a/inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp b/inst/include/interface/rcpp/rcpp_objects/rcpp_recruitment.hpp index 91c855fd..ee21ef82 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 fa7c95a6..1d3f50ff 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 65e00bbf..66b2b7ec 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 c3718928..8537cbab 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 9c3963cb..a365708a 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;