README.md 6.58 KB
Newer Older
skripvic's avatar
skripvic committed
1
# CAT Library
skripvic's avatar
skripvic committed
2

skripvic's avatar
skripvic committed
3

skripvic's avatar
skripvic committed
4
5
### CAT_InitPreprocessor
    int CAT_InitPreprocessor(int arrayTopology, int modelType, int
skripvic's avatar
skripvic committed
6
        cellSize, int globalSize, double cellsPerMeter, int arraySizeI, ...)
skripvic's avatar
skripvic committed
7
8
9
10
11
12
13
14
15
16
17
18

#### Input variables
    arrayTopology
        topology of the cellular array
    modelType
        type of the model
    cellSize
        size of value in a cell
    globalSize
        size of extra info
    cellsPerMeter
        number of cells per meter
skripvic's avatar
skripvic committed
19
20
    arraySizeI, ...
        sizes of array, number of sizes should be equal to dimension
skripvic's avatar
skripvic committed
21
22

#### Description
skripvic's avatar
skripvic committed
23
24
25
26
27
28
29
30
31
    Initiates header;
    returns  0 in case of success;
    returns -1 if error occurred when allocating file;
    returns -2 if arrayTopology is wrong;
    returns -3 if wrong number of arguments;

    Attention: number of arguments should be equal to dimension;
            if number of arguments is more than dimension, excessive arguments will not be processed;
            if number of arguments is less than dimension, not specified arguments will be equal 1.
skripvic's avatar
skripvic committed
32

skripvic's avatar
skripvic committed
33
34
#### Note
    Dimension is equal to arrayTopology / 10
skripvic's avatar
skripvic committed
35
36
>

skripvic's avatar
skripvic committed
37
38
### CAT_InitPostprocessor
    int CAT_InitPostprocessor(char *filename)
skripvic's avatar
skripvic committed
39

skripvic's avatar
skripvic committed
40
41
42
43
44
45
46
47
48
49
50
51
52
#### Input variables
    filename
        address of file name

#### Description
    Initiates header and cellular array with information from file
    returns  0 in case of success
    returns -1 if error occurred while allocating header or cellular array
    returns -2 if error occurred while opening file
    returns -3 if error occurred while reading from file
    returns -4 if file was damaged (control sum is not the same)
    returns -5 if file name was empty

skripvic's avatar
skripvic committed
53
54
>

skripvic's avatar
skripvic committed
55
56
### CAT__InitSimulator
    int CAT_InitSimulator(char *filename)
skripvic's avatar
FHP 2    
skripvic committed
57

skripvic's avatar
skripvic committed
58
#### Input variables
59
    filename
skripvic's avatar
skripvic committed
60
61
62
63
64
65
66
67
68
69
        address of file name

#### Description
    Initiates header and cellular array with information from file
    returns  0 in case of success
    returns -1 if error occurred while allocating header or cellular array
    returns -2 if error occurred while opening file
    returns -3 if error occurred while reading from file
    returns -4 if file was damaged (control sum is not the same)
    returns -5 if file name was empty
skripvic's avatar
FHP 2    
skripvic committed
70

skripvic's avatar
skripvic committed
71
>
skripvic's avatar
skripvic committed
72

skripvic's avatar
skripvic committed
73
74
### CAT_PutCell
    int CAT_PutCell(char *cellValue, int i, ...)
skripvic's avatar
skripvic committed
75
76

#### Input variables
skripvic's avatar
skripvic committed
77
    i, ...
skripvic's avatar
skripvic committed
78
79
80
81
82
        indexes of cell
    cellValue
        value to put in a cell

#### Description
skripvic's avatar
skripvic committed
83
    Puts value in the cell with i, ... indexes;
skripvic's avatar
skripvic committed
84
    returns  0 in case of success
skripvic's avatar
skripvic committed
85
86
87
88
89
90
    returns -8 if header or array were not initiated
    returns -9 if indexes are out of bounds

    Attention: number of arguments should be equal to dimension;
            if number of arguments is more than dimension, excessive arguments will not be processed;
            if number of arguments is less than dimension, not specified arguments will be equal 0.
skripvic's avatar
skripvic committed
91
92
93

>

skripvic's avatar
skripvic committed
94
95
### CAT_GetCell
    int CAT_GetCell(char *cellValue, int i, ...)
skripvic's avatar
skripvic committed
96
97

#### Input variables
skripvic's avatar
skripvic committed
98
    i, ...
skripvic's avatar
skripvic committed
99
100
101
102
103
104
105
        indexes of cell

#### Output variables
    cellValue
        puts there value from the cell

#### Description
skripvic's avatar
skripvic committed
106
    Gets value from the cell with i, ... indexes to the cellValue;
skripvic's avatar
skripvic committed
107
    returns  0 in case of success;
skripvic's avatar
skripvic committed
108
109
110
111
112
113
    returns -8 if header or array were not initiated
    returns -9 if indexes are out of bounds

    Attention: number of arguments should be equal to dimension;
            if number of arguments is more than dimension, excessive arguments will not be processed;
            if number of arguments is less than dimension, not specified arguments will be equal 0.
skripvic's avatar
skripvic committed
114
115
116
117

>

### CAT_SquareDistance
skripvic's avatar
skripvic committed
118
    double CAT_SquareDistance(int i1, ...)
skripvic's avatar
skripvic committed
119
120

#### Input variables
skripvic's avatar
skripvic committed
121
    i1, ...
