Skip to content

Commit 77883d1

Browse files
committed
- Added boolean array fill function
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9552 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent a75415c commit 77883d1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

c_runtime/boolean_array.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,3 +863,20 @@ void convert_alloc_boolean_array_from_f77(boolean_array_t* a,
863863
}
864864
transpose_boolean_array(a, dest);
865865
}
866+
867+
/* Fills an array with a value. */
868+
void fill_alloc_boolean_array(boolean_array_t* dest, modelica_boolean value, int ndims, ...)
869+
{
870+
size_t i;
871+
size_t elements = 0;
872+
va_list ap;
873+
va_start(ap, ndims);
874+
elements = alloc_base_array(dest, ndims, ap);
875+
va_end(ap);
876+
dest->data = integer_alloc(elements);
877+
878+
for(i = 0; i < elements; ++i)
879+
{
880+
boolean_set(dest, i, value);
881+
}
882+
}

c_runtime/boolean_array.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,6 @@ void convert_alloc_boolean_array_to_f77(boolean_array_t* a,
185185
boolean_array_t* dest);
186186
void convert_alloc_boolean_array_from_f77(boolean_array_t* a,
187187
boolean_array_t* dest);
188+
void fill_alloc_boolean_array(boolean_array_t* dest, modelica_boolean value, int ndims, ...);
188189

189190
#endif

0 commit comments

Comments
 (0)