Skip to content

Commit

Permalink
add test of constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed Sep 28, 2023
1 parent 09e5672 commit 14c917c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/FESetL2BeamModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ end
Constructor.
Supply the total number of elements in the set, and the cross-section definition.
Supply the total number of elements in the set, and the cross-section
definition. The parameters of the section are assumed to be uniform along the
set of the beam elements.
"""
function FESetL2Beam(N::IT, crosssection::CT) where {IT<:Integer, CT}
par = crosssection.parameters(0.0)
N = size(conn, 1)
_A = fill(par.A, N)
_I1 = fill(par.I1, N)
_I2 = fill(par.I2, N)
Expand Down Expand Up @@ -70,11 +71,12 @@ function cat(self::T, other::T) where {T<:FESetL2Beam}
end

"""
subset(self::T, L::FIntVec) where {T<:FESetL2Beam}
subset(self::T, L::IT) where {T<:FESetL2Beam, IT}
Subset of a beam-element set.
"""
function subset(self::T, L::FIntVec) where {T<:FESetL2Beam}
function subset(self::T, L::IT) where {T<:FESetL2Beam, IT}
@info "Here"
result = deepcopy(self)
result.A = self.A[L]
result.I1 = self.I1[L]
Expand Down
59 changes: 56 additions & 3 deletions test/test_beam_mesh.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module m2
module mframe1
using FinEtools
using FinEtoolsFlexStructures.FESetL2BeamModule: FESetL2Beam
using FinEtoolsFlexStructures.CrossSectionModule: CrossSectionCircle
Expand All @@ -18,6 +18,59 @@ function test()
@test count(fes) == 20
true
end
test()
end

module mframe2
using FinEtools
using FinEtoolsFlexStructures.FESetL2BeamModule: FESetL2Beam
using FinEtoolsFlexStructures.CrossSectionModule: CrossSectionCircle
using FinEtoolsFlexStructures.MeshFrameMemberModule: frame_member
using Test
function test()
L = 42
xyz = [0 0 0;
0 L/4 L*1/4;
L/4 L/4 L*2/4;
L/4 0 L*3/4;
0 0 L]
nL = 20

cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0])
fens, fes = frame_member(xyz, nL, cs)
@test count(fes) == 20

cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0])
fens, fes = frame_member(xyz, nL, cs)
list = 1:2
fes = subset(fes, list)
accepttodelegate(fes, subset(fes.delegateof, list))
@test count(fes) == 2
@show fes
true
end
test()
end

module mframe3
using FinEtools
using FinEtoolsFlexStructures.FESetL2BeamModule: FESetL2Beam
using FinEtoolsFlexStructures.CrossSectionModule: CrossSectionCircle
using FinEtoolsFlexStructures.MeshFrameMemberModule: frame_member
using Test
function test()
L = 42
xyz = [0 0 0;
0 L/4 L*1/4;
L/4 L/4 L*2/4;
L/4 0 L*3/4;
0 0 L]
nL = 20

cs = CrossSectionCircle(s -> 5.9910, s -> [0.0, 0.0, 1.0])
fes = FESetL2Beam(nL, cs)
@show fes
true
end
test()
end
using .m2
m2.test()

0 comments on commit 14c917c

Please sign in to comment.