Skip to content

Install on debian/ubuntu instructions #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.idea
venv
src/CFES
src/final.png
src/log.txt
src/main.o
src/matrix.txt
src/output.txt
src/schematic.png
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# CFES - Classical Field Equation Solver
###### Theoretical Physics Group Programming Project

## Install on Debian/Ubuntu based Linux

Run `instal_deb.sh` then:

```bash
cd src
./CFES
```

## Run

Please follow the instructions below first.

Expand Down
6 changes: 6 additions & 0 deletions install_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
sudo apt install build-essential libgsl-dev libgtk-3-dev python-tk python-virtualenv python-pip
make -C src/
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
backports.functools-lru-cache==1.5
cycler==0.10.0
kiwisolver==1.0.1
matplotlib==2.2.3
numpy==1.16.2
pyparsing==2.3.1
python-dateutil==2.8.0
pytz==2018.9
six==1.12.0
subprocess32==3.5.3
27 changes: 19 additions & 8 deletions src/combined.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <stdio.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_splinalg.h>
#include <time.h>
#include <unistd.h>

int type;
int dimension;
Expand Down Expand Up @@ -234,7 +236,7 @@ system("python plot_schematic.py > /dev/null");
void on_btn_matrix_clicked(GtkButton *button, app_widgets *app_wdgts) {

//stores integer read from spin button widget
dimension = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(app_wdgts->w_sbtn_quantity));

num_iterations = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(app_wdgts->w_sbtn_iterations));

//outputs dimension and initialises matrix elements
Expand All @@ -245,29 +247,31 @@ void on_btn_matrix_clicked(GtkButton *button, app_widgets *app_wdgts) {
}
}
f=fopen("log.txt","w");
}

void on_btn_generate_clicked (GtkButton *button, app_widgets *app_wdgts) {

FILE *fp;
fp = fopen("matrix.txt","w");
f = fopen("log.txt","a");

for (int i=0; i < dimension; i++) {
for (int j=0; j < dimension; j++) {
if (matrix[i][j] == 0.000001) {
fprintf(fp, "0.000001 ");
fprintf(fp, "0.000001 ");
} else {
fprintf(fp, "%f ", matrix[i][j]);
}
}
}
fclose(fp);
}

void on_btn_generate_clicked (GtkButton *button, app_widgets *app_wdgts) {
f = fopen("log.txt","a");

printf("Matrix successfully outputted to matrix.txt!\n");
fprintf(f,"Matrix successfully outputted to matrix.txt!\n");
fclose(f);

printf("Passing Matrix to calculation handler\n");
dimension = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(app_wdgts->w_sbtn_quantity));
num_iterations = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(app_wdgts->w_sbtn_iterations));
calc_handle(dimension, num_iterations);// Take tolerance from a button soon
gtk_main_quit();
}
Expand All @@ -289,10 +293,17 @@ int calc_handle(int dimension, int num_iterations){
// Passes the matrix system (Ax=b) to the solver
//solve(dimension, b, boundaryflag);
//sparse_solve(dimension,b , boundaryflag, 2);

clock_t start = clock();
jacobi(dimension,b ,boundaryflag, num_iterations);
clock_t end = clock();
float seconds = (float)(end - start) / CLOCKS_PER_SEC;
printf("It took %.6f seconds\n", seconds);

system("python Plotter.py > /dev/null");
// avoids race condition with the system call below - i.e. prints before calling python exec
sleep(0.1);

system("python Plotter.py > /dev/null");

exit(0);

Expand Down
2 changes: 1 addition & 1 deletion src/window_main.glade
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Please follow the instructions below first.
<property name="text" translatable="yes">1</property>
<property name="adjustment">n_adjustment</property>
<property name="numeric">True</property>
<property name="value">1</property>
<property name="value">101</property>
</object>
<packing>
<property name="expand">False</property>
Expand Down