Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the minor fixes #509

Merged
merged 22 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/cantilever/cantilever.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function structure()
# Mesh
# -------------
x_coords = range(0, L, N + 1)
nodes = [Node(xi, 0.0, 0.0) for xi in x_coords]
nodes = [Node(promote(xi, 0, 0.0)) for xi in x_coords] # to be safe when arguments supplied to Node command are not of same types
S = Rectangle(h, b)
frames = [Frame(nodes[j], nodes[j + 1], S) for j in 1:(length(nodes) - 1)]
mesh = Mesh(; nodes=nodes, elements=frames)
Expand Down
5 changes: 3 additions & 2 deletions src/Entities/Entities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ abstract type AbstractFace{dim,T} <: AbstractEntity{dim,T} end
"Return the `AbstractFace` `f` area."
function area(f::AbstractFace) end

"Return the `AbstractFace` `f` normal."
"Return the `AbstractFace` `f` normal direction."
function normal_direction(f::AbstractFace) end

## =================
Expand All @@ -109,6 +109,7 @@ An `AbstractElement` object facilitates the process of evaluating:
- The mechanical stresses and strains.

**Abstract Methods**
* [`cross_section`](@ref)
* [`coordinates`](@ref)
* [`dimension`](@ref)
* [`dofs`](@ref)
Expand Down Expand Up @@ -196,7 +197,7 @@ Cache for internal forces computations.
"""
abstract type AbstractElementCache end

"Fallbaack cache for any element."
"Fallback cache for any element."
elements_cache(::Type{<:AbstractElement}) = nothing

"""
Expand Down
28 changes: 12 additions & 16 deletions src/Entities/Nodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,24 @@ function Base.show(io::IO, ::MIME"text/plain", n::Node)
println("• Node at $(n.x) and dofs $(n.dofs)")
end

"1D node constructor with one dim coordinates."
function Node(x₁::T, dofs::Dictionary=Dictionary{Field,Vector{Dof}}()) where {T<:Real}
Node(Point(x₁), dofs)
end

"2D node constructor with two coordinates."
function Node(x₁::T, x₂::T, dofs::Dictionary=Dictionary{Field,Vector{Dof}}()) where {T<:Real}
Node(Point(x₁, x₂), dofs)
end

"3D node constructor with coordinates."
function Node(x₁::T, x₂::T, x₃::T,
dofs::Dictionary=Dictionary{Field,Vector{Dof}}()) where {T<:Real}
Node(Point(x₁, x₂, x₃), dofs)
end

"Node constructor with a `NTuple`."
function Node(t::NTuple{dim,T},
dofs::Dictionary=Dictionary{Field,Vector{Dof}}()) where {dim,T<:Real}
Node(Point(t), dofs)
end

"`Node` constructor to promote types of coordinates of Point"
function Node(t)
dofs = if length(t) > 1 && t[end] isa Dictionary
t[end]
else
Dictionary{Field,Vector{Dof}}()
end
coords = length(t) > 1 ? t[1:(end - 1)] : (t)
Node(promote(coords)..., dofs)
end


"`Node` constructor with an `AbstractVector` data type."
function Node(v::AbstractVector{T},
dofs::Dictionary=Dictionary{Field,Vector{Dof}}()) where {T<:Real}
Expand Down
2 changes: 1 addition & 1 deletion src/StructuralAnalyses/LinearStaticAnalyses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

function Base.show(io::IO, sa::LinearStaticAnalysis)
println("LinearStaticAnalysis for:")
println("• Current load factor $(sa.current_step))/$(length(load_factors(sa))).")
println("• Current load factor $(sa.current_step)/$(length(load_factors(sa))).")

Check warning on line 71 in src/StructuralAnalyses/LinearStaticAnalyses.jl

View check run for this annotation

Codecov / codecov/patch

src/StructuralAnalyses/LinearStaticAnalyses.jl#L71

Added line #L71 was not covered by tests
show(io, sa.s)
show(io, sa.state)
end
Expand Down
2 changes: 1 addition & 1 deletion src/StructuralAnalyses/StaticStates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ end
"Default constructor for static state given an structure and iteration state."
function FullStaticState(s::AbstractStructure,
iter_state::ResidualsIterationStep=ResidualsIterationStep(),
linear_solver=DEFAULT_LINEAR_SOLVER())
linear_solver=DEFAULT_LINEAR_SOLVER)
n_dofs = num_dofs(s)
n_fdofs = num_free_dofs(s)
Uᵏ = zeros(n_dofs)
Expand Down
2 changes: 1 addition & 1 deletion src/StructuralSolvers/StructuralSolvers.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Module defining structural solvers that can be used to solved different analyses.
Each solver consists of a data type with a convergence criterion and a the iteration status.
Each solver consists of a data type with a convergence criterion and the iteration status.
A step! method is used to perform a single iteration step.
"""
module StructuralSolvers
Expand Down
Loading