skripvic's avatar
skripvic committed
122
        indexes of the first cell
skripvic's avatar
skripvic committed
123
    i2, ...
skripvic's avatar
skripvic committed
124
125
126
        indexes of the second cell

#### Description
skripvic's avatar
skripvic committed
127
    Returns square distance between dots representing cells with indexes i1, ... and i2, ...;
skripvic's avatar
skripvic committed
128
    returns  0 in case of success;
skripvic's avatar
skripvic committed
129
130
131
132
    returns -6 if topology is not implemented yet
    returns -7 if topology is not acceptable for this function
    returns -8 if header or array were not initiated
    returns -9 if indexes are out of bounds
skripvic's avatar
skripvic committed
133
134

>
skripvic's avatar
skripvic committed
135

skripvic's avatar
skripvic committed
136
137
138
139
140
### CAT_GetX (CAT_GetY / CAT_GetZ / CAT_GetT)
    double CAT_GetX(int i, ...)
    double CAT_GetY(int i, ...)
    double CAT_GetZ(int i, ...)
    double CAT_GetT(int i, ...)
skripvic's avatar
skripvic committed
141
142

#### Input variables
skripvic's avatar
skripvic committed
143
    i, ...
skripvic's avatar
skripvic committed
144
145
146
        indexes of the cell

#### Description
skripvic's avatar
skripvic committed
147
148
149
150
151
    Returns X (or Y, or Z, or T) coordinate of the dot representing cell
    returns -6 if topology is not implemented yet
    returns -7 if topology is not acceptable for this function
    returns -8 if header or array were not initiated
    returns -9 if indexes are out of bounds
skripvic's avatar
skripvic committed
152
153
154


>
skripvic's avatar
skripvic committed
155

skripvic's avatar
skripvic committed
156
157
158
159
160
### CAT_GetI (CAT_GetJ / CAT_GetK / CAT_GetL)
    int CAT_GetI(double x, ...)
    int CAT_GetJ(double x, ...)
    int CAT_GetK(double x, ...)
    int CAT_GetL(double x, ...)
skripvic's avatar
skripvic committed
161
162

#### Input variables
skripvic's avatar
skripvic committed
163
    x, ...
skripvic's avatar
skripvic committed
164
165
166
        coordinates of the dot

#### Description
skripvic's avatar
skripvic committed
167
168
169
170
171
    Returns i (or j, or k, or l) index of the cell representing the dot with coordinates x, ...
    returns -6 if topology is not implemented yet
    returns -7 if topology is not acceptable for this function
    returns -8 if header or array were not initiated
    returns -9 if indexes are out of bounds
skripvic's avatar
skripvic committed
172
173

>
skripvic's avatar
skripvic committed
174

skripvic's avatar
skripvic committed
175
176


skripvic's avatar
skripvic committed
177
178
179
180
181
### CAT_GetMaxI (CAT_GetMaxJ / CAT_GetMaxK / CAT_GetMaxL)
    int CAT_GetMaxI()
    int CAT_GetMaxJ()
    int CAT_GetMaxK()
    int CAT_GetMaxL()
skripvic's avatar
skripvic committed
182
183

#### Description
skripvic's avatar
skripvic committed
184
185
    Returns maximum i (or j, or k, or l) index.
    returns -8 if header or array were not initiated
skripvic's avatar
skripvic committed
186
187

>
skripvic's avatar
skripvic committed
188

skripvic's avatar
skripvic committed
189

skripvic's avatar
skripvic committed
190
### CAT_Iterate
skripvic's avatar
skripvic committed
191
    int CAT_Iterate(int (* cellTransition)(char*))
skripvic's avatar
FHP 2    
skripvic committed
192

skripvic's avatar
skripvic committed
193
#### Input variables
194
195
    cellTransition
        Function used on Cellular array
skripvic's avatar
skripvic committed
196
#### Description
197
198
    returns 0 if changes were made
    returns 1 if there were no changes
skripvic's avatar
FHP 2    
skripvic committed
199

skripvic's avatar
skripvic committed
200
>
skripvic's avatar
FHP 2    
skripvic committed
201

skripvic's avatar
skripvic committed
202
203
### CAT_FinalizePreprocessor
    int CAT_FinalizePreprocessor(char *filename)
skripvic's avatar
FHP 2    
skripvic committed
204

skripvic's avatar
skripvic committed
205
#### Input variables
206
207
208
    filename
        pointer to name of file for saving caFileHeader

skripvic's avatar
skripvic committed
209
#### Description
210
211
212
213
    Saves caFileHeader and Cellular Array into file, frees memory.
    returns 0 in case of success
    returns 1 if error occurred during opening file
    returns 2 if error occurred during writing in the file
skripvic's avatar
skripvic committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241

>

### CAT_FinalizeSimulator
    int CAT_FinalizeSimulator(char *filename)

#### Input variables
    filename
        pointer to name of file for saving caFileHeader

#### Description
    Saves caFileHeader and Cellular Array into file, frees memory.
    returns 0 in case of success
    returns 1 if error occurred during opening file
    returns 2 if error occurred during writing in the file

>

### CAT_FinalizePostprocessor
    int CAT_FinalizePostprocessor(char *filename)

#### Input variables
    filename
        pointer to name of file for saving caFileHeader

#### Description
    Saves caFileHeader and Cellular Array into file, frees memory.
    returns 0 in case of success