8#ifndef FIMS_INTERFACE_RCPP_INTERFACE_HPP
9#define FIMS_INTERFACE_RCPP_INTERFACE_HPP
10#include "../../common/model.hpp"
11#include "../../utilities/fims_json.hpp"
28 std::signal(SIGSEGV, &fims::WriteAtExit);
29 std::signal(SIGINT, &fims::WriteAtExit);
30 std::signal(SIGABRT, &fims::WriteAtExit);
31 std::signal(SIGFPE, &fims::WriteAtExit);
32 std::signal(SIGILL, &fims::WriteAtExit);
33 std::signal(SIGTERM, &fims::WriteAtExit);
79 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> info0 =
83 std::shared_ptr<fims_info::Information<TMBAD_FIMS_TYPE>> info =
99 std::shared_ptr<fims_model::Model<TMB_FIMS_REAL_TYPE>> m0 =
135 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> info0 =
138 for (
size_t i = 0; i < info0->fixed_effects_parameters.size(); i++) {
139 *info0->fixed_effects_parameters[i] = par[i];
150 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> info0 =
153 Rcpp::NumericVector p;
155 for (
size_t i = 0; i < info0->fixed_effects_parameters.size(); i++) {
156 p.push_back(*info0->fixed_effects_parameters[i]);
170 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> info0 =
173 for (
size_t i = 0; i < info0->random_effects_parameters.size(); i++) {
174 *info0->random_effects_parameters[i] = par[i];
185 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> d0 =
188 Rcpp::NumericVector p;
190 for (
size_t i = 0; i < d0->random_effects_parameters.size(); i++) {
191 p.push_back(*d0->random_effects_parameters[i]);
205 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> d0 =
208 pars.attr(
"names") = d0->parameter_names;
221 std::shared_ptr<fims_info::Information<TMB_FIMS_REAL_TYPE>> d0 =
224 pars.attr(
"names") = d0->random_effects_names;
234template <
typename Type>
236 std::shared_ptr<fims_info::Information<Type>> d0 =
399 std::string
search =
"\"";
404 while (
pos != std::string::npos) {
416 std::stringstream
ss;
417 ss <<
"capture.output(traceback(4))";
424 Rcpp::Rcout <<
"Error parsing expression" << std::endl;
427 Rcpp::Rcout <<
"before call.";
429 Rcpp::Rcout <<
"after call.";
static uint32_t id_g
The static id of the DataInterfaceBase object.
Definition rcpp_data.hpp:32
static std::map< uint32_t, std::shared_ptr< DataInterfaceBase > > live_objects
The map associating the IDs of DataInterfaceBase to the objects. This is a live object,...
Definition rcpp_data.hpp:43
static uint32_t id_g
The static ID of the DistributionsInterfaceBase object.
Definition rcpp_distribution.hpp:24
static std::map< uint32_t, std::shared_ptr< DistributionsInterfaceBase > > live_objects
The map associating the ID of the DistributionsInterfaceBase to the DistributionsInterfaceBase object...
Definition rcpp_distribution.hpp:67
static std::vector< std::shared_ptr< FIMSRcppInterfaceBase > > fims_interface_objects
FIMS interface object vectors.
Definition rcpp_interface_base.hpp:585
static uint32_t id_g
The static id of the FleetInterfaceBase object.
Definition rcpp_models.hpp:47
static std::map< uint32_t, std::shared_ptr< FisheryModelInterfaceBase > > live_objects
The map associating the IDs of FleetInterfaceBase to the objects. This is a live object,...
Definition rcpp_models.hpp:58
static uint32_t id_g
The static id of the FleetInterfaceBase object.
Definition rcpp_fleet.hpp:25
static std::map< uint32_t, std::shared_ptr< FleetInterfaceBase > > live_objects
The map associating the IDs of FleetInterfaceBase to the objects. This is a live object,...
Definition rcpp_fleet.hpp:35
static std::map< uint32_t, std::shared_ptr< GrowthInterfaceBase > > live_objects
The map associating the IDs of GrowthInterfaceBase to the objects. This is a live object,...
Definition rcpp_growth.hpp:34
static uint32_t id_g
The static id of the GrowthInterfaceBase object.
Definition rcpp_growth.hpp:24
static std::map< uint32_t, std::shared_ptr< MaturityInterfaceBase > > live_objects
The map associating the IDs of MaturityInterfaceBase to the objects. This is a live object,...
Definition rcpp_maturity.hpp:35
static uint32_t id_g
The static id of the MaturityInterfaceBase object.
Definition rcpp_maturity.hpp:24
static uint32_t id_g
The static ID of the Parameter object.
Definition rcpp_interface_base.hpp:148
static uint32_t id_g
The static ID of the Parameter object.
Definition rcpp_interface_base.hpp:37
static uint32_t id_g
The static id of the PopulationInterfaceBase object.
Definition rcpp_population.hpp:24
static std::map< uint32_t, std::shared_ptr< PopulationInterfaceBase > > live_objects
The map associating the IDs of PopulationInterfaceBase to the objects. This is a live object,...
Definition rcpp_population.hpp:35
static uint32_t id_g
The static id of the RecruitmentInterfaceBase object.
Definition rcpp_recruitment.hpp:25
static std::map< uint32_t, std::shared_ptr< RecruitmentInterfaceBase > > live_objects
The map associating the IDs of RecruitmentInterfaceBase to the objects. This is a live object,...
Definition rcpp_recruitment.hpp:40
static uint32_t id_g
The static id of the SelectivityInterfaceBase.
Definition rcpp_selectivity.hpp:24
static std::map< uint32_t, std::shared_ptr< SelectivityInterfaceBase > > live_objects
The map associating the IDs of SelectivityInterfaceBase to the objects. This is a live object,...
Definition rcpp_selectivity.hpp:35
static std::shared_ptr< FIMSLog > fims_log
A singleton instance of the log, i.e., where there is only one log. The object is created when the ....
Definition def.hpp:263
static std::shared_ptr< Model< Type > > GetInstance()
Evaluate. Calculates the joint negative log-likelihood function.
Definition model.hpp:54
The Rcpp interface to declare different types of data, e.g., age-composition and index data....
The Rcpp interface to declare different distributions, e.g., normal and log normal....
The Rcpp interface to declare fleets. Allows for the use of methods::new() in R.
The Rcpp interface to declare different types of growth, e.g., empirical weight-at-age data....
void set_log_path(const std::string &path)
Sets the path for the log file to be written to.
Definition rcpp_interface.hpp:364
std::string get_log_warnings()
Gets the warning entries from the log as a string in JSON format.
Definition rcpp_interface.hpp:347
std::string escapeQuotes(const std::string &input)
Escapes quotations.
Definition rcpp_interface.hpp:397
bool CreateTMBModel()
Initialize and construct the FIMS model using TMB.
Definition rcpp_interface.hpp:74
std::string get_log_info()
Gets the info entries from the log as a string in JSON format.
Definition rcpp_interface.hpp:354
void log_error(std::string log_entry)
Adds a error entry to the log from the R environment.
Definition rcpp_interface.hpp:415
void set_random_parameters(Rcpp::NumericVector par)
Update random effect parameters in the tape, so the output is correct.
Definition rcpp_interface.hpp:168
std::string get_log_errors()
Gets the error entries from the log as a string in JSON format.
Definition rcpp_interface.hpp:342
void log_warning(std::string log_entry)
Adds a warning entry to the log from the R environment.
Definition rcpp_interface.hpp:386
Rcpp::List get_parameter_names(Rcpp::List pars)
Gets the parameter names object.
Definition rcpp_interface.hpp:203
void set_log_throw_on_error(bool throw_on_error)
If true, throws a runtime exception when an error is logged.
Definition rcpp_interface.hpp:371
std::string get_log()
Gets the log entries as a string in JSON format.
Definition rcpp_interface.hpp:337
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:235
void log_info(std::string log_entry)
Adds an info entry to the log from the R environment.
Definition rcpp_interface.hpp:378
void clear()
Clears the vector of independent variables.
Definition rcpp_interface.hpp:244
Rcpp::NumericVector get_fixed_parameters_vector()
Gets the fixed parameters vector object.
Definition rcpp_interface.hpp:148
Rcpp::NumericVector get_random_parameters_vector()
Gets the random parameters vector object.
Definition rcpp_interface.hpp:183
void write_log(bool write)
If true, writes the log on exit.
Definition rcpp_interface.hpp:359
void init_logging()
Definition rcpp_interface.hpp:27
void set_fixed_parameters(Rcpp::NumericVector par)
Update fixed parameters in the tape, so the output is correct.
Definition rcpp_interface.hpp:133
Rcpp::List get_random_names(Rcpp::List pars)
Gets the random effects names object.
Definition rcpp_interface.hpp:219
The Rcpp interface to declare objects that are used ubiquitously throughout the Rcpp interface,...
The Rcpp interface to declare different maturity options, e.g., logistic. Allows for the use of metho...
The Rcpp interface to declare different types of models. Allows for the use of methods::new() in R.
The Rcpp interface to declare different types of natural mortality. Allows for the use of methods::ne...
The Rcpp interface to declare different types of populations. Allows for the use of methods::new() in...
The Rcpp interface to declare different types of recruitment, e.g., Beverton–Holt stock–recruitment r...
The Rcpp interface to declare different types of selectivity, e.g., logistic and double logistic....