mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-10-03 14:47:55 +00:00
new style dict field, xdmf improvements
This commit is contained in:
+20
-3
@@ -97,11 +97,24 @@ end
|
||||
function Field{T}(data::Pair{Float64, T}...)
|
||||
return DCTV([Increment{T}(d[1], d[2]) for d in data])
|
||||
end
|
||||
|
||||
#=
|
||||
function Field{T}(data::Pair{Float64, Vector{T}}...)
|
||||
return DVTV([Increment{Vector{T}}(d[1], d[2]) for d in data])
|
||||
end
|
||||
|
||||
function Field{T}(data::Pair{Float64, Dict{Int64, T}}...)
|
||||
return DVTV([Increment{Dict{Int64, T}}(d[1], d[2]) for d in data])
|
||||
end
|
||||
=#
|
||||
|
||||
function Field{T<:Union{Vector, Dict}}(data::Pair{Float64, T}...)
|
||||
return DVTV([Increment{T}(d[1], d[2]) for d in data])
|
||||
end
|
||||
|
||||
function Field(data::Dict)
|
||||
return DVTI(data)
|
||||
end
|
||||
|
||||
function convert{T}(::Type{DCTV}, data::Pair{Real, Vector{T}}...)
|
||||
return DCTV([Increment{Vector{T}}(d[1], d[2]) for d in data])
|
||||
end
|
||||
@@ -222,11 +235,11 @@ function Base.(:*)(N::Matrix, f::DCTI)
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# Multiply DVTI field with another vector T. Vector length
|
||||
# must match to the field length and this can be used mainly
|
||||
# for interpolation purposes, i.e., u = ∑ Nᵢuᵢ
|
||||
#
|
||||
#
|
||||
function Base.(:*)(T::Vector, f::DVTI)
|
||||
@assert length(T) == length(f)
|
||||
return sum([T[i]*f[i] for i=1:length(f)])
|
||||
@@ -430,3 +443,7 @@ end
|
||||
function keys(field::DVTV)
|
||||
return Float64[increment.time for increment in field]
|
||||
end
|
||||
|
||||
function setindex!(field::Field, val, idx::Int64)
|
||||
field.data[idx] = val
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user