Bruce,
I'm with Rob. Any (good) XML parser automatically counts the number of
subelements of a particular type and returns that number when requested
(e.g. getLength() in Xerces-C used by Janus) or allows you to iterate
through the list without (e.g. "for i in vars:" in various XML modules
in Python). The dimensions attribute would only add redundancy that
isn't helpful if it is correct and causes errors if it is wrong (or
maybe just confusion: if "dimensions" is 3 and there are only two <dim>
elements, should the third dimension be assumed to be length 1?).
I do agree that <dim> and not dim1, etc. is the way to go.
An alternative that makes it look a little closer (in style) to how
<breakpointRefs>/<bpRef> is used in <griddedTableDef> would be
<variableDef name="myDataMatrixr_m" varID="myDataMatrix" units="m">
<dimensions>
<dim>2</dim>
<dim>6</dim>
<dim>3</dim>
</dimensions>
<initialValue>
...
Although I don't know if that really adds anything useful.
Again, the parser will easily know the number of <dim> elements, so it
will easily figure out whether it is a scalar or a vector/array. Note
that the parser already has to count such things in the
<breakpointRefs>/<bpRef> system.
Of course the real fun of the vector/array will be the mux/demux,
subreferencing, and MathML connections. Examples:
1) Can an initialValue of an array be one or more previously defined
variables? (scalars, vectors or arrays)
2) Can elements of an array be referenced by scalar variables?
array: eulerAngle_d(3)
scalars: rollEulerAngle_d, pitchEulerAngle_d, yawEulerAngle_d
3) Just for fun: 0-based (C) or 1-based (Fortran) indices?
Dennis
---
Dennis J. Linse, Aerospace Engineer
Science Applications International Corporation
+1-703-294-4449 <mailto:[EMAIL PROTECTED]>
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bruce Jackson
Sent: Thursday, March 13, 2008 8:17 AM
To: Curtin, Robert (Contractor)
Cc: Aerospace Sim Standard discussion group
Subject: Re: arrayDef & draft simstd comments
Rob,
I need to find some time to review your wonderfully rich suggestions
in depth, but I had a rationale for adding a "dimensions" attribute:
without it, a parser will have to count the number of <dim> elements
to determine how many dimensions are required. Plus, it serves as a
check to make sure the two counts match.
Also, I am trying to avoid names like dim1, dim2, dim3, etc... This
implies a parser would be limited in how many dimensions it is
required to look for (up to dim199?).
Good catch on the naming for the initialValue - it does need to be
consistent with the current element definition. And it may be a good
idea to reuse variableDef in place of a new arrayDef element. In this
case, the presence of a "dimensions" attribute (with a value other
than 1) would clue the parser that the variable is not scalar.
I'm passing the comments about coordinate frames along to Bruce
Hildreth for his consideration, and I expect we'll be getting back to
you; I think you have some very valid points from the perspective of
an implementer.
Thanks again, and enjoy your Fall (as we are enjoying Spring),
-- Bruce
On Mar 12, 2008, at 6:40 PM, Curtin, Robert (Contractor) wrote:
> Hi Bruce,
>
> You suggestion looks good. The "dimensions" attribute would be
> unnecessary, as it's defined by the number of <dim> elements, in the
> same way that a gridded table's dimensional size is specified by the
> number of <independentVarRef> (and also <bpRef>) elements.
>
> I'd keep <initialValue> singular to avoid confusion. I'd also carry
> across the optional "axisSystem" attribute, for use with arrays that
> define cartesian vectors/tensors. In fact, could we do all this using
> the existing <variableDef> element, by adding the appropriate
> subelements & rules?
>
>
[...]
>
> Cheers, Rob
>
>
> Rob Curtin
> QinetiQ Consulting
> on contract to Air Vehicles Division,
> Defence Science & Technology Organisation
> Tel: +61 (0)3 9626 7730
>
>
> -----Original Message-----
> From: Bruce Jackson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 12 March 2008 11:20 PM
> To: Brian, Geoff
> Cc: Aerospace Sim Standard discussion group
> Subject: Re: Matrix and Vector definitions for DaveML
>
> Geoff,
>
> This is a needed improvement to DAVE-ML.
>
> My first thought is the arrayDef attribute should be something like
> 'dimensions="3"' and then a (set) of subelements that define the
> actual
> dimensions:
>
> <arrayDef name="myDataMatrixr_m" varID="myDataMatrix" units="m"
> dimensions="3">
> <dim>2</dim>
> <dim>6</dim>
> <dim>3</dim>
> <description>My Data Matrix is a 2x6x3 matrix; the last dimension
> changes most rapidly</description>
> <initialValues>
> 111 112 113 <!-- the actual order is important, not the
> way the
> data is formatted -->
> 121 122 123
> 131 132 133
> 141 142 143
> 151 152 153
> 161 162 163
> <!-- second plane shows another valid way of listing a 6x3
> matrix -->
> 211 212 213 221 222 223 231 232 233 241 242 243 251 252
> 253 261 262 263 <!-- whitespace is unimportant
> -->
> </initialValues>
> </arrayDef>
>