mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-06 04:21:33 +00:00
Implement new function add_elements!
Add new elements to the problem.
This commit is contained in:
+1
-1
@@ -78,7 +78,7 @@ export add!, SparseMatrixCOO, SparseVectorCOO, get_nonzero_rows, get_nonzero_col
|
||||
include("problems.jl") # common problem routines
|
||||
export Problem, AbstractProblem, FieldProblem, BoundaryProblem,
|
||||
get_unknown_field_dimension, get_gdofs, Assembly,
|
||||
get_parent_field_name, get_elements
|
||||
get_parent_field_name, get_elements, add_elements!
|
||||
|
||||
include("problems_elasticity.jl")
|
||||
export Elasticity
|
||||
|
||||
+12
-1
@@ -8,7 +8,7 @@ abstract type MixedProblem<:AbstractProblem end
|
||||
|
||||
"""
|
||||
General linearized problem to solve
|
||||
(K₁+K₂)Δu + C1'*Δλ = f₁+f₂
|
||||
(K₁+K₂)Δu + C1*Δλ = f₁+f₂
|
||||
C2Δu + D*Δλ = g
|
||||
"""
|
||||
type Assembly
|
||||
@@ -274,6 +274,17 @@ function update!{P<:BoundaryProblem}(problem::Problem{P}, assembly::Assembly, el
|
||||
end
|
||||
end
|
||||
|
||||
"""
|
||||
add_elements!(problem::Problem, elements)
|
||||
|
||||
Add new elements into the problem.
|
||||
"""
|
||||
function add_elements!(problem::Problem, elements)
|
||||
for element in elements
|
||||
push!(problem.elements, element)
|
||||
end
|
||||
end
|
||||
|
||||
function get_elements(problem::Problem)
|
||||
return problem.elements
|
||||
end
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# This file is a part of JuliaFEM.
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
||||
|
||||
using JuliaFEM
|
||||
using Base.Test
|
||||
|
||||
@testset "add elements to problem" begin
|
||||
problem = Problem(Elasticity, "test", 2)
|
||||
element = Element(Quad4, [1, 2, 3, 4])
|
||||
elements = [element]
|
||||
add_elements!(problem, elements)
|
||||
@test problem.elements[1] == element
|
||||
end
|
||||
Reference in New Issue
Block a user