Skip to content
Open
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
4 changes: 2 additions & 2 deletions ext/TopOptMakieExt/TopOptMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function TopOpt.visualize(
# https://jkrumbiegel.github.io/MakieLayout.jl/v0.3/layoutables/#LScene-1
# https://makie.juliaplots.org/stable/cameras.html#D-Camera
# ax1 = layout[1, 1] = LScene(scene, camera = cam3d!, raw = false)
ax1 = LScene(fig[1, 1]; scenekw=(camera=cam3d!, raw=false)) # , height=750
ax1 = LScene(fig[1, 1]; scenekw=(camera=(cam3d!), raw=false)) # , height=750
end

# * support / load appearance / deformatione exaggeration control
Expand Down Expand Up @@ -417,7 +417,7 @@ function TopOpt.visualize(
# ax1.aspect = AxisAspect(1)
ax1.aspect = DataAspect()
else
ax1 = LScene(fig[1, 1]; scenekw=(camera=cam3d!, raw=false)) #, height=750)
ax1 = LScene(fig[1, 1]; scenekw=(camera=(cam3d!), raw=false)) #, height=750)
end

# * linewidth scaling / support / load appearance / deformatione exaggeration control
Expand Down
4 changes: 2 additions & 2 deletions src/CheqFilters/density_filter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function DensityFilter(
return DensityFilter(Val(filtering), solver, args...)
end
function DensityFilter(
::Val{true}, solver::TS, rmin::T, ::Type{TI}=Int
::Val{true}, solver::TS, rmin::T, (::Type{TI})=Int
) where {T,TI<:Integer,TS<:AbstractFEASolver}
metadata = FilterMetadata(solver, rmin, TI)
TM = typeof(metadata)
Expand All @@ -36,7 +36,7 @@ function DensityFilter(
end

function DensityFilter(
::Val{false}, solver::TS, rmin::T, ::Type{TI}=Int
::Val{false}, solver::TS, rmin::T, (::Type{TI})=Int
) where {T,TS<:AbstractFEASolver,TI<:Integer}
metadata = FilterMetadata(T, TI)
jacobian = zeros(T, 0, 0)
Expand Down
4 changes: 2 additions & 2 deletions src/CheqFilters/sens_filter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function SensFilter(::Val{filtering}, solver::AbstractFEASolver, args...) where
return SensFilter(Val(filtering), solver, args...)
end
function SensFilter(
::Val{true}, solver::TS, rmin::T, ::Type{TI}=Int
::Val{true}, solver::TS, rmin::T, (::Type{TI})=Int
) where {T,TI<:Integer,TS<:AbstractFEASolver}
metadata = FilterMetadata(solver, rmin, TI)
TM = typeof(metadata)
Expand All @@ -47,7 +47,7 @@ function SensFilter(
end

function SensFilter(
::Val{false}, solver::TS, rmin::T, ::Type{TI}=Int
::Val{false}, solver::TS, rmin::T, (::Type{TI})=Int
) where {T,TS<:AbstractFEASolver,TI<:Integer}
elementinfo = solver.elementinfo
metadata = FilterMetadata(T, TI)
Expand Down
2 changes: 1 addition & 1 deletion src/FEA/assembly_cg_displacement_solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function PCGDisplacementSolver(
end

function (s::PCGDisplacementSolver{T})(
::Type{Val{safe}}=Val{false};
(::Type{Val{safe}})=Val{false};
assemble_f=true,
rhs=assemble_f ? s.globalinfo.f : s.rhs,
lhs=assemble_f ? s.u : s.lhs,
Expand Down
4 changes: 2 additions & 2 deletions src/FEA/direct_displacement_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function DirectDisplacementSolver(
)
end
function (s::DirectDisplacementSolver{T})(
::Type{Val{safe}}=Val{false},
::Type{newT}=T;
(::Type{Val{safe}})=Val{false},
(::Type{newT})=T;
assemble_f=true,
reuse_fact=false,
rhs=assemble_f ? s.globalinfo.f : s.rhs,
Expand Down
13 changes: 8 additions & 5 deletions src/Functions/trace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct TraceEstimationMean{TF,TV,TM} <: AbstractTraceEstimationMeanMethod
sample_method::TM
end
function TraceEstimationMean(
F::SparseMatrixCSC, nv::Int, sample_once::Bool=true, sample_method=hutch_rand!
F::SparseMatrixCSC, nv::Int, sample_once::Bool=true, sample_method=(hutch_rand!)
)
V = zeros(eltype(F), size(F, 2), nv)
sample_method(V)
Expand All @@ -56,7 +56,7 @@ struct TraceEstimationSVDMean{TUS,TV,TM} <: AbstractTraceEstimationMeanMethod
sample_method::TM
end
function TraceEstimationSVDMean(
F::SparseMatrixCSC, nv::Int, sample_once::Bool=true, sample_method=hutch_rand!
F::SparseMatrixCSC, nv::Int, sample_once::Bool=true, sample_method=(hutch_rand!)
)
US = ExactSVDMean(F).US
V = zeros(eltype(F), size(US, 2), nv)
Expand All @@ -65,7 +65,10 @@ function TraceEstimationSVDMean(
return TraceEstimationSVDMean(US, size(F, 2), V, sample_once, sample_method)
end
function TraceEstimationSVDMean(
F::SparseMatrixCSC, V::AbstractMatrix, sample_once::Bool=true, sample_method=hutch_rand!
F::SparseMatrixCSC,
V::AbstractMatrix,
sample_once::Bool=true,
sample_method=(hutch_rand!),
)
US = ExactSVDMean(F).US
sample_once = sample_method === hadamard! || sample_once
Expand Down Expand Up @@ -130,7 +133,7 @@ struct DiagonalEstimation{TF,TY,TQ,TV,Ttemp,TM} <: AbstractDiagonalEstimationMet
sample_method::TM
end
function DiagonalEstimation(
F::SparseMatrixCSC, nv::Int, nE::Int, sample_once::Bool=true, sample_method=hadamard!
F::SparseMatrixCSC, nv::Int, nE::Int, sample_once::Bool=true, sample_method=(hadamard!)
)
V = zeros(eltype(F), size(F, 2), nv)
sample_method(V)
Expand All @@ -145,7 +148,7 @@ function DiagonalEstimation(
V::AbstractMatrix,
nE::Int,
sample_once::Bool=true,
sample_method=hadamard!,
sample_method=(hadamard!),
)
nv = size(V, 2)
Y = zeros(eltype(F), size(F, 1), nv)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function extract_cells(file, ::Type{TI}=Int) where {TI}
function extract_cells(file, (::Type{TI})=Int) where {TI}
line = readline(file)

cell_idx_pattern = r"^(\d+)\s*,"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function extract_material(file, ::Type{TF}=Float64) where {TF}
function extract_material(file, (::Type{TF})=Float64) where {TF}
elastic_heading_pattern = r"\*ELASTIC"
Emu_pattern = r"(-?\d+\.?\d*)\s*,\s*(-?\d+\.?\d*)"
line = readline(file)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function extract_nodes(file, ::Type{TF}=Float64, ::Type{TI}=Int) where {TF,TI}
function extract_nodes(file, (::Type{TF})=Float64, (::Type{TI})=Int) where {TF,TI}
line = readline(file)

pattern = r"(\d+)\s*,\s*(-?\d+\.?\d*(e[-\+]?\d*)?)\s*,\s*(-?\d+\.?\d*(e[-\+]?\d*)?)\s*(,\s*(-?\d+\.?\d*(e[-\+]?\d*)?))?"
Expand Down
4 changes: 2 additions & 2 deletions src/TopOptProblems/elementinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Constructs an instance of `ElementFEAInfo` from a stiffness problem `sp` using a
The static matrices and vectors are more performant and GPU-compatible therefore they are used by default.
"""
function ElementFEAInfo(
sp, quad_order=2, ::Type{Val{mat_type}}=Val{:Static}
sp, quad_order=2, (::Type{Val{mat_type}})=Val{:Static}
) where {mat_type}
Kes, weights, dloads, cellvalues, facevalues = make_Kes_and_fes(
sp, quad_order, Val{mat_type}
Expand Down Expand Up @@ -124,7 +124,7 @@ end

Constructs an empty instance of `GlobalFEAInfo` where the field `K` is an empty sparse matrix of element type `T` and the field `f` is an empty dense vector of element type `T`.
"""
GlobalFEAInfo(::Type{T}=Float64) where {T} = GlobalFEAInfo{T}()
GlobalFEAInfo((::Type{T})=Float64) where {T} = GlobalFEAInfo{T}()
function GlobalFEAInfo{T}() where {T}
return GlobalFEAInfo(sparse(zeros(T, 0, 0)), zeros(T, 0), cholesky(one(T)), qr(one(T)))
end
Expand Down
8 changes: 5 additions & 3 deletions src/TopOptProblems/grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -511,15 +511,17 @@ function _QuadraticLGrid(
)
end

function TieBeamGrid(::Type{Val{CellType}}, ::Type{T}=Float64, refine=1) where {T,CellType}
function TieBeamGrid(
::Type{Val{CellType}}, (::Type{T})=Float64, refine=1
) where {T,CellType}
if CellType === :Linear
return _LinearTieBeamGrid(T, refine)
else
return _QuadraticTieBeamGrid(T, refine)
end
end

function _LinearTieBeamGrid(::Type{T}=Float64, refine=1) where {T}
function _LinearTieBeamGrid((::Type{T})=Float64, refine=1) where {T}
nodes = Node{2,T}[]
cells = Quadrilateral[]
boundary = Tuple{Int,Int}[]
Expand Down Expand Up @@ -642,7 +644,7 @@ function _LinearTieBeamGrid(::Type{T}=Float64, refine=1) where {T}
return Grid(cells, nodes; facesets=facesets, boundary_matrix=boundary_matrix)
end

function _QuadraticTieBeamGrid(::Type{T}=Float64, refine=1) where {T}
function _QuadraticTieBeamGrid((::Type{T})=Float64, refine=1) where {T}
nodes = Node{2,T}[]
cells = QuadraticQuadrilateral[]
boundary = Tuple{Int,Int}[]
Expand Down
4 changes: 2 additions & 2 deletions src/TopOptProblems/problem_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ problem = LBeam(Val{celltype}, E = E, ν = ν, force = force)
"""
function LBeam(
::Type{Val{CellType}},
::Type{T}=Float64;
(::Type{T})=Float64;
length=100,
height=100,
upperslab=50,
Expand Down Expand Up @@ -637,7 +637,7 @@ end
- `CellType`: can be either `:Linear` or `:Quadratic` to determine the order of the geometric and field basis functions and element type. Only isoparametric elements are supported for now.
"""
function TieBeam(
::Type{Val{CellType}}, ::Type{T}=Float64, refine=1, force=T(1); E=T(1), ν=T(0.3)
::Type{Val{CellType}}, (::Type{T})=Float64, refine=1, force=T(1); E=T(1), ν=T(0.3)
) where {T,CellType}
grid = TieBeamGrid(Val{CellType}, T, refine)
dh = DofHandler(grid)
Expand Down
2 changes: 1 addition & 1 deletion src/TrussTopOptProblems/elementinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Constructs an instance of `ElementFEAInfo` from a stiffness **truss** problem `s
The static matrices and vectors are more performant and GPU-compatible therefore they are used by default.
"""
function ElementFEAInfo(
sp::TrussProblem, quad_order=1, ::Type{Val{mat_type}}=Val{:Static}
sp::TrussProblem, quad_order=1, (::Type{Val{mat_type}})=Val{:Static}
) where {mat_type}
# weights: self-weight element load vectors, all zeros now
Kes, weights, cellvalues, facevalues = make_Kes_and_fes(sp, quad_order, Val{mat_type})
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function Base.setindex!(ra::RaggedArray, v, i, j)
return ra.values[r[i]] = v
end

function find_varind(black, white, ::Type{TI}=Int) where {TI}
function find_varind(black, white, (::Type{TI})=Int) where {TI}
nel = length(black)
nel == length(white) || throw("Black and white vectors should be of the same length")
varind = zeros(TI, nel)
Expand Down