From c2f106d768ce47f72aa60c93439da3f57f574f5f Mon Sep 17 00:00:00 2001 From: Sebastian Hoehna Date: Thu, 2 Aug 2018 09:30:07 +0200 Subject: [PATCH] Breaking up type registration for windows compilation --- src/revlanguage/workspace/RbRegister_Type.cpp | 17 -- .../workspace/RbRegister_VectorType.cpp | 164 ++++++++++++++++++ src/revlanguage/workspace/Workspace.cpp | 1 + src/revlanguage/workspace/Workspace.h | 3 +- 4 files changed, 167 insertions(+), 18 deletions(-) create mode 100644 src/revlanguage/workspace/RbRegister_VectorType.cpp diff --git a/src/revlanguage/workspace/RbRegister_Type.cpp b/src/revlanguage/workspace/RbRegister_Type.cpp index 2b287ba55..028ca7c60 100644 --- a/src/revlanguage/workspace/RbRegister_Type.cpp +++ b/src/revlanguage/workspace/RbRegister_Type.cpp @@ -128,23 +128,6 @@ void RevLanguage::Workspace::initializeTypeGlobalWorkspace(void) try { - AddWorkspaceVectorType::addTypeToWorkspace( *this, new Taxon() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new RateGenerator() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new CladogeneticProbabilityMatrix() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new CladogeneticSpeciationRateMatrix() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new DistanceMatrix() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new MatrixReal() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new MatrixRealPos() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new MatrixRealSymmetric() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new AbstractHomologousDiscreteCharacterData() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new ContinuousCharacterData() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new CharacterHistoryRateModifier() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new TimeTree() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new BranchLengthTree() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new Tree() ); - AddWorkspaceVectorType::addTypeToWorkspace( *this, new Clade() ); -// AddWorkspaceVectorType::addTypeToWorkspace( *this, new Dist_bdp() ); - addTypeWithConstructor( new Clade() ); addTypeWithConstructor( new Taxon() ); diff --git a/src/revlanguage/workspace/RbRegister_VectorType.cpp b/src/revlanguage/workspace/RbRegister_VectorType.cpp new file mode 100644 index 000000000..260fd71e7 --- /dev/null +++ b/src/revlanguage/workspace/RbRegister_VectorType.cpp @@ -0,0 +1,164 @@ +/** + * @file + * This file contains the Workspace function that adds types and functions + * to the global workspace, registering them with the interpreter/compiler + * during the process. + * + * @brief Function registering language objects + * + * Instructions + * + * This is the central registry of Rev objects. It is a large file and needs + * to be properly organized to facilitate maintenance. Follow these simple + * guidelines to ensure that your additions follow the existing structure. + * + * 1. All headers are added in groups corresponding to directories in the + * revlanguage code base. + * 2. All objects (types, distributions, and functions) are registered in + * groups corresponding to directories in the revlanguage code base. + * 3. All entries in each group are listed in alphabetical order. + * + * Some explanation of the directory structure is provided in the comments + * in this file. Consult these comments if you are uncertain about where + * to add your objects in the code. + */ + + +#include +#include +#include +#include + +/* Files including helper classes */ +#include "AddContinuousDistribution.h" +#include "AddDistribution.h" +#include "AddWorkspaceVectorType.h" +#include "AddVectorizedWorkspaceType.h" +#include "RbException.h" +#include "RevAbstractType.h" +#include "RlUserInterface.h" +#include "Workspace.h" + +/// Miscellaneous types /// + +/* Base types (in folder "datatypes") */ +#include "RevObject.h" +#include "AbstractModelObject.h" + +/* Container types (in folder "datatypes/container") */ +#include "RlCorrespondenceAnalysis.h" +#include "RlMatrixReal.h" +#include "RlMatrixRealPos.h" +#include "RlMatrixRealSymmetric.h" +#include "RlRateGeneratorSequence.h" +#include "RlRateMatrix.h" +#include "RlSimplex.h" + +/* Container types (in folder "datatypes/math") */ +#include "ModelVector.h" +#include "WorkspaceVector.h" + +/* Container types (in folder "distributions/phylogenetics") */ +#include "Dist_bdp.h" + +/* Evolution types (in folder "datatypes/phylogenetics") */ +#include "RlDistanceMatrix.h" + +/* Character state types (in folder "datatypes/phylogenetics/character") */ +#include "RlAminoAcidState.h" +#include "RlDnaState.h" +#include "RlRnaState.h" +#include "RlStandardState.h" + +/* Character data types (in folder "datatypes/phylogenetics/datamatrix") */ +#include "RlAbstractCharacterData.h" +#include "RlAbstractHomologousDiscreteCharacterData.h" +#include "RlContinuousCharacterData.h" + +/* Tree types (in folder "datatypes/phylogenetics/trees") */ +#include "RlClade.h" +#include "RlRootedTripletDistribution.h" + + +/* Taxon types (in folder "datatypes/phylogenetics") */ +#include "RlTaxon.h" + +/* Inference types (in folder "analysis") */ +#include "RlBootstrapAnalysis.h" +#include "RlBurninEstimationConvergenceAssessment.h" +#include "RlHillClimber.h" +#include "RlMcmc.h" +#include "RlMcmcmc.h" +#include "RlModel.h" +#include "RlPathSampler.h" +#include "RlPosteriorPredictiveAnalysis.h" +#include "RlPosteriorPredictiveSimulation.h" +#include "RlPowerPosteriorAnalysis.h" +#include "RlSteppingStoneSampler.h" +#include "RlValidationAnalysis.h" +#include "RlAncestralStateTrace.h" + +/// Stopping Rules /// +#include "RlMaxIterationStoppingRule.h" +#include "RlMaxTimeStoppingRule.h" +#include "RlMinEssStoppingRule.h" +#include "RlGelmanRubinStoppingRule.h" +#include "RlGewekeStoppingRule.h" +#include "RlStationarityStoppingRule.h" + + +/// Types /// + +/* These types are needed as template types for the moves */ +#include "RlBranchLengthTree.h" +#include "RlCharacterHistoryRateModifier.h" +#include "RlMonitor.h" +#include "RlMove.h" +#include "RlRateGenerator.h" +#include "RlCladogeneticProbabilityMatrix.h" +#include "RlCladogeneticSpeciationRateMatrix.h" +#include "RlTimeTree.h" + + + +/** Initialize global workspace */ +void RevLanguage::Workspace::initializeVectorTypeGlobalWorkspace(void) +{ + + try + { + + AddWorkspaceVectorType::addTypeToWorkspace( *this, new Taxon() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new RateGenerator() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new CladogeneticProbabilityMatrix() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new CladogeneticSpeciationRateMatrix() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new DistanceMatrix() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new MatrixReal() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new MatrixRealPos() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new MatrixRealSymmetric() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new AbstractHomologousDiscreteCharacterData() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new ContinuousCharacterData() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new CharacterHistoryRateModifier() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new TimeTree() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new BranchLengthTree() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new Tree() ); + AddWorkspaceVectorType::addTypeToWorkspace( *this, new Clade() ); + // AddWorkspaceVectorType::addTypeToWorkspace( *this, new Dist_bdp() ); + + } + catch(RbException& rbException) + { + + RBOUT("Caught an exception while initializing types in the workspace\n"); + std::ostringstream msg; + rbException.print(msg); + msg << std::endl; + RBOUT(msg.str()); + + RBOUT("Please report this bug to the RevBayes Development Core Team"); + + RBOUT("Press any character to exit the program."); + getchar(); + exit(1); + } +} diff --git a/src/revlanguage/workspace/Workspace.cpp b/src/revlanguage/workspace/Workspace.cpp index d8a48f4bb..56d5bd16f 100755 --- a/src/revlanguage/workspace/Workspace.cpp +++ b/src/revlanguage/workspace/Workspace.cpp @@ -259,6 +259,7 @@ void Workspace::initializeGlobalWorkspace( void ) { initializeBasicTypeGlobalWorkspace(); + initializeVectorTypeGlobalWorkspace(); initializeTypeGlobalWorkspace(); initializeMonitorGlobalWorkspace(); initializeMoveGlobalWorkspace(); diff --git a/src/revlanguage/workspace/Workspace.h b/src/revlanguage/workspace/Workspace.h index 10614b411..9319ede00 100755 --- a/src/revlanguage/workspace/Workspace.h +++ b/src/revlanguage/workspace/Workspace.h @@ -100,7 +100,8 @@ namespace RevLanguage { void initializeMonitorGlobalWorkspace(void); //!< Initialize global workspace for monitors void initializeMoveGlobalWorkspace(void); //!< Initialize global workspace for moves void initializeTypeGlobalWorkspace(void); //!< Initialize global workspace for types - + void initializeVectorTypeGlobalWorkspace(void); //!< Initialize global workspace for types + TypeTable typeTable; //!< Type table bool typesInitialized; //!< Are types initialized?