I feel I am missing a simpler approach to replicating the behaviour of a 
Matlab structure. I am doing FEM, and require structure like behaviour for 
my model initialisation and mesh generation. Currently I am using composite 
type definitions, such as:

type Mesh
    coords       :: Array{Float64,2}      
    elements   :: Array{Float64,2}      
end

but in actuality I have many required fields (20 for Mesh, for example). It 
seems to me very impractical to initialise an instance of Mesh via

mesh = Mesh(field1, field2, field3, ..., field20),

as this would require a lookup of the type definition every time to ensure 
correct ordering. None of my fields have standard "default" values.

Is there an easier way to do this that I have overlooked? In Matlab I can 
just define the fields as I compute their values, using "Mesh.coords = 
...", and this would work here except that I need to initialise Mesh before 
the "." field referencing will work.

First post, so apologies if I have failed to observe etiquette rules. 

Reply via email to