Many problems arising in science are too difficult to solve
analytically, and thus require analysis of some form by a
computer. Using the language of c/ C ++ , this course introduces the
most common programming constructs used in scientific computing. The
critical importance of data structures to represent information is
emphasized, which naturally leads to an object-oriented approach to
problem solving. The use of external libraries, such as those for
numerical analysis, to solve more advanced problems are explored, with
attention paid to checks that can be made on the reliability of the
Tools to write the source code and compile it
The computers in 2L14 are available for use, and have all of the tools you will need to complete and hand in the
assignments for this course.
Text editor for windows
You will need a text editor to make text files containing the source
code. A simple editor that can be used is notepad++, which can
be downloaded from this
Text editor / IDE for Mac
If you are using a mac, install xcode . This comes with the g++ compiler. In order to do makefile based projects in xcode, these slides might help: XCode_and_makefile.pdf . It is recommended however to use the terminal and g++ compiler directly from the terminal command line. For reference see mac command line . To make the files containing the source code any text editor should work (emacs, vim, komodo). Try komodo, it is quite nice.
Compiler for Windows
The computers in 2L14 are using the MinGW (minamilist GNU for
Windows) package for compiling our C++ code. One option is to
download a tarball that includes the MinGW compiler, fltk library, and
course notes (from last year)
here . Note that these will work for Win7/10 based computers. This zip file is the same
as a USB stick at the beginning of the year. Course notes will be updated on the course website during
the year to make them more current.
If you unpack this onto a usb stick that comes up as drive
"E:", then add to the environment variable PATH "E:\MinGW\bin\" and
"E:\MinGW\msys\1.0\bin\". There are note in the week1 slides on how to edit your
path. Alternatively you can download and install the tools using the instructions which follow.
Alternate method of getting MinGW from original source
You can get a copy of MinGW by navigating
the MinGW website. It is best to
go to the downloads page, and select the
mingw-get-setup.exe , that will start an installer program to
select which options you want to install.
Save the installer, and run it. Inside the installer, push the
install button, and then continue button. You will then be presented
with a number of options to select from. Check off the boxes for
mingw-developer-tool..., mingw-base, and mingw-gcc-g++. Then from the
menu pick Installation -> Apply Changes, and then press the Apply
button. It will take some time for the package to download and install.
Once the package is installed, you will need to set the
system path to be able to find the commands g++ and make. (On
Windows 10) Search for "system path" in the windows search. Pick
"Edit system environment variable", and then push the button
"Environment Variables". Pick path, then push the edit button.
Select new, and enter the path "C:\MinGW\bin\" (or the path you have
installed MingGW in). Also add "C:\MinGW\msys\1.0\bin\" to the path.
Now if you start a command line terminal (search for cmd), you can
test if g++ and make are installed.
Getting fltk libraries for 2L14 computers
For lab assingments later in the term, and for the final project we will be using the "Full tick" (fltk)
libraries for graphics (fltk.org). These libraries are available in the week 8 examples folder that is on the course USB stick.
The fltk libraries are not installed on the 2L14 computers so you will
use the copy of the pre-compiled libraries that are on the usb stick. from my website, and
put them in the directory with the code you are trying to compile.
These files can be download from
here. Unpack the files into the directory where you are putting your source code
that uses fltk. You can use this at home as well if you are using Win7/10.
Installing fltk libraries on your Windows machine
To install the fltk libraries into your existing MinGW installation from scratch (if you don't just copy the libraries from the zip file above) do the following:
Getting fltk libraries for mac
The easiest way to get the fltk libraries for mac is to install them from "Homebrew". First install "Homebrew" by typing in a terminal:
Then in the same terminal you can install fltk:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You can find where fltk is installed then using :
brew install fltk
export FLTK_DIR=$(brew --prefix fltk)
Blair A. Jamieson
Department of Physics
Lockhart Hall (3L24)
University of Winnipeg
515 Portage Avenue
Winnipeg, MB R3B 2E9
Email. bl.jamieson (at) uwinnipeg.ca
Tel. +1 (204) 786-9216
Fax. +1 (204) 774-4134