I tried to create an Array from a single field of a type Array:
> type T1
a::Int
b::Int
end
> v=T1[T1(1,2),T1(10,20),T1(100,200)]
3-element T1 Array:
T1(1,2)
T1(10,20)
T1(100,200)
> v[:].a
type Array has no field a
--
The above construct is useful when one has to work with several moderately complex Bragg reflection lists as:
... and the number of separate arrays would quickly blow up.
What is your present suggestion for the overloadable . notation ?
Stefan, thank you for the explaining the present options.
Jeff, many thanks for the menu of present and future solutions !
I do not know DataFrames.
Some additional explanation would be welcome.
For now, I choose the most straightforward option of
function + array comprehension, even at the cost of copying.
The yet not-planned StructArrays would also be fine,
because in this case the speed of single element access
is less important than the speed of array access.
The planned FieldSlice option seems to be the ideal solution.
As I understand it, it is in the same league as SubArrays
which also avoid copies and are already very useful.
Before doing anything, it might be worth checking
how Fortran compilers handle this situation efficiently.
--
type(TT) :: v(3)
v(1) = TT(1,10,100)
v(2) = TT(2,20,200)
v(3) = TT(3,30,300)
print *, v(:)%k
I could not get closer than Section 6.13 of the Metcalf-Cohen-Read book,
but I also asked help on the Fortran mailing list.
The answers by Richard Maine (a well-known expert) are:
https://groups.google.com/forum/#!topic/comp.lang.fortran/yao-8SLny0s
https://groups.google.com/forum/#!topic/comp.lang.fortran/V55Hk_Xa1to
On Saturday, September 8, 2012 8:19:26 PM UTC+2, Jeff Bezanson wrote:
--
Tom: Many thanks for the quick intro on DataFrames !
I will surely try to put it in my active vocabulary.
Stefan: Modern Fortran (90/95/2003/2008) is much better than its reputation in the CS community. Some similarity to its syntax is not a bad thing either.