File: Developer.htm

package info (click to toggle)
cain 1.10+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 29,856 kB
  • sloc: cpp: 49,612; python: 14,988; xml: 11,654; ansic: 3,644; makefile: 133; sh: 2
file content (113 lines) | stat: -rw-r--r-- 4,796 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

<html>
<head>
<title>Developer's Guide</title>
</head>
<body>
<h1>Developer's Guide</h1>

<p>
Cain is written in <a href="http://www.python.org/">Python</a> and uses the
<a href="http://www.wxpython.org/">wxPython</a> GUI toolkit.
For plotting simulation results, it uses
<a href="http://matplotlib.sourceforge.net/">matplotlib</a> and
<a href="http://numpy.scipy.org/">numpy</a>.
To simplify mathematical expressions, it uses
<a href="http://sympy.org/">SymPy</a>.
Cain utilizes command line executables to perform the
simulations. These executables read a description of the problem
(model, method, and number of trajectories) from stdin and write the
trajectories to stdout. Cain launches the executables; it sends the
input and captures the output with pipes. When launching a job, the
user select the number of processes to use. Cain launches this number
of executables. It asks the pool of solvers to each generate
trajectories a specified number at a time until the desired number has
been collected. (See the documentation for the granularity slider
in the <a href="UserLauncher.htm">launcher</a> panel for details.)
This allows the user to stop or abort a running
simulation and store the trajectories that have been generated so far.
</p>

<p>
The <a href="https://bitbucket.org/seanmauch/cain/wiki/Home">source
code</a> for Cain, both Python application code and C++ solver
code is hosted on <a href="https://bitbucket.org/">Bitbucket</a>.
(Most of the C++ source is extracted from 
<a href="https://bitbucket.org/seanmauch/stlib/wiki/Home">STLib</a>,
which is a scientific computing C++ template library.)
Follow the instructions on the
<a href="https://bitbucket.org/seanmauch/cain/wiki/Home">Cain wiki</a>
to download the source code.
If you download a compressed archive of a development snapshot,
you will get a file name that records the Mercurial version, for
example <tt>seanmauch-cain-0cdb9c4c1739.zip</tt>. First uncompress
the file, unless your browser does that for you.<br>
<tt>unzip seanmauch-cain-0cdb9c4c1739.zip</tt><br>
Then you can rename the directory to a more convenient name.<br>
<tt>mv seanmauch-cain-0cdb9c4c1739 cain</tt>
</p>

<p>
To work with the source code, you will need Python and a suitable
C++ compiler. Read the <a href="Installation.htm">installation
instructions</a> for your operating system for details.
The easiest way to get Python and the necessary packages is to
install the 
<a href="http://www.enthought.com/products/epd.php">Enthought Python
Distribution</a>. (Note for Microsoft Windows users: The installation
instructions don't mention Python because a suitable version of Python
is packaged with the Windows distribution. However, to work with the
source code you will need to install Python.)
</p>

<p>
Before running the application, you will need to build the solvers.
(Technically, you can run the GUI application without building the
solvers, you just can't run any simulations that use the C++ solvers.)
In the top-level directory, run the makefile.<br>
<tt>cd cain</tt><br>
<tt>make</tt><br>
This simply calls the makefile in the <tt>src/solvers</tt> directory.
For Windows users, open a shell, go to the solvers directory, and run
the <tt>msvs.py</tt> script.<br>
<tt>cd cain\src\solvers</tt><br>
<tt>python msvs.py</tt>
</p>


<p>
The Python source code is split into the four top-level directories:
<tt>gui</tt>, <tt>io</tt>, <tt>simulation</tt>, and <tt>state</tt>.
The script <tt>Cain.py</tt>
launches the application. Thus you can launch Cain with the shell command
<tt>python Cain.py</tt>. The C++ source code packages are in
<tt>src</tt>. If you want to have a look at the source code, start
with the <tt>stochastic</tt> package. The random number generators
are implemented in <tt>numerical/random</tt>.
The source code for the command-line solvers is in 
<tt>src/solvers</tt>. The compiled executables are placed in
the <tt>solvers</tt> directory.
</p>



<!--
<p>
<b>Microsoft Windows Development Environment.</b><br>
First get <a href="http://www.mingw.org/wiki/Getting_Started">MinGW</a> 
by running the MinGW-5.1.6 installer.  Then get 
<a href="http://www.mingw.org/wiki/MSYS">MSYS</a>. Install MSYS 1.0.11,
MSYS DTK 1.0.11, and set the environment variable HOME to
c:\msys\1.0\home\user_name.  Make a .ssh directory in your home
directory and place your public and private SSH keys there. Then you
can use the shell commands &quot;ssh-agent $SHELL&quot; followed by
&quot;ssh-add&quot; to start a shell with SSH authentication.  Next
install subversion by running the Setup-Subversion-1.6.6.msi
installer, which will add the svn executable to your path. If you
don't already have a text editor, you can download 
<a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a>.
</p>
-->

</body>
</html>