Files
JuliaFEM.jl/src/types.jl
T
Jukka Aho 3d3e9bb441 Calculate shape functions using FEMBasis.jl
A lot of code is moved to FEMBasis.jl regarding
calculating basis / shape functions of finite elements.

* add FEMBasis to REQUIRE
* remove obsolete files
* remove obsolete test files
* make integration point iterable
* loosen type definitions
* get length of element rather from basis than connectivity
* calculate midpoint of reference element
* wrong input argument to eval_basis! fixed
2017-08-05 12:03:05 +03:00

72 lines
1.5 KiB
Julia

# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
const Node = Vector{Float64}
abstract type AbstractPoint end
type Point{P<:AbstractPoint}
id :: Int
weight :: Float64
coords :: Vector{Float64}
fields :: Dict{AbstractString, Field}
properties :: P
end
function setindex!{T}(point::Point, val::Pair{Float64, T}, field_name)
point.fields[field_name] = Field(val)
end
function getindex(point::Point, field_name)
return point.fields[field_name]
end
function getindex(point::Point, idx::Int)
return point.coords[idx]
end
function haskey(point::Point, field_name)
return haskey(point.fields, field_name)
end
function (point::Point)(field_name, time=0.0)
point.fields[field_name](time).data
end
function start(point::Point)
return start(point.coords)
end
function done(point::Point, i)
return done(point.coords, i)
end
function next(point::Point, i)
return next(point.coords, i)
end
function update!{T}(point::Point, field_name, val::Pair{Float64, T})
if haskey(point, field_name)
update!(point[field_name], val)
else
point[field_name] = val
end
end
#= TODO: in future
type Node <: AbstractPoint
end
type MaterialPoint <: AbstractPoint
end
=#
type IntegrationPoint <: AbstractPoint
end
const IP = Point{IntegrationPoint}
function IP(id, weight, coords)
return IP(id, weight, [c for c in coords], Dict(), IntegrationPoint())
end