mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-17 09:12:09 +00:00
More functionality in api
This commit is contained in:
@@ -67,7 +67,6 @@ end
|
||||
Parse elements from input.
|
||||
"""
|
||||
function parse_section(model::Model, lines, key, idx_start, idx_end, ::Type{Val{:ELEMENT}})
|
||||
# LISÄÄ TOIMINTO, ETTÄ VOI LUKEA SUORAAN ELSETIT
|
||||
definition = uppercase(lines[idx_start])
|
||||
element_type = regex_match(r"TYPE=([\w\-\_]+)", definition, 1)
|
||||
eltype_sym = symbol(element_type)
|
||||
|
||||
+41
-8
@@ -3,12 +3,16 @@
|
||||
|
||||
abstract BoundaryCondition
|
||||
|
||||
type NeumannBC <: BoundaryCondition
|
||||
value
|
||||
type NeumannBC{ S <: AbstractString} <: BoundaryCondition
|
||||
definition :: S
|
||||
value :: Any
|
||||
set_name :: S
|
||||
end
|
||||
|
||||
type DirichletBC <: BoundaryCondition
|
||||
|
||||
type DirichletBC{ S <: AbstractString } <: BoundaryCondition
|
||||
definition :: S
|
||||
value :: Any
|
||||
set_name :: S
|
||||
end
|
||||
|
||||
typealias DisplacementBC DirichletBC
|
||||
@@ -73,11 +77,16 @@ end
|
||||
|
||||
ElementSet(name, el_ids) = ElementSet(name, el_ids, Material())
|
||||
|
||||
type LoadCase{ T <: AbstractProblem }
|
||||
problem :: T
|
||||
boundary_conditions :: Vector{BoundaryProblem}
|
||||
type LoadCase{ P <: Problem }
|
||||
problem :: P
|
||||
boundary_conditions :: Vector{Union{NeumannBC, DirichletBC}}
|
||||
end
|
||||
|
||||
LoadCase{P <: Problem}(a :: P) = LoadCase(a, Vector{Union{NeumannBC,DirichletBC}}())
|
||||
LoadCase{P <: Problem, B <: BoundaryCondition}(a :: P, b :: B) = LoadCase(a, Vector{Union{NeumannBC,DirichletBC}}([b]))
|
||||
LoadCase{P <: Problem, B <: BoundaryCondition}(a :: P, b :: Vector{B}) =
|
||||
LoadCase(a, Vector{Union{NeumannBC,DirichletBC}}(b))
|
||||
|
||||
|
||||
"""
|
||||
"""
|
||||
@@ -91,7 +100,8 @@ end
|
||||
|
||||
Model() = Model(Node[],
|
||||
Element[],
|
||||
Dict{AbstractString, Union{NodeSet, ElementSet}}(),
|
||||
Dict{AbstractString,
|
||||
Union{NodeSet, ElementSet}}(),
|
||||
LoadCase[],
|
||||
)
|
||||
|
||||
@@ -100,6 +110,29 @@ function set_material!{S <: AbstractString}(model::Model, material::Material, se
|
||||
end
|
||||
|
||||
|
||||
function get_element_set(model::Model, set_name::ASCIIString)
|
||||
get_set = model.sets[set_name]
|
||||
isa(get_set, ElementSet) ? get_set : err("Found set $(set_name)
|
||||
but it is not a ElementSet. Check if you have used
|
||||
dublicate set names.")
|
||||
end
|
||||
|
||||
function add_boundary_condition!{B <: BoundaryCondition}(case::LoadCase, bc::B)
|
||||
push!(case.boundary_conditions, bc)
|
||||
end
|
||||
|
||||
function add_boundary_condition!{B <: BoundaryCondition}(case::LoadCase, bc::Vector{B})
|
||||
map(x-> push!(case.boundary_conditions, x), bc)
|
||||
end
|
||||
|
||||
function add_loadcase!(model::Model, case::LoadCase)
|
||||
push!(model.load_cases, case)
|
||||
end
|
||||
|
||||
function add_loadcase!{T<:LoadCase}(model::Model, case::Vector{T})
|
||||
map(x-> push!(model.load_cases, x), case)
|
||||
end
|
||||
|
||||
"""
|
||||
"""
|
||||
function build_core_elements()
|
||||
|
||||
Reference in New Issue
Block a user