Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 1
Functions: -% 0 / 1 / 1
Branches: -% 0 / 0 / 0

OMCompiler/SimulationRuntime/c/util/boolean_array.h
Line Branch Exec Source
1 /*
2 * This file belongs to the OpenModelica Run-Time System
3 *
4 * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings
5 * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights
6 * reserved.
7 *
8 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
9 * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY
10 * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
11 * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL
12 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
13 *
14 * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License
15 * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs:
16 * http://www.openmodelica.org or https://github.com/OpenModelica/ or
17 * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU
18 * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW
19 * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause.
20 *
21 * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY
23 * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF
24 * OSMC-PL.
25 *
26 */
27
28 #ifndef BOOLEAN_ARRAY_H_
29 #define BOOLEAN_ARRAY_H_
30
31 #include "../openmodelica.h"
32 #include "base_array.h"
33 #include "generic_array.h"
34 #include "index_spec.h"
35 #include "omc_msvc.h"
36 #include <stdarg.h>
37
38 modelica_boolean boolean_get(const boolean_array a, size_t i);
39 modelica_boolean boolean_get_2D(const boolean_array a, size_t i, size_t j);
40 modelica_boolean boolean_get_3D(const boolean_array a, size_t i, size_t j, size_t k);
41 modelica_boolean boolean_get_4D(const boolean_array a, size_t i, size_t j, size_t k, size_t l);
42 modelica_boolean boolean_get_5D(const boolean_array a, size_t i, size_t j, size_t k, size_t l, size_t m);
43
44 /* Setting the fields of a boolean_array */
45 extern void boolean_array_create(boolean_array *dest, modelica_boolean *data, int ndims, ...);
46
47 /* Allocation of a vector */
48 extern void simple_alloc_1d_boolean_array(boolean_array* dest, int n);
49 extern void boolean_array_ensure_size(boolean_array *a, int n);
50
51 /* Allocation of a matrix */
52 extern void simple_alloc_2d_boolean_array(boolean_array *dest, int r, int c);
53
54 extern void alloc_boolean_array(boolean_array *dest, int ndims, ...);
55
56 /* Allocation of boolean data */
57 extern void alloc_boolean_array_data(boolean_array* a);
58
59 /* Frees memory*/
60 extern void free_boolean_array_data(boolean_array* a);
61
62 /* Clones data*/
63 static inline void clone_boolean_array_spec(const boolean_array* src,
64 boolean_array* dst)
65 ✗ { clone_base_array_spec(src, dst); }
66
67 /* Copy boolean data given memory ptr*/
68 extern void copy_boolean_array_data_mem(const boolean_array source, modelica_boolean* dest);
69
70 /* Copy boolean array*/
71 extern void copy_boolean_array(const boolean_array source, boolean_array* dest);
72
73 /* 'and' two boolean arrays*/
74 void and_boolean_array(const boolean_array *source1, const boolean_array *source2, boolean_array *dest);
75
76 /* 'or' two boolean arrays*/
77 void or_boolean_array(const boolean_array *source1, const boolean_array *source2, boolean_array *dest);
78
79 /* 'not' a boolean array*/
80 void not_boolean_array(const boolean_array source, boolean_array *dest);
81
82 extern modelica_boolean* calc_boolean_index(int ndims, const _index_t* idx_vec, const boolean_array* arr);
83 extern modelica_boolean* calc_boolean_index_va(const boolean_array* source,int ndims,va_list ap);
84
85 extern void put_boolean_element(modelica_boolean value,int i1,boolean_array* dest);
86 extern void put_boolean_matrix_element(modelica_boolean value, int r, int c, boolean_array* dest);
87
88 extern void print_boolean_matrix(const boolean_array* source);
89 extern void print_boolean_array(const boolean_array* source);
90
91 void boolean_vector_to_string(const boolean_array *source, modelica_boolean isScalar, char *buffer, size_t bufsize);
92 extern char print_boolean(modelica_boolean value);
93 /*
94
95 a[1:3] := b;
96
97 */
98 extern void indexed_assign_boolean_array(const boolean_array source,
99 boolean_array* dest,
100 const index_spec_t* dest_spec);
101 extern void simple_indexed_assign_boolean_array1(const boolean_array* source,
102 int i1,
103 boolean_array* dest);
104 extern void simple_indexed_assign_boolean_array2(const boolean_array* source,
105 int i1, int i2,
106 boolean_array* dest);
107
108 /*
109
110 a := b[1:3];
111
112 */
113 extern void index_boolean_array(const boolean_array* source,
114 const index_spec_t* source_spec,
115 boolean_array* dest);
116 extern void index_alloc_boolean_array(const boolean_array* source,
117 const index_spec_t* source_spec,
118 boolean_array* dest);
119
120 extern void simple_index_alloc_boolean_array1(const boolean_array* source, int i1,
121 boolean_array* dest);
122
123 extern void simple_index_boolean_array1(const boolean_array* source,
124 int i1,
125 boolean_array* dest);
126 extern void simple_index_boolean_array2(const boolean_array* source,
127 int i1, int i2,
128 boolean_array* dest);
129
130 /* array(A,B,C) for arrays A,B,C */
131 extern void array_boolean_array(boolean_array* dest,int n,
132 boolean_array first,...);
133 extern void array_alloc_boolean_array(boolean_array* dest,int n,
134 boolean_array first,...);
135
136 /* array(s1,s2,s3) for scalars s1,s2,s3 */
137 extern void array_scalar_boolean_array(boolean_array* dest,int n,...);
138 extern void array_alloc_scalar_boolean_array(boolean_array* dest,int n,...);
139
140 extern void cat_boolean_array(int k,boolean_array* dest, int n,
141 const boolean_array* first,...);
142 extern void cat_alloc_boolean_array(int k,boolean_array* dest, int n,
143 const boolean_array* first,...);
144
145 extern void promote_boolean_array(const boolean_array* a, int n,boolean_array* dest);
146 extern void promote_scalar_boolean_array(modelica_boolean s,int n,
147 boolean_array* dest);
148 extern void promote_alloc_boolean_array(const boolean_array* a, int n,
149 boolean_array* dest);
150
151 static inline int ndims_boolean_array(const boolean_array* a)
152 { return ndims_base_array(a); }
153
154 extern void size_boolean_array(const boolean_array* a, integer_array* dest);
155 extern modelica_boolean scalar_boolean_array(const boolean_array* a);
156 extern void vector_boolean_array(const boolean_array* a, boolean_array* dest);
157 extern void vector_boolean_scalar(modelica_boolean a,boolean_array* dest);
158 extern void matrix_boolean_array(const boolean_array* a, boolean_array* dest);
159 extern void matrix_boolean_scalar(modelica_boolean a,boolean_array* dest);
160 extern void transpose_alloc_boolean_array(const boolean_array* a, boolean_array* dest);
161 extern void transpose_boolean_array(const boolean_array* a, boolean_array* dest);
162
163 extern void fill_boolean_array(boolean_array* dest,modelica_boolean s);
164
165 static inline void clone_reverse_boolean_array_spec(const boolean_array*source,
166 boolean_array *dest)
167 { clone_reverse_base_array_spec(source, dest); }
168 extern void convert_alloc_boolean_array_to_f77(const boolean_array* a,
169 boolean_array* dest);
170 extern void convert_alloc_boolean_array_from_f77(const boolean_array* a,
171 boolean_array* dest);
172 extern void fill_alloc_boolean_array(boolean_array* dest, modelica_boolean value, int ndims, ...);
173
174 /* Returns the smallest value in the given array, or true if the array is empty. */
175 extern modelica_boolean min_boolean_array(const boolean_array a);
176 /* Returns the largest value in the given array, or false if the array is empty. */
177 extern modelica_boolean max_boolean_array(const boolean_array a);
178
179 #endif
180