Posts from first timers are moderated to eliminate spam. If someone doesn't get to it right away, the poster often thinks that it didn't go through and posts it again. We might make it a policy that if someone sees redundant posts from the same individual when moderating, that they only post one of them.
Cheers, Kevin On Sat, Jun 20, 2015 at 9:34 PM, Tony Kelman <t...@kelman.net> wrote: > I see this was double-posted and got plenty of good responses at > https://groups.google.com/forum/#!topic/julia-users/Z5WlHpRWLho - might > be best to delete this redundant thread. > > > On Saturday, June 20, 2015 at 9:32:14 PM UTC-7, Tony Kelman wrote: >> >> You can define an inner constructor that performs incomplete >> initialization using new(), see >> http://docs.julialang.org/en/release-0.3/manual/constructors/#incomplete-initialization >> >> Then you can do >> mesh = Mesh() >> mesh.coords = ... >> >> and so on. >> >> >> On Saturday, June 20, 2015 at 12:42:55 PM UTC-7, Stef Kynaston wrote: >>> >>> 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. >>> >>