List of commits:
Subject Hash Author Date (UTC)
Реализованы классы для описания файла с результатами расчетов; создан тест b9eb54937916bf4538dc559ea3c391f0855d4280 oam 2022-04-03 18:51:28
Вспомогательные классы для описания переменных канала в определенный момент времени 33e512158850d511534458dda088a71386044de0 OAM 2022-04-01 07:22:42
В окне TimeMenu добавлены кнопки для выбора нужных координат. В окно нужно добавить функцию выбора параметров. 2cd07ab29c86f397b297576a753f96f5fcb0a567 AnMikhaylova 2022-03-26 11:08:53
В класс TimeReader добавлен метод getPointsInTime(), который вычисляет допустимые моменты времени для моделирования. Расчёт производится по данным из файла timescen.txt. Добавлено окно TimeMenu для выбора нужных моментов времени и выбора параметров. В окне реализован только вывод допустимых значений времени. 672abb1bfe2906250806e02c36273d561a67d098 AnMikhaylova 2022-03-25 20:13:56
Добавлено главное меню (MainMenu). Добавлено меню выбора канала (ChanMenu). В данном окне кнопка "выбрать" выступает в качестве загшлушки. Добавлено меню выбора директории файлов конфигурации (DirMenu). c8d0f12754cf04c526636136484fb552a61878be AnMikhaylova 2022-03-24 16:35:56
The FileReader class has been renamed (to DefaultReader). TimeInterval - added a method that calculates the total duration of the interval. TimeReader - added a method for calculating the total duration of the simulation. Changed directory with source files. 7d82fe691e99d1c76e74a7e95496ca14cd9786e3 AnMikhaylova 2022-03-17 20:05:59
The FileReader class has been renamed (to DefaultReader). TimeInterval - added a method that calculates the total duration of the interval. TimeReader - added a method for calculating the total duration of the simulation. Changed directory with source files. e348951a762aed7ed2bf0a6d61a06b7873a73518 AnMikhaylova 2022-03-17 20:01:36
initial commit 07cb3f608489e2df5cda5655d3055d7c7e46b522 oam 2022-03-17 19:33:58
Commit b9eb54937916bf4538dc559ea3c391f0855d4280 - Реализованы классы для описания файла с результатами расчетов; создан тест
Author: oam
Author date (UTC): 2022-04-03 18:51
Committer name: oam
Committer date (UTC): 2022-04-03 18:51
Parent(s): 33e512158850d511534458dda088a71386044de0
Signer:
Signing key:
Signing status: N
Tree: 3533d17782ebb9cf8567919dcee67d8b3a97444b
File Lines added Lines deleted
nbproject/project.properties 6 2
src/lleak/channel/ChanCol.java 40 40
src/lleak/channel/ChanFile.java 95 0
src/lleak/channel/ChanProf.java 63 19
test/lleak/channel/ChanFileTest.java 56 0
File nbproject/project.properties changed (mode: 100644) (index 511a934..da11af9)
1 1 annotation.processing.enabled=true annotation.processing.enabled=true
2 2 annotation.processing.enabled.in.editor=false annotation.processing.enabled.in.editor=false
3 annotation.processing.processor.options=
4 3 annotation.processing.processors.list= annotation.processing.processors.list=
5 4 annotation.processing.run.all.processors=true annotation.processing.run.all.processors=true
6 5 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 application.title=lleakres
7 application.vendor=oam
7 8 build.classes.dir=${build.dir}/classes build.classes.dir=${build.dir}/classes
8 9 build.classes.excludes=**/*.java,**/*.form build.classes.excludes=**/*.java,**/*.form
9 10 # This directory is removed when the project is cleaned: # This directory is removed when the project is cleaned:
 
... ... dist.jar=${dist.dir}/lleakres.jar
32 33 dist.javadoc.dir=${dist.dir}/javadoc dist.javadoc.dir=${dist.dir}/javadoc
33 34 dist.jlink.dir=${dist.dir}/jlink dist.jlink.dir=${dist.dir}/jlink
34 35 dist.jlink.output=${dist.jlink.dir}/lleakres dist.jlink.output=${dist.jlink.dir}/lleakres
36 endorsed.classpath=
35 37 excludes= excludes=
36 38 includes=** includes=**
37 39 jar.compress=false jar.compress=false
 
