Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fields with dictionaries is not consistent #56

Open
ahojukka5 opened this issue Apr 12, 2019 · 0 comments
Open

Update fields with dictionaries is not consistent #56

ahojukka5 opened this issue Apr 12, 2019 · 0 comments

Comments

@ahojukka5
Copy link
Member

I just realized that we have two kinds of results when updating fields with dictionaries. First one, when we already have a DVTV field, and then update with dictionary:

using FEMBase
T = Dict(1 => 1.0, 2 => 2.0)
element = Element(Seg2, (1, 2))
update!(element, "temperature", 0.0 => (0.0, 0.0))
update!(element, "temperature", 1.0 => T)
element.fields["temperature"]

# output

DVTV{2,Float64}(Pair{Float64,Tuple{Float64,Float64}}[0.0=>(0.0, 0.0), 1.0=>(1.0, 2.0)])

However, if we create a a new field:

update!(element, "temperature2", 0.0 => T)
element.fields["temperature2"]

# output

DVTVd{Float64}(Pair{Float64,Dict{Int64,Float64}}[0.0=>Dict(2=>2.0,1=>1.0)])

It cannot be like this. For sure this is causing confusion. Because it is very unlikely that the user actually wants to create DVTVd, we should always have DVTV and creating DVTVd should need some special attention, maybe

temp_field = field(0.0 => T)
update!(element, "temperature", temp_field)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant