Skip to content

Commit cae2d1f

Browse files
committed
Update documentation of FieldMatrix and FieldArray
1 parent 15ddb8d commit cae2d1f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/FieldArray.jl

+11-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ For example:
2727
yyyy::Float64
2828
end
2929
30-
Do note that `FieldArray` and its derivatives are column major.
30+
Note that you must define the fields of any `FieldArray` subtype in column major order. If you
31+
want to use an alternative ordering you will need to pay special attention in providing your
32+
own definitions of `getindex`, `setindex!` and tuple conversion.
3133
"""
3234
abstract type FieldArray{N, T, D} <: StaticArray{N, T, D} end
3335

@@ -53,7 +55,8 @@ For example:
5355
zz::Float64
5456
end
5557
56-
Do note that `FieldMatrix` and its derivatives are column major. Constructing Stress like this
58+
Note that the fields of any subtype of `FieldMatrix` must be defined in column major order.
59+
This means that formatting of constructors for literal `FieldMatrix` can be confusing. For example
5760
5861
sigma = Stress(1.0, 2.0, 3.0,
5962
4.0, 5.0, 6.0,
@@ -65,7 +68,12 @@ Do note that `FieldMatrix` and its derivatives are column major. Constructing St
6568
3.0 6.0 9.0
6669
6770
68-
will give you the transpose of what the multi-argument formatting suggests.
71+
will give you the transpose of what the multi-argument formatting suggests. For clarity,
72+
you may consider using the alternative
73+
74+
sigma = Stress(@SArray[1.0 2.0 3.0;
75+
4.0 5.0 6.0;
76+
7.0 8.0 9.0])
6977
"""
7078
abstract type FieldMatrix{N1, N2, T} <: FieldArray{Tuple{N1, N2}, T, 2} end
7179

0 commit comments

Comments
 (0)