Skip to content

Commit

Permalink
Clarify heterogenous array of records. (#2769)
Browse files Browse the repository at this point in the history
* Clarify heterogenous array of records.
Closes #2282
  • Loading branch information
HansOlsson committed Dec 16, 2020
1 parent 54de6bb commit 0c684e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chapters/arrays.tex
@@ -1,7 +1,10 @@
\chapter{Arrays}\label{arrays}

An array can be regarded as a collection of values, all of the same
type. Modelica arrays can be multidimensional and are ``rectangular'',
A non-record array can be regarded as a collection of type compatible values, \cref{type-compatible-expressions}.
An array of records may contain scalar record values whose elements differ in their dimension sizes, but apart from that they must be of the same type.
Such heterogenous arrays may only be used completely, sliced as specified, or indexed.
An array of arrays must have the same dimension sizes for all of the arrays (with the same exception for records).
Modelica arrays can be multidimensional and are ``rectangular'',
which in the case of matrices has the consequence that all rows in a
matrix have equal length, and all columns have equal length.

Expand Down
2 changes: 2 additions & 0 deletions chapters/interface.tex
Expand Up @@ -605,6 +605,8 @@ \section{Type Compatible Expressions}\label{type-compatible-expressions}
the same named elements. The type compatible expression is a record
comprised of named elements that are compatible with the corresponding
named elements of both \lstinline!A! and \lstinline!B!.
In an array expression the two records may contain elements with different sizes, but apart from that they must be of compatible types.
That generates a heterogenous array of records, see \cref{array}.
\item
If \lstinline!A! is an array expression then \lstinline!B! must also be an array expression, and \lstinline!ndims(A)! = \lstinline!ndims(B)!. The type compatible expression is an array expression with elements compatible with the elements of both \lstinline!A! and \lstinline!B!. If both \lstinline!size(A)! and \lstinline!size(B)! are known and \lstinline!size(A)! = \lstinline!size(B)! then this defines the size of the type compatible expression, otherwise the size of the expression is not known until the expression is about to be evaluated. In case of an if-expression the size of the type compatible expression is defined based on the branch selected, and for other cases \lstinline!size(A)! = \lstinline!size(B)! must hold at this point.
\item
Expand Down

0 comments on commit 0c684e4

Please sign in to comment.