Changeset 26987
- Timestamp:
- 05/04/22 13:46:00 (3 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/shared/Random/randomgenerator.cpp
r26656 r26987 18 18 19 19 pseed = new unsigned int; 20 20 *pseed = std::chrono::steady_clock::now().time_since_epoch()/std::chrono::milliseconds(1); 21 21 a = 1103515245; // BSD Formula 22 22 c = 12345; // BSD Formula … … 24 24 return; 25 25 }/*}}}*/ 26 27 26 linear_congruential_engine::linear_congruential_engine(unsigned int _a, unsigned int _b, unsigned int _m){/*{{{*/ 28 27 29 28 pseed = new unsigned int; 30 29 *pseed = std::chrono::steady_clock::now().time_since_epoch()/std::chrono::milliseconds(1); 31 30 a = _a; 32 31 c = _b; … … 34 33 return; 35 34 }/*}}}*/ 36 37 35 linear_congruential_engine::~linear_congruential_engine(){} 38 36 -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_sampling.cpp
r26747 r26987 13 13 void GaussianVector(Vector<IssmDouble>* ppf,int seed){/*{{{*/ 14 14 15 16 /*Intermediaries*/17 double rdnumber;18 19 15 /*Define seed*/ 20 16 rnd::linear_congruential_engine random_engine; 21 if(seed>=0) 22 { 17 if(seed>=0){ 23 18 int my_rank; 24 19 ISSM_MPI_Comm_rank(ISSM_MPI_COMM_WORLD,&my_rank); … … 28 23 29 24 /* Define univariate distribution */ 30 31 25 rnd::normal_distribution distribution(0.0,1.0); 32 26 … … 38 32 ppf->GetLocalSize(&M); 39 33 for(int i=0;i<M;i++){ 40 rdnumber = distribution.generator(random_engine);34 double rdnumber = distribution.generator(random_engine); 41 35 ppf->SetValue(local_indices[i],rdnumber,INS_VAL); 42 36 } 43 37 ppf->Assemble(); 44 38 39 /*Cleanup*/ 40 random_engine.free_resources(); 41 xDelete<int>(local_indices); 42 xDelete<IssmDouble>(local_vector); 45 43 }/*}}}*/ 46 44 void solutionsequence_sampling(FemModel* femmodel){
Note:
See TracChangeset
for help on using the changeset viewer.