~ubuntu-branches/ubuntu/wily/freefem++/wily

« back to all changes in this revision

Viewing changes to examples++-load/ffrandom.cpp

  • Committer: Package Import Robot
  • Author(s): Dimitrios Eftaxiopoulos, Dimitrios Eftaxiopoulos, Christophe Trophime
  • Date: 2013-09-12 00:02:58 UTC
  • mfrom: (1.2.1) (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130912000258-aclq2zfa1svt0p3x
Tags: 3.25-1
[ Dimitrios Eftaxiopoulos ]
* Imported Upstream version 3.25 (Closes: #701161 #706714)
* Change installation directory of header-like *.idp files
  from /usr/lib/freefem++ to /usr/include/freefem++, in order
  to fix a lintian warning
* Update patch to examples++-load/Makefile.am in order to enable
  functioning of load *.so and include *.idp commands in *.edp
  scripts
* Delete patches to src/Graphics/sansgraph.cpp and
  src/Graphics/xglrgraph.cpp because they are not needed any more
* Fix lintian warning about missing LDFLAGS
* Override dh_auto_test in debian/rules, such that in case it is 
  used, it completes executing all *.edp example files, regardless
  of aborting on some of them
* Add libmetis-dev to build-deps in d/control
* Remove libparmetis-dev from build deps
* Add --parallel option to dh $@ in debian/rules
* Add hardening compilation flags to mpic++
* Allow testing of compiling and running the example files after build

[ Christophe Trophime ]
* update C. Trophime email
* add support for nlopt, ipopt - simplify debian/rules
* upload CT changes to 3.20
* add patch for configure
* add patch for examples++-mpi
* fix bamg install
* add corrected scripts to build plugins
* add patch for properly build examples++-load
* add lintian overrides for libfreefem++
* add some missing files
* update patches
* update rules
* reorder BuildDepends - comment out unsupported libs

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#include <fstream>
15
15
#include <ctime>
16
16
 
 
17
// FFCS: random() and srandom() do not seem to be available in MinGW
 
18
#ifdef WIN32
 
19
#define random rand
 
20
#define srandom srand
 
21
#endif
 
22
 
17
23
unsigned long good_seed()
18
24
{
19
25
  unsigned long random_seed,  random_seed_a,random_seed_b;
57
63
  OneOperator_0(func  ff): OneOperator(map_type[typeid(R).name()]),f(ff){}
58
64
};
59
65
 
 
66
// FFCS: rand() wants an int on Win32 and Win64, so we need to have a new function "long ffrandom()" to create the OneOperator
 
67
// object which requires longs (and the MinGW compiler (g++ 4.5) refuses to compile if OneOperator and the underlying function do
 
68
// not have the same type). FFCS patched this source with "long ffrandom(){return random();}" but FF now comes with
 
69
// "genrand_int31()".
 
70
 
60
71
#ifdef WIN32
61
72
 
62
73
void init_by_array(unsigned long init_key[], int key_length);
64
75
void init_genrand(unsigned long);
65
76
//  hach for window ... F. HEcht 
66
77
long ffsrandom(long  s) { init_genrand( (unsigned int ) s); return 0;}
67
 
long random() { return genrand_int31();}
 
78
long ffrandom() { return genrand_int31();}
68
79
long ffsrandomdev() { 
69
80
  init_genrand(good_seed());
70
81
  return 0;}
71
82
#else 
72
83
 
73
84
long ffsrandom(long  s) { srandom( (unsigned int ) s); return 0;}
 
85
long ffrandom(){return random();}
74
86
long ffsrandomdev() { 
75
87
#ifdef HAVE_SRANDOMDEV
76
88
  srandomdev(); 
85
97
void init(){
86
98
  Global.Add("srandomdev","(",new OneOperator_0<long>(ffsrandomdev));
87
99
  Global.Add("srandom","(",new OneOperator1<long>(ffsrandom));
88
 
  Global.Add("random","(",new OneOperator_0<long>(random));
 
100
  Global.Add("random","(",new OneOperator_0<long>(ffrandom));
89
101
}
90
102
LOADFUNC(init); 
91
103
/* These real versions are due to Isaku Wada, 2002/01/09 added */