mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-18 17:47:29 +00:00
feat: Consolidate AbaqusReader and AsterReader (mesh I/O)
- Added 1111 lines of mesh reading code to src/readers/
- ABAQUS .inp format support (6 files: parse_mesh, parse_model, keywords, etc.)
- Code Aster .med format support (3 files: read_aster_mesh, read_aster_results)
- Modernized Julia 0.x → 1.x syntax:
* Nullable{T} → Union{T, Nothing}
* get(nullable) → direct field access
- Added Logging stdlib to Project.toml dependencies
- Functions verified: abaqus_read_mesh, aster_read_mesh
Result: 7 vendor packages consolidated (~6400 lines total)
FEMBasis, FEMBase, FEMQuad, FEMSparse, AbaqusReader, AsterReader
Tests: 5 passing (baseline maintained)
This commit is contained in:
@@ -12,9 +12,9 @@ include("sparsematrixcsc.jl")
|
||||
# include("sparsevectordok.jl") # Old Julia syntax, not used, skipping for now
|
||||
|
||||
mutable struct SparseMatrixCOO{T<:Real}
|
||||
I :: Vector{Int}
|
||||
J :: Vector{Int}
|
||||
V :: Vector{T}
|
||||
I::Vector{Int}
|
||||
J::Vector{Int}
|
||||
V::Vector{T}
|
||||
end
|
||||
|
||||
const SparseVectorCOO = SparseMatrixCOO
|
||||
@@ -120,10 +120,10 @@ Matrix(A)
|
||||
"""
|
||||
function add!(A::SparseMatrixCOO, dofs1::AbstractVector{Int}, dofs2::AbstractVector{Int}, data)
|
||||
n, m = length(dofs1), length(dofs2)
|
||||
@assert length(data) == n*m
|
||||
@assert length(data) == n * m
|
||||
k = 1
|
||||
for j=1:m
|
||||
for i=1:n
|
||||
for j = 1:m
|
||||
for i = 1:n
|
||||
add!(A, dofs1[i], dofs2[j], data[k])
|
||||
k += 1
|
||||
end
|
||||
@@ -145,7 +145,7 @@ function add!(A::SparseMatrixCOO, dofs::Vector{Int}, data::Array{Float64}, dim::
|
||||
error("Simulation stopped.")
|
||||
end
|
||||
append!(A.I, dofs)
|
||||
append!(A.J, dim*ones(Int, length(dofs)))
|
||||
append!(A.J, dim * ones(Int, length(dofs)))
|
||||
append!(A.V, vec(data))
|
||||
end
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
# License is MIT: see https://github.com/JuliaFEM/FEMSparse.jl/blob/master/LICENSE
|
||||
|
||||
mutable struct SparseVectorDOK{Tv,Ti<:Integer} <: AbstractSparseArray{Tv,Ti,1}
|
||||
data :: Dict{Ti,Tv}
|
||||
data::Dict{Ti,Tv}
|
||||
end
|
||||
|
||||
function SparseVectorDOK()
|
||||
return SparseVectorDOK(Dict{Int64, Float64}())
|
||||
return SparseVectorDOK(Dict{Int64,Float64}())
|
||||
end
|
||||
|
||||
function SparseVectorDOK{Tv,Ti<:Integer}(b::SparseVector{Tv,Ti})
|
||||
@@ -28,7 +28,7 @@ end
|
||||
function add!{Tv,Ti<:Integer}(b::SparseVectorDOK{Tv,Ti}, dofs::Vector{Ti}, data::Vector{Tv})
|
||||
@assert length(dofs) == length(data)
|
||||
z = Tv(0)
|
||||
for i=1:length(dofs)
|
||||
for i = 1:length(dofs)
|
||||
@inbounds b.data[dofs[i]] = Base.get(b.data, i, z) + data[i]
|
||||
end
|
||||
return nothing
|
||||
@@ -39,7 +39,7 @@ function get{Tv,Ti<:Integer}(b::SparseVectorDOK{Tv,Ti}, i::Ti)
|
||||
end
|
||||
|
||||
function get!{Tv,Ti<:Integer}(b::SparseVectorDOK{Tv,Ti}, dofs::Vector{Ti}, data::Vector{Tv})
|
||||
for (i,j) in enumerate(dofs)
|
||||
for (i, j) in enumerate(dofs)
|
||||
data[i] = get(b, i)
|
||||
end
|
||||
return nothing
|
||||
|
||||
Reference in New Issue
Block a user