Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
Breaking up type registration for windows compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
hoehna committed Aug 2, 2018
1 parent 01979ab commit c2f106d
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 18 deletions.
17 changes: 0 additions & 17 deletions src/revlanguage/workspace/RbRegister_Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,6 @@ void RevLanguage::Workspace::initializeTypeGlobalWorkspace(void)
try
{

AddWorkspaceVectorType<Taxon,4>::addTypeToWorkspace( *this, new Taxon() );
AddWorkspaceVectorType<RateGenerator,3>::addTypeToWorkspace( *this, new RateGenerator() );
AddWorkspaceVectorType<CladogeneticProbabilityMatrix,3>::addTypeToWorkspace( *this, new CladogeneticProbabilityMatrix() );
AddWorkspaceVectorType<CladogeneticSpeciationRateMatrix,3>::addTypeToWorkspace( *this, new CladogeneticSpeciationRateMatrix() );
AddWorkspaceVectorType<DistanceMatrix,3>::addTypeToWorkspace( *this, new DistanceMatrix() );
AddWorkspaceVectorType<MatrixReal,3>::addTypeToWorkspace( *this, new MatrixReal() );
AddWorkspaceVectorType<MatrixRealPos,3>::addTypeToWorkspace( *this, new MatrixRealPos() );
AddWorkspaceVectorType<MatrixRealSymmetric,3>::addTypeToWorkspace( *this, new MatrixRealSymmetric() );
AddWorkspaceVectorType<AbstractHomologousDiscreteCharacterData,3>::addTypeToWorkspace( *this, new AbstractHomologousDiscreteCharacterData() );
AddWorkspaceVectorType<ContinuousCharacterData,3>::addTypeToWorkspace( *this, new ContinuousCharacterData() );
AddWorkspaceVectorType<CharacterHistoryRateModifier,3>::addTypeToWorkspace( *this, new CharacterHistoryRateModifier() );
AddWorkspaceVectorType<TimeTree,3>::addTypeToWorkspace( *this, new TimeTree() );
AddWorkspaceVectorType<BranchLengthTree,3>::addTypeToWorkspace( *this, new BranchLengthTree() );
AddWorkspaceVectorType<Tree,3>::addTypeToWorkspace( *this, new Tree() );
AddWorkspaceVectorType<Clade,3>::addTypeToWorkspace( *this, new Clade() );
// AddWorkspaceVectorType<Dist_bdp,3>::addTypeToWorkspace( *this, new Dist_bdp() );

addTypeWithConstructor( new Clade() );
addTypeWithConstructor( new Taxon() );

Expand Down
164 changes: 164 additions & 0 deletions src/revlanguage/workspace/RbRegister_VectorType.cpp
Original file line number Diff line number Diff line change
@@ -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 <sstream>
#include <vector>
#include <set>
#include <cstdlib>

/* 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<Taxon,4>::addTypeToWorkspace( *this, new Taxon() );
AddWorkspaceVectorType<RateGenerator,3>::addTypeToWorkspace( *this, new RateGenerator() );
AddWorkspaceVectorType<CladogeneticProbabilityMatrix,3>::addTypeToWorkspace( *this, new CladogeneticProbabilityMatrix() );
AddWorkspaceVectorType<CladogeneticSpeciationRateMatrix,3>::addTypeToWorkspace( *this, new CladogeneticSpeciationRateMatrix() );
AddWorkspaceVectorType<DistanceMatrix,3>::addTypeToWorkspace( *this, new DistanceMatrix() );
AddWorkspaceVectorType<MatrixReal,3>::addTypeToWorkspace( *this, new MatrixReal() );
AddWorkspaceVectorType<MatrixRealPos,3>::addTypeToWorkspace( *this, new MatrixRealPos() );
AddWorkspaceVectorType<MatrixRealSymmetric,3>::addTypeToWorkspace( *this, new MatrixRealSymmetric() );
AddWorkspaceVectorType<AbstractHomologousDiscreteCharacterData,3>::addTypeToWorkspace( *this, new AbstractHomologousDiscreteCharacterData() );
AddWorkspaceVectorType<ContinuousCharacterData,3>::addTypeToWorkspace( *this, new ContinuousCharacterData() );
AddWorkspaceVectorType<CharacterHistoryRateModifier,3>::addTypeToWorkspace( *this, new CharacterHistoryRateModifier() );
AddWorkspaceVectorType<TimeTree,3>::addTypeToWorkspace( *this, new TimeTree() );
AddWorkspaceVectorType<BranchLengthTree,3>::addTypeToWorkspace( *this, new BranchLengthTree() );
AddWorkspaceVectorType<Tree,3>::addTypeToWorkspace( *this, new Tree() );
AddWorkspaceVectorType<Clade,3>::addTypeToWorkspace( *this, new Clade() );
// AddWorkspaceVectorType<Dist_bdp,3>::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);
}
}
1 change: 1 addition & 0 deletions src/revlanguage/workspace/Workspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ void Workspace::initializeGlobalWorkspace( void )
{

initializeBasicTypeGlobalWorkspace();
initializeVectorTypeGlobalWorkspace();
initializeTypeGlobalWorkspace();
initializeMonitorGlobalWorkspace();
initializeMoveGlobalWorkspace();
Expand Down
3 changes: 2 additions & 1 deletion src/revlanguage/workspace/Workspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down

0 comments on commit c2f106d

Please sign in to comment.