mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-06 04:21:33 +00:00
3d3e9bb441
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
72 lines
1.5 KiB
Julia
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
|