Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format C++ code with clang format #509

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions inst/include/common/def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@
#include <memory>
#include <vector>

//The following rows initialize default log files for outputing model progress
//comments used to assist in diagnosing model issues and tracking progress. These
//files will only be created if a logs folder is added to the root model directory.
std::ofstream FIMS_LOG ("logs/fims.log"); /**< Generic log file */
std::ofstream INFO_LOG("logs/info.log"); /**< Information.hpp log file */
// The following rows initialize default log files for outputing model progress
// comments used to assist in diagnosing model issues and tracking progress.
// These files will only be created if a logs folder is added to the root model
// directory.
std::ofstream FIMS_LOG("logs/fims.log"); /**< Generic log file */
std::ofstream INFO_LOG("logs/info.log"); /**< Information.hpp log file */
std::ofstream ERROR_LOG("logs/error.log"); /**< Error tracking log file */
std::ofstream DATA_LOG("logs/data.log"); /**< Data input tracking log file */
std::ofstream DATA_LOG("logs/data.log"); /**< Data input tracking log file */
std::ofstream MODEL_LOG("logs/model.log"); /**< Model.hpp log file */
std::ofstream FLEET_LOG("logs/fleet.log"); /**< Fleet module log file */
std::ofstream POPULATION_LOG("logs/population.log"); /**< Populations module log file */
std::ofstream RECRUITMENT_LOG("logs/recruitment.log"); /**< Recruitment module log file */
std::ofstream POPULATION_LOG(
"logs/population.log"); /**< Populations module log file */
std::ofstream RECRUITMENT_LOG(
"logs/recruitment.log"); /**< Recruitment module log file */
std::ofstream GROWTH_LOG("logs/growth.log"); /**< Growth module log file */
std::ofstream MATURITY_LOG("logs/maturity.log"); /**< Maturity module log file */
std::ofstream SELECTIVITY_LOG("logs/selectivity.log"); /**< Selectivity module log file */
std::ofstream DEBUG_LOG("logs/debug/debug.log"); /**< Development debugging log file */
std::ofstream MATURITY_LOG(
"logs/maturity.log"); /**< Maturity module log file */
std::ofstream SELECTIVITY_LOG(
"logs/selectivity.log"); /**< Selectivity module log file */
std::ofstream DEBUG_LOG(
"logs/debug/debug.log"); /**< Development debugging log file */

#ifdef TMB_MODEL
// simplify access to singletons
Expand Down
20 changes: 12 additions & 8 deletions inst/include/common/fims_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ inline const double log(const double &x) {
* @return
*/
template <class Type>
inline const Type logistic(const Type &inflection_point, const Type &slope, const Type &x) {
inline const Type logistic(const Type &inflection_point, const Type &slope,
const Type &x) {
return (1.0) / (1.0 + exp(-1.0 * slope * (x - inflection_point)));
}

Expand Down Expand Up @@ -138,27 +139,30 @@ inline const Type inv_logit(const Type &a, const Type &b, const Type &logit_x) {
* @brief The general double logistic function
*
* \f$ \frac{1.0}{ 1.0 + exp(-1.0 * slope_{asc} (x - inflection_point_{asc}))}
* \left(1-\frac{1.0}{ 1.0 + exp(-1.0 * slope_{desc} (x - inflection_point_{desc}))}
* \right)\f$
* \left(1-\frac{1.0}{ 1.0 + exp(-1.0 * slope_{desc} (x -
* inflection_point_{desc}))} \right)\f$
*
* @param inflection_point_asc the inflection point of the ascending limb of the
* double logistic function
* @param slope_asc the slope of the ascending limb of the double logistic
* function
* @param inflection_point_desc the inflection point of the descending limb of
* the double logistic function, where inflection_point_desc > inflection_point_asc
* the double logistic function, where inflection_point_desc >
* inflection_point_asc
* @param slope_desc the slope of the descending limb of the double logistic
* function
* @param x the index the logistic function should be evaluated at
* @return
*/

template <class Type>
inline const Type double_logistic(const Type &inflection_point_asc, const Type &slope_asc,
const Type &inflection_point_desc, const Type &slope_desc,
const Type &x) {
inline const Type double_logistic(const Type &inflection_point_asc,
const Type &slope_asc,
const Type &inflection_point_desc,
const Type &slope_desc, const Type &x) {
return (1.0) / (1.0 + exp(-1.0 * slope_asc * (x - inflection_point_asc))) *
(1.0 - (1.0) / (1.0 + exp(-1.0 * slope_desc * (x - inflection_point_desc))));
(1.0 -
(1.0) / (1.0 + exp(-1.0 * slope_desc * (x - inflection_point_desc))));
}

/**
Expand Down
Loading
Loading