Opened 12 years ago
Closed 11 years ago
#2106 closed defect (fixed)
Code generation for arrays of records
Reported by: | Martin Sjölund | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Code Generation | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
We need to add support for arrays of records in function context
Currently our code looks something like:
struct Complex_array _t; alloc_struct Complex_array(&_t, 1, (modelica_integer) 2);
This needs to be something like...
struct_array _t; alloc_struct_array(&t, sizeof(struct Complex), 1, 2);
Code like this is used in MoMoLib, which will probably be a part of MSL 3.2.1
Attachments (2)
Change History (12)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 12 years ago
Status: | assigned → accepted |
---|
by , 12 years ago
Attachment: | ComplexArray.mo added |
---|
by , 12 years ago
Attachment: | ComplexArray.mos added |
---|
follow-up: 4 comment:3 by , 12 years ago
comment:4 by , 12 years ago
Replying to adrpo:
Any progress on this? If not, maybe I can have a look.
I have fixed it to some extent. By falling back to normal arrays. However it doesn't cover all cases. A more robust way to fix it is to write a new set of allocation, copy and element address functions which will take element size info as an additional argument. Sometimes indexing struct arrays also generates UNKNOWN_SUBSCRIPT right now. I had to switch to the openmp stuff before I completely fixed it. If urgent I can work on it now.
comment:5 by , 12 years ago
We'll talk more about this in the dev meeting on Tuesday 14:00 and we'll decide.
comment:6 by , 12 years ago
Partially fixed in r16093. A bit of a hack, more work is needed.
recordArray[i].recordComponent
does not work yet, just recordArray[i]
directly.
We now generate array operations on all records in Model_functions.h but we should generate it just for records that actually appear in any arrays.
comment:7 by , 11 years ago
Fixed in r16536.
Multi-dimensional arrays of records need more support for default values. Right now default values handled only for one dimensional arrays of records. I think if needed we can handle those manually for 2 or 3 dimensions. I don't think anyone uses >3 dimensional arrays of records anyway.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
comment:9 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Fix breaks MetaModelica tests
comment:10 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in r16552 by Mahder.
Any progress on this? If not, maybe I can have a look.