Skip to content
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
2 changes: 1 addition & 1 deletion archived_tests/v1tests/status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ labelAbstractTypes: [ FAIL 0 | WARN 0 | SKIP 1 | PASS 25 ]

math:

nClass_interface: [ FAIL 2 | WARN 0 | SKIP 0 | PASS 4 ]
nC_inter: [ FAIL 2 | WARN 0 | SKIP 0 | PASS 4 ]
`check` not equal to array(c(2.3, 3.4, 4.5)).
Attributes: < target is NULL, current is list >
vector set and get from a full interface
Expand Down
2 changes: 1 addition & 1 deletion nCompiler/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export(argType2Cpp)
export(build_compiled_nClass)
export(calcInputList_to_calcInstrList)
export(calcInstr_nClass)
export(calcInstrList_nClass)
export(calcInstrList_nC)
export(cloglog)
export(check_Rcpp_for_nCompiler)
export(compileNimble)
Expand Down
4 changes: 2 additions & 2 deletions nCompiler/R/Rcpp_nCompiler_plugin.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ inlineCxxPlugin_env <- new.env()
## registerPlugin occurs in the package source code.
inlineCxxPlugin <- function(...) {
uses_eigen <- !isFALSE(inlineCxxPlugin_env$uses_eigen)
uses_nClass_interface <- !isFALSE(inlineCxxPlugin_env$uses_nClass_interface)
uses_nC_inter <- !isFALSE(inlineCxxPlugin_env$uses_nC_inter)
uses_nList <- !isFALSE(inlineCxxPlugin_env$uses_nList)
uses_cereal <- !isFALSE(inlineCxxPlugin_env$uses_cereal)
uses_TBB <- FALSE # !isFALSE(inlineCxxPlugin_env$uses_TBB) # including here causes error due to #defining FALSE
include.before <- character()
if(uses_eigen) include.before <- paste0(include.before, "#define NCOMPILER_USES_EIGEN\n")
if(uses_nClass_interface) include.before <- paste0(include.before, "#define NCOMPILER_USES_NCLASS_INTERFACE\n")
if(uses_nC_inter) include.before <- paste0(include.before, "#define NCOMPILER_USES_NCLASS_INTERFACE\n")
if(uses_nList) include.before <- paste0(include.before, "#define NCOMPILER_USES_NLIST\n")
if(uses_cereal) include.before <- paste0(include.before, "#define NCOMPILER_USES_CEREAL\n")
if(uses_TBB) include.before <- paste0(include.before, "#define NCOMPILER_USES_TBB\n")
Expand Down
2 changes: 1 addition & 1 deletion nCompiler/R/cppDefs_R_interface_calls.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ global_R_interface_cppDef <-
# ),
# Hincludes = nCompilerIncludeFile("nCompiler_omnibus_first_h.h"),
#CPPincludes = c(nCompilerIncludeFile("nCompiler_omnibus_first_cpp.h"),
# nCompilerIncludeFile("nClass_interface/post_Rcpp/process_call_args.h")),
# nCompilerIncludeFile("nC_inter/post_Rcpp/process_call_args.h")),
Hpreamble = c("#define NCOMPILER_USES_NCLASS_INTERFACE",
"#define USES_NCOMPILER"),
CPPpreamble = c("#define NCOMPILER_USES_NCLASS_INTERFACE",
Expand Down
2 changes: 1 addition & 1 deletion nCompiler/R/cppDefs_serialize.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ global_serialization_cppDef <-
# This is done here because it must be done once and only once to avoid
# duplicate symbols when compiling as a package.
CPPincludes = c(#nCompilerIncludeFile("nCompiler_omnibus_first_cpp.h"),
nCompilerIncludeFile("nClass_cereal/post_Rcpp/serialization_mgr.h")),
nCompilerIncludeFile("nC_cereal/post_Rcpp/serialization_mgr.h")),
CPPusings = c("using namespace Rcpp;",
"// [[Rcpp::plugins(nCompiler_plugin)]]",
"// [[Rcpp::depends(nCompiler)]]",
Expand Down
26 changes: 13 additions & 13 deletions nCompiler/R/nimbleModels.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nodeInstr_nClass <- nClass(
methodInstr = 'integerVector',
indsInstrVec = "nList('integerVector')"
),
predefined = quote(system.file(file.path("include","nCompiler", "predefined_nClasses"), package="nCompiler") |>
predefined = quote(system.file(file.path("include","nCompiler", "predef"), package="nCompiler") |>
file.path("nodeInstr_nClass")),
compileInfo=list(interface="full",
createFromR = TRUE#,
Expand All @@ -34,7 +34,7 @@ calcInstr_nClass <- nClass(
nodeIndex = 'integerScalar',
nodeInstrVec = "nList('nodeInstr_nClass')"
),
predefined = quote(system.file(file.path("include","nCompiler", "predefined_nClasses"), package="nCompiler") |>
predefined = quote(system.file(file.path("include","nCompiler", "predef"), package="nCompiler") |>
file.path("calcInstr_nClass")),
compileInfo=list(interface="full",
createFromR = TRUE,
Expand All @@ -43,13 +43,13 @@ calcInstr_nClass <- nClass(
)
)

calcInstrList_nClass <- nClass(
classname = "calcInstrList_nClass",
calcInstrList_nC <- nClass(
classname = "calcInstrList_nC",
Cpublic = list(
calcInstrList = "nList('calcInstr_nClass')"
),
predefined = quote(system.file(file.path("include","nCompiler", "predefined_nClasses"), package="nCompiler") |>
file.path("calcInstrList_nClass")),
predefined = quote(system.file(file.path("include","nCompiler", "predef"), package="nCompiler") |>
file.path("calcInstrList_nC")),
compileInfo=list(interface="full",
createFromR = TRUE,
Hincludes = "<calcInstr_nClass_c_.h>")
Expand All @@ -71,7 +71,7 @@ nodeFxnBase_nClass <- nClass(
),
# We haven't dealt with ensuring a virtual destructor when any method is virtual
# For now I did it manually by editing the .h and .cpp
predefined = quote(system.file(file.path("include","nCompiler", "predefined_nClasses"), package="nCompiler") |>
predefined = quote(system.file(file.path("include","nCompiler", "predef"), package="nCompiler") |>
file.path("nodeFxnBase_nClass")),
compileInfo=list(interface="full",
createFromR = FALSE)
Expand All @@ -92,17 +92,17 @@ modelBase_nClass <- nClass(
function(calcInstrList) {cat("In uncompiled calculate\n")},
returnType = 'numericScalar',
compileInfo = list(
C_fun = function(calcInstrList='calcInstrList_nClass') {
C_fun = function(calcInstrList='calcInstrList_nC') {
cppLiteral('Rprintf("modelBase_nClass calculate (should not see this)\\n");'); return(0)},
virtual=TRUE
)
)
),
# See comment above about needing to ensure a virtual destructor
predefined = quote(system.file(file.path("include","nCompiler", "predefined_nClasses"), package="nCompiler") |> file.path("modelBase_nClass")),
predefined = quote(system.file(file.path("include","nCompiler", "predef"), package="nCompiler") |> file.path("modelBase_nClass")),
compileInfo=list(interface="full",
createFromR = FALSE,
Hincludes = c("<nodeFxnBase_nClass_c_.h>", "<calcInstrList_nClass_c_.h>"))
Hincludes = c("<nodeFxnBase_nClass_c_.h>", "<calcInstrList_nC_c_.h>"))
)

# nCompile(modelBase_nClass, control=list(generate_predefined=TRUE))
Expand Down Expand Up @@ -270,7 +270,7 @@ makeModel_nClass <- function(varInfo,
compileInfo = list(opDefs = OPDEFS,
nClass_inherit = list(base=BASECLASS)
#inherit = list(base = "public modelClass_<mymodel>"),
#Hincludes = "<nCompiler/nClass_interface/post_Rcpp/nCompiler_model_base_devel.h>"
#Hincludes = "<nCompiler/nC_inter/post_Rcpp/nCompiler_model_base_devel.h>"
),
Cpublic = CPUBLIC
),
Expand Down Expand Up @@ -361,7 +361,7 @@ make_model_from_nimbleModel <- function(m) {
model <- makeModel_nClass(modelVarInfo, nodeInfoList, classname = "my_model")
# Currently we must compile from here because here is where we know the nodeFxnName[s].
# We have a situation where order matters: model needs to come after the utility classes. Fix me.
argList <- list("modelBase_nClass", "nodeFxnBase_nClass", "calcInstrList_nClass", "calcInstr_nClass", "nodeInstr_nClass", "model")
argList <- list("modelBase_nClass", "nodeFxnBase_nClass", "calcInstrList_nC", "calcInstr_nClass", "nodeInstr_nClass", "model")
argList <- c(argList, as.list(nodeFxnNames))
argList <- argList |> lapply(as.name)
Cmodel <- do.call("nCompile", argList)
Expand Down Expand Up @@ -389,7 +389,7 @@ calcInputList_to_calcInstrList <- function(calcInputList, comp) {
calcInstr$nodeInstrVec <- nodeInstrVec
calcInstrList[[iCalc]] <- calcInstr
}
calcInstrListObj <- comp$calcInstrList_nClass$new()
calcInstrListObj <- comp$calcInstrList_nC$new()
calcInstrListObj$calcInstrList <- calcInstrList
return(calcInstrListObj)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef EIGENTENSOR_RCPP_EXTENSIONS_FORWARD_DECLARATIONS_H_
#define EIGENTENSOR_RCPP_EXTENSIONS_FORWARD_DECLARATIONS_H_
#ifndef ET_Rcpp_ext_FORWARD_DECLARATIONS_H_
#define ET_Rcpp_ext_FORWARD_DECLARATIONS_H_

#include <type_traits>
#include <memory>
Expand Down Expand Up @@ -59,4 +59,4 @@ namespace Rcpp {
} // end namespace traits
} // end namespace Rcpp

#endif // EIGENTENSOR_RCPP_EXTENSIONS_FORWARD_DECLARATIONS_H_
#endif // ET_Rcpp_ext_FORWARD_DECLARATIONS_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//#ifndef NCOMPILER_ET_Rcpp_ext_H_
//#define NCOMPILER_ET_Rcpp_ext_H_

//#include "ET_Rcpp_ext_pre_Rcpp.h"
#include <nCompiler/ET_Rcpp_ext/post_Rcpp/SEXP_2_EigenTensor.h>
#include <nCompiler/ET_Rcpp_ext/post_Rcpp/ET_Rcpp_as_wrap.h>
#include <nCompiler/ET_Rcpp_ext/post_Rcpp/ET_SEXP_converter.h>
#include <nCompiler/ET_Rcpp_ext/post_Rcpp/ETaccessor_post_Rcpp.h>

//#endif // EIGEN_RCPP_EXTENSIONS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS

//#include <RcppCommon.h>
#include "EigenTensor_Rcpp_extensions_forward_declarations.h"
//#include <nCompiler/EigenTensor_extensions/EigenTensor_extensions_pre_Rcpp.h>
#include "ET_Rcpp_ext_forward_declarations.h"
//#include <nCompiler/ET_ext/ET_ext_pre_Rcpp.h>
#include "ETaccessor.h"

//#endif // NCOMPILER_TENSOR_RCPP_FORWARD_DECLARATIONS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <unsupported/Eigen/CXX11/Tensor>
#include "SEXP_2_EigenTensor.h"
#include "SEXP_indices_2_IndexArray.h"
#include <nCompiler/EigenTensor_extensions/index_block.h>
#include <nCompiler/ET_ext/index_block.h>

#define PRINTF Rprintf

Expand Down
23 changes: 23 additions & 0 deletions nCompiler/inst/include/nCompiler/ET_ext/ET_ext_post_Rcpp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//#ifndef __NCOMPILER_EIGEN_FXNS
//#define __NCOMPILER_EIGEN_FXNS

//#include "ET_Rcpp_ext_forward_declarations.h"
//#include <nCompiler/ET_Rcpp_ext/ET_Rcpp_ext_post_Rcpp.h>

// These are going in a post_Rcpp directory.
// However, any of them could be pre_Rcpp. They could be either.
#include <nCompiler/ET_ext/post_Rcpp/typedefs.h>
#include <nCompiler/ET_ext/post_Rcpp/setWhich.h>
//#include "repClass.h"
//#include "seqClass.h"
#include <nCompiler/ET_ext/post_Rcpp/recyclingRule.h>
#include <nCompiler/ET_ext/post_Rcpp/tensorCreation.h>
#include <nCompiler/ET_ext/post_Rcpp/tensorFlex.h>
#include <nCompiler/ET_ext/post_Rcpp/tensorOperations.h>
#include <nCompiler/ET_ext/post_Rcpp/tensorIndexingOps.h>
#include <nCompiler/ET_ext/post_Rcpp/tensorUtils.h>
#include <nCompiler/ET_ext/post_Rcpp/tensor_seq_op.h>
#include <nCompiler/ET_ext/post_Rcpp/tensor_rep_op.h>
#include <nCompiler/ET_ext/post_Rcpp/tensor_cat_op.h>

//#endif

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion nCompiler/inst/include/nCompiler/INCLUDE_RULES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Here is the scheme and associated rules:
5. Generated .cpp files will (normally) have
"#include "nCompiler_omnibus_first_cpp.h"
This will use previously stated #define flags to decide what to include further. It also has what should be the **ONLY** statement of "#include <Rcpp.h>".
6. In general, headers for each of the components (Rcpp, nClass_interfaces, Eigen, Cereal, and TBB) are in separate directories. There are also directories for some "interaction" components like nClass_interfaces+Eigen and others.
6. In general, headers for each of the components (Rcpp, nC_inters, Eigen, Cereal, and TBB) are in separate directories. There are also directories for some "interaction" components like nC_inters+Eigen and others.
7. There is inclusion across directories because it is necessary.
8. Each component's directory has a "<name>_pre_Rcpp.h" and "<name>_post_Rcpp.h" which contain simple collections of other #include statements. These are generally what is included from "nCompiler_omnibus_first_h.h" and "nCompiler_omnibus_first_cpp.h", respectively. These should NEVER be included from other files, because they don't have their own #ifndef protection and so in theory could recurse infinitely. Inclusion from other files should directly target specific files.
9. Files that have "post_Rcpp" status (i.e. should never be included from a pathway stemming from "nCompiler_omnibus_first_h.h") are placed in subdirectories called post_Rcpp within each component directory. This helps us avoid accidentally including something pre_Rcpp that should be post_Rcpp. They can only be included if the directory path explicitly includes "/post_Rcpp/" so that it sticks out.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#include <nCompiler/nC_cereal/post_Rcpp/Rcpp_types_cereal.h>
#include <nCompiler/nC_cereal/post_Rcpp/save_load_Rcpp_types.h>
//#include <nCompiler/nC_cereal/post_Rcpp/serialization_mgr.h>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RCPP_TYPES_CEREAL_H_
#define RCPP_TYPES_CEREAL_H_

#include <nCompiler/nClass_cereal/archives.h>
#include <nCompiler/nC_cereal/archives.h>

template <class possibleRcppType>
struct is_RcppType {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef NCOMPILER_CEREAL_SAVE_LOAD_RCPP_TYPES_H_
#define NCOMPILER_CEREAL_SAVE_LOAD_RCPP_TYPES_H_

#include <nCompiler/nClass_cereal/archives.h>
#include <nCompiler/nC_cereal/archives.h>
#include "Rcpp_types_cereal.h"

template<class Archive, class RcppType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef _NCOMP_SERIALIZATION_MGR
#define _NCOMP_SERIALIZATION_MGR

#include <nCompiler/nClass_cereal/archives.h>
#include <nCompiler/nClass_cereal/post_Rcpp/Rcpp_types_cereal.h>
#include <nCompiler/nClass_interface/generic_class_interface.h>
#include <nCompiler/nClass_interface/post_Rcpp/generic_class_interface_Rcpp_steps.h>
#include <nCompiler/nClass_interface/loadedObjectsHook.h>
#include <nCompiler/nClass_interface/post_Rcpp/loadedObjectHookC_impl.h>
#include <nCompiler/nClass_interface/nClass_factory.h>
#include <nCompiler/nC_cereal/archives.h>
#include <nCompiler/nC_cereal/post_Rcpp/Rcpp_types_cereal.h>
#include <nCompiler/nC_inter/generic_class_interface.h>
#include <nCompiler/nC_inter/post_Rcpp/generic_class_interface_Rcpp_steps.h>
#include <nCompiler/nC_inter/loadedObjectsHook.h>
#include <nCompiler/nC_inter/post_Rcpp/loadedObjectHookC_impl.h>
#include <nCompiler/nC_inter/nC_factory.h>
// Rough draft of C++ serialization manager class
// I want to make this as similar as possible to the design of an nClass
// for simplicity and code re-use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include<iostream>
#include<memory>
#ifdef NCOMPILER_USES_CEREAL
#include<nCompiler/nClass_cereal/archives.h>
#include<nCompiler/nC_cereal/archives.h>
#endif
#include<nCompiler/nClass_interface/expand_call_method.h>
#include<nCompiler/EigenTensor_Rcpp_extensions/ETaccessor.h>
#include<nCompiler/nC_inter/expand_call_method.h>
#include<nCompiler/ET_Rcpp_ext/ETaccessor.h>

// We must be able to assume that any Rcpp extension
// forward declarations have been made by now.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include<Rinternals.h>
#ifdef NCOMPILER_USES_CEREAL
#include<nCompiler/nClass_cereal/archives.h>
#include<nCompiler/nC_cereal/archives.h>
#endif

class loadedObjectHookBaseC {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include<R.h>
#include<Rinternals.h>
#ifdef NCOMPILER_USES_CEREAL
#include<nCompiler/nClass_cereal/archives.h>
#include<nCompiler/nC_cereal/archives.h>
#endif
#define SHOW_SHARED_PTR_DESTRUCTORS

Expand Down
16 changes: 16 additions & 0 deletions nCompiler/inst/include/nCompiler/nC_inter/nC_inter_post_Rcpp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//#ifndef NCLASS_INTERFACE_POST_RCPP_H_
//#define NCLASS_INTERFACE_POST_RCPP_H_

//#include "nC_inter_pre_Rcpp.h"
// process_call_args includes one non-templated function, so to avoid
// duplicate symbol errors from multiple compilation units, it is included
// in the interfaces cppDef managed from code-generation from R.
//#include <nCompiler/nC_inter/post_Rcpp/process_call_args.h>
#include <nCompiler/nC_inter/post_Rcpp/loadedObjectHookC_impl.h>
#include <nCompiler/nC_inter/post_Rcpp/generic_class_interface_Rcpp_steps.h>
//#include <nCompiler/nC_inter_Rcpp_ext/shared_ptr_as_wrap.h>

// I think the following will be moved to a nimble 2.0 package but is drafted here for now
#include <nCompiler/nC_inter/post_Rcpp/nCompiler_compileNimble_support.h>

//#endif // NCLASS_INTERFACE_POST_RCPP_H_
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//#ifndef OMNIBUS_NCLASS_INTERFACE_H_
//#define OMNIBUS_NCLASS_INTERFACE_H_

#include <nCompiler/nClass_interface_Rcpp_extensions/shared_ptr_as_wrap_forward_declarations.h>
#include <nCompiler/nC_inter_Rcpp_ext/shared_ptr_as_wrap_forward_declarations.h>
#include "generic_class_interface.h"
#include "nClass_factory.h"
#include "nC_factory.h"
#include "loadedObjectsHook.h"

//#endif // OMNIBUS_NCLASS_INTERFACE_H_
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef GENERIC_CLASS_INTERFACE_RCPP_STEPS_H_
#define GENERIC_CLASS_INTERFACE_RCPP_STEPS_H_

#include<nCompiler/EigenTensor_Rcpp_extensions/post_Rcpp/ETaccessor_post_Rcpp.h>
#include<nCompiler/ET_Rcpp_ext/post_Rcpp/ETaccessor_post_Rcpp.h>

// begin ETaccess scheme
// If this works, I'll move it to its own header file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// There is a forward declaration of process_call_args in generic_class_interface.h

/* #include <nCompiler/nClass_interface/generic_class_interface.h> */
/* #include <nCompiler/nC_inter/generic_class_interface.h> */
/* //#include <Rcpp.h> */

/* SEXP process_call_args(const genericInterfaceBaseC::args::argVectorT &argVector, */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//#ifndef NCLASS_INTERFACE_RCPP_EXTENSIONS_POST_RCPP_H_
//#define NCLASS_INTERFACE_RCPP_EXTENSIONS_POST_RCPP_H_

#include <nCompiler/nClass_interface_Rcpp_extensions/post_Rcpp/shared_ptr_as_wrap.h>
#include <nCompiler/nC_inter_Rcpp_ext/post_Rcpp/shared_ptr_as_wrap.h>

//#endif // NCLASS_INTERFACE_RCPP_EXTENSIONS_POST_RCPP_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define SHARED_PTR_AS_WRAP_H_

#include <memory>
#include <nCompiler/nClass_interface_Rcpp_extensions/shared_ptr_as_wrap_forward_declarations.h>
#include <nCompiler/nClass_interface/nClass_factory.h>
#include <nCompiler/nC_inter_Rcpp_ext/shared_ptr_as_wrap_forward_declarations.h>
#include <nCompiler/nC_inter/nC_factory.h>
// #include "loadedObjectEnv.h"

// For an input of type T (e.g. shared_ptr< some_nClass_ >),
Expand Down
Loading