This repository was archived by the owner on May 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathboolean_array.h
More file actions
183 lines (147 loc) · 8.04 KB
/
boolean_array.h
File metadata and controls
183 lines (147 loc) · 8.04 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
* GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the OSMC (Open Source Modelica Consortium)
* Public License (OSMC-PL) are obtained from OSMC, either from the above
* address, from the URLs: http://www.openmodelica.org or
* http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica
* distribution. GNU version 3 is obtained from:
* http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from:
* http://www.opensource.org/licenses/BSD-3-Clause.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS
* EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE
* CONDITIONS OF OSMC-PL.
*
*/
#ifndef BOOLEAN_ARRAY_H_
#define BOOLEAN_ARRAY_H_
#include "openmodelica.h"
#include "base_array.h"
#include "index_spec.h"
#include "omc_msvc.h"
#include <stdarg.h>
static OMC_INLINE modelica_boolean boolean_get(const boolean_array_t a, size_t i)
{
return ((modelica_boolean *) a.data)[i];
}
/* Setting the fields of a boolean_array */
extern void boolean_array_create(boolean_array_t *dest, modelica_boolean *data, int ndims, ...);
/* Allocation of a vector */
extern void simple_alloc_1d_boolean_array(boolean_array_t* dest, int n);
/* Allocation of a matrix */
extern void simple_alloc_2d_boolean_array(boolean_array_t *dest, int r, int c);
extern void alloc_boolean_array(boolean_array_t *dest, int ndims, ...);
/* Allocation of boolean data */
extern void alloc_boolean_array_data(boolean_array_t* a);
/* Frees memory*/
extern void free_boolean_array_data(boolean_array_t* a);
/* Clones data*/
static inline void clone_boolean_array_spec(const boolean_array_t* src,
boolean_array_t* dst)
{ clone_base_array_spec(src, dst); }
/* Copy boolean data*/
extern void copy_boolean_array_data(const boolean_array_t source, boolean_array_t* dest);
/* Copy boolean data given memory ptr*/
extern void copy_boolean_array_data_mem(const boolean_array_t source, modelica_boolean* dest);
/* Copy boolean array*/
extern void copy_boolean_array(const boolean_array_t source, boolean_array_t* dest);
/* 'and' two boolean arrays*/
void and_boolean_array(const boolean_array_t *source1, const boolean_array_t *source2, boolean_array_t *dest);
/* 'or' two boolean arrays*/
void or_boolean_array(const boolean_array_t *source1, const boolean_array_t *source2, boolean_array_t *dest);
/* 'not' a boolean array*/
void not_boolean_array(const boolean_array_t source, boolean_array_t *dest);
extern modelica_boolean* calc_boolean_index(int ndims, const _index_t* idx_vec, const boolean_array_t* arr);
extern modelica_boolean* calc_boolean_index_va(const boolean_array_t* source,int ndims,va_list ap);
extern void put_boolean_element(m_boolean value,int i1,boolean_array_t* dest);
extern void put_boolean_matrix_element(m_boolean value, int r, int c, boolean_array_t* dest);
extern void print_boolean_matrix(const boolean_array_t* source);
extern void print_boolean_array(const boolean_array_t* source);
extern char print_boolean(m_boolean value);
/*
a[1:3] := b;
*/
extern void indexed_assign_boolean_array(const boolean_array_t source,
boolean_array_t* dest,
const index_spec_t* dest_spec);
extern void simple_indexed_assign_boolean_array1(const boolean_array_t* source,
int i1,
boolean_array_t* dest);
extern void simple_indexed_assign_boolean_array2(const boolean_array_t* source,
int i1, int i2,
boolean_array_t* dest);
/*
a := b[1:3];
*/
extern void index_boolean_array(const boolean_array_t* source,
const index_spec_t* source_spec,
boolean_array_t* dest);
extern void index_alloc_boolean_array(const boolean_array_t* source,
const index_spec_t* source_spec,
boolean_array_t* dest);
extern void simple_index_alloc_boolean_array1(const boolean_array_t* source, int i1,
boolean_array_t* dest);
extern void simple_index_boolean_array1(const boolean_array_t* source,
int i1,
boolean_array_t* dest);
extern void simple_index_boolean_array2(const boolean_array_t* source,
int i1, int i2,
boolean_array_t* dest);
/* array(A,B,C) for arrays A,B,C */
extern void array_boolean_array(boolean_array_t* dest,int n,
boolean_array_t first,...);
extern void array_alloc_boolean_array(boolean_array_t* dest,int n,
boolean_array_t first,...);
/* array(s1,s2,s3) for scalars s1,s2,s3 */
extern void array_scalar_boolean_array(boolean_array_t* dest,int n,...);
extern void array_alloc_scalar_boolean_array(boolean_array_t* dest,int n,...);
extern m_boolean* boolean_array_element_addr(const boolean_array_t* source,int ndims,...);
extern m_boolean* boolean_array_element_addr1(const boolean_array_t* source,int ndims,int dim1);
extern m_boolean* boolean_array_element_addr2(const boolean_array_t* source,int ndims,int dim1,int dim2);
extern void cat_boolean_array(int k,boolean_array_t* dest, int n,
const boolean_array_t* first,...);
extern void cat_alloc_boolean_array(int k,boolean_array_t* dest, int n,
const boolean_array_t* first,...);
extern void promote_boolean_array(const boolean_array_t* a, int n,boolean_array_t* dest);
extern void promote_scalar_boolean_array(modelica_boolean s,int n,
boolean_array_t* dest);
extern void promote_alloc_boolean_array(const boolean_array_t* a, int n,
boolean_array_t* dest);
static inline int ndims_boolean_array(const boolean_array_t* a)
{ return ndims_base_array(a); }
static inline modelica_boolean *data_of_boolean_array(const boolean_array_t*a)
{ return (modelica_boolean *) a->data; }
static inline modelica_boolean *data_of_boolean_c89_array(const boolean_array_t*a)
{ return (modelica_boolean *) a->data; }
extern void size_boolean_array(const boolean_array_t* a, integer_array_t* dest);
extern m_boolean scalar_boolean_array(const boolean_array_t* a);
extern void vector_boolean_array(const boolean_array_t* a, boolean_array_t* dest);
extern void vector_boolean_scalar(modelica_boolean a,boolean_array_t* dest);
extern void matrix_boolean_array(const boolean_array_t* a, boolean_array_t* dest);
extern void matrix_boolean_scalar(modelica_boolean a,boolean_array_t* dest);
extern void transpose_alloc_boolean_array(const boolean_array_t* a, boolean_array_t* dest);
extern void transpose_boolean_array(const boolean_array_t* a, boolean_array_t* dest);
extern void fill_boolean_array(boolean_array_t* dest,modelica_boolean s);
static inline void clone_reverse_boolean_array_spec(const boolean_array_t*source,
boolean_array_t *dest)
{ clone_reverse_base_array_spec(source, dest); }
extern void convert_alloc_boolean_array_to_f77(const boolean_array_t* a,
boolean_array_t* dest);
extern void convert_alloc_boolean_array_from_f77(const boolean_array_t* a,
boolean_array_t* dest);
extern void fill_alloc_boolean_array(boolean_array_t* dest, modelica_boolean value, int ndims, ...);
#endif