Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 1e836b6

Browse files
atrosinenkoOpenModelica-Hudson
authored andcommitted
Implement *_get_5D(...) array accessors
Belonging to [master]: - #2846
1 parent 1b6a960 commit 1e836b6

5 files changed

Lines changed: 38 additions & 2 deletions

File tree

SimulationRuntime/c/util/base_array.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
#include "omc_msvc.h"
3838

3939
static OMC_INLINE size_t getIndex_2D(_index_t *dim, int i, int j) {return i*dim[1]+j;}
40-
static OMC_INLINE size_t getIndex_3D(_index_t *dim, int i, int j, int k) {return i*dim[1]*dim[2]+j*dim[2]+k;}
41-
static OMC_INLINE size_t getIndex_4D(_index_t *dim, int i, int j, int k, int l) {return i*dim[1]*dim[2]*dim[3]+j*dim[2]*dim[3]+k*dim[3]+l;}
40+
static OMC_INLINE size_t getIndex_3D(_index_t *dim, int i, int j, int k) {return (i*dim[1]+j)*dim[2]+k;}
41+
static OMC_INLINE size_t getIndex_4D(_index_t *dim, int i, int j, int k, int l) {return ((i*dim[1]+j)*dim[2]+k)*dim[3]+l;}
42+
static OMC_INLINE size_t getIndex_5D(_index_t *dim, int i, int j, int k, int l, int m) {return (((i*dim[1]+j)*dim[2]+k)*dim[3]+l)*dim[4]+m;}
4243

4344
/* Settings the fields of a base_array */
4445
void base_array_create(base_array_t *dest, void *data, int ndims, va_list ap);

SimulationRuntime/c/util/boolean_array.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ static OMC_INLINE modelica_boolean boolean_get_4D(const boolean_array_t a, size_
5757
return boolean_get(a, getIndex_4D(a.dim_size,i,j,k,l));
5858
}
5959

60+
static OMC_INLINE modelica_boolean boolean_get_5D(const boolean_array_t a, size_t i, size_t j, size_t k, size_t l, size_t m)
61+
{
62+
return boolean_get(a, getIndex_5D(a.dim_size,i,j,k,l,m));
63+
}
64+
6065
/* Setting the fields of a boolean_array */
6166
extern void boolean_array_create(boolean_array_t *dest, modelica_boolean *data, int ndims, ...);
6267

SimulationRuntime/c/util/integer_array.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ static OMC_INLINE modelica_integer integer_get_4D(const integer_array_t a, size_
5858
return integer_get(a, getIndex_4D(a.dim_size,i,j,k,l));
5959
}
6060

61+
static OMC_INLINE modelica_integer integer_get_5D(const integer_array_t a, size_t i, size_t j, size_t k, size_t l, size_t m)
62+
{
63+
return integer_get(a, getIndex_5D(a.dim_size,i,j,k,l,m));
64+
}
65+
6166
/* Settings the fields of a integer_array */
6267
extern void integer_array_create(integer_array_t *dest, modelica_integer *data,
6368
int ndims, ...);

SimulationRuntime/c/util/real_array.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ static OMC_INLINE modelica_real real_get_4D(const real_array_t a, size_t i, size
5959
return real_get(a, getIndex_4D(a.dim_size,i,j,k,l));
6060
}
6161

62+
static OMC_INLINE modelica_real real_get_5D(const real_array_t a, size_t i, size_t j, size_t k, size_t l, size_t m)
63+
{
64+
return real_get(a, getIndex_5D(a.dim_size,i,j,k,l,m));
65+
}
66+
6267
/* Setting the fields of a real_array */
6368
extern void real_array_create(real_array_t *dest, modelica_real *data, int ndims, ...);
6469

SimulationRuntime/c/util/string_array.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ static OMC_INLINE modelica_string string_get(const string_array_t a, size_t i)
4141
return ((modelica_string *) a.data)[i];
4242
}
4343

44+
static OMC_INLINE modelica_string string_get_2D(const string_array_t a, size_t i, size_t j)
45+
{
46+
return string_get(a, getIndex_2D(a.dim_size,i,j));
47+
}
48+
49+
static OMC_INLINE modelica_string string_get_3D(const string_array_t a, size_t i, size_t j, size_t k)
50+
{
51+
return string_get(a, getIndex_3D(a.dim_size,i,j,k));
52+
}
53+
54+
static OMC_INLINE modelica_string string_get_4D(const string_array_t a, size_t i, size_t j, size_t k, size_t l)
55+
{
56+
return string_get(a, getIndex_4D(a.dim_size,i,j,k,l));
57+
}
58+
59+
static OMC_INLINE modelica_string string_get_5D(const string_array_t a, size_t i, size_t j, size_t k, size_t l, size_t m)
60+
{
61+
return string_get(a, getIndex_5D(a.dim_size,i,j,k,l,m));
62+
}
63+
4464
/* Setting the fields of a string_array */
4565
extern void string_array_create(string_array_t *dest, modelica_string *data, int ndims, ...);
4666

0 commit comments

Comments
 (0)