Changeset c9bc2b7 for src


Ignore:
Timestamp:
Feb 3, 2011, 9:51:19 AM (14 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
1d5a871
Parents:
3f9eba
git-author:
Frederik Heber <heber@…> (01/03/11 14:01:22)
git-committer:
Frederik Heber <heber@…> (02/03/11 09:51:19)
Message:

Bigger rewrite of RandomNumbers ... due to cloning of prototypes.

  • in order to copy the prototypes and not use the original instance, we have implemented a new pattern called "Creator" that wraps a templated class in a creation interface class such that this abstract class can instaniate the particular types (see here http://stackoverflow.com/questions/3506026/c-clone-abstract-base-class-without-meddling-with-derived). This is also wrapped up in ..._Creator.hpp files.
  • meanwhile we also tried to have factories for Engine and Distribution but this failed due to boost::variate_operator<> having to know the particular types of engine and distribution. One could go forth with some cast's but this is very unclean and not what we want. ... Downside is that we can't set global options for engines or distributions as of now.
  • For the moment Engine- and DistributionFactory both have a prototype table, i.e. the same wrapped ones as above, but they are not used for the GeneratorFactory.
Location:
src
Files:
18 added
1 deleted
13 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/Actions/RandomNumbersAction/SetRandomNumbersDistributionAction.cpp

    r3f9eba rc9bc2b7  
    4545  CommandSetRandomNumbersDistributionState *state =
    4646      new CommandSetRandomNumbersDistributionState(
    47           RandomNumberGeneratorFactory::getInstance().getDistribution(),
     47          RandomNumberGeneratorFactory::getInstance().getDistributionName(),
    4848          params);
    4949  RandomNumberGeneratorFactory::getInstance().setDistribution(params.distribution_type);
    5050
    5151  DoLog(0) && (Log() << Verbose(0) << "Distribution of random number generator is now: "
    52       << RandomNumberGeneratorFactory::getInstance().getDistribution() << std::endl);
     52      << RandomNumberGeneratorFactory::getInstance().getDistributionName() << std::endl);
    5353
    5454  return Action::state_ptr(state);
     
    6060  CommandSetRandomNumbersDistributionState *newstate =
    6161      new CommandSetRandomNumbersDistributionState(
    62           RandomNumberGeneratorFactory::getInstance().getDistribution(),
     62          RandomNumberGeneratorFactory::getInstance().getDistributionName(),
    6363          state->params);
    6464  RandomNumberGeneratorFactory::getInstance().setDistribution(state->old_distribution_type);
    6565
    6666  DoLog(0) && (Log() << Verbose(0) << "Distribution of random number generator is undone to: "
    67       << RandomNumberGeneratorFactory::getInstance().getDistribution() << std::endl);
     67      << RandomNumberGeneratorFactory::getInstance().getDistributionName() << std::endl);
    6868
    6969  return Action::state_ptr(newstate);
  • src/Actions/RandomNumbersAction/SetRandomNumbersEngineAction.cpp

    r3f9eba rc9bc2b7  
    4545  CommandSetRandomNumbersEngineState *state =
    4646      new CommandSetRandomNumbersEngineState(
    47           RandomNumberGeneratorFactory::getInstance().getEngine(),
     47          RandomNumberGeneratorFactory::getInstance().getEngineName(),
    4848          params);
    4949  RandomNumberGeneratorFactory::getInstance().setEngine(params.engine_type);
    5050
    5151  DoLog(0) && (Log() << Verbose(0) << "Engine of random number generator is now: "
    52       << RandomNumberGeneratorFactory::getInstance().getEngine() << std::endl);
     52      << RandomNumberGeneratorFactory::getInstance().getEngineName() << std::endl);
    5353
    5454  return Action::state_ptr(state);
     
    6060  CommandSetRandomNumbersEngineState *newstate =
    6161      new CommandSetRandomNumbersEngineState(
    62           RandomNumberGeneratorFactory::getInstance().getEngine(),
     62          RandomNumberGeneratorFactory::getInstance().getEngineName(),
    6363          state->params);
    6464  RandomNumberGeneratorFactory::getInstance().setEngine(state->old_engine_type);
    6565
    6666  DoLog(0) && (Log() << Verbose(0) << "Engine of random number generator is undone to: "
    67       << RandomNumberGeneratorFactory::getInstance().getEngine() << std::endl);
     67      << RandomNumberGeneratorFactory::getInstance().getEngineName() << std::endl);
    6868
    6969  return Action::state_ptr(newstate);
  • src/Makefile.am

    r3f9eba rc9bc2b7  
    123123
    124124RANDOMSOURCE = \
     125        RandomNumbers/RandomNumberDistributionFactory.cpp \
     126        RandomNumbers/RandomNumberEngineFactory.cpp \
    125127        RandomNumbers/RandomNumberGeneratorFactory.cpp
    126128
    127129RANDOMHEADER = \
     130        RandomNumbers/RandomNumberDistribution.hpp \
     131        RandomNumbers/RandomNumberDistribution_Creator.hpp \
     132        RandomNumbers/RandomNumberDistribution_Encapsulation.hpp \
     133        RandomNumbers/RandomNumberDistributionFactory.hpp \
     134        RandomNumbers/RandomNumberEngine.hpp \
     135        RandomNumbers/RandomNumberEngine_Creator.hpp \
     136        RandomNumbers/RandomNumberEngine_Encapsulation.hpp \
     137        RandomNumbers/RandomNumberEngineFactory.hpp \
    128138        RandomNumbers/RandomNumberGenerator.hpp \
     139        RandomNumbers/RandomNumberGenerator_Creator.hpp \
     140        RandomNumbers/RandomNumberGenerator_Encapsulation.hpp \
     141        RandomNumbers/RandomNumberGeneratorFactory.hpp \
    129142        RandomNumbers/TemplatePowerSetGenerator.hpp \
    130         RandomNumbers/RandomNumberGenerator_Encapsulation.hpp \
    131         RandomNumbers/RandomNumberGeneratorFactory.hpp
     143        RandomNumbers/EmptyPrototypeTable.hpp
    132144 
    133145THERMOSTATSOURCE = \
  • src/RandomNumbers/RandomNumberDistribution_Encapsulation.hpp

    r3f9eba rc9bc2b7  
    1515
    1616#include <typeinfo>
    17 
    18 #include "RandomNumberDistribution.hpp"
    19 #include "RandomNumberGeneratorFactory.hpp"
    2017
    2118#include <boost/nondet_random.hpp>
     
    3835#include <boost/random/uniform_smallint.hpp>
    3936
     37#include "RandomNumberDistribution_Creator.hpp"
     38#include "RandomNumberDistribution.hpp"
     39#include "RandomNumberGeneratorFactory.hpp"
     40
    4041#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
    4142
     
    4849 */
    4950template <class distribution>
    50 class RandomNumberDistribution_Encapsulation : public RandomNumberDistribution
     51class RandomNumberDistribution_Encapsulation : public RandomNumberDistribution, public RandomNumberDistribution_Creator< RandomNumberDistribution_Encapsulation<distribution> >
    5152{
    5253  /**
     
    8384   *
    8485   */
    85   ~RandomNumberDistribution_Encapsulation() {}
     86  virtual ~RandomNumberDistribution_Encapsulation() {}
    8687private:
    8788  distribution distribution_type;
  • src/RandomNumbers/RandomNumberEngineFactory.def

    r3f9eba rc9bc2b7  
    1 #ifndef RANDOMNUMBERGENERATORFACTORY_DEF_
    2 #define RANDOMNUMBERGENERATORFACTORY_DEF_
     1#ifndef RANDOMNUMBERENGINEFACTORY_DEF_
     2#define RANDOMNUMBERENGINEFACTORY_DEF_
    33
    44/** BOOST_PP_SEQ of all random::boost engine types,
     
    4242#define engine_seq_a_size BOOST_PP_SEQ_SIZE(engine_seq_a)
    4343
    44 /** BOOST_PP_SEQ of all random::boost distribution types,
    45  * see see http://www.boost.org/doc/libs/1_45_0/doc/html/boost_random/reference.html#boost_random.reference.concepts
    46  */
    47 #define distribution_seq \
    48 (uniform_smallint)\
    49 (uniform_int)
    50 
    51 /*
    52 (uniform_01)\
    53 (uniform_real)\
    54 (bernoulli_distribution)\
    55 (binomial_distribution)\
    56 (cauchy_distribution)\
    57 (gamma_distribution)\
    58 (poisson_distribution)\
    59 (geometric_distribution)\
    60 (triangle_distribution)\
    61 (exponential_distribution)\
    62 (normal_distribution)\
    63 (lognormal_distribution)\
    64 (uniform_on_sphere)
    65 */
    66 #define distribution_seq_size BOOST_PP_SEQ_SIZE(distribution_seq)
    67 
    68 #endif /* RANDOMNUMBERGENERATORFACTORY_DEF_ */
     44#endif /* RANDOMNUMBERENGINEFACTORY_DEF_ */
  • src/RandomNumbers/RandomNumberEngine_Encapsulation.hpp

    r3f9eba rc9bc2b7  
    1616#include <typeinfo>
    1717
    18 #include "RandomNumberEngine.hpp"
    19 #include "RandomNumberGeneratorFactory.hpp"
    20 
    2118#include <boost/nondet_random.hpp>
    2219#include <boost/random.hpp>
     
    3431#include <boost/random/xor_combine.hpp>
    3532
     33#include "RandomNumberEngine_Creator.hpp"
     34#include "RandomNumberEngine.hpp"
     35
     36#include "RandomNumberGeneratorFactory.hpp"
    3637#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
    3738
     
    4445 */
    4546template <class engine>
    46 class RandomNumberEngine_Encapsulation : public RandomNumberEngine
     47class RandomNumberEngine_Encapsulation : public RandomNumberEngine, public RandomNumberEngine_Creator< RandomNumberEngine_Encapsulation<engine> >
    4748{
    4849  /**
     
    8687   *
    8788   */
    88   ~RandomNumberEngine_Encapsulation() {}
     89  virtual ~RandomNumberEngine_Encapsulation() {}
    8990private:
    9091  engine engine_type;
  • src/RandomNumbers/RandomNumberGeneratorFactory.cpp

    r3f9eba rc9bc2b7  
    2525
    2626#include "TemplatePowerSetGenerator.hpp"
     27#include "EmptyPrototypeTable.hpp"
    2728
    28 #include "RandomNumberEngine_Encapsulation.hpp"
    29 #include "RandomNumberDistribution_Encapsulation.hpp"
     29#include "RandomNumberEngineFactory.hpp"
     30#include "RandomNumberDistributionFactory.hpp"
    3031#include "RandomNumberGenerator_Encapsulation.hpp"
    3132
    3233#include <boost/preprocessor/facilities/empty.hpp>
    3334#include <boost/preprocessor/punctuation/paren.hpp>
     35#include <boost/preprocessor/seq/for_each_product.hpp>
     36#include <boost/preprocessor/facilities/identity.hpp>
     37#include <boost/preprocessor/facilities/expand.hpp>
     38#include <boost/preprocessor/seq/seq.hpp>
     39
    3440
    3541#include "RandomNumberGeneratorFactory.hpp"
    36 #include "RandomNumberGeneratorFactory.def"
     42#include "RandomNumberDistributionFactory.def"
     43#include "RandomNumberEngineFactory.def"
    3744
    38 enum RandomNumberGeneratorFactory::Engine RandomNumberGeneratorFactory::engine = (enum RandomNumberGeneratorFactory::Engine) 0;
    39 enum RandomNumberGeneratorFactory::Distribution RandomNumberGeneratorFactory::distribution = (enum RandomNumberGeneratorFactory::Distribution) 0;
    40 RandomNumberGeneratorFactory::EngineMap RandomNumberGeneratorFactory::engines;
    41 RandomNumberGeneratorFactory::EngineNamesMap RandomNumberGeneratorFactory::engineNames;
    42 RandomNumberGeneratorFactory::DistributionMap RandomNumberGeneratorFactory::distributions;
    43 RandomNumberGeneratorFactory::DistributionNamesMap RandomNumberGeneratorFactory::distributionNames;
    44 RandomNumberGeneratorFactory::EngineTable RandomNumberGeneratorFactory::EnginePrototypeTable;
    45 RandomNumberGeneratorFactory::DistributionTable RandomNumberGeneratorFactory::DistributionPrototypeTable;
     45enum RandomNumberDistributionFactory::Distribution RandomNumberGeneratorFactory::distribution = (enum RandomNumberDistributionFactory::Distribution) 0;
     46enum RandomNumberEngineFactory::Engine RandomNumberGeneratorFactory::engine = (enum RandomNumberEngineFactory::Engine) 0;
    4647RandomNumberGeneratorFactory::EngineDistributionTable RandomNumberGeneratorFactory::GeneratorPrototypeTable;
    47 
    4848
    4949RandomNumberGeneratorFactory::RandomNumberGeneratorFactory()
    5050{
    51   // insert all known engines
    52 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_string_enum_map(~, n, engine_seq, engines)
    53 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(engine_seq)-1 )
    54 #include BOOST_PP_LOCAL_ITERATE()
    55 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_string_enum_map(~, n, engine_seq_a, engines)
    56 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(engine_seq_a)-1 )
    57 #include BOOST_PP_LOCAL_ITERATE()
    58   for (EngineMap::const_iterator iter = engines.begin();
    59       iter != engines.end();
    60       ++iter) {
    61     engineNames.insert(make_pair(iter->second, iter->first));
    62   }
    63 
    64         // insert all known distributions
    65 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_string_enum_map(~, n, distribution_seq, distributions)
    66 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(distribution_seq)-1 )
    67 #include BOOST_PP_LOCAL_ITERATE()
    68   for (DistributionMap::const_iterator iter = distributions.begin();
    69       iter != distributions.end();
    70       ++iter) {
    71     distributionNames.insert(make_pair(iter->second, iter->first));
    72   }
    73 
    74         FillPrototypeTables();
     51        FillPrototypeTable();
    7552}
    76 
    77 /** Removes all pointers to instances from a table while free'ing memory.
    78  *
    79  * I.e. we assume class T to be a map of some key with its values pointers to
    80  * some classes that have to be free'd.
    81  *
    82  * \param _PrototypeTable table to empty
    83  */
    84 template <class T>
    85 void EmptyPrototypeTable(T &_PrototypeTable)
    86 {
    87   for (typename T::iterator iter = _PrototypeTable.begin();
    88       !_PrototypeTable.empty();
    89       iter = _PrototypeTable.begin()) {
    90     delete (iter->second);
    91     _PrototypeTable.erase(iter);
    92   }
    93   _PrototypeTable.clear();
    94 }
    95 
    96 
    9753
    9854RandomNumberGeneratorFactory::~RandomNumberGeneratorFactory()
     
    10056  // clear out factories map to allow boost::shared_ptr to do their work (i.e. to release mem)
    10157  // this is necessary as factories is a object
    102   engines.clear();
    103   engineNames.clear();
    104   EmptyPrototypeTable<EngineTable> (EnginePrototypeTable);
    105   distributions.clear();
    106   distributionNames.clear();
    107   EmptyPrototypeTable<DistributionTable> (DistributionPrototypeTable);
    10858  for (EngineDistributionTable::iterator iter = GeneratorPrototypeTable.begin();
    10959      !GeneratorPrototypeTable.empty();
    11060      iter = GeneratorPrototypeTable.begin()) {
    111     EmptyPrototypeTable< std::map<enum Distribution,RandomNumberGenerator *> > (iter->second);
     61    EmptyPrototypeTable< std::map<enum RandomNumberDistributionFactory::Distribution,IRandomNumberGenerator_Creator *> > (iter->second);
    11262    GeneratorPrototypeTable.erase(iter);
    11363  }
     
    11565}
    11666
    117 void RandomNumberGeneratorFactory::FillPrototypeTables()
     67void RandomNumberGeneratorFactory::FillPrototypeTable()
    11868{
    119   // fill EnginePrototypeTable
    120 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_map(~, n, engine_seq, EnginePrototypeTable, new RandomNumberEngine_Encapsulation, boost::, )
    121 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(engine_seq)-1 )
    122 #include BOOST_PP_LOCAL_ITERATE()
    123 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_map(~, n, engine_seq_a, EnginePrototypeTable, new RandomNumberEngine_Encapsulation, boost::, )
    124 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(engine_seq_a)-1 )
    125 #include BOOST_PP_LOCAL_ITERATE()
     69  // fill GeneratorPrototypeTable
     70#define SequenceElementizer(z,data) (data)
    12671
    127   // fill DistributionPrototypeTable
    128 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_map(~, n, distribution_seq, DistributionPrototypeTable, new RandomNumberDistribution_Encapsulation, boost::, <>)
    129 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(distribution_seq)-1 )
    130 #include BOOST_PP_LOCAL_ITERATE()
     72#define distributionengine_seqseq \
     73  BOOST_PP_SEQ_FOR_EACH_PRODUCT(SequenceElementizer, (engine_seq)(distribution_seq))
     74#define distributionengine_seqseq_a \
     75  BOOST_PP_SEQ_FOR_EACH_PRODUCT(SequenceElementizer, (engine_seq_a)(distribution_seq))
    13176
    132   // fill GeneratorPrototypeTable
    133 #define DoubleElementSequenceElementizer(z,data,elem) ((data)(elem))
     77#define suffixseq ()(<> > )
     78#define tableseq (*EnginePrototypeTable)(*DistributionPrototypeTable)
     79#define name_spaces_seq (RandomNumberEngineFactory::)(RandomNumberDistributionFactory::)
    13480
    135 #define seqseqiterate(z,n,seq) BOOST_PP_SEQ_FOR_EACH(DoubleElementSequenceElementizer, BOOST_PP_SEQ_ELEM(n,seq), distribution_seq)
    136 
    137 #define distributionengine_seqseq BOOST_PP_REPEAT( \
    138   BOOST_PP_SEQ_SIZE(engine_seq), seqseqiterate, engine_seq )
    139 
    140 #define distributionengine_seqseq_a BOOST_PP_REPEAT( \
    141   BOOST_PP_SEQ_SIZE(engine_seq_a), seqseqiterate, engine_seq_a )
    142 
    143 #define suffixseq ()(<>)
    144 #define tableseq (*EnginePrototypeTable)(*DistributionPrototypeTable)
     81#define size_tupels BOOST_PP_SEQ_SIZE(tableseq)
    14582
    14683#define TableItemPrinter(z,n,sequence) \
     84  [ \
     85  BOOST_PP_SEQ_ELEM(n,name_spaces_seq) \
     86  BOOST_PP_SEQ_ELEM(n,sequence) \
     87  ]
     88
     89#define TemplateItemPrinter(z,n,sequence) \
    14790  BOOST_PP_COMMA_IF(n) \
    14891  boost:: \
     
    15093  BOOST_PP_SEQ_ELEM(n,suffixseq)
    15194
    152 #define ParamItemPrinter(z,n,sequence) \
    153   BOOST_PP_COMMA_IF(n) \
    154   BOOST_PP_SEQ_ELEM(n,tableseq) \
    155   [ \
    156   BOOST_PP_SEQ_ELEM(n,sequence) \
    157   ]
     95#define ParamItemPrinter(z,n,sequence)
    15896
    159 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, distributionengine_seqseq, GeneratorPrototypeTable, new RandomNumberGenerator_Encapsulation, TableItemPrinter, ParamItemPrinter)
     97#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, size_tupels, distributionengine_seqseq, GeneratorPrototypeTable, TableItemPrinter, new RandomNumberGenerator_Creator< RandomNumberGenerator_Encapsulation , TemplateItemPrinter, ParamItemPrinter)
    16098#define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(distributionengine_seqseq)-1 )
    16199#include BOOST_PP_LOCAL_ITERATE()
    162100
    163 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, distributionengine_seqseq_a, GeneratorPrototypeTable, new RandomNumberGenerator_Encapsulation, TableItemPrinter, ParamItemPrinter)
     101#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(~, n, size_tupels, distributionengine_seqseq_a, GeneratorPrototypeTable, TableItemPrinter, new RandomNumberGenerator_Creator< RandomNumberGenerator_Encapsulation , TemplateItemPrinter, ParamItemPrinter)
    164102#define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(distributionengine_seqseq_a)-1 )
    165103#include BOOST_PP_LOCAL_ITERATE()
    166104}
    167105
    168 RandomNumberGenerator& RandomNumberGeneratorFactory::makeRandomNumberGenerator() const
     106RandomNumberGenerator* RandomNumberGeneratorFactory::makeRandomNumberGenerator() const
    169107{
    170108  // Instantiate and return (implicitly creates a copy of the stored prototype)
    171   return *GeneratorPrototypeTable[engine][distribution];
     109  return (GeneratorPrototypeTable[engine][distribution]->create());
    172110}
    173111
    174 RandomNumberGenerator& RandomNumberGeneratorFactory::makeRandomNumberGenerator(std::string engine_type, std::string distribution_type) const
     112RandomNumberGenerator* RandomNumberGeneratorFactory::makeRandomNumberGenerator(
     113    std::string engine_type,
     114    std::string distribution_type
     115    ) const
    175116{
    176   enum Engine eng_type;
    177   enum Distribution dis_type;
     117  enum RandomNumberEngineFactory::Engine eng_type;
     118  enum RandomNumberDistributionFactory::Distribution dis_type;
    178119
    179120  // Instantiate and return (implicitly creates a copy of the stored prototype)
    180121  if (!engine_type.empty()) {
    181     ASSERT(engines.count(engine_type) != 0,
    182       "RandomNumberGeneratorFactory::makeRandomNumberGenerator() - Selected engine "+engine_type+"is not registered.");
    183     eng_type = engines[engine_type];
     122    eng_type = RandomNumberEngineFactory::getInstance().getEnum(engine_type);
    184123  } else
    185124    eng_type = engine;
    186125  if (!distribution_type.empty()) {
    187     ASSERT(distributions.count(distribution_type) != 0,
    188         "RandomNumberGeneratorFactory::makeRandomNumberGenerator() - Selected distribution "+distribution_type+"is not registered.");
    189     dis_type = distributions[distribution_type];
     126    dis_type = RandomNumberDistributionFactory::getInstance().getEnum(distribution_type);
    190127  } else
    191128    dis_type = distribution;
    192   return *GeneratorPrototypeTable[ eng_type ][ dis_type ];
     129  return (GeneratorPrototypeTable[ eng_type ][ dis_type ]->create());
    193130}
    194131
    195132void RandomNumberGeneratorFactory::setEngine(std::string engine_type)
    196133{
    197   ASSERT(engines.count(engine_type) != 0,"Selected engine "+engine_type+"is not registered.");
    198   engine = engines[engine_type];
     134  engine = RandomNumberEngineFactory::getInstance().getEnum(engine_type);
    199135}
    200136
    201 const std::string &RandomNumberGeneratorFactory::getEngine() const
     137const std::string &RandomNumberGeneratorFactory::getEngineName() const
    202138{
    203   return engineNames[engine];
     139  return RandomNumberEngineFactory::getInstance().getName(engine);
    204140}
    205141
    206142void RandomNumberGeneratorFactory::setDistribution(std::string distribution_type)
    207143{
    208   ASSERT(distributions.count(distribution_type) != 0 ,"Selected distribution "+distribution_type+"is not registered.");
    209   distribution = distributions[distribution_type];
     144  distribution = RandomNumberDistributionFactory::getInstance().getEnum(distribution_type);
    210145}
    211146
    212 const std::string &RandomNumberGeneratorFactory::getDistribution() const
     147const std::string &RandomNumberGeneratorFactory::getDistributionName() const
    213148{
    214   return distributionNames[distribution];
     149  return RandomNumberDistributionFactory::getInstance().getName(distribution);
    215150}
    216151
    217152CONSTRUCT_SINGLETON(RandomNumberGeneratorFactory)
    218153
    219 #include "RandomNumberGeneratorFactory.undef"
     154#include "RandomNumberDistributionFactory.undef"
     155#include "RandomNumberEngineFactory.undef"
    220156
  • src/RandomNumbers/RandomNumberGeneratorFactory.hpp

    r3f9eba rc9bc2b7  
    1616#include "CodePatterns/Singleton.hpp"
    1717
    18 #include "RandomNumberDistribution.hpp"
    19 #include "RandomNumberEngine.hpp"
    20 #include "RandomNumberGenerator.hpp"
     18#include "RandomNumberDistributionFactory.hpp"
     19#include "RandomNumberEngineFactory.hpp"
    2120
    2221#include <map>
    2322
    24 #include "TemplatePowerSetGenerator.hpp"
    25 #include "RandomNumberGeneratorFactory.def"
     23#include "RandomNumberGenerator_Creator.hpp"
    2624
    2725#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
     26
     27class RandomNumberGenerator;
    2828
    2929/** This is the abstract factory class for random number generators.
     
    4040  friend class Singleton<RandomNumberGeneratorFactory>;
    4141  friend class RandomNumberGeneratorFactoryTest;
     42
    4243public:
    4344
     
    4748
    4849public:
    49   /** Enumeration of all (pseudo-)random number engines implemented in
    50    *  boost::random, see
    51    *  http://www.boost.org/doc/libs/1_45_0/doc/html/boost_random/reference.html#boost_random.reference.concepts
    52    */
    53   enum Engine {
    54 BOOST_PP_REPEAT( engine_seq_size, seqitems_as_enum, engine_seq)
    55 ,
    56 BOOST_PP_REPEAT( engine_seq_a_size, seqitems_as_enum, engine_seq_a)
    57   };
    58 
    59   /** Enumeration of all distribution implemented in random::boost.
    60    */
    61   enum Distribution {
    62 BOOST_PP_REPEAT( distribution_seq_size, seqitems_as_enum, distribution_seq)
    63   };
    64 
    6550  /** Create a Generator of previously set type.
    6651   *
    6752   * \return random number generator instance
    6853   */
    69   RandomNumberGenerator& makeRandomNumberGenerator() const;
     54  RandomNumberGenerator* makeRandomNumberGenerator() const;
    7055
    7156  /** Create a Generator of desired combination of engine and distribution.
     
    7560   *
    7661   * \param engine_type name of engine, give empty string for current default
    77    * \param distribution_type name of distribution, give empty string for current default
     62   * \param distribution_type name of distribution, give empty string for
     63   *        current default
    7864   * \return random number generator instance
    7965   */
    80   RandomNumberGenerator& makeRandomNumberGenerator(std::string engine_type, std::string distribution_type) const;
     66  RandomNumberGenerator* makeRandomNumberGenerator(std::string engine_type, std::string distribution_type) const;
    8167
    8268  /** Specify the precise type of the engine to build
     
    8672  void setEngine(std::string engine_type);
    8773
    88   /** Getter for current type of engine.
     74  /** Getter for the name of the current type of engine.
    8975   *
    9076   * @return name of engine
    9177   */
    92   const std::string &getEngine() const;
     78  const std::string &getEngineName() const;
    9379
    9480  /** Specify the precise type of the distribution to build
     
    9884  void setDistribution(std::string distribution_type);
    9985
    100   /** Getter for current type of distribution.
     86  /** Getter for the name of the current type of distribution.
    10187   *
    10288   * @return name of distribution
    10389   */
    104   const std::string &getDistribution() const;
     90  const std::string &getDistributionName() const;
    10591
    10692protected:
     
    10995   *  and stores them in \a PrototypeTable.
    11096   */
    111   void FillPrototypeTables();
     97  void FillPrototypeTable();
    11298
    11399  typedef std::map<
    114       std::string,
    115       enum Engine
    116       > EngineMap;
    117   typedef std::map<
    118       enum Engine,
    119       RandomNumberEngine *
    120       > EngineTable;
    121   typedef std::map<
    122       enum Engine,
    123       std::string
    124         > EngineNamesMap;
    125 
    126   typedef std::map<
    127       std::string,
    128       enum Distribution
    129       > DistributionMap;
    130   typedef std::map<
    131       enum Distribution,
    132       RandomNumberDistribution *
    133       > DistributionTable;
    134   typedef std::map<
    135       enum Distribution,
    136       std::string
    137       > DistributionNamesMap;
    138 
    139   typedef std::map<
    140       enum Engine,
     100      enum RandomNumberEngineFactory::Engine,
    141101      std::map<
    142         enum Distribution,
    143         RandomNumberGenerator *>
     102        enum RandomNumberDistributionFactory::Distribution,
     103        IRandomNumberGenerator_Creator *>
    144104  > EngineDistributionTable;
    145105
    146   static enum Engine engine;
    147   static enum Distribution distribution;
    148   static EngineMap engines;
    149   static EngineTable EnginePrototypeTable;
    150   static EngineNamesMap engineNames;
    151   static DistributionMap distributions;
    152   static DistributionTable DistributionPrototypeTable;
    153   static DistributionNamesMap distributionNames;
     106  static enum RandomNumberDistributionFactory::Distribution distribution;
     107  static enum RandomNumberEngineFactory::Engine engine;
    154108  static EngineDistributionTable GeneratorPrototypeTable;
    155109};
    156110
    157 #include "RandomNumberGeneratorFactory.undef"
    158 
    159111#endif /* RANDOMNUMBERGENERATORFACTORY_HPP_ */
  • src/RandomNumbers/RandomNumberGenerator_Encapsulation.hpp

    r3f9eba rc9bc2b7  
    1414#endif
    1515
    16 #include "RandomNumberDistribution.hpp"
    17 #include "RandomNumberEngine.hpp"
     16#include <boost/nondet_random.hpp>
     17#include <boost/random.hpp>
     18#include <boost/random/bernoulli_distribution.hpp>
     19#include <boost/random/binomial_distribution.hpp>
     20#include <boost/random/cauchy_distribution.hpp>
     21#include <boost/random/exponential_distribution.hpp>
     22#include <boost/random/gamma_distribution.hpp>
     23#include <boost/random/geometric_distribution.hpp>
     24#include <boost/random/linear_congruential.hpp>
     25#include <boost/random/lognormal_distribution.hpp>
     26#include <boost/random/normal_distribution.hpp>
     27#include <boost/random/poisson_distribution.hpp>
     28#include <boost/random/triangle_distribution.hpp>
     29#include <boost/random/uniform_01.hpp>
     30#include <boost/random/uniform_int.hpp>
     31#include <boost/random/uniform_on_sphere.hpp>
     32#include <boost/random/uniform_real.hpp>
     33#include <boost/random/uniform_smallint.hpp>
     34#include <boost/random/additive_combine.hpp>
     35#include <boost/random/discard_block.hpp>
     36#include <boost/random/inversive_congruential.hpp>
     37#include <boost/random/lagged_fibonacci.hpp>
     38#include <boost/random/linear_congruential.hpp>
     39#include <boost/random/linear_feedback_shift.hpp>
     40#include <boost/random/mersenne_twister.hpp>
     41#include <boost/random/random_number_generator.hpp>
     42#include <boost/random/ranlux.hpp>
     43#include <boost/random/shuffle_output.hpp>
     44#include <boost/random/subtract_with_carry.hpp>
     45#include <boost/random/xor_combine.hpp>
     46#include <boost/random/variate_generator.hpp>
     47
     48#include <typeinfo>
     49
     50#include "RandomNumberGenerator_Creator.hpp"
    1851#include "RandomNumberGenerator.hpp"
     52
    1953#include "RandomNumberGeneratorFactory.hpp"
    20 
    2154#include "unittests/RandomNumberGeneratorFactoryUnitTest.hpp"
    2255
     
    3669 */
    3770template <class engine, class distribution>
    38 class RandomNumberGenerator_Encapsulation : public RandomNumberGenerator
     71class RandomNumberGenerator_Encapsulation : public RandomNumberGenerator, public RandomNumberGenerator_Creator< RandomNumberGenerator_Encapsulation<engine, distribution> >
    3972{
    4073  /**
     
    4376  friend class RandomNumberGeneratorFactory;
    4477  friend class RandomNumberGeneratorFactoryTest;
     78
     79  friend class RandomNumberGenerator_Creator< RandomNumberGenerator_Encapsulation<engine, distribution> >;
    4580
    4681public:
     
    6499   */
    65100  std::string EngineName() {
    66     return engine_type.name();
     101    return typeid(engine_type).name();
    67102  }
    68103
     
    71106   */
    72107  std::string DistributionName() {
    73     return distribution_type.name();
     108    return typeid(distribution_type).name();
    74109  }
    75110
     111protected:
    76112  /** Constructor that instantiates a specific random number generator and
    77113   * distribution.
     
    79115   * @param _distribution_type instance of the desired distribution
    80116   */
    81   RandomNumberGenerator_Encapsulation(
    82       RandomNumberEngine &_engine_type,
    83       RandomNumberDistribution &_distribution_type
    84       ) :
    85     engine_type(static_cast<RandomNumberEngine_Encapsulation<engine> &>(_engine_type)),
    86     distribution_type(static_cast<RandomNumberDistribution_Encapsulation<distribution> &>(_distribution_type)),
    87     randomgenerator(boost::variate_generator<engine, distribution> (
    88         engine_type.getEngine(),
    89         distribution_type.getDistribution()
    90         ))
     117  RandomNumberGenerator_Encapsulation() :
     118    randomgenerator(
     119        boost::variate_generator<engine, distribution> (
     120            engine_type,
     121            distribution_type)
     122        )
    91123  {
    92124    // note that we instantiate the variate_generator with the copied instances!
     
    96128   *
    97129   */
    98   ~RandomNumberGenerator_Encapsulation() {}
     130  virtual ~RandomNumberGenerator_Encapsulation() {}
    99131private:
    100   RandomNumberEngine_Encapsulation<engine> engine_type;
    101   RandomNumberDistribution_Encapsulation<distribution> distribution_type;
     132  engine engine_type;
     133  distribution distribution_type;
    102134  mutable boost::variate_generator<engine, distribution> randomgenerator;
    103135};
  • src/RandomNumbers/TemplatePowerSetGenerator.hpp

    r3f9eba rc9bc2b7  
    2525#include <boost/preprocessor/seq/enum.hpp>
    2626#include <boost/preprocessor/seq/for_each.hpp>
     27#include <boost/preprocessor/seq/for_each_i.hpp>
    2728#include <boost/preprocessor/stringize.hpp>
    2829#include <boost/preprocessor/tuple/elem.hpp>
     
    3637 * [test]
    3738 */
    38 #define SquareBracketize(r, data, elem)  \
     39#define SquareBracketize(r, data, i, elem)  \
    3940[ \
     41BOOST_PP_SEQ_ELEM(i, data) \
    4042elem \
    4143]
     
    142144 * then we use
    143145 * #define tableprinter(z,n,seq) BOOST_PP_SEQ_ELEM(n,seq)
    144  * #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(seqsize, n, seqseq, MultiMap, test::, tableprinter)
     146 * #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_multidimmap(seqsize, n, seqseq, bla::, MultiMap, test::testfunction, test_printer, tableprinter)
    145147 * #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(seqseq)-1 )
    146148 * #include BOOST_PP_LOCAL_ITERATE()
     
    152154
    153155 */
    154 #define seqitems_as_enum_key_multidimmap(z,n,seq_of_tupels, map, template_function, template_arg_printer, param_arg_printer) \
     156#define seqitems_as_enum_key_multidimmap(z,n, size_tupels, seq_of_tupels, map, tableitems_arg_printer, template_function, template_arg_printer, param_arg_printer) \
    155157  map \
    156   BOOST_PP_SEQ_FOR_EACH(SquareBracketize, ~, BOOST_PP_SEQ_ELEM(n, seq_of_tupels)) \
     158  BOOST_PP_REPEAT (size_tupels, tableitems_arg_printer,  BOOST_PP_SEQ_ELEM(n, seq_of_tupels) ) \
    157159  = template_function \
    158   < BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(tableseq), template_arg_printer,  BOOST_PP_SEQ_ELEM(n, seq_of_tupels) ) > (\
    159   BOOST_PP_REPEAT(BOOST_PP_SEQ_SIZE(tableseq), param_arg_printer,  BOOST_PP_SEQ_ELEM(n, seq_of_tupels) ) );
     160  < BOOST_PP_REPEAT(size_tupels, template_arg_printer,  BOOST_PP_SEQ_ELEM(n, seq_of_tupels) ) > (\
     161  BOOST_PP_REPEAT(size_tupels, param_arg_printer,  BOOST_PP_SEQ_ELEM(n, seq_of_tupels) ) );
    160162
    161163
  • src/RandomNumbers/unittests/Makefile.am

    r3f9eba rc9bc2b7  
    88
    99TESTS = \
    10   RandomNumberGeneratorFactoryUnitTest
     10  RandomNumberDistributionFactoryUnitTest \
     11  RandomNumberEngineFactoryUnitTest \
     12  RandomNumberGeneratorFactoryUnitTest \
     13  RandomNumberGeneratorUnitTest
    1114
    1215
     
    3134PARSERLIBS = ../../Parser/libMolecuilderParser.la
    3235
     36RandomNumberDistributionFactoryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     37        RandomNumberDistributionFactoryUnitTest.cpp \
     38        RandomNumberDistributionFactoryUnitTest.hpp \
     39        $(srcdir)/../RandomNumberDistributionFactory.cpp \
     40        $(srcdir)/../RandomNumberDistributionFactory.hpp
     41RandomNumberDistributionFactoryUnitTest_LDADD = ${GSLLIBS}
     42
     43RandomNumberEngineFactoryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     44        RandomNumberEngineFactoryUnitTest.cpp \
     45        RandomNumberEngineFactoryUnitTest.hpp \
     46        $(srcdir)/../RandomNumberEngineFactory.cpp \
     47        $(srcdir)/../RandomNumberEngineFactory.hpp
     48RandomNumberEngineFactoryUnitTest_LDADD = ${GSLLIBS}
     49
    3350RandomNumberGeneratorFactoryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    3451        RandomNumberGeneratorFactoryUnitTest.cpp \
    3552        RandomNumberGeneratorFactoryUnitTest.hpp \
     53        $(srcdir)/../RandomNumberDistributionFactory.cpp \
     54        $(srcdir)/../RandomNumberDistributionFactory.hpp \
     55        $(srcdir)/../RandomNumberEngineFactory.cpp \
     56        $(srcdir)/../RandomNumberEngineFactory.hpp \
    3657        $(srcdir)/../RandomNumberGeneratorFactory.cpp \
    3758        $(srcdir)/../RandomNumberGeneratorFactory.hpp
    3859RandomNumberGeneratorFactoryUnitTest_LDADD = ${GSLLIBS}
    3960
     61RandomNumberGeneratorUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     62        RandomNumberGeneratorUnitTest.cpp \
     63        RandomNumberGeneratorUnitTest.hpp \
     64        $(srcdir)/../RandomNumberDistributionFactory.cpp \
     65        $(srcdir)/../RandomNumberDistributionFactory.hpp \
     66        $(srcdir)/../RandomNumberEngineFactory.cpp \
     67        $(srcdir)/../RandomNumberEngineFactory.hpp \
     68        $(srcdir)/../RandomNumberGeneratorFactory.cpp \
     69        $(srcdir)/../RandomNumberGeneratorFactory.hpp
     70RandomNumberGeneratorUnitTest_LDADD = ${GSLLIBS}
     71
    4072
    4173#AUTOMAKE_OPTIONS = parallel-tests
  • src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.cpp

    r3f9eba rc9bc2b7  
    99 * RandomNumberGeneratorFactoryUnitTest.cpp
    1010 *
    11  *  Created on: Dec 31, 2010
     11 *  Created on: Jan 03, 2011
    1212 *      Author: heber
    1313 */
     
    2626#include "RandomNumberGeneratorFactoryUnitTest.hpp"
    2727
    28 #include "RandomNumbers/RandomNumberDistribution_Encapsulation.hpp"
    29 #include "RandomNumbers/RandomNumberEngine_Encapsulation.hpp"
    30 #include "RandomNumbers/RandomNumberGenerator_Encapsulation.hpp"
     28#include "RandomNumbers/RandomNumberGenerator.hpp"
     29#include "RandomNumbers/RandomNumberEngineFactory.hpp"
     30#include "RandomNumbers/RandomNumberDistributionFactory.hpp"
    3131#include "RandomNumbers/RandomNumberGeneratorFactory.hpp"
    3232
     
    8080void RandomNumberGeneratorFactoryTest::tearDown()
    8181{
     82  RandomNumberDistributionFactory::purgeInstance();
     83  RandomNumberEngineFactory::purgeInstance();
    8284  RandomNumberGeneratorFactory::purgeInstance();
    83 }
    84 
    85 void RandomNumberGeneratorFactoryTest::EngineTest()
    86 {
    87   // check default value
    88   CPPUNIT_ASSERT_EQUAL(
    89       std::string("minstd_rand0"),
    90       RandomNumberGeneratorFactory::getInstance().getEngine());
    91 
    92   // check one of the engines in the table
    93   CPPUNIT_ASSERT_EQUAL(
    94       std::string(typeid(boost::minstd_rand0).name()),
    95       RandomNumberGeneratorFactory::getInstance().
    96             EnginePrototypeTable[RandomNumberGeneratorFactory::minstd_rand0]->name()
    97   );
    98 }
    99 
    100 void RandomNumberGeneratorFactoryTest::DistributionTest()
    101 {
    102   // check default value
    103   CPPUNIT_ASSERT_EQUAL(
    104       std::string("uniform_smallint"),
    105       RandomNumberGeneratorFactory::getInstance().getDistribution());
    106 
    107   // check one of the distributions in the table
    108   CPPUNIT_ASSERT_EQUAL(
    109       std::string(typeid(boost::uniform_smallint<> ).name()),
    110       RandomNumberGeneratorFactory::getInstance().
    111             DistributionPrototypeTable[RandomNumberGeneratorFactory::uniform_smallint]->name()
    112   );
    11385}
    11486
    11587void RandomNumberGeneratorFactoryTest::GeneratorTest()
    11688{
     89  RandomNumberGenerator *rng = NULL;
    11790  // check one of the engines and distributions
     91  rng = RandomNumberGeneratorFactory::getInstance().
     92      GeneratorPrototypeTable[RandomNumberEngineFactory::minstd_rand0]
     93                              [RandomNumberDistributionFactory::uniform_smallint]->create();
    11894  CPPUNIT_ASSERT_EQUAL(
    11995      std::string(typeid(boost::minstd_rand0).name()),
    120       RandomNumberGeneratorFactory::getInstance().
    121             GeneratorPrototypeTable[RandomNumberGeneratorFactory::minstd_rand0][RandomNumberGeneratorFactory::uniform_smallint]
    122                                                                                 ->EngineName()
     96      rng->EngineName()
    12397  );
    12498  CPPUNIT_ASSERT_EQUAL(
    12599      std::string(typeid(boost::uniform_smallint<> ).name()),
    126       RandomNumberGeneratorFactory::getInstance().
    127             GeneratorPrototypeTable[RandomNumberGeneratorFactory::minstd_rand0][RandomNumberGeneratorFactory::uniform_smallint]
    128                                                                                 ->DistributionName()
     100      rng->DistributionName()
    129101  );
     102  delete rng;
    130103
    131   // obtain some random values for uniform_smallint
    132   RandomNumberGeneratorFactory::getInstance().setDistribution("uniform_smallint");
    133   RandomNumberGenerator &rng = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator();
    134   for (size_t i=0; i < 1000; ++i) {
    135     const int testint = rng();
    136     CPPUNIT_ASSERT_MESSAGE("randon number from uniform_smallint is out of [0:9]!", testint >= 0);
    137     CPPUNIT_ASSERT_MESSAGE("randon number from uniform_smallint is out of [0:9]!", testint <= 9);
    138   }
    139104}
    140105
  • src/RandomNumbers/unittests/RandomNumberGeneratorFactoryUnitTest.hpp

    r3f9eba rc9bc2b7  
    22 * RandomNumberGeneratorFactoryUnitTest.hpp
    33 *
    4  *  Created on: Dec 31, 2010
     4 *  Created on: Jan 03, 2011
    55 *      Author: heber
    66 */
     
    2020{
    2121  CPPUNIT_TEST_SUITE( RandomNumberGeneratorFactoryTest );
    22   CPPUNIT_TEST ( EngineTest );
    23   CPPUNIT_TEST ( DistributionTest );
    2422  CPPUNIT_TEST ( GeneratorTest );
    2523  CPPUNIT_TEST_SUITE_END();
     
    2927  void tearDown();
    3028
    31   void EngineTest();
    32   void DistributionTest();
    3329  void GeneratorTest();
    3430
  • src/builder_init.cpp

    r3f9eba rc9bc2b7  
    169169void cleanUp()
    170170{
     171  RandomNumberDistributionFactory::purgeInstance();
     172  RandomNumberEngineFactory::purgeInstance();
    171173  RandomNumberGeneratorFactory::purgeInstance();
    172174  FormatParserStorage::purgeInstance();
Note: See TracChangeset for help on using the changeset viewer.