... ... javac.source=11
48 50 javac.target=11 javac.target=11
49 51 javac.test.classpath=\ javac.test.classpath=\
50 52 ${javac.classpath}:\ ${javac.classpath}:\
51 ${build.classes.dir}
53 ${build.classes.dir}:\
54 ${libs.junit_4.classpath}:\
55 ${libs.hamcrest.classpath}
52 56 javac.test.modulepath=\ javac.test.modulepath=\
53 57 ${javac.modulepath} ${javac.modulepath}
54 58 javac.test.processorpath=\ javac.test.processorpath=\
File src/lleak/channel/ChanCol.java changed (mode: 100644) (index c3378c2..5d209ad)
6 6 package lleak.channel; package lleak.channel;
7 7
8 8 /** /**
9 *
10 * @author oam
9 *
10 * @author tassy
11 11 */ */
12 12 public class ChanCol { public class ChanCol {
13 private int ic; // индекс столбца
14 private String varname; // идентификатор
15 private String fullname; // полное название
16
17 public ChanCol() {
18 }
19
20 public ChanCol(int ic, String varname, String fullname) {
21 this.ic = ic;
22 this.varname = varname;
23 this.fullname = fullname;
24 }
25
26 public int getIc() {
27 return ic;
28 }
29
30 public void setIc(int ic) {
31 this.ic = ic;
32 }
33
34 public String getVarname() {
35 return varname;
36 }
37
38 public void setVarname(String varname) {
39 this.varname = varname;
40 }
41
42 public String getFullname() {
43 return fullname;
44 }
45
46 public void setFullname(String fullname) {
47 this.fullname = fullname;
48 }
49
50
13
14 private int ic; // индекс столбца
15 private String varname; // идентификатор
16 private String fullname; // полное название
17
18 public ChanCol() {
19 }
20
21 public ChanCol(int ic, String varname, String fullname) {
22 this.ic = ic;
23 this.varname = varname;
24 this.fullname = fullname;
25 }
26
27 public int getIc() {
28 return ic;
29 }
30
31 public void setIc(int ic) {
32 this.ic = ic;
33 }
34
35 public String getVarname() {
36 return varname;
37 }
38
39 public void setVarname(String varname) {
40 this.varname = varname;
41 }
42
43 public String getFullname() {
44 return fullname;
45 }
46
47 public void setFullname(String fullname) {
48 this.fullname = fullname;
49 }
50
51 51 } }
File src/lleak/channel/ChanFile.java added (mode: 100644) (index 0000000..c3b5e44)
1 /*
2 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 */
5 package lleak.channel;
6
7 import java.io.BufferedReader;
8 import java.io.FileNotFoundException;
9 import java.io.FileReader;
10 import java.io.IOException;
11 import java.util.ArrayList;
12 import java.util.logging.Level;
13 import java.util.logging.Logger;
14
15 /**
16 * Класс, представляющий данные из расчетного файла в виде массива (списка) состояний в каждый момент времени
17 * @author tassy
18 */
19 public class ChanFile {
20 private final String chname;
21 private ArrayList<ChanCol> columns; // метаданные по столбцам
22 private int nt; // количество шагов по времени
23 private int nx; // количество точек по х
24 private int nc; // количество столбцов
25 private ArrayList<ChanProf> data;
26
27 public ChanFile(int nt, int nx, String chname, ArrayList<ChanCol> columns) {
28 this.chname = chname;
29 this.columns = columns;
30 this.nt = nt;
31 this.nx = nx;
32 this.nc = columns.size();
33 data = new ArrayList<>(nt); // инициализируем по количеству шагов по времени
34 readChan();
35 }
36
37 /**
38 * Чтение файла, заполнение структур данных
39 */
40 public void readChan(){
41 BufferedReader br = null;
42 try {
43 br = new BufferedReader(new FileReader(chname));
44 String line;
45 // цикл по количеству шагов по времени
46 for(int i=0; i<nt; ++i){
47 // первая строка для каждого шага - для определения времени
48 line = br.readLine();
49 String[] arr = line.trim().split("\\s+");
50 ChanProf cp = new ChanProf(nx, arr[0], columns);
51 cp.readFromLine(0, line);
52 for(int j=1; j<nx; ++j){
53 line = br.readLine();
54 cp.readFromLine(j, line);
55 }
56 data.add(cp);
57 }
58 } catch (FileNotFoundException ex) {
59 Logger.getLogger(ChanFile.class.getName()).log(Level.SEVERE, null, ex);
60 } catch (IOException ex) {
61 Logger.getLogger(ChanFile.class.getName()).log(Level.SEVERE, null, ex);
62 } finally {
63 if(br != null)try {
64 br.close();
65 } catch (IOException ex) {
66 Logger.getLogger(ChanFile.class.getName()).log(Level.SEVERE, null, ex);
67 }
68 }
69 }
70
71 public String getChname() {
72 return chname;
73 }
74
75 public ArrayList<ChanCol> getColumns() {
76 return columns;
77 }
78
79 public int getNt() {
80 return nt;
81 }
82
83 public int getNx() {
84 return nx;
85 }
86
87 public int getNc() {
88 return nc;
89 }
90
91 public ArrayList<ChanProf> getData() {
92 return data;
93 }
94
95 }
File src/lleak/channel/ChanProf.java changed (mode: 100644) (index 55dba96..c74003b)
... ... import java.util.Map;
10 10 import java.util.TreeMap; import java.util.TreeMap;
11 11
12 12 /** /**
13 * Класс для представления
14 * @author oam
13 * Класс для представления состояния канала в заданный момент времени
14 *
15 * @author tassy
15 16 */ */
16 17 public class ChanProf { public class ChanProf {
17 private double time;
18 private String stime;
19 private ArrayList<double []> columns; // список массивов значений столбцов, кроме первого (время) и второго (индекс точки)
20 private Map<String, double[]> namedcols; // для поиска по ключу - имени переменной
21
22 /**
23 * В списке столбцов первые два (время и индекс точки) игнорируются
24 * @param stime время (строка)
25 * @param list список столбцов
26 */
27 public ChanProf(String stime, ArrayList<ChanCol> list) {
28 this.stime = stime;
29 time = Double.parseDouble(stime);
30 columns = new ArrayList<>(24);
31 namedcols = new TreeMap<>();
32 }
33
18 private ArrayList<ChanCol> varlist;
19 private double time;
20 private String stime;
21 private ArrayList<double[]> columns; // список массивов значений столбцов, кроме первого (время) и второго (индекс точки)
22 private Map<String, double[]> namedcols; // для поиска по ключу - имени переменной
23
24 /**
25 * Конструктор класса
26 *
27 * @param nx количество точек по х
28 * @param stime время (строка)
29 * @param varlist список столбцов
30 */
31 public ChanProf(int nx, String stime, ArrayList<ChanCol> varlist) {
32 this.stime = stime;
33 this.varlist = varlist;
34 time = Double.parseDouble(stime);
35 int nc = varlist.size()-2; // первые два столбца - t и j - игнорируются
36 columns = new ArrayList<>();
37 namedcols = new TreeMap<>();
38 for(int i=0;i<varlist.size()-2;++i){
39 double [] da = new double[nx];
40 columns.add(da);
41 // помещаем в словарь ссылку на массив с ключом имя переменной
42 namedcols.put(varlist.get(i+2).getVarname(), da);
43 }
44 }
45
46 /**
47 * Чтение данных из строки с заданным индексом
48 * @param index индекс
49 * @param line строка из исходного файла
50 */
51 public void readFromLine(int index, String line){
52 String[] arr = line.trim().split("\\s+");
53 for(int i=2;i<varlist.size();++i){
54 columns.get(i-2)[index] = Double.parseDouble(arr[i]);
55 }
56 }
57
58 public ArrayList<ChanCol> getVarlist() {
59 return varlist;
60 }
61
62 public double getTime() {
63 return time;
64 }
65
66 public String getStime() {
67 return stime;
68 }
69
70 public ArrayList<double[]> getColumns() {
71 return columns;
72 }
73
74 public Map<String, double[]> getNamedcols() {
75 return namedcols;
76 }
77
34 78 } }
File test/lleak/channel/ChanFileTest.java added (mode: 100644) (index 0000000..1ebb461)
1 /*
2 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 * Click nbfs://nbhost/SystemFileSystem/Templates/UnitTests/JUnit4TestClass.java to edit this template
4 */
5 package lleak.channel;
6
7 import java.util.ArrayList;
8 import org.junit.After;
9 import org.junit.AfterClass;
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import static org.junit.Assert.*;
14
15 /**
16 *
17 * @author oam
18 */
19 public class ChanFileTest {
20
21 public ChanFileTest() {
22 }
23
24 @BeforeClass
25 public static void setUpClass() {
26 }
27
28 @AfterClass
29 public static void tearDownClass() {
30 }
31
32 @Before
33 public void setUp() {
34 }
35
36 @After
37 public void tearDown() {
38 }
39
40 /**
41 * Test of readChan method, of class ChanFile.
42 */
43 @Test
44 public void testReadChan() {
45 System.out.println("readChan");
46 ArrayList<ChanCol> columns = new ArrayList<>();
47 columns.add(new ChanCol(0, "t", "Время"));
48 columns.add(new ChanCol(1, "j", "Индекс"));
49 columns.add(new ChanCol(2, "x", "Координата"));
50 columns.add(new ChanCol(3, "u", "Скорость"));
51 ChanFile instance = new ChanFile(1001, 201, "/home/oam/ch1", columns);
52 int index = 1000;
53 double[] res = instance.getData().get(index).getColumns().get(1);
54 System.out.println(res[0]); }
55
56 }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/oami/lleakres

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/oami/lleakres

Clone this repository using git:
git clone git://git.rocketgit.com/user/oami/lleakres

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main