-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_write_msg.cpp
executable file
·61 lines (46 loc) · 1.54 KB
/
read_write_msg.cpp
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
/*
*/
#include "read_write_msg.h"
void initial_message(int lx, int ly, long int t, double dt, double dx, int br_int, double sigma)
{
cout<< "FISHER WAVES, Splitting step method 2D! " << endl;
cout<< "System parameters: " << endl;
cout<< endl;
cout<< "System size: x coordinate= " << lx << "\t \t" << "y coordinate: " << ly << "\t \t" << "Time= " << t*dt << endl;
cout<< "Discretization: " << " dx= " << dx << "\t" << "dt= "<< dt <<endl;
cout<< "Br interacija: " << br_int<<endl;
cout << "Sigma= " << sigma << endl;
cout<<endl;
}
void write1d_data(double *x, double *y, int size, string filename)
{ ofstream dat;
filename = "./" + filename;
cout << filename << endl;
dat.open(filename.c_str(), ios::out);
for(int i=0;i<size;i++)
dat<< x[i] << " " << y[i] << endl;
dat.close();
}
void write2d_data_sq(double **mat, int ly, int no_points, int br_int, string filename)
{ ofstream dat;
filename = "./" + filename;
dat.open(filename.c_str(), ios::out);
for(int iy=0;iy<ly/2;iy++)
{ dat << iy << "\t";
for(int i=0;i<no_points;i++)
dat << mat[iy][i]/br_int << "\t";
dat << "\n";
}
dat.close();
}
void write2d_data(double **mat, int ly, int no_points, int br_int, string filename)
{ ofstream dat;
dat.open(filename.c_str(), ios::out);
for(int iy=0;iy<ly;iy++)
{ dat << iy << "\t";
for(int i=0;i<no_points;i++)
dat << mat[i][iy]/br_int << "\t";
dat << "\n";
}
dat.close();
}