JuliaFEM / FEMBase.jl

JuliaFEM base package (core functionality)
http://juliafem.org/
MIT License
16 stars 9 forks source link

Consider using symbols instead of strings for fields #38

Open KristofferC opened 6 years ago

KristofferC commented 6 years ago

Currently, fields are indexed using Strings (haskey(element, "flux")). For cases like this, using Symbols is usually better since Symbols are interned and therefore represented by their pointer. This means comparing symbols is just a pointer comparison and hashing them is faster than for strings. For example, the columns in a DataFrame are indexed using Symbols.

ahojukka5 commented 6 years ago

We have had discussions about this subject a couple of times in Gitter. I think we generally agree it would be better to use symbols. We could still have things like update!(elements, "my data", 1.0) syntax for user-friendliness, and string is converted to a symbol.

ahojukka5 commented 6 years ago

Also, going towards more explicit syntax, maybe it would be good to have update_integration_points!, update_element!, update_problem!, update_analysis! and so on to make clear for which structure are fields going to be updated.